/* ============================================================
   exhibition-vernissage — opening-night invitation card, one screen
   A printed museum invitation: ivory sheet with a fine double
   border, elegant Fraunces serif type, a brass accent, held on a
   quiet desk-toned backdrop.

   Shell contract:
     - No JS / script failure (.js.card-ready absent): a normal
       scrolling page; every panel stacks in document order, so all
       content is always reachable.
     - JS ready (.js.card-ready on <html>): the .card grid locks to
       100dvh — front / tabs / panels. Only the active panel scrolls
       internally, never the page.
     - Very short viewports (landscape phones, on-screen keyboard)
       fall back to the stacked scrolling layout so nothing is ever
       clipped off-screen.
   ============================================================ */

:root {
  --paper: #e7ddca;            /* desk backdrop */
  --card: #faf6ee;             /* ivory sheet */
  --ink: #26221b;
  --ink-soft: #4a443a;
  --muted: #837a6a;
  --line: rgba(38, 34, 27, 0.16);
  --accent: #a87e4a;           /* brass */
  --accent-soft: #c19a63;
  --error: #b3352a;
  --radius: 14px;
  --stage-pad: 12px;
  --font-display: "Fraunces", "Playfair Display", Georgia, serif;
  --font-sans: "Karla", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--ink);
  background:
    radial-gradient(120% 90% at 50% 0%, #efe7d6 0%, var(--paper) 58%, #dcd1bb 100%);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Only the JS-ready shell locks scrolling — a no-JS page scrolls
   naturally so every panel stays reachable. */
.js.card-ready body { overflow: hidden; }

.stage {
  padding:
    calc(var(--stage-pad) + env(safe-area-inset-top, 0px))
    calc(var(--stage-pad) + env(safe-area-inset-right, 0px))
    calc(var(--stage-pad) + env(safe-area-inset-bottom, 0px))
    calc(var(--stage-pad) + env(safe-area-inset-left, 0px));
  display: flex;
  flex-direction: column;
}

.js.card-ready .stage {
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
}

/* ── The card sheet ───────────────────────────────────────── */
.card {
  flex: 1;
  min-width: 0;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  display: grid;
  /* one column, never wider than the sheet: without minmax(0, 1fr) the
     implicit auto column can grow to the tab strip's min-content width,
     blowing the card out past the viewport on phones */
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  background: var(--card);
  border: 1px solid rgba(38, 34, 27, 0.28);
  outline: 1px solid var(--line);
  outline-offset: -7px;
  border-radius: var(--radius);
  box-shadow: 0 18px 48px rgba(58, 46, 28, 0.22);
  overflow: hidden;
}

/* ── Card front (now a full page: the cover) ──────────────── */
.front {
  text-align: center;
  padding: 24px 6px 18px;
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.5), rgba(255, 253, 248, 0) 55%),
    var(--card);
}

.front__guest {
  margin: 0 0 12px;
  font-size: 13px;
  font-style: italic;
  color: var(--accent);
}

.front__kicker {
  margin: 0 0 10px;
  font-size: 10px;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--accent);
}

.front__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(38px, 9vw, 72px);
  line-height: 0.98;
  letter-spacing: 0.01em;
  color: var(--ink);
}

.front__title span { display: block; }

.front__title--italic {
  font-style: italic;
  font-weight: 300;
  color: var(--accent);
  padding-left: 0.5em;
}

.front__subtitle {
  margin: 12px 0 0;
  font-family: var(--font-display);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-soft);
}

.front__subtitle em { font-style: italic; color: var(--accent); }

.ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 14px auto 10px;
  max-width: 220px;
  color: var(--accent);
}

.ornament span:first-child,
.ornament span:last-child {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

.ornament span:nth-child(2) { font-size: 9px; }

.front__request {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-soft);
}

.front__date {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
}

.front__date em { font-style: italic; color: var(--accent); }

.front__place {
  margin: 0;
  font-size: 10px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ── Tabs ─────────────────────────────────────────────────── */
.tabs-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  border-top: 1px solid var(--line);
  padding: 10px 12px 12px;
  min-width: 0;
}

