/* ═══════════════════════════════════════════════════════════════════════
   stationery-save-the-date-digital-card-flat-date — "The Flat Date"
   --------------------------------------------------------------------
   A formal, portrait save-the-date card: an ivory sheet with a hairline
   frame sits on a deep desk-like backdrop. The date leads — a tiny month
   calendar with the day circled, beside the spelled-out date.

   Design tokens → shell → sheet → cover (mini-cal) → keepsake photos →
   details → RSVP → guestbook → pager → a11y → lightbox → print →
   reduced-motion → no-JS fallback.
   ═════════════════════════════════════════════════════════════════════ */

/* ── 1 · Tokens ─────────────────────────────────────────────────────── */
:root {
  --desk:       #24211b;   /* deep backdrop the card sits on   */
  --desk-soft:  #2d2922;
  --ivory:      #fbf6ea;   /* the card paper                   */
  --ivory-2:    #f3ecd9;   /* recessed paper inside the card   */
  --ink:        #2e2a23;   /* warm charcoal ink                */
  --ink-soft:   #5d564a;
  --muted:      #8a8172;
  --hairline:   #ddd0ab;   /* card rules & borders             */
  --accent:     #c05c38;   /* terracotta (the circled date)    */
  --accent-deep:#a0492a;
  --gold:       #b18d4f;   /* foil accents                     */
  --white:      #fffdf8;
  --err:        #b3542f;
  --desk-line:  rgba(251,246,234,.14);
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body:    "Karla", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ease: cubic-bezier(.22,.61,.36,1);
}

/* ── 2 · Reset & base ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ivory);
  background: var(--desk);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

p, h1, h2, h3, dl, dd, figure { margin: 0; }

button { font: inherit; color: inherit; }

/* ── 3 · The single-viewport shell ──────────────────────────────────── */
.invite-shell {
  height: 100vh;               /* fallback for older browsers */
  height: 100dvh;              /* dynamic viewport (mobile UI) */
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background:
    radial-gradient(rgba(177,141,79,.13) 1px, transparent 1.4px) 0 0 / 30px 30px,
    var(--desk);
}

/* ── 4 · Masthead (fixed; never scrolls) ────────────────────────────── */
.invite-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .9rem max(1.25rem, env(safe-area-inset-left)) .9rem max(1.25rem, env(safe-area-inset-right));
  border-bottom: 1px solid var(--desk-line);
  background: rgba(36,33,27,.9);
}

.monogram {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: .28em;
  color: var(--ivory);
}
.monogram .amp { color: var(--accent); letter-spacing: 0; padding: 0 .1em; }

.guest-greeting {
  margin-left: auto;
  font-size: .82rem;
  letter-spacing: .06em;
  color: var(--gold);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 40vw;
}
.guest-greeting[hidden] { display: none; }

/* ── 5 · Panels — only the active one is visible & scrolls ──────────── */
.invite-panels {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

.panel {
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--gold) transparent;
}
.js .panel { display: none; }
.js .panel.is-active {
  display: flex;
  flex-direction: column;
  animation: panel-in .45s var(--ease);
}

@keyframes panel-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.panel:focus { outline: none; }

/* No-JS fallback: the app unwraps into a normal scrolling document so
   every panel and the brand footer stay reachable without JavaScript. */
html:not(.js) .invite-shell { height: auto; display: block; overflow: visible; }
html:not(.js) .invite-panels { overflow: visible; }
html:not(.js) .panel { height: auto; overflow: visible; }

/* ── 6 · The sheet — every panel presents as an ivory card ──────────── */
.sheet {
  margin: auto;
  width: 100%;
  max-width: 30rem;
  background: var(--ivory);
  color: var(--ink);
  border: 1px solid var(--hairline);
  border-radius: 20px;
  box-shadow:
    0 0 0 1px rgba(251,246,234,.05),
    0 34px 80px -34px rgba(0,0,0,.75);
  padding: clamp(1.9rem, 6vw, 2.8rem) clamp(1.4rem, 6vw, 2.6rem) clamp(2.2rem, 7vw, 3rem);
  text-align: center;
}

