/* zapapps-memorial — shared stylesheet. Theme comes from site.json via config-loader.js
   (CSS custom properties). Mobile-first, plain CSS, no framework. */

:root {
  --primary: #1e5f74;
  --primary-light: #e7eff1;
  --accent: #d97760;
  --gold: #c9982a;
  --earth: #c4a876;
  --earth-dark: #8b6f47;
  --on-primary: #fff;
  --font: Georgia, 'Times New Roman', serif;

  --ink: #2a2f36;
  --muted: #6b7480;
  --line: #e4e2dc;
  --bg: #ffffff;
  --card: #ffffff;
  --soft: #faf8f4;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(30, 40, 50, 0.07);
  --shadow-lg: 0 12px 34px rgba(30, 40, 50, 0.16);
  --ok: #2e7d54;
  --warn: #9a6a1a;
  --bad: #b3402f;
  --maxw: 900px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--soft);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--primary); }
h1, h2, h3 { font-family: var(--font); line-height: 1.2; color: var(--ink); font-weight: 600; }
.container { max-width: var(--maxw); margin: 0 auto; padding: 0 1.1rem; }
.muted { color: var(--muted); }
.center { text-align: center; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- header ---------- */
.site-header { background: var(--card); border-bottom: 1px solid var(--line); }
.site-header .container { display: flex; align-items: center; gap: 1rem; padding-top: 0.7rem; padding-bottom: 0.7rem; }
.brand { display: flex; align-items: center; gap: 0.5rem; flex: none; }
.brand-logo { max-height: 40px; width: auto; border: 0; }
.brand-name { font-family: var(--font); font-weight: 600; font-size: 1.06rem; color: var(--primary); letter-spacing: 0.01em; }
.header-nav { margin-left: auto; display: flex; gap: 0.35rem; flex-wrap: wrap; }
.header-nav a { text-decoration: none; color: var(--muted); font-size: 0.9rem; padding: 0.35rem 0.6rem; border-radius: 8px; }
.header-nav a:hover, .header-nav a[aria-current] { color: var(--primary); background: var(--primary-light); }

/* ---------- memorial hero ---------- */
.hero { background: linear-gradient(180deg, var(--primary-light), var(--soft)); padding: 2.2rem 0 1.6rem; text-align: center; }
.hero .kicker { text-transform: uppercase; letter-spacing: 0.16em; font-size: 0.72rem; color: var(--primary); font-family: -apple-system, system-ui, sans-serif; margin: 0 0 0.5rem; }
.hero h1 { font-size: clamp(1.7rem, 5vw, 2.6rem); margin: 0 0 0.35rem; color: var(--primary); }
.hero .honoree { font-size: 1.15rem; color: var(--earth-dark); }
.hero .dates { color: var(--muted); font-size: 0.95rem; margin-top: 0.15rem; }
.hero .subhead { max-width: 46ch; margin: 0.9rem auto 0; color: #46505a; }
.hero .epitaph { font-family: var(--font); font-style: italic; font-size: clamp(1.05rem, 3.6vw, 1.4rem); line-height: 1.4; color: var(--earth-dark); max-width: 32ch; margin: 0.7rem auto 0; }
.hero .epitaph:empty { display: none; margin: 0; }
.hero .epitaph:not(:empty)::before { content: '\201C'; }
.hero .epitaph:not(:empty)::after { content: '\201D'; }
.portrait { width: 128px; height: 128px; border-radius: 50%; object-fit: cover; margin: 0 auto 0.9rem; border: 4px solid #fff; box-shadow: var(--shadow); }

/* ---------- cards / sections ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.section { padding: 1.6rem 0; }
.section > h2 { font-size: 1.3rem; margin: 0 0 0.9rem; }
.panel { padding: 1.2rem 1.15rem; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 0.45rem; justify-content: center;
  font-family: -apple-system, system-ui, sans-serif; font-size: 0.95rem; font-weight: 600;
  padding: 0.68rem 1.15rem; border-radius: 999px; border: 1.5px solid transparent; cursor: pointer;
  text-decoration: none; transition: filter .15s, background .15s, color .15s, border-color .15s;
}
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-ghost { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-ghost:hover { background: var(--primary-light); }
.btn-soft { background: var(--primary-light); color: var(--primary); }
.btn-danger { background: #fff; color: var(--bad); border-color: #e6b8b0; }
.btn-danger:hover { background: #fbeae7; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.85rem; }

/* ---------- forms ---------- */
.field { margin-bottom: 1.05rem; }
.field label { display: block; font-family: -apple-system, system-ui, sans-serif; font-weight: 600; font-size: 0.9rem; margin-bottom: 0.35rem; }
.field .hint { font-size: 0.8rem; color: var(--muted); font-family: -apple-system, system-ui, sans-serif; }
input[type=text], input[type=email], input[type=search], input[type=date], textarea, select {
  width: 100%; font: inherit; font-size: 1rem; color: var(--ink);
  padding: 0.7rem 0.8rem; border: 1.5px solid var(--line); border-radius: 10px; background: #fff;
}
textarea { min-height: 120px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.code-input { letter-spacing: 0.5em; text-align: center; font-size: 1.5rem; font-weight: 700; }

/* relationship chips */
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip { font-family: -apple-system, system-ui, sans-serif; font-size: 0.85rem; padding: 0.35rem 0.75rem; border-radius: 999px; border: 1.5px solid var(--line); background: #fff; color: var(--muted); cursor: pointer; }
.chip[aria-pressed=true], .chip.active { background: var(--primary-light); border-color: var(--primary); color: var(--primary); font-weight: 600; }
.badge { display: inline-block; font-family: -apple-system, system-ui, sans-serif; font-size: 0.7rem; font-weight: 700; letter-spacing: .03em; padding: 0.15rem 0.5rem; border-radius: 999px; background: var(--primary-light); color: var(--primary); }
.badge.gold { background: #f7edd2; color: var(--warn); }
.badge.pending { background: #fbeee2; color: var(--warn); }
.badge.published { background: #e4f3ea; color: var(--ok); }

/* ---------- drop zone / media ---------- */
.dropzone {
  border: 2px dashed #cdd3d8; border-radius: 12px; padding: 1.3rem; text-align: center;
  color: var(--muted); background: #fbfaf7; font-family: -apple-system, system-ui, sans-serif; cursor: pointer;
}
.dropzone.drag { border-color: var(--primary); background: var(--primary-light); color: var(--primary); }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 0.5rem; margin-top: 0.7rem; }
.thumb { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: #eee; }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; }
.thumb .x { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; font-size: 14px; line-height: 22px; }
.filemeta { font-size: 0.75rem; color: var(--muted); font-family: -apple-system, system-ui, sans-serif; }

/* ---------- modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(20,26,32,.55); display: flex; align-items: center; justify-content: center; padding: 1rem; z-index: 60; }
.modal { background: #fff; border-radius: 16px; max-width: 560px; width: 100%; max-height: 90vh; overflow: auto; box-shadow: var(--shadow-lg); }
.modal-head { padding: 1rem 1.2rem; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { margin: 0; font-size: 1.15rem; }
.modal-body { padding: 1.2rem; }
.modal-foot { padding: 1rem 1.2rem; border-top: 1px solid var(--line); display: flex; gap: 0.6rem; justify-content: flex-end; flex-wrap: wrap; }
.modal .close { background: none; border: 0; font-size: 1.4rem; cursor: pointer; color: var(--muted); }

/* ---------- toast ---------- */
.toast-wrap { position: fixed; left: 0; right: 0; bottom: 1rem; display: flex; flex-direction: column; align-items: center; gap: 0.5rem; z-index: 80; pointer-events: none; }
.toast { pointer-events: auto; background: var(--ink); color: #fff; padding: 0.7rem 1.1rem; border-radius: 999px; box-shadow: var(--shadow-lg); font-family: -apple-system, system-ui, sans-serif; font-size: 0.9rem; max-width: 90%; animation: toastIn .2s ease; }
.toast.ok { background: var(--ok); } .toast.bad { background: var(--bad); } .toast.warn { background: var(--warn); }
@keyframes toastIn { from { transform: translateY(12px); opacity: 0; } }

/* ---------- memory card / wall ---------- */
.memory { padding: 1.15rem 1.15rem 1.05rem; margin-bottom: 1rem; break-inside: avoid; }
.memory .m-head { display: flex; align-items: baseline; gap: 0.5rem; flex-wrap: wrap; }
.memory .m-name { font-weight: 700; font-size: 1.05rem; }
.memory .m-when { color: var(--muted); font-size: 0.85rem; margin-left: auto; font-family: -apple-system, system-ui, sans-serif; }
.memory .m-msg { margin: 0.55rem 0 0; color: #3a424c; }
.memory .m-media { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 0.5rem; margin-top: 0.8rem; }
.memory .m-media img { border-radius: 10px; aspect-ratio: 4/3; object-fit: cover; cursor: zoom-in; }
.wall-counter { text-align: center; color: var(--muted); font-family: -apple-system, system-ui, sans-serif; margin: 0.2rem 0 1.1rem; }
.wall-counter b { color: var(--primary); font-size: 1.4rem; }
.viewmodes { display: flex; gap: 0.4rem; flex-wrap: wrap; justify-content: center; margin-bottom: 1.2rem; }
.masonry { columns: 2; column-gap: 1rem; }
.grid-photos { columns: 3; column-gap: 0.6rem; }
.grid-photos img { width: 100%; margin-bottom: 0.6rem; border-radius: 10px; cursor: zoom-in; }
.group-head { font-size: 1.1rem; color: var(--primary); border-bottom: 2px solid var(--primary-light); padding-bottom: 0.3rem; margin: 1.4rem 0 0.9rem; }

/* timeline */
.era-block { margin-bottom: 1.4rem; }
.era-label { font-family: -apple-system, system-ui, sans-serif; font-weight: 700; color: var(--earth-dark); }
.era-range { color: var(--muted); font-size: 0.85rem; }

/* ---------- stars / reviews ---------- */
.stars { display: inline-flex; gap: 2px; color: var(--gold); font-size: 1.15rem; }
.stars .s { color: #dcd7cb; }
.star-pick button { background: none; border: 0; font-size: 1.8rem; color: #dcd7cb; cursor: pointer; }
.star-pick button.on { color: var(--gold); }
.review { padding: 1rem 1.1rem; margin-bottom: 0.8rem; }
.review .r-top { display: flex; align-items: center; gap: 0.5rem; }
.review .r-name { font-weight: 700; }

/* ---------- lightbox ---------- */
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.9); display: flex; align-items: center; justify-content: center; z-index: 90; padding: 1rem; }
.lightbox img { max-width: 96vw; max-height: 92vh; border-radius: 8px; }
.lightbox .lx-close { position: absolute; top: 14px; right: 18px; color: #fff; font-size: 2rem; background: none; border: 0; cursor: pointer; }

/* ---------- admin ---------- */
.admin-toolbar { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.admin-toolbar input[type=search] { max-width: 240px; }
.queue-item { display: flex; gap: 0.9rem; padding: 0.9rem; align-items: flex-start; margin-bottom: 0.7rem; }
.queue-item.dragging { opacity: .5; }
.queue-item .drag { cursor: grab; color: #bcc2c9; font-size: 1.2rem; padding-top: 0.2rem; }
.queue-item .q-thumb { width: 66px; height: 66px; border-radius: 10px; object-fit: cover; flex: none; background: var(--primary-light); }
.queue-item .q-body { flex: 1; min-width: 0; }
.queue-item .q-msg { color: #444; font-size: 0.92rem; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.queue-item .q-actions { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 0.7rem; margin-bottom: 1rem; }
.kpi { padding: 0.8rem 1rem; text-align: center; }
.kpi b { display: block; font-size: 1.7rem; color: var(--primary); }
.kpi span { font-family: -apple-system, system-ui, sans-serif; font-size: 0.78rem; color: var(--muted); }
.switch { display: inline-flex; align-items: center; gap: 0.5rem; font-family: -apple-system, system-ui, sans-serif; }
.switch input { width: 42px; height: 24px; }

/* ---------- showcase ---------- */
.showcase-hero { text-align: center; padding: 3rem 0 2rem; background: linear-gradient(180deg, var(--primary-light), #fff); }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; max-width: 620px; margin: 1.4rem auto; }
.stat b { display: block; font-size: 2rem; color: var(--primary); }
.stat span { font-family: -apple-system, system-ui, sans-serif; font-size: 0.8rem; color: var(--muted); }
.cta-band { background: var(--primary); color: #fff; text-align: center; padding: 2.4rem 1rem; border-radius: var(--radius); }
.cta-band h2 { color: #fff; }

/* ---------- keepsakes ---------- */
.keepsake-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1rem; }
.keepsake-card { padding: 1.2rem; text-align: center; }
.keepsake-card .icon { font-size: 2rem; }
.qr-card { width: 288px; height: 432px; border: 1px solid var(--line); border-radius: 12px; margin: 0 auto; padding: 1.2rem; text-align: center; background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; box-shadow: var(--shadow); }

.footer { text-align: center; color: var(--muted); font-size: 0.82rem; padding: 2rem 1rem 3rem; font-family: -apple-system, system-ui, sans-serif; }

/* ---------- responsive ---------- */
@media (min-width: 720px) {
  .memory .m-media img { aspect-ratio: 4/3; }
}
@media (max-width: 640px) {
  .masonry, .grid-photos { columns: 1; }
  .stat-row { grid-template-columns: 1fr 1fr; }
  .header-nav { display: none; }
  .header-nav.open { display: flex; position: absolute; right: 1rem; top: 3.2rem; background: #fff; flex-direction: column; box-shadow: var(--shadow-lg); border-radius: 10px; padding: 0.4rem; z-index: 40; }
}
@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
}
