/* Eclipse Media guest book. Cream paper, dark ink, serif display type.
   System fonts only: nothing extra to download on reception wifi. */
:root {
  --paper: #f6f1e7;
  --card: #fffdf8;
  --ink: #1f1b16;
  --muted: #6f665a;
  --line: #e2d8c6;
  --accent: #8a6a3d;
  --accent-ink: #fffdf8;
  --ok: #4d6b4a;
  --bad: #9a3b2e;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", ui-serif, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 14px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
h1, h2 { font-family: var(--serif); font-weight: 500; letter-spacing: 0.005em; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(2rem, 9vw, 3rem); line-height: 1.1; }
h2 { font-size: 1.3rem; }
p { margin: 0; }
img { max-width: 100%; display: block; }
a { color: inherit; }
[hidden] { display: none !important; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; opacity: 0; }

.eyebrow { font-size: 0.72rem; letter-spacing: 0.24em; text-transform: uppercase; color: var(--accent); }
.date { font-family: var(--serif); font-style: italic; color: var(--muted); font-size: 1.05rem; }
.lede { font-family: var(--serif); font-size: 1.15rem; line-height: 1.5; color: var(--ink); text-wrap: pretty; }
.fine { font-size: 0.85rem; color: var(--muted); }
.muted { color: var(--muted); }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.foot { margin-top: 40px; text-align: center; font-size: 0.7rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 22px; border-radius: 999px; border: 1px solid transparent;
  font: 600 1rem/1 var(--sans); text-decoration: none; cursor: pointer; user-select: none;
  -webkit-tap-highlight-color: transparent; transition: transform 0.08s ease, background 0.15s ease;
}
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--ink); color: var(--accent-ink); }
.btn.quiet { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.light { background: #fff; color: var(--ink); }
.btn.big { min-height: 64px; width: 100%; font-size: 1.15rem; box-shadow: 0 10px 24px -12px rgba(31, 27, 22, 0.55); }
.btn.small { min-height: 40px; padding: 0 16px; font-size: 0.9rem; }
.btn[disabled] { opacity: 0.5; cursor: default; }
.btn svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; }
input:focus-visible + .btn, .btn:focus-visible, .link:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.field { display: block; margin-top: 14px; }
.field > span { display: block; font-size: 0.82rem; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.field small { font-weight: 400; }
input[type="text"], input[type="email"], input[type="date"], input:not([type]), textarea {
  width: 100%; min-height: 48px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; color: var(--ink); font: 16px/1.4 var(--sans); /* 16px stops iOS zooming */
}
textarea { resize: vertical; }
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.bar { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; margin: 12px 0 10px; }
.bar-fill { height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width 0.3s ease; }

.toast {
  position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: var(--accent-ink); padding: 12px 18px; border-radius: 999px; font-size: 0.9rem;
  max-width: calc(100vw - 32px); text-align: center; z-index: 50; box-shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.5);
}

/* ---------------------------------------------------------------- guest */
.guest, .notice, .gallery { max-width: 560px; margin: 0 auto; padding: 0 20px calc(32px + env(safe-area-inset-bottom)); }
.notice { text-align: center; padding-top: 22vh; display: grid; gap: 14px; }

.hero { text-align: center; padding: 44px 0 26px; }
.hero-text { display: grid; gap: 10px; }
.hero.has-image { position: relative; margin: 0 -20px; padding: 0; }
.hero.has-image .hero-img { width: 100%; height: min(36vh, 320px); object-fit: cover; }
.hero.has-image .hero-text {
  position: relative; margin: -56px 20px 0; padding: 22px 16px 20px; background: var(--paper);
  border-radius: var(--radius) var(--radius) 0 0;
}

.start { display: grid; gap: 14px; text-align: center; padding-bottom: 8px; }
.start .lede { margin-bottom: 6px; }
.start .btn.quiet { justify-self: center; border: 0; text-decoration: underline; text-underline-offset: 4px; font-weight: 500; min-height: 44px; }

.progress, .note { margin-top: 18px; }
.progress-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.progress-head strong { font-family: var(--serif); font-weight: 500; font-size: 1.2rem; }
.progress-head span { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 0.9rem; }
.progress.complete { border-color: var(--ok); }
.progress.complete .bar-fill { background: var(--ok); }
.note .btn { margin-top: 16px; width: 100%; }
.note-saved { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.note-saved strong { font-family: var(--serif); font-weight: 500; font-size: 1.15rem; }

.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 18px; }
.tile { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--line); }
.tile-img, .tile-img img { width: 100%; height: 100%; object-fit: cover; }
.tile.waiting .tile-img, .tile.preparing .tile-img { animation: pulse 1.4s ease-in-out infinite; }
.tile:not(.done) .tile-img img { opacity: 0.55; }
.tile-ring { position: absolute; left: 6px; right: 6px; bottom: 6px; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.6); overflow: hidden; }
.tile-ring i { display: block; height: 100%; width: 0; background: var(--ink); transition: width 0.2s linear; }
.tile.done .tile-ring, .tile.failed .tile-ring { display: none; }
.tile.done::after {
  content: "✓"; position: absolute; right: 5px; bottom: 5px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--ok); color: #fff; font-size: 12px; line-height: 20px; text-align: center;
}
.tile-retry {
  position: absolute; inset: 0; width: 100%; border: 0; background: rgba(154, 59, 46, 0.82); color: #fff;
  font: 600 0.8rem var(--sans); cursor: pointer;
}
@keyframes pulse { 50% { opacity: 0.5; } }