.panel-inner { /* alias so all four panels share .sheet styles */
  /* .sheet rules apply via the class in markup */
}

/* ── 7 · Shared labels ──────────────────────────────────────────────── */
.ornament {
  color: var(--gold);
  font-size: .8rem;
  letter-spacing: .6em;
  margin-bottom: 1rem;
  opacity: .9;
}

.eyebrow {
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .42em;
  text-transform: uppercase;
  color: var(--gold);
}

.panel-index {
  font-family: var(--font-display);
  font-style: italic;
  font-size: .95rem;
  color: var(--gold);
  letter-spacing: .2em;
}

.panel-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.9rem, 5vw, 2.4rem);
  line-height: 1.1;
  margin-top: .2rem;
}

.panel-sub {
  color: var(--muted);
  font-size: .98rem;
  line-height: 1.6;
  margin-top: .6rem;
}

/* ── 8 · Cover — the date leads ─────────────────────────────────────── */
.d-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2.2rem, 7.5vw, 3.1rem);
  line-height: 1.08;
  margin-top: .4rem;
}
.d-title .amp {
  font-style: italic;
  font-weight: 400;
  color: var(--accent);
  padding: 0 .1em;
}

.d-tagline {
  color: var(--ink-soft);
  font-size: .98rem;
  line-height: 1.55;
  max-width: 22rem;
  margin: .6rem auto 0;
}

/* the machine date block */
.date-hero { margin-top: 1.6rem; }

.d-line {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: .55rem;
  color: var(--ink-soft);
  font-size: .92rem;
}
.d-weekday {
  font-weight: 700;
  letter-spacing: .22em;
  text-transform: uppercase;
  font-size: .76rem;
}
.d-sep { color: var(--accent); font-size: .85rem; }

/* the mini month calendar with the date circled */
.mini-cal {
  width: min(100%, 16.5rem);
  margin: 1.4rem auto 0;
  padding: 1rem 1rem .9rem;
  border: 1px solid var(--hairline);
  border-radius: 14px;
  background: var(--ivory-2);
}

.mini-cal-head {
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--accent-deep);
}
.mini-cal-head .mini-year { color: var(--gold); }

.mini-cal-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-top: .7rem;
}
.mini-cal-week span {
  font-size: .6rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-align: center;
  color: var(--muted);
}

.mini-cal-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-top: .35rem;
}

.mini-cell {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  font-size: .8rem;
  color: var(--ink-soft);
  border-radius: 50%;
}
.mini-cell.is-blank { visibility: hidden; }
.mini-cell.is-date {
  background: var(--accent);
  color: var(--white);
  font-weight: 700;
  box-shadow: 0 6px 14px -6px rgba(160,73,42,.65);
}

/* the spelled-out date — readable truth next to the picture */
.d-spelled {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.5rem, 5vw, 1.95rem);
  margin-top: 1.2rem;
}

.d-place {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1.1rem, 3.4vw, 1.3rem);
  color: var(--accent-deep);
  margin-top: .55rem;
}

.d-note {
  color: var(--muted);
  font-size: .92rem;
  line-height: 1.6;
  max-width: 20rem;
  margin: .6rem auto 0;
}

/* private-link chip — shown by JS only on /s/ token links */
.private-chip {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  margin-top: 1.1rem;
  padding: .45rem 1rem;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: var(--ivory-2);
  font-size: .8rem;
  color: var(--ink-soft);
}
.private-chip[hidden] { display: none; }
.private-chip svg { color: var(--accent); }

/* ── 8b · Keepsake photos (optional — delete the markup to hide) ────── */
/* the cover portrait — a matted, hairline-framed keepsake */
.photo-cover {
  max-width: 15.5rem;
  margin: 0 auto 1.35rem;
  padding: .55rem;
  background: var(--white);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  box-shadow: 0 16px 32px -20px rgba(46,42,35,.55);
}
.photo-cover img {
  display: block;
  width: 100%; height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 7px;
  cursor: zoom-in;
}

/* the Our Moments gallery — a wide featured frame over a square grid */
.photo-gallery { text-align: left; }

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .9rem;
  margin-top: 1.6rem;
}

