/* Invite Studio — base.css
 * Layout + structure only. Every colour and font comes from the theme variables below;
 * the values here are neutral fallbacks used when a theme is missing or incomplete.
 * Themes (themes/<id>.css) load after this file and override :root.
 */
:root {
  --c-page: #ece6da;
  --c-paper: #f7f2e8;
  --c-paper-2: #4f5640;
  --c-ink: #2c2a26;
  --c-ink-soft: #6b6559;
  --c-on-paper-2: var(--c-paper);       /* the extended tokens below are defined by every theme */
  --c-on-paper-2-soft: var(--c-paper);
  --c-on-accent: #fbf7ef;
  --c-text-accent: var(--c-accent);
  --c-foil-ink: #7a5e2c;
  --c-photo-paper: #fbfaf6;
  --c-line: rgba(44, 42, 38, .25);
  --c-focus: var(--c-accent);
  --c-primary: #4f5640;
  --c-accent: #6d2232;
  --c-foil: #b8975a;
  --c-envelope: var(--c-paper-2);       /* optional theme var */
  --c-on-primary: var(--c-paper);       /* text on --c-primary (countdown band, buttons) */
  --font-script: "Parisienne", "Allura", "Snell Roundhand", "Apple Chancery", cursive;
  --font-serif: "Cormorant Garamond", "EB Garamond", "Iowan Old Style", Georgia, serif;
  --font-sans: "Jost", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --paper-grain: url("assets/shared/paper-grain.svg");
  --shadow-paper: 0 1px 1px rgba(30, 25, 15, .18), 0 8px 18px -6px rgba(30, 25, 15, .35);
  --radius-paper: 2px;
  --ease-paper: cubic-bezier(.22, .8, .24, 1);
}

/* ---------- reset-ish ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background-color: var(--c-page);
  color: var(--c-ink);
  font-family: var(--font-serif);
  font-size: 1.0625rem;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
img[hidden], [hidden] { display: none !important; }
button { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--c-focus); outline-offset: 3px; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.icon { display: inline-flex; flex: none; }
.icon svg { display: block; }
body.is-envelope { overflow: hidden; }

.boot-note {
  min-height: 100vh; display: grid; place-items: center; padding: 2rem;
  font-style: italic; color: var(--c-ink-soft); text-align: center;
}

/* ---------- paper primitives ---------- */
.card {
  position: relative;
  background-color: var(--c-paper);
  color: var(--c-ink);
  border-radius: var(--radius-paper);
  box-shadow: var(--shadow-paper);
}
.card--alt { background-color: var(--c-paper-2); color: var(--c-on-paper-2); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 48px; padding: .7rem 1.5rem;
  border: 1px solid var(--c-primary); border-radius: 1px;
  background: var(--c-primary); color: var(--c-on-primary);
  font-family: var(--font-serif); font-size: .95rem; letter-spacing: .14em; text-transform: uppercase;
  text-decoration: none; cursor: pointer;
  transition: transform .2s var(--ease-paper), background-color .2s, color .2s;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: .6; cursor: progress; transform: none; }
.btn--ghost { background: transparent; color: var(--c-ink); border-color: currentColor; }
.btn--small { min-height: 44px; padding: .5rem 1rem; font-size: .8rem; }

/* ---------- language switch: a quiet text link ---------- */
.lang-switch {
  display: inline-flex; align-items: center; min-height: 44px; padding: .25rem .5rem;
  background: none; border: 0; cursor: pointer;
  font-family: var(--font-serif); font-size: .78rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--c-ink-soft); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .3em;
}
.lang-switch:hover { color: var(--c-ink); }
.home__top { max-width: 520px; margin: 0 auto; padding: .25rem .5rem 0; display: flex; justify-content: flex-end; position: relative; z-index: 10; }

/* =====================================================================
   OPENING ENVELOPE
   ===================================================================== */
.opening {
  position: fixed; inset: 0; z-index: 50;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.75rem;
  padding: 1.5rem 1rem;
}
/* the backdrop is its own layer so it can fade while the envelope glides onto the table */
.opening__bg {
  position: absolute; inset: 0; z-index: -1;
  background-color: var(--c-page);
  background-image: var(--paper-grain);
  background-size: 260px;
}
.opening.is-opening { pointer-events: none; }
.opening.is-opening .envelope { will-change: transform; }
.opening__kicker {
  font-family: var(--font-serif); font-size: .8rem; letter-spacing: .3em; text-transform: uppercase;
  color: var(--c-ink-soft); text-align: center; min-height: 1em;
}
.opening__hint {
  font-family: var(--font-script); font-size: 1.6rem; color: var(--c-ink-soft);
  animation: hint-breathe 2.6s ease-in-out infinite;
}
@keyframes hint-breathe { 50% { opacity: .45; } }

.envelope {
  --env-w: min(86vw, 420px);
  position: relative;
  width: var(--env-w);
  aspect-ratio: 1.45;
  padding: 0; border: 0; background: none; cursor: pointer;
  perspective: 1400px;
  transform: rotate(-1.5deg);
  transition: transform .5s var(--ease-paper), opacity .5s;
  -webkit-tap-highlight-color: transparent;
}

