@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,500;0,600;1,500&family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* Default palette ("Classic"). The admin Settings page can swap in any preset
     from src/themes.js, which overrides these same variables. The names are
     historical: --moss is the main button/link color, --gold the accent. */
  --cream: #faf7f0;
  --cream-2: #f1ede1;
  --moss: #5b6b45;       /* olive */
  --moss-dark: #3a4530;  /* deep olive */
  --gold: #6e2a39;       /* burgundy accent */
  --pear: #aab97e;       /* pear/sage accent */
  --pear-tint: #f2f1e2;  /* light pear-tinted background */
  --ink: #2f2c26;
  --ink-soft: #6b6558;
  --line: #ddd4bd;        /* borders */
  --line-strong: #cfc6ac; /* dashed drop-zone and input borders */
  --line-soft: #eee6d3;   /* faint dividers */
  --white: #ffffff;
  /* Headings: the elegant serif by default; a theme can swap in a clean sans. */
  --heading-font: 'Playfair Display', Georgia, serif;
  --heading-weight: 600;
  --danger: #a4443a;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(47, 44, 38, 0.08);
  --shadow-lg: 0 14px 40px rgba(47, 44, 38, 0.16);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .serif {
  font-family: var(--heading-font);
  font-weight: var(--heading-weight);
  color: var(--moss-dark);
  margin: 0 0 0.3em;
}