.gallery-item { margin: 0; }
.gallery-item.is-featured { grid-column: 1 / -1; }

.gallery-item img {
  display: block;
  width: 100%; height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  box-shadow: 0 10px 22px -18px rgba(46,42,35,.5);
  background: var(--ivory-2);   /* while a host photo loads */
  cursor: zoom-in;
}
.gallery-item.is-featured img { aspect-ratio: 16 / 9; }

.gallery-item figcaption {
  margin-top: .45rem;
  font-size: .82rem;
  font-style: italic;
  color: var(--muted);
  line-height: 1.45;
}

.photo img:focus-visible,
.gallery-item img:focus-visible,
.banner-flyer img:focus-visible,
.free-media img:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

/* ── 8c · Official flyer / banner (optional) ──────────────────────────
   A wide matted frame for hosts who already have a designed flyer or
   poster for the event — guests see it and confirm they're in the right
   place. Clicking it opens the same full-size viewer as the photos.
   Delete the whole <figure> to hide. */
.banner-flyer {
  margin-top: 1.9rem;
  text-align: left;
}
.banner-flyer img {
  display: block;
  width: 100%; height: auto;
  aspect-ratio: 8 / 3;
  object-fit: cover;
  padding: .4rem;
  background: var(--white);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  box-shadow: 0 16px 32px -22px rgba(46,42,35,.5);
  cursor: zoom-in;
}
.banner-flyer figcaption {
  margin-top: .5rem;
  font-size: .82rem;
  font-style: italic;
  color: var(--muted);
  line-height: 1.45;
}

/* ── 9 · Cover CTAs ─────────────────────────────────────────────────── */
.cover-cta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .75rem;
  margin-top: 1.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  padding: .9rem 1.5rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: .92rem;
  font-weight: 600;
  letter-spacing: .02em;
  cursor: pointer;
  transition: transform .18s var(--ease), box-shadow .18s var(--ease), background-color .18s, border-color .18s;
  min-height: 48px;
}

.btn-primary {
  background: var(--accent);
  color: var(--white);
  box-shadow: 0 10px 24px -12px rgba(160,73,42,.65);
}
.btn-primary:hover { background: var(--accent-deep); transform: translateY(-1px); }

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--hairline);
}
.btn-ghost:hover { border-color: var(--gold); color: var(--accent-deep); }

.btn:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

.scroll-hint {
  margin-top: 1.9rem;
  font-size: .78rem;
  letter-spacing: .08em;
  color: var(--muted);
}
.scroll-arrow {
  display: inline-block;
  margin-left: .5rem;
  color: var(--accent);
  animation: bob 1.8s ease-in-out infinite;
}
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(4px); }
}

/* ── 10 · Details panel (a sheet) ───────────────────────────────────── */
.details { text-align: left; }

.detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.7rem;
  margin-top: 2rem;
}

.detail-item {
  border-top: 1px solid var(--hairline);
  padding-top: 1.1rem;
}

.detail-item dt {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: .75rem;
}
.detail-item dt svg { color: var(--accent); flex: 0 0 auto; }

.detail-item dd { line-height: 1.55; }
.detail-item dd + dd { margin-top: .3rem; }

.d-venue {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.2rem, 3.4vw, 1.45rem);
}
.d-address { color: var(--muted); font-size: .94rem; }

.d-date { font-family: var(--font-display); font-size: clamp(1.15rem, 3.2vw, 1.35rem); }
.d-time  { color: var(--muted); font-size: .94rem; }
.d-more  { font-family: var(--font-display); font-style: italic; color: var(--accent-deep); font-size: 1rem; }

.note { color: var(--ink-soft); font-size: .96rem; }
.note::before { content: "✦ "; color: var(--gold); font-size: .7rem; vertical-align: .08em; }

/* ── 10b · Optional film feature (video URL embed) ────────────────────
   A poster + play button that lazy-loads an <iframe> from the URL in
   data-video-url (YouTube / Vimeo / any embeddable URL). Nothing loads
   until the guest taps play. Leave the URL empty for a gentle hint;
   delete the whole .film-card to hide the feature. */
.gallery-label {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--gold);
}