/* -------------------------------------------------------------- gallery */
.gallery { max-width: 1100px; }
.gallery-head { text-align: center; padding: 40px 0 22px; display: grid; gap: 8px; }
.gallery-head .btn { justify-self: center; margin-top: 10px; }
.toolbar {
  position: sticky; top: 0; z-index: 5; display: flex; gap: 10px; align-items: center; justify-content: space-between;
  padding: 10px 0; background: var(--paper); border-bottom: 1px solid var(--line); margin-bottom: 14px;
}
.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; min-width: 0; width: 100%; }
@media (max-width: 520px) { .tabs button { flex: 1; padding: 10px 6px; } }
.tabs button {
  border: 0; background: none; padding: 10px 12px; min-height: 40px; border-radius: 999px; font: 500 0.92rem var(--sans);
  color: var(--muted); cursor: pointer; white-space: nowrap;
}
.tabs button[aria-selected="true"] { background: var(--ink); color: var(--accent-ink); }

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
@media (min-width: 700px) { .grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; } }
.g-tile { position: relative; margin: 0; aspect-ratio: 1; overflow: hidden; border-radius: 6px; background: var(--line); cursor: pointer; }
.g-tile img { width: 100%; height: 100%; object-fit: cover; }
.g-tile.is-hidden img { opacity: 0.35; filter: grayscale(1); }
.g-tile figcaption {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 8px 6px; font-size: 0.72rem; color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.6)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.badge { position: absolute; top: 6px; left: 6px; background: var(--ink); color: #fff; font-size: 0.66rem; padding: 3px 7px; border-radius: 99px; letter-spacing: 0.04em; }
.g-hide {
  position: absolute; right: 5px; top: 5px; min-height: 28px; padding: 0 9px; border: 0; border-radius: 99px;
  background: rgba(255, 253, 248, 0.92); color: var(--ink); font: 600 0.7rem var(--sans); cursor: pointer;
}
.empty { text-align: center; padding: 48px 0; color: var(--muted); }
#more { display: flex; margin: 20px auto 0; }

.messages { display: grid; gap: 10px; max-width: 640px; margin: 0 auto; }
.m-card { display: grid; grid-template-columns: 72px 1fr; gap: 14px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; cursor: pointer; }
.m-card img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; }
.m-card.is-hidden { opacity: 0.55; }
.m-text { font-family: var(--serif); font-size: 1.08rem; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.m-by { font-size: 0.8rem; color: var(--muted); margin-top: 4px; }

dialog { border: 0; padding: 0; color: inherit; }
dialog::backdrop { background: rgba(20, 17, 13, 0.6); }
.lightbox {
  width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; background: #14110d; color: #f6f1e7;
}
.lightbox[open] { display: grid; grid-template-rows: auto 1fr auto; }
.lb-top, .lb-bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; }
.lb-bottom { align-items: flex-end; padding-bottom: calc(14px + env(safe-area-inset-bottom)); min-height: 76px; }
.lb-btn { background: none; border: 0; color: inherit; font: 500 0.95rem var(--sans); padding: 10px 6px; text-decoration: none; cursor: pointer; }
.lb-pos { font-size: 0.82rem; opacity: 0.7; font-variant-numeric: tabular-nums; }
.lb-stage { position: relative; min-height: 0; display: grid; place-items: center; }
.lb-stage img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; position: absolute; inset: 0; margin: auto; }
.lb-stage img.is-hidden { opacity: 0.4; }
.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; width: 44px; height: 64px; border: 0;
  background: rgba(20, 17, 13, 0.45); color: #fff; font-size: 2rem; line-height: 1; cursor: pointer; border-radius: 8px;
}
.lb-nav.prev { left: 6px; } .lb-nav.next { right: 6px; }
.lb-meta { min-width: 0; display: grid; gap: 2px; }
.lb-meta strong { font-family: var(--serif); font-weight: 500; font-size: 1.1rem; }
.lb-meta p { font-family: var(--serif); font-style: italic; max-height: 6.2em; overflow: auto; overflow-wrap: anywhere; white-space: pre-wrap; }
.lb-date { font-size: 0.78rem; opacity: 0.65; }
.lb-bottom .btn { flex: none; }

