/* =====================================================================
   Wedding invitation · Bảo Phi & Thúy Linh
   Mobile-first. Colors and fonts live in :root tokens.
   ===================================================================== */

:root {
  color-scheme: light;

  --ivory: #FAF7F2;
  --paper: #FCFAF6;
  --champagne: #F2EBDF;
  --ink: #2F2522;
  --ink-soft: #66574F;
  --burgundy: #6B1D2A;
  --burgundy-deep: #531521;
  --gold: #B39869;
  --gold-text: #86693C;     /* gold dark enough for small text (AA on ivory) */
  --gold-line: rgba(179, 152, 105, .55);
  --gold-faint: rgba(179, 152, 105, .28);
  --desk: #EDE5D8;

  --serif: 'Cormorant Garamond', 'Times New Roman', serif;
  --script: 'Great Vibes', 'Cormorant Garamond', cursive;
  --sans: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --hy: 'Noto Serif TC', 'Songti TC', 'PMingLiU', serif;

  --ease: cubic-bezier(.22, .61, .36, 1);
  --ease-door: cubic-bezier(.7, 0, .25, 1);
  --card: 560px;
  --pad: 28px;

  /* Fine paper grain, inline so it costs no request */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .38 0 0 0 0 .28 0 0 0 .06 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--ivory) var(--grain);
  color: var(--ink);
  font: 300 15px/1.75 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "lnum" 1; /* lining numerals; survives the font shorthand */
}
body.is-locked { overflow: hidden; height: 100%; }

img { display: block; max-width: 100%; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; margin: -1px;
}

:focus-visible { outline: 1px solid var(--burgundy); outline-offset: 3px; }

/* ---------- Type ---------- */
.kicker {
  margin: 0 0 18px;
  font: 400 11px/1.6 var(--sans);
  letter-spacing: .32em;
  text-transform: uppercase;
  color: var(--gold-text);
}
.title {
  margin: 0 0 28px;
  font: 400 34px/1.15 var(--serif);
  color: var(--burgundy);
  letter-spacing: .01em;
}
.script {
  font-family: var(--script);
  font-weight: 400;
  color: var(--burgundy);
  line-height: 1.15;
}
.muted { color: var(--ink-soft); margin: 0 auto 24px; max-width: 34em; }
.hy { font-family: var(--hy); font-weight: 300; line-height: 1; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 28px;
  border: 1px solid var(--burgundy); border-radius: 0;
  font: 400 11.5px/1 var(--sans); letter-spacing: .24em; text-transform: uppercase;
  text-decoration: none;
  transition: background-color .4s var(--ease), color .4s var(--ease), border-color .4s var(--ease);
}
.btn--solid { background: var(--burgundy); color: var(--ivory); }
.btn--solid:hover { background: var(--burgundy-deep); }
.btn--ghost { background: transparent; color: var(--burgundy); border-color: var(--gold-line); }
.btn--ghost:hover { border-color: var(--burgundy); }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .6; cursor: default; }

/* ---------- Ornaments ---------- */
.divider {
  display: flex; align-items: center; justify-content: center; gap: 16px;
  margin: 0 auto 28px; color: var(--gold);
}
.divider::before, .divider::after {
  content: ''; width: 64px; height: 1px; background: var(--gold-line);
}
.divider .hy { font-size: 20px; }

.seal {
  display: grid; place-items: center;
  width: 92px; height: 92px; border-radius: 50%;
  background: var(--burgundy);
  color: #E3CFA4;
  box-shadow: 0 0 0 1px var(--burgundy), inset 0 0 0 5px var(--burgundy), inset 0 0 0 6px rgba(227, 207, 164, .7), 0 10px 28px rgba(83, 21, 33, .22);
}
.seal .hy { font-size: 40px; transform: translateY(1px); }
.seal--small { width: 64px; height: 64px; margin: 0 auto 20px; }
.seal--small .hy { font-size: 28px; }

/* =====================================================================
   COVER: two ivory drapes (animated in main.js)
   ===================================================================== */
.cover {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center;
  overflow: hidden;
}
.cover.is-leaving { pointer-events: none; }
.cover.is-gone { display: none; }