.film-card { margin-top: 2rem; }

.film-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  margin-top: .9rem;
  overflow: hidden;
  border-radius: 12px;
  background: var(--ivory-2);   /* mat behind the poster / while loading */
  border: 1px solid var(--hairline);
  box-shadow: 0 16px 32px -22px rgba(46,42,35,.5);
}

.film-open {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  padding: 0; border: 0; background: none;
  cursor: pointer;
}
.film-open img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}

.film-play {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: clamp(3.4rem, 12vw, 4.4rem); height: clamp(3.4rem, 12vw, 4.4rem);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--accent-deep);
  background: radial-gradient(circle at 32% 28%, var(--white), var(--ivory-2) 62%, var(--hairline));
  border: 1px solid var(--hairline);
  box-shadow: 0 12px 28px -12px rgba(46,42,35,.6);
  animation: film-pulse 2.6s ease-in-out infinite;
  transition: transform .2s var(--ease);
}
.film-play svg { width: 1.5rem; height: 1.5rem; margin-left: 3px; }
.film-open:hover .film-play { transform: translate(-50%, -50%) scale(1.08); }
.film-open:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.film-hint {
  position: absolute; left: 50%; bottom: .9rem;
  transform: translateX(-50%);
  padding: .35rem .85rem;
  border-radius: 999px;
  background: rgba(36,33,27,.62);
  color: var(--ivory);
  font-size: .68rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
  pointer-events: none;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.film-frame iframe {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  border: 0;
}

.film-note {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  margin: 0; padding: 0 1.1rem;
  color: var(--muted);
  font-size: .86rem; font-style: italic; text-align: center;
  background: var(--ivory-2);
  pointer-events: none;   /* the play button stays clickable beneath */
}

.film-external {
  display: inline-flex; align-items: center; gap: .35rem;
  margin-top: .8rem;
  font-size: .72rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent-deep);
  text-decoration: none;
  border-bottom: 1px solid var(--hairline);
  padding-bottom: 2px;
  transition: color .18s, border-color .18s;
}
.film-external:hover { color: var(--gold); border-color: var(--gold); }
.film-external[hidden] { display: none; }
@keyframes film-pulse {
  0%, 100% { box-shadow: 0 12px 28px -12px rgba(46,42,35,.6), 0 0 0 0 rgba(177,141,79,.35); }
  50%      { box-shadow: 0 12px 28px -12px rgba(46,42,35,.6), 0 0 0 12px rgba(177,141,79,0); }
}

/* ── 10c · Optional free page (A Note From Us) ─────────────────────────
   An optional page of your own: repeatable free blocks, each with a title,
   free text and an optional photo. Ships as the last panel; the engine
   removes the whole .panel-free section when no blocks are filled (or the
   section is toggled off), and the pager pill goes with it. Move the
   <section> in index.html to reorder it among the tabs. */
.free { text-align: left; }

.free-blocks { margin-top: 1.4rem; }

.free-block {
  padding: 1.5rem 1.4rem 1.6rem;
  border: 1px solid var(--hairline);
  border-radius: 16px;
  background: var(--ivory-2);
}
.free-block + .free-block { margin-top: 1.2rem; }

.free-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.45rem, 4.5vw, 1.8rem);
  line-height: 1.15;
  text-align: center;
}

.free-media {
  max-width: 22rem;
  margin: 1.1rem auto 0;
}
.free-media img {
  display: block;
  width: 100%; height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  padding: .4rem;
  background: var(--white);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  box-shadow: 0 16px 32px -22px rgba(46,42,35,.5);
  cursor: zoom-in;
}

.free-content {
  margin-top: 1rem;
  font-size: .98rem;
  line-height: 1.7;
  color: var(--ink-soft);
  white-space: pre-line;   /* keep the host's line breaks from the textarea */
}

/* ── 11 · RSVP panel (a sheet) ──────────────────────────────────────── */
.rsvp-wrap { text-align: left; }

.rsvp-title { margin-top: .2rem; }
.rsvp-description { margin-top: .6rem; color: var(--muted); line-height: 1.6; }

