/* ===================================================================
   Stillwater — eggshell theme
   The entire palette lives in this one editable block of custom
   properties. Change these and the whole site re-themes.
   =================================================================== */
:root {
  --surface-page:    #F3EDDE;  /* page / primary surface          */
  --surface-header:  #EAE2CF;  /* header bar / secondary surface  */
  --surface-card:    #EEE8D8;  /* card surface                    */
  --hairline:        #E0D7C2;  /* hairline border                 */
  --hairline-inner:  #E2D9C4;  /* inner dividers                  */
  --accent:          #C9947A;  /* terracotta — the single accent  */
  --accent-deep:     #b87e63;
  --text:            #3B362B;  /* deep warm brown                 */
  --muted:           #9A9079;  /* muted text                      */
  --pill-bg:         #EAE2CF;  /* tag pill background             */
  --pill-text:       #6B6148;  /* tag pill text                   */

  --serif: Georgia, "Iowan Old Style", "Times New Roman", Times, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --radius: 10px;
  --maxw: 1080px;
  --gap: 24px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--surface-page);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.55;
  font-size: 16px;
}

a { color: var(--accent-deep); text-decoration: none; }
a:hover { text-decoration: underline; }

code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85em; }

/* ---------- Header / footer ---------- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  background: var(--surface-header);
  border-bottom: 1px solid var(--hairline);
}
.brand {
  font-family: var(--serif);
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.3px;
}
.brand:hover { text-decoration: none; }
.site-nav a {
  margin-left: 22px;
  color: var(--text);
  font-size: 0.95rem;
}
.site-nav a:hover { color: var(--accent-deep); }

.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 36px 24px 64px;
}

.site-footer {
  border-top: 1px solid var(--hairline);
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
  padding: 24px;
}

/* ---------- Headings ---------- */
.page-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 2rem;
  margin: 0 0 24px;
  color: var(--text);
}
.section-title {
  font-family: var(--serif);
  font-size: 1.3rem;
  margin: 32px 0 16px;
}
.empty { color: var(--muted); }

/* ---------- Hero: recent events grid ---------- */
.hero-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gap);
}
.event-card {
  display: block;
  background: var(--surface-card);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  overflow: hidden;
  color: var(--text);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.event-card:hover {
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(59, 54, 43, 0.10);
}
.card-media {
  aspect-ratio: 3 / 2;
  background: var(--hairline);
}
.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;       /* crop-to-fill non-3:2 covers, centered */
  display: block;
}
.card-media.placeholder {
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 0.9rem;
}
.card-body { padding: 14px 16px 18px; }
.card-title {
  font-family: var(--serif);
  font-size: 1.15rem;
  margin: 0 0 4px;
}
.card-meta { color: var(--muted); font-size: 0.85rem; margin: 0; }

/* ---------- Controls strip ---------- */
.timeline-section { margin-top: 56px; }
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 20px;
  align-items: center;
  padding: 18px 0 20px;
  border-bottom: 1px solid var(--hairline);
}
.search-box {
  flex: 1 1 240px;
  min-width: 200px;
  padding: 9px 14px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: #fff8ea;
  color: var(--text);
  font-size: 0.95rem;
}
.search-box:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.tag-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  font-size: 0.8rem;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--pill-bg);
  color: var(--pill-text);
  border: 1px solid var(--hairline);
  cursor: pointer;
  font-family: var(--sans);
}
.tag-pills.static .pill { cursor: default; }
button.pill:hover { border-color: var(--accent); }
button.pill.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.date-range { display: flex; align-items: center; gap: 10px; font-size: 0.85rem; color: var(--muted); }
.date-range input[type="date"] {
  border: 1px solid var(--hairline);
  border-radius: 6px;
  padding: 5px 8px;
  background: #fff8ea;
  color: var(--text);
  font-family: var(--sans);
}
.link-btn {
  background: none; border: none; color: var(--accent-deep);
  cursor: pointer; font-size: 0.9rem; padding: 0; font-family: var(--sans);
}
.link-btn:hover { text-decoration: underline; }
.result-count { color: var(--muted); font-size: 0.85rem; margin: 16px 0 0; }

/* ---------- Timeline ---------- */
.timeline {
  list-style: none;
  margin: 18px 0 0;
  padding: 0 0 0 28px;
  position: relative;
}
.timeline::before {           /* the left spine line */
  content: "";
  position: absolute;
  left: 6px; top: 8px; bottom: 8px;
  width: 2px;
  background: var(--hairline);
}
.timeline-row {
  position: relative;
  display: flex;
  gap: 18px;
  align-items: flex-start;
  padding: 18px 0;
  border-bottom: 1px solid var(--hairline-inner);
}
.timeline-row::before {       /* the spine dot */
  content: "";
  position: absolute;
  left: -28px; top: 26px;
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--surface-page);
  box-shadow: 0 0 0 1px var(--accent);
}
.timeline-row .row-main { flex: 1 1 auto; min-width: 0; }
.row-date { color: var(--muted); font-size: 0.8rem; margin: 0 0 2px; }
.row-title { font-family: var(--serif); font-size: 1.2rem; margin: 0 0 4px; }
.row-title a { color: var(--text); }
.row-title a:hover { color: var(--accent-deep); }
.row-meta { color: var(--muted); font-size: 0.85rem; margin: 0 0 8px; }
.row-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.row-tags .pill { font-size: 0.72rem; padding: 3px 9px; }
.row-thumb {
  flex: 0 0 132px;
  width: 132px; height: 88px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--hairline);
  border: 1px solid var(--hairline);
}
.row-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.load-more-wrap { text-align: center; margin-top: 24px; }
.load-more {
  background: var(--surface-card);
  border: 1px solid var(--hairline);
  color: var(--text);
  padding: 10px 22px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.9rem;
}
.load-more:hover { border-color: var(--accent); }
.timeline-empty { color: var(--muted); padding: 24px 0; list-style: none; }