.drape { position: absolute; top: 0; bottom: 0; width: 50.2%; will-change: transform; }
.drape--left { left: 0; }
.drape--right { right: 0; }
.drape__rim, .drape__cloth { position: absolute; inset: 0; }
.drape__rim { background: #D6C4A4; }
/* Soft folds: two fold rhythms at different widths so the cloth never looks striped */
.drape__cloth {
  background-color: #F5EFE4;
  background-image:
    repeating-linear-gradient(90deg, rgba(255,255,255,0) 0, rgba(255,255,255,.38) 15px, rgba(150,120,80,.05) 31px, rgba(255,255,255,0) 47px),
    repeating-linear-gradient(90deg, rgba(150,120,80,0) 0, rgba(150,120,80,.05) 38px, rgba(255,255,255,.2) 61px, rgba(150,120,80,0) 83px),
    repeating-linear-gradient(90deg, rgba(150,120,80,0) 0, rgba(150,120,80,.05) 90px, rgba(150,120,80,0) 191px),
    var(--grain);
  background-size: 47px 100%, 83px 100%, 191px 100%, 160px 160px;
}
.drape--right .drape__cloth { background-position: right top, right top, right top, 0 0; }

.cover__valance {
  position: absolute; top: 0; left: 0; right: 0; z-index: 1; overflow: hidden;
  color: var(--gold-text);
  filter: drop-shadow(0 6px 10px rgba(120, 95, 60, .10));
  transition: transform 1.1s cubic-bezier(.55, 0, .2, 1) 2.6s, opacity 1.1s var(--ease) 2.6s;
}
.cover__valance .sketch { width: 100%; height: 100%; }
.valance__fill path { fill: #F1E9DC; stroke: none; opacity: 0; animation: fade-in 1.2s var(--ease) .2s forwards; }
.sketch--valance .ln { animation-delay: calc(var(--i, 0) * 30ms + .3s); }
@keyframes fade-in { to { opacity: 1; } }
.cover.is-opening .cover__valance { transform: translateY(-105%); opacity: 0; }
.cover__date { margin: -24px 0 36px; font: 400 11px/1.6 var(--sans); letter-spacing: .3em; text-transform: uppercase; color: var(--gold-text); }

.cover__petals { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; pointer-events: none; }

.cover__content {
  position: relative; z-index: 3;
  display: flex; flex-direction: column; align-items: center;
  padding: 56px 36px;
  text-align: center;
  transition: opacity .6s var(--ease), transform .8s var(--ease);
}
.cover__content::before { /* quiet halo so the text sits on calm cloth */
  content: ''; position: absolute; inset: -40px -60px; z-index: -1;
  background: radial-gradient(closest-side, rgba(250,247,242,.92), rgba(250,247,242,.6) 60%, rgba(250,247,242,0));
}
.seal-wrap { position: relative; display: grid; place-items: center; width: 190px; height: 190px; margin: -18px 0 4px; }
.cover__wreath { position: absolute; inset: 0; color: var(--gold-text); }
.cover__wreath .sketch { width: 100%; height: 100%; }

/* Hồng mai branches growing in from the bottom corners */
.cover__flora { position: absolute; bottom: 0; z-index: 1; width: clamp(160px, 46vw, 400px); color: #4A3128; pointer-events: none; transition: opacity .6s var(--ease); }
.cover__flora--left { left: 0; }
.cover__flora--right { right: 0; transform: scaleX(-1); }
.cover.is-opening .cover__flora { opacity: 0; }
.sketch .petal { fill: #EED7A2; fill-opacity: 0; }
.is-visible .sketch .petal.ln { animation: draw 1.5s cubic-bezier(.45, .05, .3, 1) calc(var(--i, 0) * 45ms + .25s) forwards, petal 1.2s var(--ease) calc(var(--i, 0) * 45ms + 1.2s) forwards; }
@keyframes petal { to { fill-opacity: .9; } }

/* Rope tiebacks: drawn on each drape once it is gathered */
.drape__tie { position: absolute; top: 60%; width: max(15%, 54px); color: var(--gold-text); opacity: 0; transform: translateY(-42%); transition: opacity .4s var(--ease); }
.drape--left .drape__tie { left: 0; }
.drape--right .drape__tie { right: 0; transform: translateY(-42%) scaleX(-1); }
.drape__tie.is-visible { opacity: 1; }
.drape__tie .ln { animation-duration: .8s !important; animation-delay: calc(var(--i, 0) * 60ms) !important; }
.cover__greeting {
  margin: 0 0 40px;
  font: italic 400 25px/1.4 var(--serif);
  color: var(--ink);
}
.cover.is-opening .cover__content { opacity: 0; transform: translateY(-8px) scale(.98); }

/* =====================================================================
   FLOATING CONTROLS
   ===================================================================== */
.controls {
  position: fixed; z-index: 40;
  top: max(12px, env(safe-area-inset-top)); right: 12px;
}
.lang {
  display: flex;
  background: rgba(250, 247, 242, .88);
  border: 1px solid var(--gold-line);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.lang button {
  min-width: 44px; min-height: 44px; padding: 0 10px;
  background: none; border: 0;
  font: 400 11px/1 var(--sans); letter-spacing: .2em;
  color: var(--ink-soft);
}
.lang button[aria-pressed="true"] { color: var(--burgundy); font-weight: 500; }
.lang button + button { border-left: 1px solid var(--gold-faint); }

.music {
  position: fixed; z-index: 40;
  right: 14px; bottom: max(14px, env(safe-area-inset-bottom));
  display: grid; place-items: center;
  width: 46px; height: 46px; padding: 0; border-radius: 50%;
  background: rgba(250, 247, 242, .9);
  border: 1px solid var(--gold-line);
  color: var(--burgundy);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.music svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.2; }
.music::after { /* slash when paused */
  content: ''; position: absolute; width: 26px; height: 1px; background: currentColor;
  transform: rotate(-45deg); transition: opacity .3s;
}
.music[aria-pressed="true"]::after { opacity: 0; }

/* =====================================================================
   PAGE / CARD
   ===================================================================== */
.backdrop { display: none; }

.card {
  position: relative;
  max-width: var(--card);
  margin: 0 auto;
  overflow: hidden;
  text-align: center;
}

.section { position: relative; padding: 80px var(--pad); }
.section + .section::before { /* hairline between sections */
  content: ''; position: absolute; top: 0; left: 50%; width: 1px; height: 44px;
  background: var(--gold-line);
}

/* ---------- Hero ---------- */
.hero { padding-top: 96px; }
.hero__sprig {
  position: absolute; top: 34px; left: -12px; width: 150px; height: 50px;
  color: var(--gold); opacity: .8; transform: scaleX(-1);
}
.hero__photo {
  position: relative;
  width: 74%; max-width: 340px; aspect-ratio: 3 / 4;
  margin: 8px auto 40px;
}
.hero__photo::before { /* outer hairline arch */
  content: ''; position: absolute; inset: -9px;
  border: 1px solid var(--gold-line);
  border-radius: 999px 999px 0 0;
}
.hero__photo > * { border-radius: 999px 999px 0 0; overflow: hidden; width: 100%; height: 100%; }
.hero__photo img { object-fit: cover; }
.hero__photo .ph::after { border-radius: 999px 999px 0 0; }

.hero__names { margin: 0; font-size: clamp(46px, 13vw, 62px); }
.hero__names .amp, [data-names] .amp {
  display: block; margin: 2px 0;
  font: italic 300 .5em/1 var(--serif); color: var(--gold);
}
.hero__lead { margin: 14px 0 34px; font: italic 400 19px/1.5 var(--serif); color: var(--ink-soft); }

.date {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  max-width: 330px; margin: 0 auto 18px;
}
.date > span { padding: 6px 0; font: 400 11px/1.4 var(--sans); letter-spacing: .26em; text-transform: uppercase; color: var(--ink-soft); }
.date > span:first-child { border-right: 1px solid var(--gold-line); padding-right: 14px; }
.date > span:last-child { border-left: 1px solid var(--gold-line); padding-left: 14px; }
.date__big { padding: 0 18px !important; font: 300 44px/1 var(--serif) !important; letter-spacing: .02em !important; color: var(--burgundy) !important; }
.hero__lunar { margin: 0; font: italic 400 16px/1.5 var(--serif); color: var(--ink-soft); }
.hero__quote {
  max-width: 24em; margin: 36px auto 0; padding: 22px 0 0;
  border-top: 1px solid var(--gold-faint);
  font: italic 400 18px/1.6 var(--serif); color: var(--ink);
}

/* ---------- Family ----------
   Two houses side by side, a red thread (tơ hồng) down from each,
   tied in a heart between the couple's names. */
.family__intro { max-width: 22em; margin: -14px auto 34px; font: italic 400 18px/1.5 var(--serif); color: var(--ink-soft); }
.family__tree { max-width: 820px; margin: 0 auto; }
.family__grid, .family__couple { display: grid; grid-template-columns: 1fr 1fr; }
.family__col { padding: 0 6px; }
.family__art { max-width: 150px; margin: 0 auto 12px; }
.family__col .kicker { margin-bottom: 8px; }
.family__parent { margin: 0; font: 400 16.5px/1.55 var(--serif); }
.family__col p.addr { margin-top: 8px; font: 300 12.5px/1.6 var(--sans); color: var(--ink-soft); }
.family__thread { margin: 10px 0 6px; }
.family__thread .sketch { color: var(--burgundy); }
.sketch--thread g { stroke-width: 1.5; }
.family__person { padding: 0 4px; }
.family__person .kicker { display: block; margin: 0 0 6px; }
.family__person .person { display: block; font: 400 23px/1.25 var(--serif); color: var(--burgundy); }
}

/* ---------- Events ---------- */
.events__list { display: grid; gap: 28px; }
.event {
  position: relative;
  padding: 34px 22px 32px;
  background: var(--paper);
  border: 1px solid var(--gold-line);
}
.event::before { content: ''; position: absolute; inset: 5px; border: 1px solid var(--gold-faint); pointer-events: none; }
/* Gold corner brackets, like a printed card */
.event__corner { position: absolute; width: 24px; height: 24px; border: 0 solid var(--gold); pointer-events: none; }
.event__corner:nth-of-type(1) { top: 12px; left: 12px; border-top-width: 1px; border-left-width: 1px; }
.event__corner:nth-of-type(2) { top: 12px; right: 12px; border-top-width: 1px; border-right-width: 1px; }
.event__corner:nth-of-type(3) { bottom: 12px; left: 12px; border-bottom-width: 1px; border-left-width: 1px; }
.event__corner:nth-of-type(4) { bottom: 12px; right: 12px; border-bottom-width: 1px; border-right-width: 1px; }
.event__art { margin: 0 -4px 18px; }
.event__name { margin: 0 0 10px; }
.event__venue { margin: 0 0 6px; font: 400 30px/1.2 var(--serif); color: var(--burgundy); }
.event__host { margin: 0 0 26px; font: italic 400 17px/1.4 var(--serif); color: var(--ink-soft); }
.event__facts {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  border-top: 1px solid var(--gold-faint); border-bottom: 1px solid var(--gold-faint);
  padding: 20px 0;
}
.event__fact { padding: 0 6px; }
.event__fact + .event__fact { border-left: 1px solid var(--gold-faint); }
.event__label { display: block; font: 400 10px/1.6 var(--sans); letter-spacing: .26em; text-transform: uppercase; color: var(--gold-text); }
.event__big { display: block; margin: 6px 0 4px; font: 300 32px/1.05 var(--serif); color: var(--ink); }
.event__sub { display: block; font: italic 400 14px/1.35 var(--serif); color: var(--ink-soft); }
.event__lunar { margin: 14px 0 0; font: italic 400 15px/1.5 var(--serif); color: var(--ink-soft); }
.event__where { margin: 24px auto 0; }
.event__addr {
  display: inline-flex; align-items: flex-start; gap: 8px; max-width: 24em; margin: 8px 0 0;
  font: 500 19px/1.4 var(--serif); color: var(--ink); text-decoration: none;
}
a.event__addr span { text-decoration: underline; text-decoration-color: var(--gold-line); text-underline-offset: 5px; text-decoration-thickness: 1px; }
a.event__addr:hover span { text-decoration-color: var(--burgundy); }
.event__pin { flex: none; width: 18px; height: 18px; margin-top: 3px; fill: none; stroke: var(--burgundy); stroke-width: 1.4; }
.event__dress { margin: 12px 0 0; font: italic 400 15px/1.5 var(--serif); color: var(--gold-text); }
.sketch--venue .ln { animation-delay: calc(var(--i, 0) * 22ms + .2s); } /* many strokes: draw faster */
.sketch--venue g { stroke-width: 1.1; }
.event__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 26px; }
.event__actions .btn { padding: 0 18px; flex: 1 1 140px; }
.event__cal { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 18px; margin-top: 14px; }
.event__cal a {
  display: inline-flex; align-items: center; min-height: 44px;
  font-size: 13px; color: var(--burgundy);
  text-decoration: underline; text-decoration-color: var(--gold-line); text-underline-offset: 5px;
}

/* ---------- Sketches (assets/js/sketches.js) ---------- */
.sketch { display: block; width: 100%; height: auto; overflow: visible; color: #4A3128; }
.sketch__ink { fill: var(--burgundy); stroke: none; font-family: var(--hy); }
/* Each stroke has pathLength=1 and class .ln: dash "1 2" with offset 1 hides it, offset 0 shows it whole. */
.js .sketch .ln { stroke-dasharray: 1 2; stroke-dashoffset: 1; }
.js .sketch__ink { opacity: 0; transition: opacity 1.2s var(--ease) 1.6s; }
.is-visible .sketch .ln { animation: draw 1.5s cubic-bezier(.45, .05, .3, 1) calc(var(--i, 0) * 45ms + .25s) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.is-visible .sketch__ink { opacity: .9; }

/* ---------- Program ---------- */
.program__date { margin: -14px 0 40px; font: 400 12px/1.6 var(--sans); letter-spacing: .3em; color: var(--gold-text); }
.program__list { list-style: none; margin: 0 auto; padding: 0; max-width: 460px; }
.program__item {
  display: grid; grid-template-columns: 46% 1fr; align-items: center; gap: 18px;
  padding: 22px 0; text-align: left;
}
.program__item + .program__item { border-top: 1px solid var(--gold-faint); }
.program__item:nth-child(even) { grid-template-columns: 1fr 46%; text-align: right; }
.program__item:nth-child(even) .program__art { order: 2; }
.program__time { margin: 0; font: 300 34px/1 var(--serif); color: var(--burgundy); }
.program__title { margin: 8px 0 2px; font: 500 21px/1.3 var(--serif); }
.program__note { margin: 0; font: italic 400 15px/1.45 var(--serif); color: var(--ink-soft); }

.gift__art { width: 150px; margin: -10px auto 10px; }

/* ---------- Countdown ---------- */
.countdown__grid { display: grid; grid-template-columns: repeat(3, 1fr); max-width: 340px; margin: 0 auto; }
.countdown__cell + .countdown__cell { border-left: 1px solid var(--gold-faint); }
.countdown__num { display: block; font: 300 46px/1.1 var(--serif); color: var(--burgundy); font-variant-numeric: lining-nums tabular-nums; }
.countdown__label { font: 400 10.5px/1.6 var(--sans); letter-spacing: .28em; text-transform: uppercase; color: var(--ink-soft); }
.countdown__done { grid-column: 1 / -1; font: italic 400 22px/1.4 var(--serif); color: var(--burgundy); }

/* ---------- Placeholder (hero, album, QR) ---------- */
.ph {
  position: relative;
  display: grid; place-items: center; align-content: center; gap: 10px;
  width: 100%; height: 100%;
  background: var(--champagne) var(--grain);
  color: var(--gold);
}
.ph::after { content: ''; position: absolute; inset: 10px; border: 1px solid var(--gold-line); pointer-events: none; }
.ph .hy { font-size: 30px; opacity: .85; }
.ph__mono { font: italic 300 22px/1 var(--serif); letter-spacing: .12em; color: var(--gold-text); }
.ph__label { font: 400 9.5px/1 var(--sans); letter-spacing: .3em; text-transform: uppercase; color: var(--gold-text); opacity: .8; }

/* ---------- Album (self-contained) ---------- */
/* Flex rows: portrait = 1 column, landscape = 2 columns; a short last row centres itself. */
.album { --cols: 2; --gap: 10px; display: flex; flex-wrap: wrap; justify-content: center; column-gap: var(--gap); row-gap: 10px; }
.album__item {
  position: relative; display: block; padding: 0;
  flex: 0 0 calc((100% - (var(--cols) - 1) * var(--gap)) / var(--cols));
  border: 0; background: none; overflow: hidden;
  aspect-ratio: 3 / 4;
}
.album__item--landscape { flex-basis: calc((100% - (var(--cols) - 1) * var(--gap)) / var(--cols) * 2 + var(--gap)); aspect-ratio: 3 / 2; }
.album__item img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.4s var(--ease), opacity .8s var(--ease); }
.album__item img.is-loading { opacity: 0; }
.album__item:hover img { transform: scale(1.025); }
.album__item .ph .hy { font-size: 22px; }

.lightbox {
  position: fixed; inset: 0; z-index: 60;
  display: grid; grid-template-rows: auto 1fr auto;
  background: var(--ivory) var(--grain);
  opacity: 0; transition: opacity .45s var(--ease);
}
.lightbox.is-open { opacity: 1; }
.lightbox__bar { display: flex; justify-content: space-between; align-items: center; padding: max(8px, env(safe-area-inset-top)) 8px 0 20px; }
.lightbox__count { font: 400 11px/1 var(--sans); letter-spacing: .26em; color: var(--ink-soft); }
.lightbox__btn {
  display: grid; place-items: center; width: 48px; height: 48px;
  background: none; border: 0; color: var(--burgundy);
}
.lightbox__btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.1; }
.lightbox__stage { position: relative; display: grid; place-items: center; min-height: 0; padding: 12px 16px; touch-action: pan-y; }
.lightbox__figure { margin: 0; max-width: 100%; max-height: 100%; display: grid; place-items: center; transition: opacity .35s var(--ease), transform .35s var(--ease); }
.lightbox__figure img { max-height: calc(100dvh - 170px); max-width: min(100%, 900px); object-fit: contain; box-shadow: 0 0 0 1px var(--gold-line); }
.lightbox__figure .ph { width: min(78vw, 420px); height: auto; aspect-ratio: var(--ratio, 3 / 4); max-height: calc(100dvh - 170px); }
.lightbox__figure .ph .hy { font-size: 46px; }
.lightbox__nav { position: absolute; top: 50%; transform: translateY(-50%); }
.lightbox__nav--prev { left: 2px; }
.lightbox__nav--next { right: 2px; }
.lightbox__caption { min-height: 64px; padding: 6px 24px max(18px, env(safe-area-inset-bottom)); text-align: center; font: italic 400 17px/1.4 var(--serif); color: var(--ink-soft); }

@media (min-width: 720px) {
  .lightbox__nav--prev { left: 24px; }
  .lightbox__nav--next { right: 24px; }
}

/* ---------- Story ---------- */
.story__list { list-style: none; margin: 0 auto; padding: 0; max-width: 400px; text-align: left; position: relative; }
.story__list::before { content: ''; position: absolute; left: 6px; top: 8px; bottom: 8px; width: 1px; background: var(--gold-line); }
.story__item { position: relative; padding: 0 0 34px 38px; }
.story__item:last-child { padding-bottom: 0; }
.story__item::before {
  content: ''; position: absolute; left: 2px; top: 9px; width: 9px; height: 9px;
  background: var(--ivory); border: 1px solid var(--gold); transform: rotate(45deg);
}
.story__year { display: block; font: italic 400 16px/1.4 var(--serif); color: var(--gold-text); }
.story__title { margin: 0 0 4px; font: 500 21px/1.3 var(--serif); color: var(--burgundy); }
.story__text { margin: 0; font-size: 14px; color: var(--ink-soft); }

/* ---------- Gift ---------- */
.gift__panel { display: grid; gap: 20px; margin-top: 32px; }
.gift__panel.is-in { animation: rise .7s var(--ease) both; }
.gift__card { padding: 28px 22px 22px; border: 1px solid var(--gold-line); background: var(--paper); }
.gift__qr { width: 168px; height: 168px; margin: 14px auto 20px; }
.gift__qr img { width: 100%; height: 100%; object-fit: contain; }
.gift__qr .ph .hy { font-size: 24px; }
.gift__rows { margin: 0 0 18px; display: grid; gap: 8px; }
.gift__rows div { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; border-bottom: 1px solid var(--gold-faint); padding-bottom: 8px; }
.gift__rows dt { color: var(--ink-soft); }
.gift__rows dd { margin: 0; text-align: right; font-weight: 400; }
.gift__num { font: 400 15px/1.3 var(--sans); letter-spacing: .08em; }
.gift__card .btn { width: 100%; }

/* ---------- RSVP form ---------- */
.form { max-width: 420px; margin: 8px auto 0; text-align: left; }
.field { margin: 0 0 26px; padding: 0; border: 0; min-width: 0; }
.field > label, .field > legend {
  display: block; margin-bottom: 4px; padding: 0;
  font: 400 11px/1.6 var(--sans); letter-spacing: .2em; text-transform: uppercase; color: var(--ink-soft);
}
.req { color: var(--burgundy); }
.field input[type="text"], .field input[type="tel"], .field input[type="number"], .field textarea {
  display: block; width: 100%; min-height: 48px; padding: 10px 2px;
  background: transparent; border: 0; border-bottom: 1px solid var(--gold-line); border-radius: 0;
  font: 400 18px/1.4 var(--serif); color: var(--ink);
  transition: border-color .3s;
  -webkit-appearance: none; appearance: none;
}
.field textarea { resize: vertical; min-height: 88px; }
.field input:focus, .field textarea:focus { outline: none; border-bottom-color: var(--burgundy); }
.field input::placeholder, .field textarea::placeholder { color: #A99A8F; font-style: italic; }
.hint { display: block; margin-top: 6px; font-size: 12.5px; line-height: 1.5; color: var(--ink-soft); }
.err { display: block; font-size: 12.5px; color: #9B1C2E; }
.err:empty { display: none; }
.err:not(:empty) { margin-top: 6px; }
.is-invalid { border-bottom-color: #9B1C2E !important; }

.choices { display: grid; gap: 4px; margin-top: 6px; }
.choices--row { grid-template-columns: repeat(auto-fit, minmax(72px, 1fr)); gap: 8px; }
.choice { position: relative; display: flex; align-items: center; gap: 12px; min-height: 44px; cursor: pointer; font: 400 18px/1.35 var(--serif); }
.choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choice > span::before {
  content: ''; display: inline-block; flex: none;
  width: 16px; height: 16px; margin-right: 12px; vertical-align: -2px;
  border: 1px solid var(--gold); border-radius: 50%;
  transition: background-color .3s, box-shadow .3s;
}
.choice input[type="checkbox"] + span::before { border-radius: 0; }
.choice input:checked + span::before { background: var(--burgundy); box-shadow: inset 0 0 0 3px var(--ivory); border-color: var(--burgundy); }
.choice input:focus-visible + span { outline: 1px solid var(--burgundy); outline-offset: 4px; }

.choice--pill { justify-content: center; border: 1px solid var(--gold-line); font: 400 15px/1.2 var(--sans); padding: 0 8px; text-align: center; transition: background-color .3s, color .3s, border-color .3s; }
.choice--pill > span::before { display: none; }
.choice--pill:has(input:checked) { background: var(--burgundy); border-color: var(--burgundy); color: var(--ivory); }
.choice--pill.is-checked { background: var(--burgundy); border-color: var(--burgundy); color: var(--ivory); }
.field--inline { margin: 14px 0 0; }

.hp { display: none; }
.form__error { margin: 0 0 14px; text-align: center; font-size: 13.5px; color: #9B1C2E; }
.form__error:empty { display: none; }
.form__demo { margin: 14px 0 0; text-align: center; font-size: 12px; color: var(--ink-soft); }

.thanks { max-width: 420px; margin: 0 auto; padding: 36px 24px; border: 1px solid var(--gold-line); animation: rise .9s var(--ease) both; }
.thanks:focus { outline: none; }
.thanks__text { margin: 0 0 24px; font: italic 400 21px/1.5 var(--serif); color: var(--ink); }

/* ---------- Closing ---------- */
.closing { padding-bottom: 120px; }
.monogram {
  position: relative;
  display: grid; place-items: center;
  width: 104px; height: 104px; margin: 0 auto 32px;
  border: 1px solid var(--gold-line); border-radius: 50%;
}
.monogram::after { content: ''; position: absolute; inset: 5px; border: 1px solid var(--gold-faint); border-radius: 50%; }
.monogram span { font: italic 300 34px/1 var(--serif); color: var(--burgundy); letter-spacing: .04em; }
.monogram i { font-style: normal; margin: 0 6px; color: var(--gold); font-size: 20px; vertical-align: 4px; }
.closing__names { margin: 26px 0 8px; font-size: 40px; }
.closing__tag { margin: 0 0 30px; font: 400 11px/1.6 var(--sans); letter-spacing: .28em; color: var(--gold-text); }
.closing__hy { display: block; font-size: 26px; color: var(--gold); }

.noscript { padding: 24px; text-align: center; }

/* =====================================================================
   MOTION
   ===================================================================== */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity 1.2s var(--ease), transform 1.2s var(--ease); }
.js .reveal--left:not(.is-visible) { transform: translateX(-28px); }
.js .reveal--right:not(.is-visible) { transform: translateX(28px); }
.js .reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .sketch .ln { stroke-dashoffset: 0; animation: none !important; }
  .sketch .petal { fill-opacity: .9; }
  .js .sketch__ink { opacity: .9; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; transition-delay: 0s !important; }
  .js .reveal { opacity: 1; transform: none; }
}

/* =====================================================================
   TABLET: same single column, a little more air
   ===================================================================== */
@media (min-width: 600px) {
  .card { max-width: 600px; }
  .section { padding-left: 48px; padding-right: 48px; }
  .controls { top: 20px; right: 24px; }
  .music { right: 24px; bottom: 24px; }
}

/* =====================================================================
   DESKTOP (≥ 960px): full-width page, each section laid out for the screen
   ===================================================================== */
@media (min-width: 960px) {
  :root { --pad: 64px; }
  .card { max-width: none; }
  .section { padding: 132px var(--pad); }
  .section + .section::before { height: 64px; }
  .title { font-size: 46px; margin-bottom: 44px; }
  .kicker { font-size: 12px; }
  .muted { font-size: 16px; }

  /* Hero: arch portrait left, names and date right, one full screen */
  .hero {
    display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    grid-template-areas: "photo kicker" "photo names" "photo lead" "photo date" "photo lunar" "photo quote";
    align-content: center; column-gap: 7vw;
    max-width: 1180px; min-height: 100vh; margin: 0 auto;
    padding-top: 88px; padding-bottom: 88px;
  }
  .hero > .kicker { grid-area: kicker; align-self: end; margin-bottom: 26px; }
  .hero__photo { grid-area: photo; width: 100%; max-width: 440px; margin: 0 auto; align-self: center; }
  .hero__names { grid-area: names; font-size: clamp(72px, 7vw, 104px); }
  .hero__lead { grid-area: lead; font-size: 23px; margin: 22px 0 40px; }
  .hero .date { grid-area: date; max-width: 400px; }
  .date__big { font-size: 56px !important; }
  .hero__lunar { grid-area: lunar; font-size: 18px; }
  .hero__quote { grid-area: quote; align-self: start; font-size: 20px; }
  .hero__sprig { left: auto; right: 4vw; top: 64px; width: 220px; height: 74px; transform: none; }

  /* Family */
  .family__intro { font-size: 21px; margin-bottom: 48px; }
  .family__col { padding: 0 32px; }
  .family__art { max-width: 230px; margin-bottom: 18px; }
  .family__parent { font-size: 22px; }
  .family__thread { margin: 14px 0 10px; }
  .sketch--thread g { stroke-width: .8; }
  .family__person .person { font-size: 38px; }

  /* Events: three cards side by side */
  .events__list { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 32px; max-width: 1180px; margin: 0 auto; }
  .event { display: flex; flex-direction: column; padding: 48px 64px 44px; }
  .event__art { margin: -6px 0 22px; }
  .sketch--venue g { stroke-width: .75; } /* the drawing is scaled up 2x here */
  .event__venue { font-size: 38px; }
  .event__big { font-size: 46px; }
  .event__sub { font-size: 15.5px; }
  .event__addr { font-size: 22px; }
  .event__label { font-size: 11px; }
  .event__actions { margin-top: auto; padding-top: 30px; }

  .events__list:not(:has(> :nth-child(2))) { max-width: 780px; } /* a single event stays card-width */
  .js .reveal--left:not(.is-visible) { transform: translateX(-56px); }
  .js .reveal--right:not(.is-visible) { transform: translateX(56px); }

  /* Program: sketches in a row */
  .program__list { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 28px; max-width: 1180px; }
  .program__item, .program__item:nth-child(even) { display: block; padding: 0; text-align: center; }
  .program__item + .program__item { border-top: 0; }
  .program__art { max-width: 190px; margin: 0 auto 22px; }
  .program__time { font-size: 44px; }
  .program__title { font-size: 23px; }
  .program__note { font-size: 16px; }
  .gift__art { width: 190px; }

  /* Countdown */
  .countdown__grid { max-width: 560px; }
  .countdown__num { font-size: 76px; }
  .countdown__label { font-size: 11.5px; }

  /* Album: four columns */
  .album { --cols: 4; --gap: 1%; max-width: 1120px; margin: 0 auto; row-gap: 14px; }
  .album__item--landscape { aspect-ratio: 1.531; } /* same row height as a portrait at this gap */

  /* Story: horizontal timeline */
  .story__list { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 32px; max-width: 1080px; text-align: center; }
  .story__list::before { left: 0; right: 0; top: 6px; bottom: auto; width: auto; height: 1px; }
  .story__item { padding: 40px 0 0; }
  .story__item::before { left: calc(50% - 5px); top: 2px; }
  .story__title { font-size: 24px; }

  /* Gift */
  .gift__panel { grid-template-columns: 1fr 1fr; gap: 28px; max-width: 820px; margin-left: auto; margin-right: auto; }

  /* RSVP: .field--half puts two short fields on one row */
  .form { display: grid; grid-template-columns: 1fr 1fr; column-gap: 36px; max-width: 680px; }
  .form > * { grid-column: 1 / -1; }
  .form > .field--half { grid-column: auto; }
  .thanks { max-width: 560px; }

  .closing__names { font-size: 56px; }
}