/* deadline countdown */
.countdown {
  margin-top: 1.4rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--hairline);
  border-radius: 14px;
  background: var(--ivory-2);
}
.countdown.is-off { display: none; }

.countdown-label {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .26em;
  text-transform: uppercase;
  color: var(--gold);
  text-align: center;
}

.countdown-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .5rem;
  margin-top: .65rem;
}

.count-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .1rem;
  padding: .5rem 0;
  border-radius: 10px;
  background: var(--ivory);
}
.count-box > span:first-child {
  font-family: var(--font-display);
  font-size: clamp(1.45rem, 5vw, 1.9rem);
  line-height: 1;
  color: var(--accent-deep);
  font-variant-numeric: tabular-nums;
}
.count-tag {
  font-size: .6rem;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
}

.countdown-closed {
  margin-top: .65rem;
  text-align: center;
  font-size: .86rem;
  color: var(--accent-deep);
}
.countdown.is-expired .countdown-grid { opacity: .35; }
.countdown.is-expired .countdown-closed { display: block; }
.countdown.is-expired .countdown-closed[hidden] { display: block; }

/* the form */
#rsvp-form { margin-top: 1.5rem; }

.form-row {
  display: grid;
  grid-template-columns: 1fr;
  column-gap: 1.3rem;
}
@media (min-width: 480px) {
  .form-row { grid-template-columns: 1fr 1fr; }
}

.form-group { margin-bottom: 1.3rem; }

.form-group label {
  display: block;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: .4rem;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  border: 0;
  border-bottom: 2px solid var(--hairline);
  border-radius: 0;
  background: transparent;
  font: inherit;
  font-size: .98rem;
  color: var(--ink);
  padding: .55rem .1rem;
  transition: border-color .18s;
  appearance: none;
  -webkit-appearance: none;
}

.form-group textarea { resize: vertical; min-height: 3rem; line-height: 1.5; }

.form-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23b18d4f' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .2rem center;
  padding-right: 1.8rem;
  cursor: pointer;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-bottom-color: var(--accent);
}

.form-group input::placeholder,
.form-group textarea::placeholder { color: #b3a891; }

.error {
  display: block;
  min-height: 1.15em;
  font-size: .8rem;
  color: var(--err);
  margin-top: .3rem;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  margin-top: .4rem;
}

#submit-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  padding: .9rem 1.9rem;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--white);
  font-size: .96rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 48px;
  box-shadow: 0 10px 24px -12px rgba(160,73,42,.65);
  transition: background-color .18s, transform .18s var(--ease);
}
#submit-button:hover { background: var(--accent-deep); transform: translateY(-1px); }
#submit-button:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

.loading {
  font-size: .86rem;
  color: var(--muted);
  letter-spacing: .06em;
}

/* ── 12 · Guestbook (Style A mount; injected markup styled below) ───── */
.guestbook-section { text-align: left; }

.guestbook-title { margin-top: .2rem; }
.guestbook-description { margin-top: .6rem; color: var(--muted); line-height: 1.6; }

.guestbook-body { margin-top: 1.5rem; }

.guestbook-body form { margin-bottom: 1.7rem; }

.guestbook-body .form-control {
  width: 100%;
  border: 0;
  border-bottom: 2px solid var(--hairline);
  border-radius: 0;
  background: transparent;
  font: inherit;
  font-size: .98rem;
  color: var(--ink);
  padding: .55rem .1rem;
  margin-bottom: .25rem;
}
.guestbook-body .form-control:focus { outline: none; border-bottom-color: var(--accent); }

.guestbook-body textarea.form-control { resize: vertical; min-height: 5rem; line-height: 1.5; }

.guestbook-body .error { display: block; min-height: 1.1em; font-size: .8rem; color: var(--err); }

.guestbook-body button[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .8rem 1.7rem;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--ivory);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 46px;
  margin-top: .6rem;
}
.guestbook-body button[type="submit"]:hover { background: var(--accent-deep); }

.guestbook-body .loading-guestbook { font-size: .84rem; color: var(--muted); margin-top: .5rem; }
.guestbook-body .guestbook-chapta { margin-top: .8rem; }