a { color: inherit; text-decoration: none; }

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--cream-2);
  background: var(--white);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar .brand {
  font-family: var(--heading-font);
  font-size: 1.25rem;
  color: var(--moss-dark);
  font-weight: 600;
}
.topbar .brand small {
  display: block;
  font-family: 'Inter', sans-serif;
  font-size: 0.7rem;
  color: var(--ink-soft);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.topbar form { margin: 0; }
.link-btn {
  background: none;
  border: none;
  color: var(--ink-soft);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 8px;
}
.breadcrumb {
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin: 20px 0 6px;
}
.breadcrumb a { color: var(--moss); }
.breadcrumb .sep { margin: 0 6px; opacity: 0.5; }

/* ---------- Hero ---------- */
.hero {
  text-align: center;
  padding: 56px 20px 40px;
}
.hero h1 {
  font-size: clamp(2.2rem, 6vw, 3.4rem);
  margin-bottom: 10px;
}
.hero .date {
  color: var(--gold);
  font-weight: 600;
  letter-spacing: 0.04em;
  font-size: 1.05rem;
  margin-bottom: 6px;
}
.hero .venue {
  color: var(--ink-soft);
  font-size: 0.95rem;
}
.hero .venue a { color: var(--moss); text-decoration: underline; text-underline-offset: 3px; }
.hero p.tagline {
  max-width: 560px;
  margin: 18px auto 0;
  color: var(--ink-soft);
  line-height: 1.6;
}

/* ---------- Card grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
  margin: 22px 0;
}
.card {
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  display: block;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.card .cover {
  aspect-ratio: 4 / 3;
  background: var(--cream-2) url('data:image/svg+xml;utf8,') center/cover;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold);
  font-size: 2rem;
}
.card .cover img { width: 100%; height: 100%; object-fit: cover; display: block; transition: opacity 0.3s ease; }
.card .body { padding: 14px 16px; }
.card .body h3 { font-size: 1.1rem; margin-bottom: 3px; }
.card .body p { margin: 0; font-size: 0.8rem; color: var(--ink-soft); }

/* Sized and styled to match the "Tap to add photos" dropzone exactly — same
   dashed border, same radius, same height — rather than being a card-shaped
   tile that stretched to the full height of a photo card next to it. */
.add-card {
  width: 100%;
  border: 2px dashed var(--line-strong);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 66px;
  padding: 6px 14px;
  margin: 10px 0;
  color: var(--moss-dark);
  cursor: pointer;
  background: transparent;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.add-card:hover { border-color: var(--gold); color: var(--gold); }

/* ---------- Section header ---------- */
.section-header { padding: 30px 0 6px; text-align: center; }
.section-header h1 { font-size: clamp(1.8rem, 5vw, 2.6rem); }
.section-header p { color: var(--ink-soft); max-width: 600px; margin: 6px auto 0; }
.title-edit-btn {
  border: none;
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.55em;
  vertical-align: middle;
  cursor: pointer;
  padding: 4px 6px;
  margin-left: 4px;
  border-radius: 6px;
  line-height: 1;
}
.title-edit-btn:hover { color: var(--gold); background: var(--pear-tint); }
#title-edit-form { max-width: 480px; margin-left: auto; margin-right: auto; text-align: left; }
.section-meta { text-align: center; color: var(--ink-soft); font-size: 0.85rem; margin-bottom: 10px; }

.subsection-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  margin: 30px 0 10px;
  font-weight: 600;
}

.gallery-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin: 30px 0 10px;
}
.gallery-header .subsection-label { margin: 0; }
.gallery-header-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* A section hub page (has subpages, so its own upload/gallery are hidden —
   see section.ejs's hasSubpages) only ever shows this lone "Download All"
   row, no label to space it against, so it needs its own right-alignment. */
.hub-download-row { justify-content: flex-end; }

/* ---------- Upload widget ---------- */
/* The uploader no longer reads as a raised white card — it sits flat on the
   page background, so the dashed dropzone border is the only thing outlining
   it. Combined with the side-by-side icon/text layout below, the whole block
   is about half the height it used to be while the camera stays 3.1rem. */
.uploader {
  background: transparent;
  border-radius: var(--radius);
  box-shadow: none;
  padding: 0;
  margin: 10px 0;
}
.dropzone {
  border: 2px dashed var(--line-strong);
  border-radius: 12px;
  padding: 6px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  color: var(--ink-soft);
  transition: border-color 0.15s ease, background 0.15s ease;
  cursor: pointer;
}
.dropzone.dragover { border-color: var(--gold); background: var(--pear-tint); }
.dropzone .icon { font-size: 3.1rem; margin: 0; line-height: 1; flex: 0 0 auto; }
.dz-text { min-width: 0; }
.dropzone strong { display: block; color: var(--moss-dark); font-size: 0.95rem; line-height: 1.25; }
.dropzone small { display: block; margin-top: 1px; color: var(--ink-soft); font-size: 0.75rem; line-height: 1.3; }

.uploader input[type="file"] { display: none; }
.name-row {
  margin-top: 6px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.name-row label { font-size: 0.85rem; color: var(--ink-soft); }
.name-row input[type="text"] {
  flex: 1;
  min-width: 160px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.9rem;
  font-family: inherit;
}

.btn {
  display: inline-block;
  background: var(--moss);
  color: var(--white);
  border: none;
  padding: 11px 20px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}
.btn:hover { background: var(--moss-dark); }
.btn.secondary { background: transparent; color: var(--moss); border: 1.5px solid var(--moss); }
.btn.secondary:hover { background: var(--moss); color: var(--white); }
.btn.small { padding: 7px 14px; font-size: 0.8rem; }

.progress-wrap { margin-top: 14px; display: none; }
.progress-wrap.active { display: block; }
.progress-bar-track {
  height: 8px;
  border-radius: 5px;
  background: var(--cream-2);
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--gold);
  transition: width 0.2s ease;
}
.progress-label { font-size: 0.78rem; color: var(--ink-soft); margin-top: 6px; }
/* Round 22: the label now carries a running "Uploading 12 of 200 — IMG_1.jpg",
   so long filenames are clipped rather than wrapping the box taller, and a
   Cancel button sits beside it. */
.progress-row { display: flex; align-items: center; gap: 10px; }
.progress-row .progress-label {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.upload-cancel {
  flex: 0 0 auto;
  margin-top: 6px;
  background: none;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 3px 12px;
  font-size: 0.75rem;
  color: var(--ink-soft);
  cursor: pointer;
}
.upload-cancel[hidden] { display: none; }
.lightbox .lb-video-note { max-width: 320px; margin-left: auto; margin-right: auto; }
.upload-errors {
  margin-top: 12px;
  background: #fbeceb;
  border: 1px solid #eec9c5;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.82rem;
  color: var(--danger);
  display: none;
}
.upload-errors.active { display: block; }
.upload-errors ul { margin: 4px 0 0; padding-left: 18px; }

/* ---------- Gallery ---------- */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px 10px;
  margin: 20px 0 40px;
}
.gallery-item { display: flex; flex-direction: column; min-width: 0; }
.tile {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  overflow: hidden;
  background: var(--cream-2);
  cursor: pointer;
  display: block;
}
.tile:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(47,44,38,0.65);
  color: #fff;
  font-size: 0.68rem;
  padding: 3px 7px;
  border-radius: 999px;
}
.tile .play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  color: #fff;
  text-shadow: 0 2px 6px rgba(0,0,0,0.5);
}
.tile.pdf-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 10px; text-align: center; }
.tile.pdf-tile .pdf-open { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; height: 100%; }
.tile.pdf-tile .icon { font-size: 2rem; color: var(--gold); }
.tile.pdf-tile .fname { font-size: 0.68rem; color: var(--ink-soft); margin-top: 6px; word-break: break-word; line-height: 1.3; max-height: 2.6em; overflow: hidden; }
.uploader-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 2px 0;
  min-height: 22px;
}
.uploader-display {
  font-size: 0.68rem;
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.uploader-edit-btn {
  border: none;
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.7rem;
  cursor: pointer;
  padding: 2px 4px;
  line-height: 1;
  border-radius: 4px;
  flex-shrink: 0;
}
.uploader-edit-btn:hover { color: var(--gold); background: var(--pear-tint); }

/* ---------- "Who uploaded this?" modal ---------- */
/* A real popup rather than the old cramped inline row, so there's room to
   type comfortably on a phone — the tile itself stays small; only the final
   saved name is truncated to fit under the photo. */
.uploader-modal {
  position: fixed;
  inset: 0;
  background: rgba(20, 18, 14, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 110;
  padding: 20px;
}
.uploader-modal.active { display: flex; }
.uploader-modal-card {
  position: relative;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px 22px 20px;
  width: 100%;
  max-width: 400px;
  max-height: 88vh;
  overflow-y: auto;
}
.uploader-modal-card h3 { font-size: 1.05rem; margin-bottom: 14px; padding-right: 20px; }
.uploader-modal-card input[type="text"],
.uploader-modal-card input[type="datetime-local"] {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: inherit;
  font-size: 1rem;
  margin-bottom: 14px;
}
.uploader-modal-card .actions { display: flex; gap: 10px; }

/* Admin-only fields (Round 13) tacked onto the same shared popup — a plain
   pencil edit stays a one-field form for guests; only an admin session ever
   sees this block at all (footer.ejs gates it server-side). */
.admin-modal-section { margin-bottom: 6px; }
.admin-modal-divider {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  border-top: 1px solid var(--line-soft);
  padding-top: 14px;
  margin-bottom: 12px;
}
.admin-field-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 5px;
}
.admin-field-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.92rem;
  resize: vertical;
  margin-bottom: 12px;
}
.admin-field-hint {
  font-size: 0.74rem;
  color: var(--ink-soft);
  margin: -6px 0 14px;
}
.admin-exif-hint {
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin-bottom: 6px;
  font-style: italic;
}
.admin-exif-hint a { color: var(--gold); }
.uploader-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  border: none;
  background: transparent;
  color: var(--ink-soft);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
}
.uploader-modal-close:hover { color: var(--gold); }