.tabs {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

/* Desktop: the strip is transparent to layout (display: contents), so the
   tab buttons keep wrapping inside .tabs exactly as before. On phones the
   strip becomes the scrollable row (see the max-width: 480px block). */
.tabs__strip { display: contents; }

/* ‹ › icon buttons (mobile only) — scroll the tab strip when it overflows.
   They live OUTSIDE the tablist, because they are controls, not tabs. */
.tabs__arrow {
  display: none;
  flex: 0 0 auto;
  appearance: none;
  width: 34px;
  min-height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, opacity 0.2s;
}

.tabs__arrow svg { width: 16px; height: 16px; }

.tabs__arrow:not(:disabled):hover { color: var(--ink); border-color: var(--accent); }
.tabs__arrow:disabled { opacity: 0.35; cursor: default; }

.tabs__arrow:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.tabs__btn {
  appearance: none;
  border: 1px solid var(--line);
  background: transparent;
  font-family: var(--font-sans);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding: 8px 16px;
  min-height: 40px;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.2s, background 0.2s, border-color 0.2s;
}

.tabs__btn:hover { color: var(--ink); border-color: var(--accent); }

.tabs__btn.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--card);
  font-weight: 600;
}

.tabs__btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Panels ───────────────────────────────────────────────── */
.panels {
  min-height: 0;
  position: relative;
  border-top: 1px solid var(--line);
}

.panel {
  background: var(--card);
  padding: 20px 22px 24px;
}

/* App mode only: the active panel fills the row and scrolls
   internally. Without .js.card-ready every panel stacks in flow. */
.js.card-ready .panel {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--accent) transparent;
}

.js.card-ready .panel:not(.is-active) { display: none; }

.js.card-ready .panel::-webkit-scrollbar { width: 8px; }
.js.card-ready .panel::-webkit-scrollbar-thumb { background: rgba(168, 126, 74, 0.5); border-radius: 4px; }
.js.card-ready .panel::-webkit-scrollbar-track { background: transparent; }

.panel-scroll {
  max-width: 480px;
  margin: 0 auto;
}

/* ── Cover panel: the card front fills its page, centred ────
   Spacer pseudo-elements centre the cover when it fits and
   collapse to 0 when it overflows, so content is never clipped
   (unlike plain flex centring). */
.js.card-ready #panel-cover .panel-scroll {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}
.js.card-ready #panel-cover .panel-scroll::before,
.js.card-ready #panel-cover .panel-scroll::after {
  content: "";
  flex: 1 0 auto;
}
.cover-cta { text-align: center; margin-top: 22px; }
.cover-cta .btn { font-size: 12px; }

/* ── Shared type ──────────────────────────────────────────── */
.eyebrow {
  margin: 0 0 4px;
  font-size: 10px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--accent);
}

.panel-title {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 34px;
  line-height: 1.05;
  color: var(--ink);
}

.panel-title em { font-style: italic; font-weight: 300; color: var(--accent); }

/* ── Invitation lead ──────────────────────────────────────── */
.invite__lead {
  margin: 0 0 20px;
  font-family: var(--font-display);
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink-soft);
}

.invite__lead em { color: var(--ink); }

.invite__drop {
  float: left;
  font-size: 2.9em;
  line-height: 0.82;
  padding-right: 8px;
  color: var(--accent);
  font-style: italic;
}

.invite__reply {
  margin: 0;
  text-align: center;
  font-size: 13px;
  font-style: italic;
  color: var(--muted);
}

.invite__reply strong { color: var(--accent); font-style: normal; }

/* ── Facts ────────────────────────────────────────────────── */
.facts {
  margin: 0 0 18px;
  border-top: 1px solid var(--line);
}

.fact {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.fact dt {
  font-size: 10px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 4px;
}

.fact dd {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-soft);
}

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

/* ── Buttons ──────────────────────────────────────────────── */
.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 16px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  appearance: none;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--card);
  font-family: var(--font-sans);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 10px 18px;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  font-weight: 600;
  transition: background 0.2s, color 0.2s, transform 0.15s;
}

.btn:hover { background: var(--accent); border-color: var(--accent); }
.btn:active { transform: scale(0.98); }

.btn svg { width: 14px; height: 14px; }

.btn--ghost {
  background: transparent;
  color: var(--ink);
}

.btn--ghost:hover { background: var(--ink); color: var(--card); }

.btn--block { width: 100%; justify-content: center; }