.guestbook-wrap { border-top: 1px solid var(--hairline); }
.guestbook-entry {
  padding: 1rem 0;
  border-bottom: 1px solid var(--hairline);
}
.guestbook-entry:last-child { border-bottom: 0; }
.guestbook-entry h5 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.02rem;
  margin: 0 0 .25rem;
}
.guestbook-entry p { margin: 0 0 .2rem; line-height: 1.55; color: var(--ink-soft); }
.guestbook-entry small { font-size: .75rem; color: var(--muted); }

.more-guestbook-wrap { margin-top: 1rem; text-align: center; }
#load-more {
  padding: .7rem 1.5rem;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  font-size: .86rem;
  font-weight: 600;
  cursor: pointer;
}
#load-more:hover { border-color: var(--gold); color: var(--accent-deep); }

/* ── 13 · Pager (fixed bottom rail; never scrolls) ──────────────────── */
.invite-pager {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .4rem;
  padding: .7rem max(1rem, env(safe-area-inset-left)) calc(.7rem + env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-right));
  border-top: 1px solid var(--desk-line);
  background: rgba(36,33,27,.92);
}

.pager-btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .55rem .85rem;
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  font-size: .8rem;
  font-weight: 600;
  color: rgba(251,246,234,.55);
  cursor: pointer;
  transition: background-color .18s, color .18s;
}

.pager-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: currentColor;
  opacity: .5;
  transition: opacity .18s, transform .18s var(--ease);
}

.pager-label { display: inline; }

.pager-btn:hover { color: var(--ivory); }
.pager-btn:hover .pager-dot { opacity: .85; }

.pager-btn.is-active {
  background: var(--ivory);
  color: var(--accent-deep);
  box-shadow: 0 4px 14px -6px rgba(0,0,0,.6);
}
.pager-btn.is-active .pager-dot { opacity: 1; transform: scale(1.15); background: var(--accent); }

.pager-btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.pager-btn.is-pruned { display: none; }
.invite-pager.is-single { display: none; }

@media (max-width: 479px) {
  .invite-pager { gap: .3rem; padding-top: .5rem; }
  .pager-btn { gap: .4rem; padding: .4rem .55rem; font-size: .74rem; min-height: 40px; }
  .pager-dot { width: 7px; height: 7px; }
}

/* ── 14 · Utilities & a11y ──────────────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: .75rem;
  top: .75rem;
  z-index: 50;
  padding: .6rem 1rem;
  border-radius: 8px;
  background: var(--ivory);
  color: var(--ink);
  font-size: .85rem;
  text-decoration: none;
  transform: translateY(-220%);
  transition: transform .2s;
}
.skip-link:focus { transform: translateY(0); }

[data-empty="hide"].is-empty { display: none !important; }

/* toast — ivory so it reads on the dark backdrop */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(5rem + env(safe-area-inset-bottom));
  transform: translate(-50%, 16px);
  z-index: 60;
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .75rem 1.3rem;
  border-radius: 999px;
  background: var(--ivory);
  color: var(--ink);
  font-size: .88rem;
  box-shadow: 0 18px 40px -14px rgba(0,0,0,.65);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s var(--ease), transform .22s var(--ease);
  max-width: calc(100vw - 2rem);
}
.toast.is-show { opacity: 1; transform: translate(-50%, 0); }
.toast svg { color: var(--accent); flex: 0 0 auto; }

/* ── 14b · Brand footer (placeholder) ─────────────────────────────────
   Written after </main> so it survives the no-JS stacked document; the
   shell tucks it into the last existing panel (main.js), where it reads
   as the invitation's closing line even when RSVP / Guestbook are
   stripped. The host or the platform replaces the brand text. */
.app-footer { padding: 1.4rem 1.1rem 2.4rem; text-align: center; }
html.js .app-footer { display: none; }
html.js .panel .app-footer {
  display: block;
  margin-top: clamp(1.8rem, 6vw, 3rem);
  padding-top: 1.1rem;
  padding-bottom: 0;
  border-top: 1px solid var(--hairline);
}
.footer-brand {
  margin: 0;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--muted);
}
.footer-brand-name {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.25em;
  text-transform: none;
  letter-spacing: .02em;
  color: var(--accent-deep);
}