.tile .dl-btn {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(47,44,38,0.65);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  opacity: 0;
  transition: opacity 0.15s ease, background 0.15s ease;
}
.tile .dl-btn:hover { background: var(--moss); }
.tile:hover .dl-btn, .tile:focus-within .dl-btn { opacity: 1; }
@media (hover: none) {
  .tile .dl-btn { opacity: 1; } /* always show on touch devices, no hover state */
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

/* ---------- Admin: select & move photos ---------- */
.tile-select {
  display: none;
  position: absolute;
  top: 6px;
  left: 6px;
  width: 22px;
  height: 22px;
  z-index: 3;
  accent-color: var(--moss);
  cursor: pointer;
}
.gallery.select-mode .tile-select { display: block; }
.gallery.select-mode .tile { cursor: pointer; }
.gallery.select-mode .tile .dl-btn,
.gallery.select-mode .admin-delete-form { display: none !important; }
.tile.tile-selected { outline: 3px solid var(--gold); outline-offset: -3px; }
.tile.tile-selected::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(47,44,38,0.25);
  pointer-events: none;
}

.move-toolbar {
  display: none;
  position: sticky;
  bottom: 14px;
  z-index: 20;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--white);
  box-shadow: var(--shadow-lg);
  border-radius: 999px;
  padding: 10px 16px;
  margin: 0 0 30px;
}
.move-toolbar.active { display: flex; }
.move-count { font-size: 0.82rem; color: var(--ink-soft); white-space: nowrap; }
.move-toolbar select,
.move-toolbar input[type="text"] {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.82rem;
  max-width: 200px;
}
.move-status { font-size: 0.78rem; color: var(--moss-dark); }
.move-status.error { color: var(--danger); }