/* ── Artist ───────────────────────────────────────────────── */
.artist {
  display: grid;
  grid-template-columns: 118px 1fr;
  gap: 18px;
  align-items: start;
  margin-bottom: 22px;
}

.artist__portrait {
  margin: 0;
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: 4 / 5;
  background: linear-gradient(150deg, #e3d8c2, #d4c6a8); /* fallback while loading */
  border: 1px solid var(--line);
}

.artist__portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

/* the artist portrait is tappable too — opens full size in the lightbox */
.artist__portrait-link {
  display: block;
  border-radius: 10px;
}

.artist__portrait-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 10px;
}

.js .artist__portrait-link:hover .artist__portrait img,
.js .artist__portrait-link:focus-visible .artist__portrait img { transform: scale(1.04); }

.artist__bio p {
  margin: 0 0 10px;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--ink-soft);
}

.artist__bio em { color: var(--ink); }

/* ── Optional photo backdrop ────────────────────────────────
   Add class `stage--photo` to <div class="stage"> to swap the warm
   paper tone for a photograph (assets/img/backdrop.jpg) behind the
   card — “photos become backgrounds”. The warm overlay keeps the
   ivory card readable; works with or without JS. */
.stage--photo {
  background:
    linear-gradient(180deg, rgba(26, 19, 12, 0.52), rgba(26, 19, 12, 0.62)),
    url("../img/backdrop.jpg") center / cover no-repeat;
}

/* ── Cover photo (optional guest-of-honour portrait on the card
     front — delete the .cover-photo-link block to hide it) ── */
.cover-photo-link {
  display: block;
  margin: 0 auto 14px;
  max-width: 150px;
}

.cover-photo {
  margin: 0;
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: 4 / 5;
  background: linear-gradient(150deg, #e3d8c2, #d4c6a8);
  border: 1px solid var(--line);
  outline: 1px solid var(--line);
  outline-offset: 3px;
}

.cover-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cover-photo-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 10px;
}

/* zoom cue on the cover portrait and artist portrait (hover/focus only;
   taps open the lightbox) — the same gentle "+" as the gallery tiles */
.cover-photo::after,
.artist__portrait::after {
  content: "+";
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(26, 22, 15, 0.55);
  color: var(--card);
  font-size: 15px;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.25s;
}

.js .cover-photo-link:hover .cover-photo::after,
.js .cover-photo-link:focus-visible .cover-photo::after,
.js .artist__portrait-link:hover .artist__portrait::after,
.js .artist__portrait-link:focus-visible .artist__portrait::after { opacity: 1; }

/* ── Gallery (optional photo showcase tab — the photo heart of
     the template; tap any tile for the full-screen lightbox) ── */
.gallery {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px 10px;
}

.gallery__tile { min-width: 0; }

.gallery__item {
  display: block;
  text-decoration: none;
  color: inherit;
}

.gallery__frame {
  margin: 0;
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 4 / 5;
  background: linear-gradient(150deg, #e3d8c2, #d4c6a8);
  border: 1px solid var(--line);
}

.gallery__frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.js .gallery__item:hover .gallery__frame img { transform: scale(1.05); }

.gallery__item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 8px;
}

/* zoom cue on each tile (hover/focus only; taps open the lightbox) */
.gallery__frame::after {
  content: "+";
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(26, 22, 15, 0.55);
  color: var(--card);
  font-size: 15px;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.25s;
}

.js .gallery__item:hover .gallery__frame::after,
.js .gallery__item:focus-visible .gallery__frame::after { opacity: 1; }

.gallery__cap {
  margin-top: 7px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  font-size: 11.5px;
  line-height: 1.35;
}

.gallery__no {
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
}

.gallery__name { color: var(--ink-soft); font-style: italic; }

.gallery__media { color: var(--muted); }

/* ── Free page (optional host-filled Notes panel) — repeatable blocks,
     each a title, free text and an OPTIONAL photo. The panel ships as a
     single .free-block that the render engine clones per entry; when the
     host adds no blocks the engine removes the whole panel, so main.js
     hides the Notes tab with it. ── */
.free-blocks {
  display: grid;
  gap: 28px;
  margin: 0 0 6px;
}

.free-block { min-width: 0; }