.envelope:focus-visible { outline-offset: 10px; }
.envelope__back, .envelope__pocket, .envelope__flap {
  position: absolute; inset: 0;
  background-color: var(--c-envelope);
  background-image: var(--paper-grain);
  background-size: 200px;
}
.envelope__back { background: none; border-radius: 3px; box-shadow: 0 14px 30px -12px rgba(25, 20, 10, .55), 0 2px 3px rgba(25, 20, 10, .2); }
.envelope__letter {
  position: absolute; left: 6%; right: 6%; top: 6%; height: 86%;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: .35rem;
  padding-top: 9%;
  text-align: center;
  transition: transform 1s var(--ease-paper);
}
.envelope__letter-line { font-size: .7rem; letter-spacing: .3em; text-transform: uppercase; color: var(--c-ink-soft); }
.envelope__letter-names { font-family: var(--font-script); font-size: clamp(1.15rem, 6.2vw, 1.7rem); line-height: 1.1; padding: 0 .75rem; max-width: 100%; overflow-wrap: anywhere; }
.envelope__pocket {
  clip-path: polygon(0 0, 50% 54%, 100% 0, 100% 100%, 0 100%);
  filter: brightness(.96);
  border-radius: 0 0 3px 3px;
}
/* subtle fold lines on the pocket */
.envelope__pocket::after {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(to top right, transparent calc(50% - .5px), rgba(0,0,0,.12) 50%, transparent calc(50% + .5px)) left bottom / 50% 100% no-repeat,
    linear-gradient(to top left, transparent calc(50% - .5px), rgba(0,0,0,.12) 50%, transparent calc(50% + .5px)) right bottom / 50% 100% no-repeat;
}
.envelope__flap {
  bottom: auto; height: 62%;
  background: none;
  transform-origin: 50% 0;
  transform-style: preserve-3d;   /* no filter/opacity/clip-path here — any of those would flatten the 3D fold */
  z-index: 3;
}
/* two-sided flap: envelope stock on the front, printed liner on the back */
.envelope__flap-face {
  position: absolute; inset: 0;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
.envelope__flap-front {
  background-color: var(--c-envelope);
  background-image: var(--paper-grain);
  background-size: 200px;
  filter: brightness(1.04);
}
/* inside of the flap: envelope stock with the printed liner set in from the edges, like a real lined envelope */
/* the back face is flipped once by its own rotateX and again by the flap, so its triangle is drawn
   base-down: after both flips the wide edge sits on the hinge and the point stands up, joined to the envelope */
.envelope__flap-back {
  transform: rotateX(180deg);
  clip-path: polygon(0 100%, 100% 100%, 50% 0);
  background-color: var(--c-envelope);
  background-image: var(--paper-grain);
  background-size: 200px;
  filter: brightness(.92);
}
.envelope__flap-liner {
  position: absolute; inset: 0; overflow: hidden;
  clip-path: polygon(6% 4%, 94% 4%, 50% 88%);
  background-color: var(--c-accent);
}
.envelope__flap-liner img { width: 100%; height: 100%; object-fit: cover; display: block; }
.envelope__flap-back .envelope__flap-liner { clip-path: polygon(6% 96%, 94% 96%, 50% 12%); }
/* hinge crease along the top edge — keeps the flap visibly joined to the envelope while it folds */
.envelope__hinge {
  position: absolute; left: 0; right: 0; top: 0; height: 2px; z-index: 4; pointer-events: none;
  background: linear-gradient(rgba(0,0,0,.22), transparent);
}

/* the same open flap on the table, standing up off the envelope's top edge */
.piece--envelope .envelope__flap-open {
  position: absolute; left: 0; right: 0; bottom: 100%; height: 62%;
  clip-path: polygon(0 100%, 100% 100%, 50% 0);
  background-color: var(--c-envelope);
  background-image: var(--paper-grain);
  background-size: 200px;
  filter: brightness(.92);
  pointer-events: none;
}
.piece--envelope .envelope__flap-open .envelope__flap-liner { clip-path: polygon(6% 96%, 94% 96%, 50% 12%); }
/* centred with left/top, not `translate` — themes use `translate` for hover lift, which would
   otherwise wipe out the centring and make the seal jump. Seal is 24% of width = 34.8% of height. */
.envelope .seal--envelope {
  position: absolute; z-index: 4; left: 38%; top: 44.6%;
  width: 24%;
  transition: translate .2s var(--ease-paper);
}
/* back 0 · letter 1 · pocket 2 · flap 3 (drops to 0 once open, so the letter rises in front of it) */
.envelope__letter { z-index: 1; }
.envelope__pocket { z-index: 2; }

/* the opening sequence itself is a Web Animations timeline in app.js (renderEnvelope) */

/* =====================================================================
   SEAL
   ===================================================================== */
.seal {
  position: relative; display: grid; place-items: center;
  aspect-ratio: 1; border-radius: 50%;
  background-color: var(--c-accent);
  container-type: inline-size;
  /* wax colour of the theme's seal art (design/tools/wax-seal.mjs) — the monogram is cast from it */
  --wax: var(--c-accent); --wax-hi: rgba(255, 248, 232, .55); --wax-lo: rgba(20, 8, 4, .6);
}
[data-theme="vineyard"] .seal { --wax: #7A2232; }
[data-theme="confetti"] .seal { --wax: #A3271A; }
[data-theme="meadow"]   .seal { --wax: #7D8D66; --wax-hi: rgba(240, 246, 226, .55); --wax-lo: rgba(28, 34, 18, .6); }
[data-theme="rosa"]     .seal { --wax: #B8924E; --wax-hi: rgba(255, 244, 210, .8);  --wax-lo: rgba(60, 38, 8, .7); }
[data-theme="woodland"] .seal { --wax: #B4643C; }
[data-theme="lullaby"]  .seal { --wax: #D4AE5E; --wax-hi: rgba(255, 248, 222, .85); --wax-lo: rgba(84, 58, 12, .62); }
[data-theme="safari"]   .seal { --wax: #C47E57; --wax-hi: rgba(255, 240, 226, .6); }
.seal.has-art { background: none; }
.seal__art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
/* The monogram is the stamp's engraving: wax-coloured capitals standing proud of the recessed face,
   lit like the art (light from the upper left): bright upper-left edge, dark lower-right edge, a soft
   cast shadow. No ink colour — it is the same wax. (.seal .seal__mono beats theme overrides.) */
.seal .seal__mono {
  position: relative; font-family: var(--font-serif); font-weight: 600;
  font-size: 28cqi; line-height: 1; letter-spacing: .04em; text-indent: .04em; text-transform: uppercase;
  color: var(--wax); color: color-mix(in srgb, var(--wax) 94%, #fff);
  opacity: 1; mix-blend-mode: normal;
  text-shadow:
    -.022em -.026em .006em var(--wax-hi),
    .02em .026em .008em var(--wax-lo),
    .045em .06em .05em var(--wax-lo);
  translate: 0 .03em;           /* optical centre of capitals */
}
.seal .seal__mono[data-len="2"] { font-size: 22cqi; letter-spacing: .02em; text-indent: .02em; }
.seal .seal__mono[data-len="3"] { font-size: 16cqi; letter-spacing: 0; text-indent: 0; }
.seal .seal__mono[data-len="4"] { font-size: 12.5cqi; letter-spacing: 0; text-indent: 0; }

/* =====================================================================
   HOME / COLLAGE  — positions follow design/design-system.md §2/§3.
   Every piece gets --x --y --w (--h) --r --z from app.js in "u" (1u = 1% of stage width).
   ===================================================================== */
.home { padding-bottom: 3rem; }
.home.is-sealed { visibility: hidden; }
.home__title:focus { outline: none; }
.stage {
  container-type: inline-size;
  width: 100%; max-width: 520px; margin: 0 auto;
  overflow: hidden;          /* iOS 15 */
  overflow: clip;            /* florals may bleed past the cards but never cause horizontal scroll */
  /* 1u = 1% of the stage width. Fallback for browsers without container units (iOS < 16) */
  --u: calc(min(100vw, 520px) / 100);
}
@supports (width: 1cqi) { .stage { --u: 1cqi; } }
/* --top: room above the collage's y=0 for the open envelope flap (it stands ~33u above the envelope) */
.collage { --top: 34; position: relative; display: block; height: calc((200 + var(--top)) * var(--u)); }

.piece, .decor {
  position: absolute;
  left: calc(var(--x) * var(--u));
  top: calc((var(--y) + var(--top)) * var(--u));
  width: calc(var(--w) * var(--u));
  transform: rotate(var(--r, 0deg));
  z-index: var(--z, 1);
}
.piece {
  margin: 0; padding: 0; border: 0;
  height: calc(var(--h) * var(--u));
  font-family: var(--font-serif);
  text-align: center;
  container-type: inline-size;
  --pw: var(--w);            /* piece width in u: padding/gap on the piece itself can't use its own cqi */
}
button.piece { cursor: pointer; }
.decor { pointer-events: none; transform: rotate(var(--r, 0deg)) scaleX(var(--flip, 1)); }
.decor img { width: 100%; height: auto; }

/* reveal: only `opacity` + `translate` animate, and fill-mode is backwards so the theme's hover lift
   (translate/scale) is never overridden once the animation has finished */
.collage .piece, .collage .decor { visibility: hidden; }
.collage.is-revealed .piece, .collage.is-revealed .decor {
  visibility: visible;
  animation: drop-in .5s var(--ease-paper) backwards;
  animation-delay: calc(var(--i, 0) * 70ms);
}
/* pre-draw the art under the sealed envelope screen (see renderAll in app.js); .01 keeps it painted, not seen */
.collage.is-prewarm:not(.is-revealed) .piece, .collage.is-prewarm:not(.is-revealed) .decor { visibility: visible; opacity: .01; }
/* Each card keeps its own layer from the pre-draw on, so dealing the cards only moves finished
   pictures around instead of redrawing their textures every frame. */
.collage.is-prewarm .piece, .collage.is-prewarm .decor { will-change: transform, translate, scale, opacity; }
/* The opened envelope on the table never lifts on hover, so it needs no transition; with one, its
   reveal became an opacity transition that redrew the whole envelope every frame of the deal. */
.collage .piece--envelope { transition: none; }
/* The table itself is drawn under the (opaque, fixed) envelope screen too; it stays inert and aria-hidden. */
.home.is-sealed.is-prewarm { visibility: visible; }
/* the envelope piece is already there — the opening envelope glided onto exactly this spot */
.collage.is-revealed .piece--envelope { animation: none; }
.collage.no-anim .piece, .collage.no-anim .decor { animation: none; }
@keyframes drop-in { from { opacity: 0; translate: 0 -16px; scale: 1.03; } }

/* opened envelope lying behind everything (theme draws the liner with ::before) */
.piece--envelope { background-color: var(--c-envelope); box-shadow: var(--shadow-paper); }
/* decorative paper never lifts on hover (themes lift .card/.envelope) */
.collage .piece--envelope:hover, .opening .envelope__letter:hover, .collage div.piece--polaroid:hover { translate: none; scale: none; box-shadow: var(--shadow-paper); }
.decor--scatter img { opacity: .95; }

/* invitation card */
.piece--invite {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: calc(var(--pw) * .1 * var(--u)) calc(var(--pw) * .09 * var(--u));
}
.invite__body { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5cqi; width: 100%; margin: auto 0; }
.piece--invite .invite__line { font-size: max(11px, 5.2cqi); letter-spacing: .16em; text-transform: uppercase; line-height: 1.5; color: var(--c-ink-soft); }
.invite__names { display: flex; flex-direction: column; align-items: center; line-height: 1; font-family: var(--font-script); color: var(--c-text-accent); }
.invite__name { font-size: max(34px, 20cqi); line-height: 1.05; overflow-wrap: anywhere; }
.invite__names.is-long .invite__name { font-size: max(30px, 16cqi); }
.invite__names.is-many .invite__name { font-size: max(24px, 12cqi); }
.invite__amp { font-family: var(--font-serif); font-style: italic; font-size: max(18px, 10cqi); opacity: .85; margin: 1cqi 0; }
.invite__sub { font-size: max(13px, 6cqi); letter-spacing: .04em; line-height: 1.35; }

/* date card */
.piece--date {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: calc(var(--pw) * .015 * var(--u));
  padding: calc(var(--pw) * .1 * var(--u)) calc(var(--pw) * .06 * var(--u));
}
.piece--date :is(.date__weekday, .date__year, .date__time) { font-size: max(10px, 9cqi); letter-spacing: .14em; text-transform: uppercase; line-height: 1.2; }
.date__day { font-size: max(36px, 42cqi); line-height: .95; letter-spacing: -.01em; font-variant-numeric: lining-nums; }
.date__month { font-family: var(--font-script); font-size: max(22px, 19cqi); line-height: 1.1; }
.piece--date :is(.date__time, .date__year) { letter-spacing: .06em; }
.piece--date .date__venue { font-size: max(9px, 7.5cqi); letter-spacing: .06em; text-transform: uppercase; line-height: 1.3; margin-top: 2cqi; opacity: .9; }

/* round details tag */
.piece--tag {
  aspect-ratio: 1; height: auto;
  border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding-top: calc(var(--pw) * .08 * var(--u));
  background-color: var(--c-accent); color: var(--c-on-accent);
}
.tag__kicker { font-size: max(11px, 9cqi); letter-spacing: .14em; }
.tag__main { font-family: var(--font-script); font-size: max(28px, 22cqi); line-height: 1; }

/* twine from the date card to the tag eyelet */
.twine { overflow: visible; pointer-events: none; }
.twine path { fill: none; stroke: var(--c-ink-soft); stroke-opacity: .6; stroke-width: 1.5; }

/* RSVP card */
.piece--rsvp {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: calc(var(--pw) * .02 * var(--u));
  padding: calc(var(--pw) * .08 * var(--u));
}
.rsvp__kicker { font-family: var(--font-script); font-size: max(24px, 14cqi); line-height: 1.1; color: var(--c-text-accent); }
.rsvp__main { font-size: max(12px, 6.5cqi); letter-spacing: .3em; text-transform: uppercase; }
.rsvp__by { font-style: italic; font-size: max(12px, 6cqi); color: var(--c-ink-soft); }
.piece--seal { height: auto; cursor: pointer; }

/* polaroids */
.collage .piece--polaroid { height: auto; display: flex; flex-direction: column; padding: calc(var(--pw) * .06 * var(--u)) calc(var(--pw) * .06 * var(--u)) 0; }
.polaroid { background-color: var(--c-photo-paper); color: var(--c-ink); }
.polaroid__photo { aspect-ratio: 1; width: 100%; }
.polaroid__caption {
  display: block; min-height: 22cqi; padding: 3cqi 0 4cqi;
  font-family: var(--font-script); font-size: max(16px, 10cqi); line-height: 1.1; text-align: center;
}

/* ---------- Arrival (second-stage reveal) ----------
   Triggered when cfg.arrival is present. Two additions to the collage:
   (1) .postmark — a hand-stamped ink seal overlaid on the envelope's upper
   right, carrying the localized "Special Delivery" words and arrival date;
   (2) .card--arrival — a small announcement card tucked at a right-lean
   over the top of the flat-lay, button that opens the arrival page.

   The postmark uses an SVG frame (currentColor) filled with the theme's
   accent/foil color; its text is overlaid as HTML spans so it stays
   localized per-visitor without needing per-language assets. */
.postmark {
  position: absolute;
  top: -10%;
  right: -4%;
  width: 34%;
  color: var(--c-accent);
  transform: rotate(-10deg);
  pointer-events: none;
  z-index: 3;
  opacity: .9;
  mix-blend-mode: multiply;
  line-height: 0;
}
.postmark svg { display: block; width: 100%; height: auto; }

/* Opening envelope (full-screen tap-to-open): same postmark, smaller + more
   contained relative to the envelope's own landscape box. */
.opening .envelope .postmark {
  top: -4%;
  right: 6%;
  width: 24%;
  z-index: 5;
  transform: rotate(-12deg);
}

/* Collage announcement card. Reads as a slip of paper laid over the top of
   the flat-lay. Uses --c-paper-2 (second card stock) so it reads as a
   different sheet from the main invitation. */
.collage .piece--arrival.card--arrival {
  background-color: var(--c-paper-2);
  color: var(--c-on-paper-2, var(--c-ink));
  display: flex; flex-direction: column; justify-content: center;
  gap: calc(var(--pw) * .018 * var(--u));
  padding: calc(var(--pw) * .07 * var(--u)) calc(var(--pw) * .08 * var(--u));
  text-align: left;
  box-shadow: var(--shadow-lift, var(--shadow-paper));
  border: 1px solid color-mix(in srgb, var(--c-ink-soft) 14%, transparent);
}
.card--arrival__kicker {
  font-family: var(--font-sans); font-weight: 700;
  font-size: max(9px, 5.6cqi); letter-spacing: .22em; text-transform: uppercase;
  color: var(--c-accent);
  line-height: 1.3;
}
.card--arrival__title {
  font-family: var(--font-script); font-size: max(22px, 16cqi); line-height: 1;
  color: var(--c-ink);
}
.card--arrival__date {
  font-family: var(--font-serif); font-style: italic; font-size: max(11px, 6.4cqi);
  color: var(--c-ink-soft);
  line-height: 1.2;
}
.card--arrival__open {
  margin-top: auto;
  font-family: var(--font-sans); font-weight: 600;
  font-size: max(9px, 5.2cqi); letter-spacing: .18em; text-transform: uppercase;
  color: var(--c-accent);
}

/* ---------- Arrival page ----------
   Mirror the page vocabulary of story/padrinos but centered and quiet.
   The welcome form inherits .field + .btn styles already in base.css. */
.arrival__named {
  font-family: var(--font-script); font-size: clamp(2rem, 7vw, 3.2rem);
  line-height: 1.05; color: var(--c-ink); margin: 0 0 1rem;
  text-align: center;
}
.arrival__facts {
  margin: 0 auto 1.6rem; max-width: 36ch; text-align: center;
  font-family: var(--font-serif); font-style: italic; font-size: 1rem;
  color: var(--c-ink-soft); letter-spacing: .02em;
}
.arrival__note {
  margin: 0 auto 1.8rem; max-width: 40ch; text-align: center;
  font-family: var(--font-serif); font-size: 1.05rem; line-height: 1.7;
  color: var(--c-ink);
}
.arrival__private {
  margin: 0 auto 1.6rem; max-width: 36ch; text-align: center;
  font-family: var(--font-serif); font-style: italic; font-size: .9rem;
  color: var(--c-ink-soft);
  padding: .9rem 1.1rem;
  border-top: 1px dashed var(--c-line);
  border-bottom: 1px dashed var(--c-line);
}
.arrival__photo {
  margin: 0 auto 2rem; max-width: 300px;
  background: var(--c-photo-paper, #fff);
  padding: 10px 10px 36px;
  box-shadow: var(--shadow-paper);
  transform: rotate(-1.5deg);
}
.arrival__photo img { display: block; width: 100%; height: auto; }

.arrival__welcome {
  max-width: 440px; margin: 2.5rem auto 0;
  padding-top: 1.6rem;
  border-top: 1px solid var(--c-line);
}
.arrival__welcome-h {
  font-family: var(--font-script); font-weight: 400;
  font-size: clamp(1.6rem, 4.6vw, 2.2rem);
  line-height: 1.05; color: var(--c-ink); margin: 0 0 .4rem;
  text-align: center;
}
.arrival__welcome-lede {
  margin: 0 0 1.4rem; text-align: center;
  font-family: var(--font-serif); font-style: italic; font-size: .95rem;
  color: var(--c-ink-soft);
}
.arrival__welcome .field { margin-bottom: 1rem; }
.arrival__welcome .btn { width: 100%; }
.arrival__thanks {
  margin: 1.2rem 0 0; text-align: center;
  font-family: var(--font-serif); font-style: italic; color: var(--c-ink-soft);
}

@media (prefers-reduced-motion: no-preference) {
  .collage.is-revealed .piece--arrival {
    animation: arrive-in .7s cubic-bezier(.22, .9, .27, 1.02) both;
    animation-delay: calc(.4s + var(--i, 8) * .06s);
  }
  @keyframes arrive-in {
    from { opacity: 0; transform: translate(6%, -10%) rotate(14deg); }
    to   { opacity: 1; transform: translate(0, 0) rotate(5.5deg); }
  }
}

/* photo frames + placeholders */
.photo-frame { position: relative; display: block; overflow: hidden; background-color: var(--c-paper); background-color: color-mix(in srgb, var(--c-ink-soft) 18%, var(--c-paper)); }
.photo-frame img { height: auto; }
.photo-frame__mono { font-family: var(--font-serif); font-style: normal; font-weight: 600; font-size: 1.6em; letter-spacing: .12em; text-transform: uppercase; opacity: .55; }
.photo-frame img { width: 100%; height: 100%; object-fit: cover; }
.photo-frame__placeholder {
  display: none; position: absolute; inset: 0; place-items: center; padding: .5rem;
  font-family: var(--font-serif); font-style: italic; font-size: .8rem; letter-spacing: .04em; color: var(--c-ink);
  background-image: repeating-linear-gradient(135deg, transparent 0 7px, color-mix(in srgb, var(--c-ink-soft) 9%, transparent) 7px 8px);
}
.photo-frame.is-empty .photo-frame__placeholder { display: grid; }
.photo-frame.is-empty img { display: none; }

.home__hint {
  text-align: center; font-style: italic; font-size: .9rem; color: var(--c-ink-soft);
  margin: .5rem 1rem 1.5rem;
}

/* ---------- desktop: landscape table, 100 : 58 ---------- */
@media (min-width: 1024px) {
  .stage { max-width: 1160px; padding: 0 2rem; }
  .stage { --u: calc((min(100vw, 1160px) - 4rem) / 100); }
  @supports (width: 1cqi) { .stage { --u: 1cqi; } }
  .collage { --top: 18; height: calc((56 + var(--top)) * var(--u)); }
  .piece, .decor {
    left: calc(var(--dx, var(--x)) * var(--u));
    top: calc((var(--dy, var(--y)) + var(--top)) * var(--u));
    width: calc(var(--dw, var(--w)) * var(--u));
    transform: rotate(var(--dr, var(--r, 0deg)));
  }
  .piece { height: calc(var(--dh, var(--h)) * var(--u)); --pw: var(--dw, var(--w)); }
  .decor { transform: rotate(var(--dr, var(--r, 0deg))) scaleX(var(--flip, 1)); }
  .decor.is-mobile-only { display: none; }
  .home__hint { margin-top: 1rem; }
}

/* =====================================================================
   COUNTDOWN — a full-bleed strip of card stock, 1deg off square, with four ticket stubs
   ===================================================================== */
.countdown-band { position: relative; overflow: hidden; overflow: clip; padding: 2.75rem 0 1.5rem; }
/* garland laid across the band's top edge */
.countdown__garland {
  position: absolute; z-index: 2; left: -6%; top: 2.75rem; width: 112%; max-width: none; height: auto;
  transform: translateY(-45%); pointer-events: none;
}
.countdown { position: relative; z-index: 1;
  width: 120%; margin-left: -10%;
  transform: rotate(-1deg);
  padding: 2rem 10% 2.25rem;
  background-color: var(--c-primary);
  color: var(--c-on-primary);
  text-align: center;
}
.countdown__line { font-family: var(--font-script); font-size: clamp(2rem, 8vw, 3rem); line-height: 1.1; margin-bottom: 1.1rem; padding: 0 1rem; }
.countdown__grid {
  display: flex; justify-content: center; gap: 2.5%;
  font-variant-numeric: tabular-nums lining-nums;
}
.countdown__unit {
  display: flex; flex-direction: column; align-items: center;
  width: 25%; max-width: 128px; padding: .8rem .25rem .7rem;
  background-color: var(--c-paper); color: var(--c-ink);
  /* perforated left edge */
  -webkit-mask: radial-gradient(circle 3px at 0 50%, transparent 98%, #000 100%) 0 0 / 100% 10px repeat-y, linear-gradient(#000 0 0) 6px 0 / calc(100% - 6px) 100% no-repeat;
          mask: radial-gradient(circle 3px at 0 50%, transparent 98%, #000 100%) 0 0 / 100% 10px repeat-y, linear-gradient(#000 0 0) 6px 0 / calc(100% - 6px) 100% no-repeat;
}
.countdown__unit:nth-child(1) { transform: rotate(-1.5deg); }
.countdown__unit:nth-child(2) { transform: rotate(1deg); }
.countdown__unit:nth-child(3) { transform: rotate(-.5deg); }
.countdown__unit:nth-child(4) { transform: rotate(1.5deg); }
.countdown__grid.has-seconds .countdown__unit { width: 21%; max-width: 120px; }
.countdown__done {
  display: inline-block; margin: .25rem auto 0; padding: .6rem 1.4rem .5rem;
  background-color: var(--c-paper); color: var(--c-ink); transform: rotate(-1.5deg);
  font-size: .8rem; letter-spacing: .22em; text-transform: uppercase;
}
.countdown__num { font-size: clamp(1.6rem, 7.5vw, 3.25rem); line-height: 1; letter-spacing: -.02em; white-space: nowrap; }
.countdown__label { margin-top: .4rem; font-size: min(.6875rem, 2.7vw); letter-spacing: .12em; text-transform: uppercase; color: var(--c-ink-soft); }
.countdown-band .countdown__label { letter-spacing: .08em; font-size: min(.6875rem, 2.6vw); }
@media (min-width: 600px) {
  .countdown { width: 104%; margin-left: -2%; }
}
@media (min-width: 1024px) {
  .countdown-band { padding-top: 5.5rem; }
  .countdown__garland { top: 5.5rem; left: 50%; width: auto; max-height: 170px; max-width: 112%; transform: translate(-50%, -45%); }
}

.home__foot { max-width: 520px; margin: 1.25rem auto 0; padding: 0 1rem; text-align: center; font-size: .9rem; color: var(--c-ink-soft); }
.home__foot-note { margin-bottom: 1rem; font-style: italic; }
.credit { font-size: .75rem; font-variant: small-caps; letter-spacing: .14em; text-transform: lowercase; }
.credit a { color: inherit; text-decoration: none; border-bottom: 1px solid currentColor; display: inline-block; padding: .65rem 0 .1rem; }

/* =====================================================================
   PAGES
   ===================================================================== */
.view { min-height: 100vh; padding: 12px 0 2rem; }
.page {
  position: relative;
  max-width: 640px; margin: 0 12px;
  padding: 1rem 24px 72px;
  background-color: var(--c-paper);
  color: var(--c-ink);
  box-shadow: var(--shadow-paper);
  animation: page-in .38s var(--ease-paper) backwards;
}
@media (min-width: 664px) { .page { margin: 0 auto; padding: 1.5rem 56px 96px; } .view { padding-top: 32px; } }
@keyframes page-in { from { opacity: 0; translate: 0 24px; } }
.page__bar { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin: -.25rem -.5rem 1.25rem; }
.page__back {
  display: inline-flex; align-items: center; gap: .3rem; min-height: 44px; padding: .4rem .5rem;
  background: none; border: 0; cursor: pointer;
  font-family: var(--font-serif); font-size: .78rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--c-ink-soft); text-decoration: none;
}
.page__back:hover span { text-decoration: underline; text-underline-offset: .3em; }
.page__sprig { display: block; width: 110px; height: auto; margin: .6rem auto 0; }
@media (min-width: 1024px) { .page__sprig { width: 140px; } }
.page__head { text-align: center; margin-bottom: 1.75rem; }
.page__kicker { margin-bottom: .6rem; font-size: .75rem; letter-spacing: .26em; text-transform: uppercase; color: var(--c-ink-soft); }
.page__title { font-family: var(--font-script); font-weight: 400; font-size: 3.4rem; line-height: 1.1; color: var(--c-primary); margin-top: .25rem; }
.page__title:focus { outline: none; }
.page__section { margin: 0 0 2.25rem; }
.page__h {
  display: flex; align-items: center; gap: .75rem;
  font-family: var(--font-serif); font-weight: 500; font-size: .8rem; letter-spacing: .26em; text-transform: uppercase;
  color: var(--c-accent); margin-bottom: 1rem;
}
.page__h::after { content: ""; flex: 1; height: 1px; background: currentColor; opacity: .3; }
.page__soft, .page__fine { color: var(--c-ink-soft); }
.page__fine { font-size: .8rem; margin-top: .5rem; }
.page__lede { font-size: 1.1rem; text-align: center; margin-bottom: .75rem; }
.page__notice { font-size: .9rem; padding: .75rem 1rem; border: 1px dashed var(--c-ink-soft); color: var(--c-ink-soft); }
.page__cta { text-align: center; }

/* details: when */
.page__when { padding: 1.75rem 1.25rem 1.25rem; text-align: center; transform: rotate(-.6deg); }
.when__weekday { font-size: .78rem; letter-spacing: .26em; text-transform: uppercase; color: var(--c-ink-soft); }
.when__date { font-size: 1.6rem; line-height: 1.3; margin: .25rem 0; }
.when__month { font-family: var(--font-script); font-size: 2.4rem; color: var(--c-primary); }
.when__time { font-size: .9rem; letter-spacing: .14em; text-transform: uppercase; margin-bottom: 1rem; }
.when__cal { display: flex; flex-direction: column; align-items: center; gap: .25rem; }
.when__gcal { display: inline-flex; align-items: center; min-height: 44px; font-size: .9rem; color: var(--c-ink-soft); text-underline-offset: .25em; }

/* timeline */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 5.1rem; top: .5rem; bottom: .5rem; width: 1px; background: var(--c-ink-soft); opacity: .4; }
.timeline__item { display: grid; grid-template-columns: 4.4rem 1fr; gap: 1.4rem; padding: .55rem 0; position: relative; }
.timeline__item::before {
  content: ""; position: absolute; left: calc(5.1rem - 4px); top: 1.05rem; width: 9px; height: 9px; border-radius: 50%;
  background: var(--c-page); border: 1px solid var(--c-accent);
}
.timeline__time { text-align: right; font-size: .85rem; letter-spacing: .06em; padding-top: .2rem; color: var(--c-ink-soft); font-variant-numeric: tabular-nums; }
.timeline__body { display: flex; flex-direction: column; }
.timeline__title { font-size: 1.15rem; }
.timeline__place, .timeline__note { font-size: .9rem; color: var(--c-ink-soft); }
.timeline__note { font-style: italic; }

.venue__name { font-size: 1.35rem; }
.venue__addr { font-style: normal; color: var(--c-ink-soft); margin: .2rem 0 .5rem; white-space: pre-line; }
.venue__note { font-size: .95rem; margin-bottom: 1rem; }
.notes { margin: 0; padding-left: 1.1rem; }
.notes li { margin-bottom: .5rem; }
.notes li::marker { color: var(--c-accent); }
/* A registry query string must not widen the Details sheet on a small phone. */
.page .note-link { overflow-wrap: anywhere; word-break: normal; }

/* Gift-registry pills on the Details page. One per registry note. The brand
   label comes from the author's text prefix when present, else from a known
   hostname, else from the hostname itself. */
.registry { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .55rem; }
.registry li { margin: 0; }
.registry__link {
  display: inline-flex; flex-direction: column; align-items: flex-start; gap: .15rem;
  min-height: 48px; padding: .55rem .95rem;
  border: 1px solid color-mix(in srgb, var(--c-ink-soft) 55%, transparent);
  background: color-mix(in srgb, var(--c-paper) 68%, #fff);
  color: var(--c-ink); text-decoration: none;
  border-radius: 1px;
  transition: background-color .18s ease, border-color .18s ease, translate .18s ease;
}
.registry__link:hover { translate: 0 -1px; border-color: var(--c-accent); background: color-mix(in srgb, var(--c-paper) 50%, #fff); }
.registry__link:focus-visible { outline: 2px solid var(--c-focus); outline-offset: 2px; }
.registry__brand { font-family: var(--font-serif, var(--c-font-serif, inherit)); font-size: 1rem; line-height: 1.1; letter-spacing: .005em; }
.registry__host { font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--c-ink-soft); overflow-wrap: anywhere; }

/* "Who Knows Mom Best?" — self-scored trivia. One question at a time. */
.page__cta--soft { text-align: center; margin-top: 1.1rem; }
.quiz__lede { text-align: center; font-size: .95rem; color: var(--c-ink-soft); margin: 0 auto 1.4rem; max-width: 34ch; }
.quiz__progress { text-align: center; font-size: .72rem; letter-spacing: .18em; text-transform: uppercase; color: var(--c-ink-soft); margin: 0 0 .5rem; }
.page h2.quiz__q, .quiz__q {
  font-family: var(--font-serif, inherit);
  font-weight: 400;
  font-style: italic;
  font-size: clamp(1.25rem, 4.2vw, 1.6rem);
  line-height: 1.3; text-align: center;
  letter-spacing: normal; text-transform: none;
  color: var(--c-ink);
  max-width: 28ch; margin: 0 auto 1.6rem;
}
.quiz__form { display: grid; gap: .9rem; max-width: 420px; margin: 0 auto; }
.quiz__input {
  font-family: var(--font-serif, inherit); font-size: 1.125rem; color: var(--c-ink);
  background: transparent; border: 0;
  border-bottom: 1.5px solid var(--c-ink-soft); border-radius: 0;
  min-height: 48px; padding: .5rem .125rem; text-align: center;
}
.quiz__input:focus { outline: none; border-bottom-color: var(--c-primary); }
.quiz__input:read-only { opacity: .65; border-bottom-style: dashed; }
.quiz__reveal { margin-top: 1.6rem; display: grid; gap: 1rem; max-width: 420px; margin-left: auto; margin-right: auto; }
.quiz__mom {
  text-align: center;
  font-family: var(--font-serif, inherit); font-size: 1.125rem; color: var(--c-ink);
  padding: 1.1rem 1rem; border-radius: var(--radius-paper, 3px);
  background: color-mix(in srgb, var(--c-paper-2, var(--c-paper)) 85%, transparent);
  border: 1px dashed color-mix(in srgb, var(--c-primary) 45%, transparent);
}
.quiz__mom small {
  display: block; font-family: var(--font-sans, inherit); font-weight: 700;
  font-size: .7rem; letter-spacing: .2em; text-transform: uppercase;
  color: var(--c-ink-soft); margin-bottom: .35rem;
}
.quiz__mom strong { font-weight: 400; font-family: var(--font-script, var(--font-serif, inherit)); font-size: 1.6rem; color: var(--c-primary); }
.quiz__choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; }
.quiz__choice { min-height: 44px; }
.quiz__finish { text-align: center; padding: 1.4rem 0; }
.quiz__finish-title { font-family: var(--font-script, var(--font-serif, inherit)); font-size: clamp(2rem, 6vw, 2.6rem); color: var(--c-primary); margin: 0 0 .6rem; }
.quiz__finish-line { font-family: var(--font-serif, inherit); font-size: 1.05rem; color: var(--c-ink); margin: 0 auto; max-width: 30ch; line-height: 1.5; }
@media (max-width: 420px) {
  .quiz__choices { grid-template-columns: 1fr; }
}

/* Padrinos — honor roll of chosen padrinos / padrinazgo roles.
   Each card: small-caps role above a script-sized name, optional italic note.
   The page reads as a ceremonial page from a wedding or baptism program. */
.padrinos__lede { text-align: center; font-size: 1rem; color: var(--c-ink-soft); margin: 0 auto 1.8rem; max-width: 36ch; line-height: 1.6; font-style: italic; }
.padrinos__list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.4rem; }
.padrinos__card {
  display: grid; gap: .3rem; text-align: center;
  padding: 1.4rem 1.2rem 1.6rem;
  background: color-mix(in srgb, var(--c-paper-2, var(--c-paper)) 75%, transparent);
  border-radius: var(--radius-paper, 3px);
  border: 1px solid color-mix(in srgb, var(--c-foil, var(--c-primary)) 30%, transparent);
}
.padrinos__role {
  font-family: var(--font-sans, inherit);
  font-size: .72rem; letter-spacing: .22em; text-transform: uppercase;
  color: var(--c-ink-soft); margin: 0 0 .2rem;
}
.page h3.padrinos__name, .padrinos__name {
  font-family: var(--font-script, var(--font-serif, inherit));
  font-weight: 400; font-style: normal;
  font-size: clamp(1.6rem, 5vw, 2rem); line-height: 1.1;
  color: var(--c-primary);
  letter-spacing: normal; text-transform: none;
  margin: 0;
}
.padrinos__note {
  font-family: var(--font-serif, inherit);
  font-style: italic; font-size: .95rem; line-height: 1.5;
  color: var(--c-ink); margin: .4rem 0 0; max-width: 24ch; margin-inline: auto;
}
@media (max-width: 520px) {
  .padrinos__list { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
  .padrinos__card { padding: 1.2rem 1rem 1.3rem; }
}

/* RSVP form */
.rsvp__deadline { text-align: center; font-size: .8rem; letter-spacing: .18em; text-transform: uppercase; color: var(--c-ink-soft); margin-bottom: 1.5rem; }
.rsvp-form { padding: 1.5rem 1.25rem 1.75rem; }
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.field { margin: 0 0 1.35rem; padding: 0; border: 0; min-width: 0; }
.field__label { display: block; font-size: .8rem; letter-spacing: .14em; text-transform: uppercase; margin-bottom: .45rem; padding: 0; }
.field__opt { text-transform: none; letter-spacing: 0; color: var(--c-ink-soft); font-style: italic; }
.field__hint { font-size: .85rem; color: var(--c-ink-soft); margin: -.2rem 0 .5rem; }
:where(.field) :where(input:not([type=radio]):not([type=checkbox]), select, textarea) {
  display: block; width: 100%; min-height: 48px;
  padding: .65rem .8rem;
  font: inherit; font-size: 1.05rem; color: var(--c-ink);
  background: #fff; background: color-mix(in srgb, var(--c-paper) 70%, #fff);
  border: 1px solid var(--c-ink-soft); border: 1px solid color-mix(in srgb, var(--c-ink-soft) 60%, transparent);
  border-radius: 1px;
}
:where(.field) textarea { resize: vertical; min-height: 6rem; }
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible { outline: 2px solid var(--c-focus); outline-offset: 1px; }
:where(.field.is-invalid) :where(input, select, textarea) { border-color: #8e1b1b; border-bottom-width: 2px; }
.field__error { color: var(--c-accent); font-size: .9rem; margin-top: .4rem; font-style: italic; }
.choices { display: grid; gap: .5rem; }
.choice {
  display: flex; align-items: center; gap: .75rem; min-height: 48px; padding: .55rem .8rem;
  border: 1px solid var(--c-line); border: 1px solid color-mix(in srgb, var(--c-ink-soft) 50%, transparent); cursor: pointer;
}
.choice input { width: 1.15rem; height: 1.15rem; margin: 0; accent-color: var(--c-accent); flex: none; }
.choice.is-checked { border-color: var(--c-accent); }
.choice:has(input:checked) { border-color: var(--c-accent); background: color-mix(in srgb, var(--c-accent) 8%, transparent); }
.choices--tickets { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .75rem; }
.choices--tickets .choice {
  position: relative; justify-content: center; text-align: center; min-height: 64px; padding: .75rem .4rem; overflow-wrap: anywhere; hyphens: auto;
  background-color: var(--c-paper); box-shadow: var(--shadow-paper);
  transition: transform .2s var(--ease-paper), background-color .2s;
}
.choices--tickets .choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choices--tickets .choice.is-checked, .choices--tickets .choice:has(input:checked) {
  background-color: var(--c-paper-2); color: var(--c-on-paper-2);
  box-shadow: inset 0 0 0 2px var(--c-accent), var(--shadow-paper); transform: rotate(1.5deg);
}
.choices--tickets .choice:has(input:focus-visible) { outline: 2px dashed var(--c-focus); outline-offset: 4px; }
.form__summary, .form__send-error { color: var(--c-accent); font-style: italic; margin-bottom: 1rem; }
.form__actions { text-align: center; margin-top: 1.75rem; }
.form__send-error { margin: 1rem 0 0; }
.btn--submit { width: 100%; }

.rsvp-thanks { padding: 2.5rem 1.5rem 2rem; text-align: center; display: grid; justify-items: center; gap: 1rem; }
.rsvp-thanks:focus { outline: none; }
.seal--thanks { width: 72px; --seal-size: 72px; }
.page .rsvp-thanks__title { letter-spacing: 0; text-transform: none; font-variant: normal; font-family: var(--font-script); font-weight: 400; font-size: 2.6rem; color: var(--c-primary); }
.demo-note { font-size: .82rem; }

/* Story */
.story__text p { margin-bottom: 1rem; font-size: 1.12rem; line-height: 1.65; }
.story__text p:first-child::first-letter {
  font-family: var(--font-script); font-size: 3.5em; float: left; line-height: .82;
  margin: .06em .14em 0 0; padding: 0 .04em; color: var(--c-primary);
}
@supports (initial-letter: 3) or (-webkit-initial-letter: 3) {
  .story__text p:first-child::first-letter { float: none; font-size: 1em; line-height: inherit; margin: 0 .16em 0 0; -webkit-initial-letter: 3; initial-letter: 3; }
}
.story__signoff { font-family: var(--font-script); font-size: 1.9rem; text-align: right; margin: -1rem 0 2rem; color: var(--c-primary); }
.gallery { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem .9rem; align-items: start; }
@media (min-width: 664px) { .gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.5rem 1rem; } .gallery__item:last-child:nth-child(odd) { grid-column: auto; width: auto; } }
.gallery__item { position: relative; transform: rotate(var(--r, 0deg)); padding: 6% 6% 0; }
.gallery__item:last-child:nth-child(odd) { grid-column: span 2; width: calc(50% - .45rem); justify-self: center; }
.gallery__photo { aspect-ratio: 4 / 5; }
.gallery__item .polaroid__caption { font-size: 1.15rem; min-height: 2.4rem; padding: .45rem 0 .5rem; }
.gallery__item:not(:has(.polaroid__caption)) { padding-bottom: 1.6rem; }
.gallery__photo img { aspect-ratio: 4 / 5; object-fit: cover; }

/* =====================================================================
   DEMO LIST
   ===================================================================== */
.demos { max-width: 520px; margin: 0 auto; padding: 3.5rem 1.25rem 4rem; }
.demos__missing { margin-bottom: 2.5rem; padding: 1rem 1.1rem; border-left: 3px solid var(--c-accent); }
.demos__missing h1 { font-size: 1.4rem; font-weight: 500; margin-bottom: .3rem; }
.demos__title { font-family: var(--font-script); font-weight: 400; font-size: 3rem; line-height: 1.1; color: var(--c-primary); }
.demos__intro { color: var(--c-ink-soft); margin: .4rem 0 2rem; }
.demos__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
.demos__item { rotate: var(--r); }
.demos__link {
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap;
  padding: 1.1rem 1.25rem; min-height: 56px; text-decoration: none;
  background: var(--c-paper); box-shadow: var(--shadow-paper);
}
.demos__label { font-size: 1.25rem; }
.demos__meta { font-size: .72rem; letter-spacing: .18em; text-transform: uppercase; color: var(--c-ink-soft); }

/* =====================================================================
   WIDER SCREENS — the collage stays a phone-sized object centred on the page
   ===================================================================== */
@media (min-width: 600px) {
  .home { padding-top: 2rem; }
  .countdown { border-radius: var(--radius-paper); box-shadow: var(--shadow-paper); }
  .page { padding-top: 2rem; }
}

/* =====================================================================
   REDUCED MOTION
   ===================================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; transition-delay: 0s !important; }
  .collage.is-revealed .piece, .collage.is-revealed .decor { animation: none; }
  .opening__hint { animation: none; }
}

.field--check .choice__label { text-align: left; }

/* =====================================================================
   NEUTRAL STATES (not found / not published), PREVIEW, FALLING SCATTER
   ===================================================================== */
.neutral { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 2rem 1rem; }
.neutral__card {
  max-width: 30rem; padding: 2.5rem 1.75rem; text-align: center;
  background: var(--c-paper); box-shadow: var(--shadow-paper); transform: rotate(-.8deg);
}
.neutral__title { font-family: var(--font-serif); font-weight: 500; font-size: 1.5rem; line-height: 1.25; margin-bottom: .75rem; }
.neutral__alt { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--c-line); font-size: .9rem; color: var(--c-ink-soft); }
.neutral__dev { margin-top: 1.5rem; font-size: .8rem; }

.preview-replay {
  position: fixed; z-index: 70; left: .5rem; top: .5rem; min-height: 36px; padding: .3rem .7rem; opacity: .9;
  background: var(--c-paper); color: var(--c-ink); border: 1px solid var(--c-line); border-radius: 3px;
  font-family: var(--font-serif); font-size: .78rem; letter-spacing: .12em; text-transform: uppercase;
  box-shadow: var(--shadow-paper); cursor: pointer;
}

.scatter-fall { position: fixed; inset: 0; z-index: 55; pointer-events: none; overflow: hidden; }
.scatter-fall__piece { position: absolute; top: 0; height: auto; }

/* =====================================================================
   OLD SAFARI (iOS < 16): no container units — px/vw approximations for the type inside pieces
   ===================================================================== */
@supports not (width: 1cqi) {
  .piece--invite .invite__line { font-size: 11px; }
  .invite__name { font-size: min(9.5vw, 46px); }
  .invite__amp { font-size: 20px; }
  .invite__sub { font-size: 13px; }
  .invite__body { gap: 12px; }
  .piece--date :is(.date__weekday, .date__year, .date__time) { font-size: 11px; }
  .date__day { font-size: min(13vw, 60px); }
  .date__month { font-size: min(6.5vw, 30px); }
  .piece--date .date__venue { font-size: 10px; }
  .tag__kicker { font-size: 11px; }
  .tag__main { font-size: min(7.5vw, 36px); }
  .rsvp__kicker { font-size: min(8vw, 36px); }
  .rsvp__main { font-size: 12px; }
  .rsvp__by { font-size: 13px; }
  .polaroid__caption { font-size: 16px; min-height: 2.6em; padding: .4em 0 .6em; }
  .seal__mono { font-size: min(4.5vw, 22px); }
}

/* =====================================================================
   PRINT — a clean paper copy of whatever is on screen
   ===================================================================== */
@media print {
  @page { margin: 12mm; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body { background: #fff; min-height: 0; }
  .opening, .scatter-fall, .preview-replay, .lang-switch, .page__back, .home__hint, .countdown-band,
  .rsvp-form, .page__cta, .when__cal, .page__fine, .form__actions, .credit a::after { display: none !important; }
  .home.is-sealed { visibility: visible; }
  .collage .piece, .collage .decor { visibility: visible !important; animation: none !important; }
  .stage { max-width: 150mm; overflow: visible; }
  .page { box-shadow: none; margin: 0 auto; max-width: none; padding: 0; animation: none; }
  .page__section, .timeline__item, .gallery__item { break-inside: avoid; }
  a[href^="http"].btn::after { content: " " attr(href); font-size: .7rem; text-transform: none; letter-spacing: 0; }
}

/* =====================================================================
   MOTION ONLY — material/stock/ink rules belong to the material block.
   Paint shadows once, then composite their opacity and transforms.
   ===================================================================== */
.opening.is-opening .envelope,
.opening.is-opening .envelope__letter { transition: none; }
.opening.is-opening .opening__hint { animation: none; }
.opening.is-opening .envelope__flap,
.opening.is-opening .envelope__letter,
.opening.is-opening .seal--envelope { will-change: transform; }
.opening.is-primed .envelope__flap,
.opening.is-primed .envelope__letter,
.opening.is-primed .seal--envelope { will-change: transform; }
/* Chrome drops the pocket's V clip-path while the flap's 3D animation re-sorts layers, so the
   pocket briefly covers the letter (the "card glitches as it comes out" bug). Its own layer keeps the clip. */
.opening .envelope__pocket { will-change: transform; }
.envelope__flap-shade, .envelope__cast-shadow, .seal__release { opacity: 0; pointer-events: none; }
/* The default long collage stagger is lovely on replay, but an opening is a
   single gesture: all stationery has landed within about 2.4 seconds. */
.collage.is-opening-reveal.is-revealed .piece,
.collage.is-opening-reveal.is-revealed .decor {
  animation-duration: .36s;
  animation-delay: calc(min(var(--i, 0), 9) * 28ms);
}
@media (prefers-reduced-motion: reduce) {
  .opening.is-opening .envelope,
  .opening.is-opening .envelope__flap,
  .opening.is-opening .envelope__letter,
  .opening.is-opening .seal--envelope { will-change: auto; }
}
/* END MOTION ONLY */

/* =====================================================================
   ENVELOPE MATERIAL — original matte stock, folded sheets, upper-left light.
   No timeline/transforms here: the motion block and app.js own movement.
   ===================================================================== */
.envelope {
  /* Pre-rendered tile of the fibre texture (source: design note in app history). A filter-based SVG
     here was re-computed on every repaint and made the opening stutter. 270px image shown at 180px. */
  --env-fiber: image-set(url("assets/shared/env-fiber.webp") 1.5x);
  --env-stock-light: rgba(255, 246, 219, .11);
  --env-fold-ink: rgba(58, 39, 24, .23);
  --env-shadow: 0 1px 1px rgba(42, 31, 18, .26),
    2px 4px 5px -3px rgba(42, 31, 18, .27),
    7px 13px 22px -13px rgba(42, 31, 18, .36);
}
.opening > .envelope, .collage .piece--envelope {
  background-image: var(--env-fiber), linear-gradient(133deg, var(--env-stock-light), transparent 46%, rgba(46, 30, 17, .06));
  background-size: 180px 180px, 100% 100%;
  background-blend-mode: normal;
  border-radius: 2.8px 3.2px 2.6px 3.4px;
  box-shadow: var(--env-shadow);
}
.opening > .envelope:hover, .collage .piece--envelope:hover {
  box-shadow: var(--env-shadow);
}
/* The liner is its own lighter sheet inside the back, not ink on the stock.
   It runs underneath the mouth; no wide stock stripe bisects the printing. */
.envelope::before {
  content: ''; position: absolute; inset: -.5px 3.8% auto; height: 66%;
  background: linear-gradient(180deg, rgba(58, 39, 24, .08), transparent 12%),
    var(--envelope-liner-image) center bottom / 100% 194% no-repeat, var(--envelope-interior, #e9dcc4);
  clip-path: polygon(0 0, 100% 0, 100% 15%, 51% 99%, 49% 99%, 0 15%);
  pointer-events: none; z-index: 0; filter: saturate(.82) contrast(.96);
}
.piece--envelope .envelope__flap-open { bottom: calc(100% - 1px); }
/* A very subtle pressure dimple beneath the seal — just enough to anchor the wax, not a smudge.
   Fades out with the opening so it doesn't linger after the seal is gone. */
.opening > .envelope::after {
  content: ''; position: absolute; left: 38%; top: 44%; width: 24%; height: 32%;
  z-index: 3; pointer-events: none;
  background: radial-gradient(ellipse at 50% 50%, rgba(49, 32, 19, .05), transparent 60%);
  transition: opacity .3s ease-out;
}
.opening.is-opening > .envelope::after { opacity: 0; }
.envelope__back {
  background-color: var(--envelope-interior, #e9dcc4);
  background-image: var(--env-fiber), linear-gradient(160deg, rgba(255, 248, 225, .13), rgba(58, 39, 24, .08));
  background-size: 180px 180px, 100% 100%;
  border-radius: inherit;
  box-shadow: inset 1px 1px .7px rgba(255, 246, 219, .27), inset -1px -1px .7px rgba(49, 32, 19, .22);
  z-index: -1;
}
.envelope__pocket {
  background-color: var(--c-envelope);
  background-image: var(--env-fiber), linear-gradient(112deg, rgba(255, 246, 219, .035), rgba(49, 32, 19, .075));
  background-size: 180px 180px, 100% 100%;
  clip-path: polygon(0 0, 49.5% 54%, 50.5% 54%, 100% 0, 100% 100%, 0 100%);
  filter: none;
  box-shadow: inset -1px -1.3px 1px rgba(49, 32, 19, .17);
}
/* Left side folded over the right; the lower sheet overlaps both.
   Double hairline at the join = a lit paper edge beside its glue shadow. */
.envelope__pocket::before, .envelope__pocket::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-color: var(--c-envelope);
  background-size: 180px 180px, 100% 100%, 100% 100%;
}
.envelope__pocket::before {
  clip-path: polygon(0 0, 52% 56%, 0 100%);
  background-image: var(--env-fiber), linear-gradient(129deg, rgba(255, 246, 219, .09), rgba(58, 39, 24, .035));
}
.envelope__pocket::after {
  clip-path: polygon(0 100%, 49.5% 45%, 50.6% 45.3%, 100% 100%);
  background-image: var(--env-fiber),
    linear-gradient(138deg, transparent 49.55%, rgba(255, 246, 219, .18) 49.8%, rgba(58, 39, 24, .14) 50.15%, transparent 50.6%),
    linear-gradient(222deg, transparent 49.55%, rgba(255, 246, 219, .15) 49.8%, rgba(58, 39, 24, .12) 50.15%, transparent 50.6%),
    linear-gradient(155deg, rgba(255, 246, 219, .08), transparent 65%, rgba(58, 39, 24, .045));
  background-size: 180px 180px, 50% 100%, 50% 100%, 100% 100%;
  background-position: 27px 11px, left bottom, right bottom, center;
  background-repeat: repeat, no-repeat, no-repeat, no-repeat;
}
.envelope__flap-face { clip-path: polygon(0 0, 100% 0, 51% 99.4%, 50% 100%, 49% 99.4%); }
.envelope__flap-front {
  filter: none;
  background-image: var(--env-fiber), linear-gradient(155deg, rgba(255, 246, 219, .15), transparent 60%, rgba(58, 39, 24, .05));
  background-size: 180px 180px, 100% 100%;
  box-shadow: inset 0 .8px .5px rgba(255, 246, 219, .25);
}
.envelope__flap-front::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 62' preserveAspectRatio='none'%3E%3Cpath d='M0 .5L49 61.2Q50 62 51 61.2L100 .5' fill='none' stroke='%233a2718' stroke-opacity='.20' stroke-width='.45'/%3E%3Cpath d='M0 0L49 60.7Q50 61.5 51 60.7L100 0' fill='none' stroke='%23fff6db' stroke-opacity='.20' stroke-width='.2'/%3E%3C/svg%3E") center / 100% 100%;
}
.envelope__flap-back, .piece--envelope .envelope__flap-open {
  background-color: var(--envelope-interior, #e9dcc4);
  background-image: var(--env-fiber), linear-gradient(155deg, rgba(255, 246, 219, .16), transparent 50%, rgba(58, 39, 24, .065));
  background-size: 180px 180px, 100% 100%;
  clip-path: polygon(0 100%, 100% 100%, 51% .6%, 50% 0, 49% .6%);
  filter: none;
}
.envelope__flap-back .envelope__flap-liner,
.piece--envelope .envelope__flap-open .envelope__flap-liner {
  clip-path: polygon(3.8% 100%, 96.2% 100%, 51% 8%, 49.4% 7.7%);
  background: var(--envelope-interior, #e9dcc4);
}
.envelope__flap-liner img {
  position: absolute; top: 0; left: 0; width: 100%; height: 206.45%;
  object-fit: fill; filter: saturate(.82) contrast(.96);
}
.envelope__flap-liner::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: var(--env-fiber), linear-gradient(180deg, rgba(255, 242, 215, .055), transparent 72%, rgba(58, 39, 24, .09));
  background-size: 180px 180px, 100% 100%;
  box-shadow: inset 0 0 1px rgba(58, 39, 24, .22);
}
.envelope__hinge {
  left: 3.8%; right: 3.8%; height: 1px; top: 0;
  background: rgba(58, 39, 24, .16);
  box-shadow: none;
}
.envelope__cast-shadow {
  position: absolute; left: 3%; right: 1%; top: 4%; height: 58%; z-index: 1;
  background: radial-gradient(ellipse at 52% 5%, rgba(44, 28, 16, .22), transparent 70%);
  transform-origin: center top;
}
/* Softer shade gradients: the flap must still read as its envelope colour mid-lift. */
.envelope__flap-shade {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(40, 27, 17, .22), rgba(40, 27, 17, .07) 52%, transparent);
}
.envelope__flap-back .envelope__flap-shade {
  background: linear-gradient(0deg, rgba(40, 27, 17, .18), transparent 72%);
}
.opening .seal--envelope {
  filter: drop-shadow(.6px 1.3px .6px rgba(47, 29, 16, .25)) drop-shadow(2px 3px 2px rgba(47, 29, 16, .14));
}
/* The seal-release crack: thinner and lighter so when it flashes it reads as a hairline, not a wedge. */
.seal__release {
  position: absolute; inset: 26% 24% 23%; z-index: 3;
  clip-path: polygon(48% 16%, 48.6% 40%, 51.5% 50%, 49% 68%, 50.6% 84%, 50% 84%, 48.4% 68%, 51% 50%, 47.5% 40%, 46.6% 16%);
  background: rgba(63, 34, 22, .15);
}
.envelope__letter-shadow {
  position: absolute; left: 6%; right: 6%; top: 6%; height: 86%; z-index: 0;
  border-radius: 2px; pointer-events: none; opacity: 0;
  box-shadow: 2px 5px 9px rgba(47, 32, 19, .20), 6px 13px 20px -5px rgba(47, 32, 19, .12);
}
/* END ENVELOPE MATERIAL */

/* A light folded tracing sheet, not frosted glass. Ink stays above the vellum
   so the names retain their original contrast; only the tied thread crosses it. */
.collage .piece--invite { border: 0; cursor: pointer; overflow: visible; }
.piece--invite .invite__body { position: relative; z-index: 2; pointer-events: none; }
.vellum {
  position: absolute; inset: 2px -3px 3px -2px; z-index: 1;
  background: rgba(255, 251, 239, .26) var(--paper-grain) center / 240px;
  border: 1px solid rgba(255, 251, 239, .5);
  border-right-color: rgba(103, 88, 63, .16);
  box-shadow: 1px 2px 2px rgba(63, 47, 29, .09);
  transform: rotate(.6deg); pointer-events: none;
}
.vellum::before {
  content: ''; position: absolute; inset: 0 6% 0 auto; width: 1px;
  background: rgba(255, 251, 239, .5);
  box-shadow: 1px 0 rgba(103, 88, 63, .05);
}
.vellum__thread {
  position: absolute; left: -2%; right: -2%; bottom: 12%; height: 1px;
  background: var(--c-text-accent); opacity: .7; transform: rotate(-2deg);
  box-shadow: 0 1px rgba(255, 251, 239, .8), 0 2px 1px rgba(63, 47, 29, .12);
}
.vellum > .icon { position: absolute; right: 12%; bottom: 3%; width: 27%; color: var(--c-text-accent); opacity: .8; }
.vellum .vellum__knot { width: 100%; height: auto; }
.is-unwrapped > .vellum { visibility: hidden; }
@media (prefers-reduced-motion: reduce) {
  .vellum { transform: none; }
}
@media print { .vellum { display: none; } }

/* Two torn cotton sheets per theme; the other cards keep their clean trim.
   Only this narrow edge is clipped, never content, shadows or focus outlines. */
:is(.piece--invite, .page__when)::before {
  content: ''; position: absolute; left: 0; right: 0; bottom: -3px; height: 6px;
  background: var(--c-paper) var(--paper-grain) center bottom / 240px;
  clip-path: polygon(0 0,100% 0,100% 65%,97% 78%,93% 64%,89% 86%,85% 70%,81% 93%,77% 73%,73% 83%,69% 63%,65% 85%,61% 71%,57% 96%,53% 76%,49% 88%,45% 69%,41% 87%,37% 74%,33% 94%,29% 72%,25% 84%,21% 68%,17% 92%,13% 76%,9% 89%,5% 70%,2% 83%,0 66%);
  pointer-events: none;
}
:is(.piece--invite, .page__when) {
  background-image: var(--paper-grain);
  background-size: 240px;
}

/* Keep keyboard focus outside decorative card stitching in every theme. */
button.piece:focus-visible {
  outline: 2px dashed var(--c-focus);
  outline-offset: 6px;
}

/* Hand-set typography. Higher-level OpenType variants remain overridable
   (a body-level 'onum' feature otherwise defeats lining countdown figures). */
html body { font-feature-settings: 'kern', 'liga'; font-variant-numeric: oldstyle-nums proportional-nums; }
:is(h1, h2, h3, .invite__line, .invite__sub, .rsvp__by, .page__kicker) { text-wrap: balance; }
:is(.story__text, .notes, .venue__note, .timeline__note) { text-wrap: pretty; hanging-punctuation: first last; }
:is(.countdown__num, .date__day, .date__year, .date__time, .when__date, .when__time, .timeline__time, input[type=number]) {
  font-feature-settings: 'kern', 'liga', 'lnum', 'tnum';
  font-variant-numeric: lining-nums tabular-nums;
}
:is(.card__kicker, .page__h, .credit, .tag__kicker) { font-variant-caps: small-caps; }

/* Printed ink sits a fraction into cotton stock. Foil is trim, never body ink. */
.piece--invite .invite__names, .page .page__title, .envelope__letter-names {
  text-shadow: .25px .6px .25px rgba(255, 251, 239, .75), -.15px -.3px .3px rgba(53, 38, 24, .2);
}
.piece--invite::after {
  content: ''; position: absolute; inset: 9px; pointer-events: none; z-index: 3;
  border: 1px solid var(--c-foil); opacity: .16;
}
.piece--invite.has-caught-light::after { animation: foil-catch 850ms ease-out 1; }
@keyframes foil-catch {
  0%, 100% { opacity: .16; }
  42% { opacity: .46; border-top-color: var(--c-paper); border-right-color: var(--c-foil); }
  68% { opacity: .28; border-right-color: var(--c-paper); }
}
@media (prefers-reduced-motion: reduce) {
  .piece--invite.has-caught-light::after { animation: none; }
}