/* ---------- Forms / modal ---------- */
.inline-form {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin: 14px 0 24px;
  display: none;
}
.inline-form.active { display: block; }
.inline-form h3 { font-size: 1rem; margin-bottom: 10px; }
.inline-form input[type="text"], .inline-form textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  margin-bottom: 10px;
}
.inline-form textarea { resize: vertical; min-height: 60px; }
.inline-form .actions { display: flex; gap: 10px; }

.error-banner {
  background: #fbeceb;
  border: 1px solid #eec9c5;
  color: var(--danger);
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  max-width: 1100px;
  margin: 16px auto 0;
}

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 40px 34px;
  max-width: 380px;
  width: 100%;
  text-align: center;
}
.login-card h1 { font-size: 1.8rem; }
.login-card .date { color: var(--gold); font-weight: 600; margin-bottom: 4px; }
.login-card .venue { color: var(--ink-soft); font-size: 0.85rem; margin-bottom: 20px; }
.login-card input[type="password"] {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 1rem;
  margin-bottom: 14px;
  text-align: center;
}
.login-card .btn { width: 100%; padding: 12px; }
.login-card .error { color: var(--danger); font-size: 0.85rem; margin-bottom: 12px; }
.login-card .login-note { color: var(--ink-soft); font-size: 0.92rem; margin: 10px 0 0; }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(20, 18, 14, 0.92);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}
.lightbox.active { display: flex; }
.lightbox .content { max-width: 92vw; max-height: 88vh; text-align: center; }
.lightbox img, .lightbox video { max-width: 92vw; max-height: 80vh; border-radius: 8px; }
.lightbox .caption { color: #f0ece0; font-size: 0.85rem; margin-top: 12px; }
.lightbox .dl-link {
  display: inline-block;
  margin-top: 10px;
  color: #f0ece0;
  border: 1px solid rgba(240,236,224,0.5);
  border-radius: 999px;
  padding: 7px 16px;
  font-size: 0.8rem;
  text-decoration: none;
}
.lightbox .dl-link:hover { background: rgba(240,236,224,0.12); }
.lightbox .close {
  position: absolute;
  top: 18px;
  right: 24px;
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
  background: none;
  border: none;
  line-height: 1;
}

footer.site-footer {
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.78rem;
  padding: 30px 20px 50px;
}

/* ---------- Nav links (Guestbook / Slideshow / etc.) ---------- */
.topbar .nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.topbar .nav-link {
  font-size: 0.82rem;
  color: var(--ink-soft);
  font-weight: 500;
  padding: 8px 10px;
  border-radius: 999px;
  transition: background 0.15s ease, color 0.15s ease;
}
.topbar .nav-link:hover { background: var(--cream-2); color: var(--moss-dark); }

/* ---------- Guest sign-in form ---------- */
.container.narrow { max-width: 640px; }
.card-form {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px 24px;
  margin: 20px 0 50px;
}
.field-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--moss-dark);
  margin: 18px 0 6px;
}
.field-label .req { color: var(--danger); }
.field-label .optional { color: var(--ink-soft); font-weight: 400; }
.card-form input[type="text"],
.card-form textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.92rem;
}
.card-form textarea { resize: vertical; min-height: 70px; }

.checkbox-row { display: flex; flex-wrap: wrap; gap: 8px; }
.checkbox-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.85rem;
  color: var(--ink-soft);
  cursor: pointer;
}
.checkbox-pill input { accent-color: var(--moss); }
.checkbox-pill:has(input:checked) { border-color: var(--moss); color: var(--moss-dark); background: var(--pear-tint); }

.conditional-field { display: none; margin-top: 10px; }
.conditional-field.active { display: block; }

.fun-questions {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
}