.free-title {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 26px;
  line-height: 1.15;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.free-title em { font-style: italic; color: var(--accent); }

.free-content {
  margin: 0 0 14px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink-soft);
  white-space: pre-line;
  overflow-wrap: anywhere;
}

/* optional photo — the same framed, tappable treatment as the gallery
   tiles (tap to open full size in the lightbox). When a block has no
   image the frame is dropped entirely (the img is removed at render), so
   a text-only block stays clean. */
.free-figure {
  margin: 0;
  position: relative;
  max-width: 300px;
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: 4 / 5;
  background: linear-gradient(150deg, #e3d8c2, #d4c6a8);
  border: 1px solid var(--line);
}

.free-figure:not(:has(img)) { display: none; }

.free-image-link { display: block; }

.free-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.js .free-image-link:hover .free-img,
.js .free-image-link:focus-visible .free-img { transform: scale(1.04); }

.free-image-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 10px;
}

/* gentle "+" zoom cue, matching the cover / artist / gallery photos */
.free-figure::after {
  content: "+";
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(26, 22, 15, 0.55);
  color: var(--card);
  font-size: 15px;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.25s;
}

.js .free-image-link:hover .free-figure::after,
.js .free-image-link:focus-visible .free-figure::after { opacity: 1; }

/* ── Lightbox (full-screen photo viewer, opened by main.js) ── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(24, 18, 11, 0.92);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

.lightbox.is-open { opacity: 1; pointer-events: auto; }

.lightbox__close {
  position: absolute;
  top: calc(14px + env(safe-area-inset-top, 0px));
  right: calc(14px + env(safe-area-inset-right, 0px));
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(250, 246, 238, 0.35);
  background: rgba(250, 246, 238, 0.08);
  color: var(--card);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.lightbox__close svg { width: 18px; height: 18px; }

.lightbox__close:hover { background: var(--accent); border-color: var(--accent); }

.lightbox__close:focus-visible { outline: 2px solid var(--accent-soft); outline-offset: 2px; }

.lightbox__stage {
  margin: 0;
  max-width: min(880px, 92vw);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lightbox__img {
  max-width: 100%;
  max-height: 76vh;
  width: auto;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
}

.lightbox__cap {
  margin-top: 12px;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 15px;
  color: rgba(250, 246, 238, 0.85);
  text-align: center;
  max-width: 70ch;
}

/* ‹ › browse buttons (only shown when a group has more than one photo) */
.lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(250, 246, 238, 0.35);
  background: rgba(250, 246, 238, 0.08);
  color: var(--card);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.lightbox__nav svg { width: 20px; height: 20px; }
.lightbox__nav:hover { background: var(--accent); border-color: var(--accent); }
.lightbox__nav:focus-visible { outline: 2px solid var(--accent-soft); outline-offset: 2px; }
.lightbox__nav--prev { left: calc(8px + env(safe-area-inset-left, 0px)); }
.lightbox__nav--next { right: calc(8px + env(safe-area-inset-right, 0px)); }