.sheet { width: min(440px, calc(100vw - 24px)); border-radius: 18px; background: var(--card); padding: 22px; }
.sheet h2 { margin-bottom: 6px; }
.choice { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: 12px; margin-top: 10px; cursor: pointer; }
.choice input { margin-top: 4px; accent-color: var(--ink); }
.choice small { display: block; color: var(--muted); font-size: 0.82rem; }
.check { display: flex; gap: 10px; align-items: center; margin: 14px 2px 4px; font-size: 0.92rem; }
.check input { width: 18px; height: 18px; accent-color: var(--ink); }
.sheet-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }

/* ---------------------------------------------------------------- admin */
body.admin { background: #faf7f1; }
.admin-bar { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid var(--line); background: var(--card); }
.admin-brand { font-family: var(--serif); font-size: 1.15rem; text-decoration: none; }
.admin-brand span { color: var(--muted); font-style: italic; }
.admin-main { max-width: 720px; margin: 0 auto; padding: 22px 20px 60px; display: grid; gap: 16px; }
.admin-main h1 { font-size: 1.9rem; }
.pill { display: inline-block; font-size: 0.72rem; padding: 3px 10px; border-radius: 99px; background: var(--line); color: var(--muted); white-space: nowrap; }
.pill.open { background: #dfe9dc; color: var(--ok); }
.pill.closed { background: #efe0dc; color: var(--bad); }
.error { color: var(--bad); font-weight: 600; margin-top: 8px; }
.notice-bar { background: #dfe9dc; color: #2f4a2c; padding: 10px 14px; border-radius: 10px; }
.form .btn { margin-top: 16px; }
.form .fine { margin-top: 12px; }
.prefixed { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; background: #fff; overflow: hidden; }
.prefixed em { font-style: normal; color: var(--muted); padding-left: 12px; white-space: nowrap; font-size: 0.9rem; max-width: 50%; overflow: hidden; text-overflow: ellipsis; }
.prefixed input { border: 0; padding-left: 2px; min-width: 0; }
.event-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.event-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.event-list a { display: grid; text-decoration: none; min-width: 0; }
.event-list strong { font-family: var(--serif); font-weight: 500; font-size: 1.15rem; }
.event-list span { font-size: 0.88rem; }
.qr-card { display: grid; gap: 18px; }
@media (min-width: 560px) { .qr-card { grid-template-columns: 200px 1fr; align-items: center; } }
.qr { width: 200px; max-width: 100%; margin: 0 auto; background: #fff; border-radius: 10px; padding: 6px; border: 1px solid var(--line); }
.qr svg, .card-qr svg { display: block; width: 100%; height: auto; }
.qr-side { display: grid; gap: 10px; min-width: 0; }
.copy-row { overflow-wrap: anywhere; font-size: 0.95rem; }
.copy-row.magic { background: var(--paper); padding: 10px 12px; border-radius: 10px; font-family: ui-monospace, Menlo, monospace; font-size: 0.8rem; margin: 10px 0; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.inline-form { margin: 12px 0; }
.card h2 { margin-bottom: 8px; }
.facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 4px 0 12px; }
.facts div { background: var(--paper); border-radius: 10px; padding: 10px; }
.facts dt { font-size: 0.72rem; color: var(--muted); }
.facts dd { margin: 0; font-family: var(--serif); font-size: 1.3rem; }
.hero-preview { width: 100%; max-height: 220px; object-fit: cover; border-radius: 10px; margin-bottom: 12px; }
.card .btn-row { margin-top: 10px; }

/* ---------------------------------------------------- printable table cards */
body.print-page { background: #d9d4ca; }
.print-bar { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px; }
.sheet-a4 { width: 210mm; height: 297mm; margin: 0 auto 24px; background: #fff; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.table-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3.2mm; text-align: center;
  padding: 10mm; background: var(--paper); outline: 0.2mm dashed #c9bfae; color: var(--ink);
}
.table-card h1 { font-size: 26pt; }
.table-card .eyebrow { font-size: 7.5pt; }
.card-lede { font-family: var(--serif); font-style: italic; font-size: 12pt; }
.card-qr { width: 46mm; padding: 2mm; background: #fff; border-radius: 2mm; margin: 2mm 0; }
.card-url { font-size: 9pt; letter-spacing: 0.02em; overflow-wrap: anywhere; }
.card-fine { font-size: 6.5pt; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); }
@media screen and (max-width: 820px) { .sheet-a4 { zoom: 0.45; } }
@media print {
  @page { size: A4; margin: 0; }
  body.print-page { background: #fff; }
  .print-bar { display: none; }
  .sheet-a4 { margin: 0; zoom: 1; }
  .table-card { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Admin: section links and inline inputs on couple pages */
.admin-nav { display: flex; gap: 18px; margin: 0 auto 0 28px; font-size: .92rem; }
.admin-nav a { text-decoration: none; color: var(--muted); }
.admin-nav a:hover { color: inherit; }
.btn-row input:not([type="file"]):not([type="hidden"]), .btn-row select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: var(--card); min-width: 0; flex: 1 1 160px; }
.event-list li > span:first-child { min-width: 0; }