/* ---------- Album page ---------- */
.crumbs { margin-bottom: 18px; font-size: 0.9rem; }
.album-head { margin-bottom: 28px; }
.album-subtitle { font-family: var(--serif); font-size: 1.2rem; color: var(--text); margin: -12px 0 8px; }
.album-meta { color: var(--muted); font-size: 0.9rem; margin: 0 0 10px; }
.album-desc { max-width: 60ch; }

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.photo-tile {
  padding: 0; border: 1px solid var(--hairline); background: var(--hairline);
  border-radius: 8px; overflow: hidden; cursor: pointer; aspect-ratio: 1 / 1;
}
.photo-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-tile:hover { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(40, 36, 28, 0.92);
  display: flex; align-items: center; justify-content: center;
}
.lightbox[hidden] { display: none; }
.lb-figure { margin: 0; max-width: 92vw; max-height: 88vh; text-align: center; }
.lb-figure img {
  max-width: 92vw; max-height: 80vh; object-fit: contain;
  border-radius: 4px; background: #00000022;
}
.lb-figure figcaption { color: #f3eddecc; margin-top: 12px; font-size: 0.95rem; }
.lb-close, .lb-nav {
  position: absolute; background: rgba(243,237,222,0.12); color: #fff;
  border: none; cursor: pointer; border-radius: 999px;
}
.lb-close { top: 18px; right: 22px; width: 44px; height: 44px; font-size: 1.6rem; }
.lb-nav { top: 50%; transform: translateY(-50%); width: 52px; height: 52px; font-size: 2rem; }
.lb-prev { left: 18px; }
.lb-next { right: 18px; }
.lb-close:hover, .lb-nav:hover { background: var(--accent); }

/* ---------- Admin ---------- */
.admin-head { display: flex; align-items: center; justify-content: space-between; }
.inline-form { display: inline; margin: 0; }
.admin-panel { margin: 8px 0 24px; }
.admin-status {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: var(--surface-card); border: 1px solid var(--hairline);
  border-radius: var(--radius); padding: 14px 18px; flex-wrap: wrap;
}
.admin-status p { margin: 0; font-size: 0.9rem; }
.btn-primary {
  background: var(--accent); color: #fff; border: none; cursor: pointer;
  padding: 9px 18px; border-radius: 8px; font-size: 0.92rem; font-family: var(--sans);
}
.btn-primary:hover { background: var(--accent-deep); }

.admin-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.admin-table th, .admin-table td {
  text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--hairline-inner);
  vertical-align: middle;
}
.admin-table th { color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }
.cell-cover { width: 84px; }
.cell-cover img { width: 72px; height: 48px; object-fit: cover; border-radius: 6px; display: block; }
.album-link { font-family: var(--serif); font-size: 1.02rem; }
.muted { color: var(--muted); }
.small { font-size: 0.78rem; }
.admin-table .pill { margin: 1px 2px; display: inline-block; }

.form-ok { background: #e3ecdd; border: 1px solid #c5d6b9; color: #41603a; padding: 10px 14px; border-radius: 8px; }
.form-error { background: #f3dcd3; border: 1px solid #e3b9a8; color: #8a4a32; padding: 10px 14px; border-radius: 8px; }

/* ---------- Login ---------- */
.login-wrap { max-width: 360px; margin: 24px auto; }
.login-form { display: flex; flex-direction: column; gap: 10px; }
.login-form label { font-size: 0.85rem; color: var(--muted); }
.login-form input {
  padding: 10px 12px; border: 1px solid var(--hairline); border-radius: 8px;
  background: #fff8ea; font-size: 1rem; color: var(--text);
}
.hint { color: var(--muted); font-size: 0.82rem; margin-top: 18px; }

/* ---------- Edit form ---------- */
.edit-form { max-width: 720px; }
.field { margin-bottom: 18px; }
.field-row { display: flex; gap: 20px; flex-wrap: wrap; }
.field-row .field { flex: 1 1 220px; }
.field label { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 5px; }
.field input[type="text"], .field input[type="date"], .field textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--hairline);
  border-radius: 8px; background: #fff8ea; font-size: 0.95rem; color: var(--text);
  font-family: var(--sans);
}
.cover-picker {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px; margin-top: 8px;
}
.cover-option {
  position: relative; padding: 0; border: 2px solid var(--hairline);
  border-radius: 8px; overflow: hidden; cursor: pointer; background: var(--hairline);
  aspect-ratio: 3 / 2;
}
.cover-option img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-option .cover-check {
  position: absolute; top: 6px; left: 6px;
  background: var(--accent); color: #fff; font-size: 0.7rem;
  padding: 2px 8px; border-radius: 999px; opacity: 0;
}
.cover-option.selected { border-color: var(--accent); }
.cover-option.selected .cover-check { opacity: 1; }
.form-actions { display: flex; align-items: center; gap: 18px; margin-top: 8px; }