/* position counter + hint (set by main.js) */
.lightbox__count {
  position: absolute;
  top: calc(14px + env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  letter-spacing: 0.24em;
  font-variant-numeric: tabular-nums;
  color: rgba(250, 246, 238, 0.72);
}

.lightbox__hint {
  margin: 10px 0 0;
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: rgba(250, 246, 238, 0.55);
}

/* zoom: tap the photo to zoom in and pan (the stage scrolls) */
.lightbox__img { cursor: zoom-in; touch-action: manipulation; }

.lightbox__stage.is-zoomed {
  display: block;
  overflow: auto;
  max-height: 84vh;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.lightbox__stage.is-zoomed .lightbox__img {
  max-width: none;
  max-height: none;
  margin: 0 auto;
  cursor: zoom-out;
}

/* ── Official flyer (optional — delete the block to hide it) ── */
.flyer-section {
  text-align: center;
  margin: 0 0 20px;
}

.flyer-frame {
  margin: 0 auto;
  max-width: 230px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--line);
  outline: 1px solid var(--line);
  outline-offset: 4px;
  box-shadow: 0 8px 22px rgba(58, 46, 28, 0.14);
}

.flyer-link {
  position: relative;
  display: block;
}

.flyer-link img {
  width: 100%;
  display: block;
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.js .flyer-link:hover img { transform: scale(1.03); }

/* gentle "+" zoom cue on the flyer, matching the cover portrait,
   artist portrait and gallery tiles (hover/focus only; taps open
   the lightbox) */
.flyer-link::after {
  content: "+";
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(26, 22, 15, 0.55);
  color: var(--card);
  font-size: 15px;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.25s;
}

.js .flyer-link:hover::after,
.js .flyer-link:focus-visible::after { opacity: 1; }

.flyer-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 8px;
}

.flyer-cap {
  margin: 0;
  padding: 9px 12px 11px;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 12.5px;
  color: var(--muted);
}

/* ── Film (optional video feature — set href="" or delete to hide) ── */
.video-head { margin-bottom: 18px; }

.video-tile {
  max-width: 400px;
  margin: 0 auto;
}

.video-tile-link {
  position: relative;
  display: block;
  text-decoration: none;
  color: inherit;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  background:
    radial-gradient(90% 130% at 18% 0%, rgba(255, 253, 248, 0.55), transparent 60%),
    linear-gradient(150deg, #dccfa9, #c2ae83);
  box-shadow: 0 8px 22px rgba(58, 46, 28, 0.12);
}

.video-tile-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 12px;
}

.video-thumb {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  /* warm paper tones while the thumbnail loads, and as the base
     for the no-poster fallback */
  background:
    radial-gradient(90% 130% at 18% 0%, rgba(255, 253, 248, 0.55), transparent 60%),
    linear-gradient(150deg, #dccfa9, #c2ae83);
}

.video-thumb__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* gentle fallback when the film has no poster and the provider has no
   thumbnail (e.g. a Vimeo link): a soft vignette keeps the play button
   the quiet centre of the tile */
.video-thumb--fallback {
  background:
    radial-gradient(120% 140% at 50% 40%, rgba(255, 253, 248, 0.62), rgba(255, 253, 248, 0) 62%),
    radial-gradient(90% 130% at 18% 0%, rgba(255, 253, 248, 0.55), transparent 60%),
    linear-gradient(150deg, #dccfa9, #c2ae83);
}

.video-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(250, 246, 238, 0.92);
  color: var(--ink);
  box-shadow: 0 10px 26px rgba(38, 34, 27, 0.28);
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), background 0.2s, color 0.2s;
  z-index: 1;
}

.video-play svg { width: 26px; height: 26px; margin-left: 4px; }

.js .video-tile-link:hover .video-play,
.js .video-tile-link:focus-visible .video-play {
  background: var(--accent);
  color: var(--card);
  transform: translate(-50%, -50%) scale(1.07);
}

.video-caption {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 11px 14px 13px;
  background: var(--card);
}

.video-title { color: var(--ink-soft); font-style: italic; }

/* ── Video modal (full-screen player) ── */
.video-modal {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(24, 18, 11, 0.92);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

.video-modal.is-open { opacity: 1; pointer-events: auto; }

.video-modal__close {
  position: absolute;
  top: calc(14px + env(safe-area-inset-top, 0px));
  right: calc(14px + env(safe-area-inset-right, 0px));
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(250, 246, 238, 0.35);
  background: rgba(250, 246, 238, 0.08);
  color: var(--card);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.video-modal__close svg { width: 18px; height: 18px; }
.video-modal__close:hover { background: var(--accent); border-color: var(--accent); }
.video-modal__close:focus-visible { outline: 2px solid var(--accent-soft); outline-offset: 2px; }

.video-modal__stage {
  width: 100%;
  max-width: 880px;
  aspect-ratio: 16 / 9;
  max-height: 80vh; /* never taller than the viewport (landscape phones) */
  background: #000;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
}

.video-modal__stage iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* ── RSVP / guestbook shared language ─────────────────────── */
.rsvp-description,
.guestbook-description,
.gallery-description {
  margin: 0 0 16px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
}

.form-group { margin-bottom: 14px; }

.form-group label {
  display: block;
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffdf8;
  color: var(--ink);
  font-family: var(--font-sans);
  /* 16px on form fields: below this, iOS Safari zooms the page into
     whichever field is focused — a classic mobile-unfriendliness trap */
  font-size: 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control::placeholder { color: #b3aa99; }

.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(168, 126, 74, 0.18);
}

select.form-control { appearance: none; }

textarea.form-control { resize: vertical; }

.error {
  display: block;
  color: var(--error);
  font-size: 12px;
  margin-top: 4px;
}

.form-submit { margin-top: 4px; }

.loading,
.loading-guestbook {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 10px 0;
}

/* the party-size group dims when the guest declines — a pure
   visual hint; the field is never disabled (platform submits it) */
#guest-group.is-dimmed { opacity: 0.45; }

/* ── RSVP countdown-inline (only shown when platform sets a deadline) ── */
.countdown-inline {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  font-size: 13px;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 16px;
  margin-bottom: 16px;
  background: #fffdf8;
}

.countdown-inline span:first-child {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 10px;
  color: var(--muted);
  margin-right: 6px;
}

.countdown-inline .count-day,
.countdown-inline .count-hour,
.countdown-inline .count-minute,
.countdown-inline .count-second {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--accent);
}

/* ── Guestbook (injected markup) ──────────────────────────── */
.guestbook-body { }

#guestbookForm .form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

#guestbookForm textarea.form-control { min-height: 84px; }

#guestbookForm .d-flex { display: flex; justify-content: center; }

#guestbookForm button[type="submit"] {
  appearance: none;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--card);
  font-family: var(--font-sans);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 10px 22px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
}

#guestbookForm button[type="submit"]:hover { background: var(--accent); border-color: var(--accent); }

.guestbook-chapta { display: flex; justify-content: center; margin: 10px 0; }

#comments-container.guestbook-wrap {
  margin-top: 20px;
  border-top: 1px solid var(--line);
  padding-top: 6px;
}