.capture-block {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
}
.selfie-wrap, .voice-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.selfie-preview {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.btn.danger-outline {
  background: transparent;
  color: var(--danger);
  border: 1.5px solid var(--danger);
  padding: 11px 20px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}
.voice-controls { display: flex; align-items: center; gap: 10px; }
.voice-timer { font-size: 0.85rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.voice-audio { width: 100%; margin-top: 8px; }
.voice-hint { font-size: 0.78rem; color: var(--ink-soft); width: 100%; margin-top: 4px; }

.success-banner {
  background: #f1f5ec;
  border: 1px solid #cfe0bd;
  color: var(--moss-dark);
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.9rem;
  text-align: center;
  max-width: 1100px;
  margin: 16px auto 0;
}

/* ---------- Guestbook ---------- */
.guestbook-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin: 10px 0 50px;
}
.guestbook-card {
  position: relative;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.gb-top { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.gb-selfie { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.gb-selfie-placeholder { display: flex; align-items: center; justify-content: center; background: var(--cream-2); font-size: 1.3rem; color: var(--gold); }
.gb-name { font-weight: 600; color: var(--moss-dark); font-size: 0.98rem; }
.gb-relation { font-size: 0.78rem; color: var(--ink-soft); }
.gb-text { font-size: 0.88rem; line-height: 1.5; margin: 8px 0; }
.gb-fun { font-size: 0.82rem; color: var(--ink-soft); margin-top: 8px; display: grid; gap: 3px; }
.gb-audio { width: 100%; margin-top: 10px; }
.gb-date { font-size: 0.7rem; color: var(--ink-soft); margin-top: 10px; opacity: 0.7; }

/* ---------- Admin delete controls ---------- */
.admin-delete-form { position: absolute; top: 10px; right: 10px; margin: 0; z-index: 2; }
.admin-delete-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: rgba(164, 68, 58, 0.88);
  color: #fff;
  font-size: 0.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.admin-delete-btn:hover { background: var(--danger); }
.tile .admin-delete-form { top: 6px; right: 34px; }

/* ---------- Info pages (Hotel Info, Our Home, etc.) ---------- */
.info-body {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px 28px;
  margin: 20px 0 50px;
  line-height: 1.7;
  font-size: 0.95rem;
  white-space: pre-wrap;
}
.info-edit-form textarea { min-height: 220px; }

@media (max-width: 480px) {
  .hero { padding: 40px 16px 28px; }
  .card-form { padding: 20px 16px; }
}

/* --- Bottom navigation (Round 15) -----------------------------------------
   The site is used mostly on iPhones, where the top nav has scrolled away by
   the time you reach the end of a gallery. Two pieces:
     .tabbar — fixed app-style bar, phone widths only
     .pager  — inline previous / up / next, at all widths
   -------------------------------------------------------------------------- */

.tabbar { display: none; }

.pager {
  display: flex;
  align-items: stretch;
  gap: 8px;
  margin: 22px 0 8px;
  padding-top: 16px;
  border-top: 1px solid var(--cream-2);
}
.pager-link {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--white);
  border: 1px solid var(--cream-2);
  border-radius: 12px;
  text-decoration: none;
  color: var(--moss-dark);
  box-shadow: var(--shadow);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.pager-link:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.pager-next { justify-content: flex-end; text-align: right; }
.pager-arrow { font-size: 1.35rem; line-height: 1; color: var(--gold); flex: 0 0 auto; }
.pager-text { min-width: 0; }
.pager-kicker {
  display: block;
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.pager-name {
  display: block;
  font-size: 0.86rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pager-up {
  flex: 0 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
}
.pager-up:hover { color: var(--gold); }
/* Empty slots keep their space so "Next" stays pinned right even with no
   "Previous" — but they must never look or behave like buttons. */
.pager-empty {
  background: none;
  border: none;
  box-shadow: none;
  pointer-events: none;
}

@media (max-width: 768px) {
  .tabbar {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    background: var(--white);
    border-top: 1px solid var(--cream-2);
    box-shadow: 0 -4px 20px rgba(47, 44, 38, 0.08);
    /* Sits above the iPhone home indicator rather than under it. */
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .tab {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 7px 2px 6px;
    text-decoration: none;
    color: var(--ink-soft);
  }
  .tab.is-active { color: var(--gold); }
  .tab-icon { font-size: 1.25rem; line-height: 1; }
  .tab-label {
    font-size: 0.63rem;
    letter-spacing: 0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  /* Keep the fixed bar from covering the end of the page, and keep the
     sticky move toolbar clear of it too. */
  footer.site-footer { padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }
  .move-toolbar { bottom: calc(58px + env(safe-area-inset-bottom, 0px)); }

  .pager { gap: 6px; }
  .pager-link { padding: 9px 10px; gap: 6px; }
  .pager-up { padding: 9px 8px; font-size: 0.76rem; }
}

@media (max-width: 420px) {
  /* On the narrowest phones the middle "up" link would squeeze the prev/next
     names down to an ellipsis — drop its text and keep just the arrow. The
     link keeps its destination in title/aria-label, and gets a button-like
     circle so a lone arrow still reads as tappable. */
  .pager-up .pager-name { display: none; }
  .pager-up {
    flex: 0 0 auto;
    width: 42px;
    padding: 0;
    align-self: stretch;
    background: var(--white);
    border: 1px solid var(--cream-2);
    box-shadow: var(--shadow);
  }
  .pager-up .pager-arrow { font-size: 1.2rem; color: var(--gold); }
}

/* Field labels inside the inline edit form (title + description), Round 16. */
.inline-form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--moss-dark);
  margin: 10px 0 4px;
}
.inline-form-label:first-of-type { margin-top: 0; }
.inline-form-label .optional { font-weight: 400; color: var(--ink-soft); }

/* --- Round 17: nested pages, page text, reordering, delete ---------------- */

/* Editable text-and-links block above a page's gallery. */
.page-body {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin: 14px 0 18px;
  color: var(--ink);
  line-height: 1.55;
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}
.page-body p { margin: 0 0 10px; }
.page-body p:last-child { margin-bottom: 0; }
.page-body a { color: var(--gold); text-decoration: underline; text-underline-offset: 2px; }

/* A card plus its reorder controls. The wrapper carries the grid cell so the
   card itself keeps its existing hover-lift behaviour. */
.card-wrap { display: flex; flex-direction: column; }
.card-wrap .card { flex: 1; }
.reorder-row {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 6px;
}
.reorder-btn {
  border: 1px solid var(--cream-2);
  background: var(--white);
  color: var(--moss-dark);
  border-radius: 8px;
  width: 46px;
  padding: 5px 0;
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
}
.reorder-btn:hover:not(:disabled) { border-color: var(--gold); color: var(--gold); }
.reorder-btn:disabled { opacity: 0.3; cursor: default; }

/* Delete control inside the edit panel, visually separated from the saves. */
.danger-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--cream-2);
}
.danger-note { font-size: 0.78rem; color: var(--ink-soft); }
.btn.danger {
  background: transparent;
  color: var(--gold);
  border: 1px solid var(--gold);
}
.btn.danger:hover { background: var(--gold); color: var(--white); }

.body-edit-form { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--cream-2); }
.inline-form-hint {
  font-size: 0.76rem;
  color: var(--ink-soft);
  margin-top: 6px;
  line-height: 1.45;
}
.inline-form-hint code {
  background: var(--cream-2);
  padding: 1px 4px;
  border-radius: 4px;
  font-size: 0.95em;
}

/* --- Round 18: role bar --------------------------------------------------
   Shown only to a moderator or admin, directly under the top nav, so it's
   never a mystery why extra controls are on screen. Deliberately muted —
   it's a persistent status strip, not an alert. */
.role-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 8px 16px;
  background: var(--pear-tint, #eef0e2);
  border-bottom: 1px solid var(--cream-2);
  font-size: 0.8rem;
  color: var(--ink-soft);
  text-align: center;
}
.role-bar-text strong { color: var(--moss-dark); }
.role-bar form { margin: 0; }
.role-bar-btn {
  border: 1px solid var(--moss-dark);
  background: transparent;
  color: var(--moss-dark);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.76rem;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
}
.role-bar-btn:hover { background: var(--moss-dark); color: var(--white); }

@media (max-width: 560px) {
  .role-bar { gap: 8px; padding: 7px 12px; font-size: 0.74rem; }
}

/* --- Round 20: full-screen gallery navigation ----------------------------
   Arrows, position counter, and the scroll lock that keeps the page behind
   the overlay still while you swipe. */

body.lightbox-open { overflow: hidden; }

.lightbox .lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border: none;
  border-radius: 50%;
  background: rgba(240, 236, 224, 0.14);
  color: #fff;
  font-size: 2.1rem;
  line-height: 1;
  padding: 0 0 4px;          /* optically centres the chevron glyph */
  cursor: pointer;
  font-family: inherit;
}
.lightbox .lb-nav:hover { background: rgba(240, 236, 224, 0.28); }
.lightbox .lb-nav[hidden] { display: none; }
.lightbox .lb-prev { left: 10px; }
.lightbox .lb-next { right: 10px; }

.lightbox .lb-counter {
  position: absolute;
  top: 24px;
  left: 0;
  right: 0;
  text-align: center;
  color: rgba(240, 236, 224, 0.75);
  font-size: 0.8rem;
  letter-spacing: 0.03em;
  pointer-events: none;
}

@media (max-width: 560px) {
  /* Smaller, closer to the edges, and the photo gets a little more room so
     the arrows don't sit on top of it. */
  .lightbox { padding: 16px 8px; }
  .lightbox .lb-nav { width: 44px; height: 44px; font-size: 1.8rem; }
  .lightbox .lb-prev { left: 2px; }
  .lightbox .lb-next { right: 2px; }
  .lightbox img, .lightbox video { max-width: 100%; max-height: 72vh; }
}

/* --- Round 23 ---------------------------------------------------------------
   The "Order:" line above a gallery, and the low-storage note in the role bar. */
.sort-row { font-size: 0.78rem; color: var(--ink-soft); margin: 0 0 10px; }
.sort-row a { color: var(--moss-dark); }
.sort-row strong { color: var(--ink); font-weight: 600; }
.role-bar-warning { display: block; margin-top: 3px; color: var(--danger); font-weight: 600; }

/* --- Round 25: the Duplicates review page ----------------------------------- */
.dup-banner {
  background: var(--pear-tint);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 10px 14px;
  margin: 0 0 14px;
  font-size: 0.88rem;
}
.dup-banner-wait { background: var(--white); }
.dup-summary { margin: 0 0 22px; }
.dup-summary p { margin: 0 0 8px; }
.dup-help { font-size: 0.82rem; color: var(--ink-soft); }
.dup-group {
  background: var(--white);
  border-radius: 14px;
  padding: 14px;
  margin: 0 0 16px;
  box-shadow: 0 1px 4px rgba(47, 44, 38, 0.08);
}
.dup-group-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; margin-bottom: 10px; font-size: 0.9rem; }
.dup-kind { color: var(--ink-soft); font-size: 0.8rem; }
.dup-flag {
  font-size: 0.7rem;
  background: #fbeceb;
  color: var(--danger);
  border-radius: 999px;
  padding: 2px 9px;
}
.dup-row { margin: 0; }
.dup-choice {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--moss-dark);
  cursor: pointer;
}
.dup-choice input { width: 18px; height: 18px; margin: 0; accent-color: var(--moss-dark); }
.dup-meta { font-size: 0.72rem; color: var(--ink-soft); line-height: 1.45; margin-top: 2px; overflow-wrap: anywhere; }
.dup-meta a { color: var(--moss-dark); font-weight: 600; }
/* The copy being kept gets an outline, so the choice is visible at a glance. */
.dup-item:has(input[name="keep"]:checked) .tile { outline: 3px solid var(--moss-dark); outline-offset: 2px; }
.dup-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* --- Round 26: zoom in the full-screen viewer ------------------------------- */
.lightbox { overflow: hidden; }
.lightbox img {
  touch-action: none;           /* our own pinch/drag, not the browser's page zoom */
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  transform-origin: center center;
  cursor: zoom-in;
  will-change: transform;
}
.lightbox.lb-is-zoomed img { cursor: grab; border-radius: 0; position: relative; z-index: 1; }
.lightbox.lb-is-zoomed img:active { cursor: grabbing; }
.lightbox img.lb-animating { transition: transform 0.22s ease-out; }
/* Caption and Download step aside while you look around a zoomed photo. */
.lightbox.lb-is-zoomed .caption,
.lightbox.lb-is-zoomed .dl-link { opacity: 0; pointer-events: none; }
.lightbox .caption, .lightbox .dl-link { transition: opacity 0.15s; }
/* The controls stay on top of a zoomed photo. */
.lightbox .close, .lightbox .lb-counter { z-index: 3; }
.lightbox .lb-nav { z-index: 3; }
.lightbox .lb-zoom {
  position: absolute;
  top: 14px;
  left: 16px;
  z-index: 3;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: rgba(240, 236, 224, 0.14);
  color: #fff;
  cursor: pointer;
}
.lightbox .lb-zoom[hidden] { display: none; }
.lightbox .lb-zoom:hover { background: rgba(240, 236, 224, 0.28); }
.lightbox .lb-zoom.lb-zoom-out .lb-zoom-plus { display: none; }
/* A small pulse on the button while the full-resolution photo downloads. */
.lightbox.lb-loading-full .lb-zoom { animation: lb-zoom-pulse 1s ease-in-out infinite; }
@keyframes lb-zoom-pulse { 50% { background: rgba(240, 236, 224, 0.36); } }
.lightbox .lb-hint {
  position: absolute;
  left: 50%;
  bottom: 22%;
  transform: translateX(-50%);
  z-index: 3;
  background: rgba(20, 18, 14, 0.78);
  color: #f0ece0;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 0.85rem;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s;
}
.lightbox .lb-hint.lb-hint-show { opacity: 1; }
@media (max-width: 560px) {
  .lightbox .lb-zoom { top: 10px; left: 10px; width: 40px; height: 40px; }
}
/* Over a bright zoomed-in photo, keep the counter and close button readable. */
.lightbox.lb-is-zoomed .lb-counter,
.lightbox.lb-is-zoomed .close { text-shadow: 0 1px 3px rgba(0, 0, 0, 0.75); color: #fff; }
.lightbox.lb-is-zoomed .lb-zoom,
.lightbox.lb-is-zoomed .lb-nav { background: rgba(20, 18, 14, 0.45); }

/* ---------- Admin Settings page ---------- */
.settings-page .card-form h2 { font-size: 1.25rem; margin: 26px 0 4px; }
.settings-page .card-form h2:first-child { margin-top: 0; }
.settings-hint { color: var(--ink-soft); font-size: 0.82rem; margin: 6px 0 0; line-height: 1.45; }
.settings-errors { margin: 8px 0 0; padding-left: 20px; text-align: left; }
.settings-page .card-form input[type="url"],
.settings-page .card-form input[type="password"],
.settings-page .copy-row input[type="text"],
.settings-select {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.92rem;
  background: var(--white);
  color: var(--ink);
}
.settings-start { border: 2px solid var(--moss); }
.template-grid, .theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin-top: 12px; }
.template-card, .theme-card {
  display: flex; flex-direction: column; gap: 6px;
  border: 1.5px solid var(--line); border-radius: 10px; padding: 12px; cursor: pointer; background: var(--white);
}
.template-card input, .theme-card input { accent-color: var(--moss); margin: 0; }
.icon-setting { display: flex; align-items: center; gap: 12px; }
.icon-setting input { max-width: 140px; }
.icon-preview { width: 56px; height: 56px; border-radius: 13px; box-shadow: var(--shadow); flex: 0 0 auto; }
.template-card:has(input:checked), .theme-card:has(input:checked) { border-color: var(--moss); background: var(--pear-tint); }
.template-name, .theme-name { font-weight: 600; color: var(--moss-dark); font-size: 0.92rem; }
.template-sections { color: var(--ink-soft); font-size: 0.78rem; line-height: 1.4; }
.theme-swatches { display: flex; border-radius: 6px; overflow: hidden; border: 1px solid var(--line); height: 28px; }
.theme-swatches span { flex: 1; }
.radio-line { display: flex; align-items: center; gap: 8px; margin: 10px 0 0; font-size: 0.92rem; cursor: pointer; }
.radio-line input { accent-color: var(--moss); }
.copy-row { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
.copy-row input { flex: 1; min-width: 0; font-size: 0.82rem; }
.setup-banner { background: var(--pear-tint); border: 1.5px solid var(--moss); border-radius: var(--radius); padding: 14px 18px; margin: 18px 0; text-align: center; }
.setup-banner a { color: var(--moss); font-weight: 600; text-decoration: underline; }

/* On a phone the moderator/admin menu is long; let it drop below the event
   name instead of squeezing the name onto several lines. */
@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; row-gap: 6px; }
  .topbar .brand { flex: 0 1 auto; min-width: 0; }
  .topbar .nav-links { margin-left: -10px; }
}
.template-card input, .theme-card input { align-self: flex-start; }