/* ── 14c · Powered-by brand strip (full width, above the pager) ───────
   A slim full-width line pinned above the pager in the JS shell (and
   closing the stacked document without JS). The engine swaps the brand
   token inside .link-footer for the platform name at render; the cockpit's
   Free Powered By field can override the whole line. */
html:not(.js) .powered-by {
  width: 100%;
  text-align: center;
  padding: 1.1rem 1.1rem 1.6rem;
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--muted);
}
html.js .powered-by {
  flex: 0 0 auto;
  width: 100%;
  text-align: center;
  padding: .55rem 1rem;
  border-top: 1px solid var(--desk-line);
  background: rgba(36,33,27,.92);
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--muted);
}
.powered-by .link-footer { color: var(--gold); }

/* ── 14b · Photo lightbox (tap any photo to view it full-screen) ────── */
.lightbox {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 70;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .9rem;
  padding: 1.25rem;
  background: rgba(24,21,17,.94);
  opacity: 0;
  transition: opacity .22s var(--ease);
}
.lightbox[hidden] { display: none; }
.lightbox.is-open { opacity: 1; }

.lightbox-img {
  display: block;
  max-width: 100%;
  max-height: 78vh;
  border-radius: 10px;
  border: 1px solid rgba(251,246,234,.18);
  box-shadow: 0 30px 80px -30px rgba(0,0,0,.85);
  transform-origin: 50% 50%;
  transition: transform .22s var(--ease);
  cursor: zoom-in;
  touch-action: none;
  will-change: transform;
}
.lightbox-img.is-zoomed { cursor: grab; }
.lightbox-img.is-dragging { transition: none; cursor: grabbing; }

.lightbox-caption {
  font-size: .9rem;
  font-style: italic;
  color: var(--ivory-2);
  text-align: center;
}
.lightbox-caption:empty { display: none; }

/* zoom controls — +/− for mouse, keyboard and assistive tech */
.lightbox-tools {
  position: absolute;
  bottom: max(1.2rem, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: .5rem;
}
.lightbox-tool {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: var(--ivory);
  color: var(--ink);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 8px 20px -8px rgba(0,0,0,.6);
}
.lightbox-tool:hover { background: var(--ivory-2); }
.lightbox-tool:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.lightbox-close {
  position: absolute;
  top: max(1rem, env(safe-area-inset-top));
  right: max(1rem, env(safe-area-inset-right));
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: var(--ivory);
  color: var(--ink);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 8px 20px -8px rgba(0,0,0,.6);
}
.lightbox-close:hover { background: var(--ivory-2); }
.lightbox-close:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ── 15 · Print: the card as a sheet of paper ───────────────────────── */
@media print {
  html, body { height: auto; background: #fff; }

  .invite-shell {
    height: auto;
    display: block;
    overflow: visible;
    background: #fff;
  }

  .invite-head, .invite-pager, .skip-link, .scroll-hint, .cover-cta, .private-chip {
    display: none !important;
  }

  .invite-panels { overflow: visible; }

  .js .panel,
  .panel {
    display: block !important;
    height: auto;
    min-height: 0;
    overflow: visible;
    animation: none;
    page-break-inside: avoid;
    break-inside: avoid;
    margin-bottom: 2rem;
  }

  .sheet {
    max-width: 100%;
    border: 1px solid #ddd;
    box-shadow: none;
    border-radius: 0;
    padding: 1.5rem;
  }

  .guestbook-body, #rsvp-form, .countdown { display: none !important; }

  .lightbox { display: none !important; }
  .film-frame iframe { display: none !important; } /* a playing video can't print — the poster prints instead */
  .film-hint, .film-external, .lightbox-tools { display: none !important; }
  .photo, .gallery-item, .banner-flyer, .film-card, .free-block { break-inside: avoid; }
  .app-footer { padding: 1rem 0 0; }
}

/* ── 16 · Reduced motion ────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001s !important;
  }
  .js .panel.is-active { animation: none; }
  .scroll-arrow, .film-play { animation: none; }
}