.guestbook-entry {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.guestbook-entry:last-child { border-bottom: 0; }

.guestbook-entry h5 {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 400;
  letter-spacing: 0.03em;
  color: var(--accent);
}

.guestbook-entry p {
  margin: 0 0 4px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-soft);
}

.guestbook-entry small {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.06em;
}

.more-guestbook-wrap {
  display: flex;
  justify-content: center;
  padding: 16px 0 4px;
}

#load-more {
  appearance: none;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-soft);
  font-family: var(--font-sans);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 9px 20px;
  border-radius: 999px;
  cursor: pointer;
}

#load-more:hover { border-color: var(--accent); color: var(--ink); }

.thank-you-message { text-align: center; padding: 20px 0; }

.thank-you-message h3,
.thank-you-message h4 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 28px;
  letter-spacing: 0.03em;
  margin: 0 0 6px;
  color: var(--accent);
}

.thank-you-message p { color: var(--muted); font-size: 13px; margin: 2px 0; }

/* ── Footer (end of the guestbook panel) ── */
.app-footer {
  margin-top: 26px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
}

.app-footer p { margin: 0 0 6px; }
.app-footer em { color: var(--ink-soft); }

.footer-brand {
  display: inline-block;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 15px;
  letter-spacing: 0.04em;
  color: var(--accent);
}

/* ── Full-width powered-by brand strip ───────────────────────
   A slim, full-width footer line under the card (and at the end of the
   stacked no-JS document). The engine swaps the literal brand token inside
   .link-footer for the platform name at render; the cockpit's Free Powered
   By field can override the whole line. Always visible. */
.powered-by {
  flex: 0 0 auto;
  width: 100%;
  text-align: center;
  padding: 10px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}

.powered-by .link-footer {
  color: var(--accent);
  font-style: italic;
  text-transform: none;
  letter-spacing: 0.04em;
}

/* ── Toast ────────────────────────────────────────────────── */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 20px);
  background: var(--ink);
  color: var(--card);
  font-size: 13px;
  font-weight: 500;
  padding: 10px 18px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 50;
}