/* ---------- People pills + filter labels ---------- */
.pill.person { background: #e6ddc9; color: #5d5a3e; }
button.pill.person.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.people-pills { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filter-label { color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }
.meta-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

/* ---------- Lock badges + blurred covers ---------- */
.lock-badge {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  background: rgba(40,36,28,0.62); color: #fff;
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 0.8rem;
}
.lock-badge.big { width: 48px; height: 48px; font-size: 1.4rem; top: 12px; right: 12px; }
.card-media { position: relative; }
.row-thumb { position: relative; }
img.blurred { filter: blur(2px); }
.lock-inline { font-size: 0.7em; vertical-align: middle; }

/* ---------- Download affordances ---------- */
.dl-link { white-space: nowrap; }
.photo-tile-wrap { position: relative; }
.tile-dl {
  position: absolute; bottom: 8px; right: 8px;
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(40,36,28,0.6); color: #fff;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.12s ease; text-decoration: none; font-size: 0.9rem;
}
.photo-tile-wrap:hover .tile-dl { opacity: 1; }
.tile-dl:hover { background: var(--accent); text-decoration: none; }
.lb-download {
  position: absolute; top: 18px; right: 74px;
  width: 44px; height: 44px; border-radius: 999px;
  background: rgba(243,237,222,0.12); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 1.2rem; text-decoration: none;
}
.lb-download:hover { background: var(--accent); text-decoration: none; }

/* ---------- Locked event gate ---------- */
.locked-gate {
  display: flex; gap: 32px; align-items: center; flex-wrap: wrap;
  background: var(--surface-card); border: 1px solid var(--hairline);
  border-radius: var(--radius); padding: 28px; margin-top: 12px;
}
.locked-cover { position: relative; width: 280px; max-width: 100%; aspect-ratio: 3/2; border-radius: 8px; overflow: hidden; background: var(--hairline); }
.locked-cover img { width: 100%; height: 100%; object-fit: cover; }
.locked-body { flex: 1 1 280px; }
.unlock-form { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.unlock-form input { padding: 9px 12px; border: 1px solid var(--hairline); border-radius: 8px; background: #fff8ea; font-size: 1rem; }

/* ---------- Markdown rendering ---------- */
.markdown > :first-child { margin-top: 0; }
.markdown > :last-child { margin-bottom: 0; }
.markdown h1, .markdown h2, .markdown h3 { font-family: var(--serif); }
.markdown blockquote {
  border-left: 3px solid var(--accent); margin: 8px 0; padding: 2px 14px; color: var(--muted);
}
.markdown code { background: var(--surface-header); padding: 1px 5px; border-radius: 4px; }
.markdown ul, .markdown ol { padding-left: 22px; }

/* ---------- Markdown editor ---------- */
.md-editor { border: 1px solid var(--hairline); border-radius: 8px; overflow: hidden; background: #fff8ea; }
.md-toolbar { display: flex; gap: 4px; align-items: center; padding: 6px 8px; background: var(--surface-header); border-bottom: 1px solid var(--hairline); }
.md-toolbar button {
  border: 1px solid transparent; background: transparent; cursor: pointer;
  padding: 4px 9px; border-radius: 6px; color: var(--text); font-size: 0.85rem; font-family: var(--sans);
}
.md-toolbar button:hover { background: var(--surface-card); border-color: var(--hairline); }
.md-spacer { flex: 1; }
.md-preview-toggle.active { background: var(--accent); color: #fff; }
.md-input { width: 100%; border: none; background: transparent; padding: 12px; font-size: 0.95rem; color: var(--text); font-family: var(--sans); resize: vertical; }
.md-input:focus { outline: none; }
.md-preview { padding: 12px; min-height: 80px; }

/* ---------- Password panel (admin) ---------- */
.password-panel { max-width: 720px; margin-top: 36px; padding-top: 8px; border-top: 1px solid var(--hairline); }
.password-form { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0; }
.password-form input { flex: 1 1 240px; padding: 9px 12px; border: 1px solid var(--hairline); border-radius: 8px; background: #fff8ea; }
.link-btn.danger { color: #a8502f; }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .hero-grid { grid-template-columns: repeat(2, 1fr); }
  .site-header { padding: 16px 20px; }
}
@media (max-width: 560px) {
  .hero-grid { grid-template-columns: 1fr; }
  .row-thumb { flex-basis: 96px; width: 96px; height: 64px; }
  .container { padding: 24px 16px 48px; }
}