.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ── Reveal (progressive enhancement) ─────────────────────── */
.js.card-ready .panel.is-active .panel-scroll {
  animation: rise 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* staggered fade-up for [data-reveal] blocks — only once the app
   shell is live (.js.card-ready), so a JS-less page is fully
   readable from the first paint */
.js.card-ready [data-reveal] {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: var(--reveal-delay, 0s);
}

.js.card-ready [data-reveal].is-in { opacity: 1; transform: none; }

.js .no-motion .panel.is-active .panel-scroll { animation: none; }
.js .no-motion [data-reveal],
.js .no-motion [data-reveal].is-in { opacity: 1; transform: none; transition: none; }

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Reduced motion: keep content, drop the flourish ──────── */
@media (prefers-reduced-motion: reduce) {
  .js.card-ready .panel.is-active .panel-scroll { animation: none; }
  .js.card-ready [data-reveal],
  .js.card-ready [data-reveal].is-in { opacity: 1; transform: none; transition: none; }
  .js .gallery__item:hover .gallery__frame img { transform: none; }
  .js .artist__portrait-link:hover .artist__portrait img { transform: none; }
  .js .free-image-link:hover .free-img { transform: none; }
  .js .video-tile-link:hover .video-play { transform: translate(-50%, -50%); }
}

/* ── Short screens: tighter page padding ──────────────────── */
@media (max-height: 760px) {
  .stage { --stage-pad: 8px; }
  .panel { padding: 16px 18px 20px; }
  .panel-title { font-size: 28px; }
  .cover-photo-link { max-width: 110px; margin-bottom: 10px; }
}

/* ── Too-short viewports (landscape phones, on-screen keyboard):
      the fixed shell cannot fit front + tabs + panel, so we fall
      back to a normal scrolling page with every panel stacked —
      content is never clipped, always reachable. ── */
@media (max-height: 480px) {
  .js.card-ready body { overflow: visible; }
  .js.card-ready .stage { height: auto; max-height: none; }
  .tabs-bar { display: none; }
  .js.card-ready .panel { position: static; display: block !important; overflow: visible; }
  .js.card-ready .panel.is-active .panel-scroll { animation: none; }
}

/* ── Narrow phones ────────────────────────────────────────── */
@media (max-width: 400px) {
  .tabs__btn { padding: 7px 11px; font-size: 11px; letter-spacing: 0.1em; }
  .artist { grid-template-columns: 1fr; }
  .artist__portrait { max-width: 150px; }
  .gallery__media { display: none; }
}

/* ── Phones: one swipeable row of tabs (thumb-friendly, saves vertical
     space), two bigger gallery tiles per row so photos take centre stage ── */
@media (max-width: 480px) {
  /* the tab row becomes a swipeable strip with ‹ › icon buttons at the
     edges (main.js → tabArrows), so a seven-tab invitation never hides a
     tab off-screen */
  .tabs-bar { gap: 6px; padding: 8px 8px 10px; }
  .tabs { flex-wrap: nowrap; justify-content: flex-start; }
  .tabs__strip {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    /* let the strip shrink below its content width so it scrolls instead
       of forcing the tab bar (and the whole card) wider than the phone */
    min-width: 0;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    /* swiping the tab row must not chain into the browser's
       back/forward gesture (mobile) */
    overscroll-behavior-x: contain;
    gap: 6px;
  }
  .tabs__strip::-webkit-scrollbar { display: none; }
  .tabs__arrow { display: grid; }
  .tabs__btn {
    flex: 0 0 auto;
    scroll-snap-align: start;
    min-height: 42px;
  }
  /* thumb-friendly tap targets (44px Apple HIG minimum) */
  .btn { min-height: 44px; }
  .gallery { grid-template-columns: repeat(2, 1fr); gap: 10px 8px; }
}

/* ── Print ────────────────────────────────────────────────── */
@media print {
  body { overflow: visible !important; height: auto; background: #fff; }
  .stage--photo { background: #fff; }
  .lightbox, .video-modal { display: none !important; }
  .js.card-ready .stage { height: auto; max-height: none; }
  .stage { height: auto; padding: 0; display: block; }
  .card {
    display: block;
    max-width: none;
    margin: 0;
    border: 1px solid #999;
    outline: none;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
  }
  .tabs-bar, .toast, .cover-cta { display: none; }
  .powered-by { display: none; }
  .panels { border-top: 0; }
  .panel {
    position: static;
    display: block !important;
    overflow: visible;
    padding: 16px 24px 20px;
  }
  .panel-scroll { max-width: none; }
  .front { padding: 28px 24px; }
  .front__title--italic { color: #000; }
  .fact dd { color: #222; }
  .fact dt { color: #333; }
  .gallery__frame, .cover-photo, .artist__portrait { border-color: #ddd; }
}
