/* ==========================================================================
   Kevin & Regine — invitation
   Palette: cream & warm sand first, chocolate text, one terracotta accent.
   ========================================================================== */

:root {
  --cream: #F5EFE6;
  --cream-hi: #FBF8F3;
  --sand: #D8C2A8;
  --sand-lo: #EEE3D4;
  --sand-mid: #E5D5C1;
  --terracotta: #C96A4A;
  --rust: #A44A3F;
  --choc: #5B3A29;
  --ink: #4B3022;
  --muted: #86664F;
  --gold: #B8914E;
  --gold-hi: #E8CD90;
  --gold-lo: #8C6A2E;
  --line: rgba(169, 138, 100, 0.45);
  /* one warm accent for script, numbers and small caps, from the terracotta family */
  --clay: #B0603F;

  --serif: 'Cormorant Garamond', 'Cormorant', Georgia, 'Times New Roman', serif;
  --caps: 'Marcellus', 'Cormorant Garamond', Georgia, serif;
  --script: 'Pinyon Script', 'Snell Roundhand', 'Apple Chancery', cursive;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in: cubic-bezier(0.55, 0, 0.8, 0.2);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

  --shadow-card: 0 1px 2px rgba(91, 58, 41, 0.06), 0 18px 40px -18px rgba(91, 58, 41, 0.28);
  --grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .36  0 0 0 0 .23  0 0 0 0 .16  0 0 0 .075 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");

  --gutter: clamp(18px, 5vw, 40px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 12px;
}

body {
  margin: 0;
  min-height: 100svh;
  background: var(--cream) var(--grain);
  color: var(--ink);
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.1875rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body.is-locked { overflow: hidden; }

img { display: block; max-width: 100%; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3, .section-lead, .hero__invite, .rsvp-done__text, .final-check__text { text-wrap: balance; }
button { font: inherit; color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }

::selection { background: rgba(201, 106, 74, 0.22); }

:focus-visible {
  outline: 2px solid var(--terracotta);
  outline-offset: 3px;
  border-radius: 4px;
}

.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;
}

/* ---------------------------------------------------------------- shared */

.kicker {
  font-family: var(--caps);
  font-size: 0.74rem;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--clay);
  line-height: 1.5;
}

/* The ampersand: a classic italic serif, never a script flourish. */
.amp {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
}

/* inside script lines (guest names) the serif ampersand needs a little more size */
.scene__name .amp,
.hero__dear .amp,
.letter__dear .amp { font-size: 0.72em; margin: 0 0.08em; }

.sprig {
  width: 132px;
  height: 20px;
  margin: 0 auto;
  background: url('/img/divider.svg') center / contain no-repeat;
}

.paper {
  position: relative;
  background: var(--cream-hi) url('/img/paper.jpg') center / 100% 100% no-repeat;
}

/* Phones held sideways: the framed paper would be distorted — use a drawn frame. */
@media (max-height: 520px) and (orientation: landscape) {
  .paper { background: var(--cream-hi) var(--grain); }
  .paper::before {
    content: '';
    position: absolute;
    inset: 12px;
    border: 1px solid var(--line);
    pointer-events: none;
  }
}

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 1s var(--ease-out), transform 1s var(--ease-out);
  transition-delay: var(--d, 0ms);
}

.reveal.is-in {
  opacity: 1;
  transform: none;
}

/* Buttons */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.7em;
  min-height: 52px;
  padding: 0.85em 1.7em;
  border: 0;
  border-radius: 4px;
  font-family: var(--caps);
  font-size: 0.8rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  text-decoration: none;
  line-height: 1.2;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.25s var(--ease-out), box-shadow 0.25s var(--ease-out), background-color 0.25s, color 0.25s, opacity 0.25s;
}

.btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

.btn:active { transform: scale(0.98); }

.btn--primary {
  overflow: hidden;
  color: #FFF8EE;
  background: linear-gradient(135deg, #C96A4A 0%, #B96044 55%, #A8573C 100%);
  box-shadow: 0 12px 26px -12px rgba(150, 80, 50, 0.7), inset 0 0 0 1px rgba(255, 236, 205, 0.25);
}

.btn--primary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 244, 222, 0.38) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: transform 0.9s var(--ease-out);
}

.btn--primary:hover::after { transform: translateX(120%); }

@media (hover: hover) {
  .btn--primary:hover { box-shadow: 0 16px 30px -12px rgba(150, 80, 50, 0.8), inset 0 0 0 1px rgba(255, 236, 205, 0.32); }
  .btn--ghost:hover { background: rgba(216, 194, 168, 0.16); }
}

.btn--ghost {
  color: var(--choc);
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--line);
}

.btn--wide { width: 100%; }
.btn--lg { min-height: 58px; font-size: 0.84rem; }
.btn--sm { min-height: 44px; padding: 0.7em 1.2em; font-size: 0.72rem; letter-spacing: 0.18em; }

.btn.is-loading { pointer-events: none; }
.btn.is-loading .btn__label { opacity: 0; }
.btn.is-loading::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 248, 238, 0.35);
  border-top-color: #FFF8EE;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.link-quiet {
  background: none;
  border: 0;
  padding: 6px 2px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1rem;
  color: var(--muted);
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 4px;
  cursor: pointer;
}

.form-error {
  min-height: 1.5em;
  margin: 10px 0 4px;
  font-style: italic;
  font-size: 1rem;
  color: #A5553A;
  text-align: center;
}

/* ---------------------------------------------------------------- boot */

.boot {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  background: var(--cream) var(--grain);
  transition: opacity 0.6s var(--ease-out), visibility 0.6s;
}

.boot__seal {
  width: 96px;
  height: 96px;
  animation: breathe-soft 1.6s ease-in-out infinite alternate;
}

body:not(.is-booting) .boot { opacity: 0; visibility: hidden; pointer-events: none; }

@keyframes breathe-soft {
  from { opacity: 0.35; transform: scale(0.98); }
  to   { opacity: 1; transform: scale(1); }
}

/* ==========================================================================
   1 · Gate
   ========================================================================== */

.gate {
  position: fixed;
  inset: 0;
  z-index: 20;
  overflow-y: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(255, 250, 242, 0.9), transparent 70%),
    var(--sand-lo) var(--grain);
  transition: opacity 0.8s var(--ease-out);
}

.gate__paper {
  width: 100%;
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(12svh, 64px) 15% max(10svh, 56px);
}

@media (min-width: 720px) and (min-height: 660px) {
  .gate__paper {
    --card-h: min(94svh, 1000px);
    width: auto;
    min-height: 0;
    height: var(--card-h);
    aspect-ratio: 2 / 3;
    /* % padding would resolve against the viewport, so derive it from the card height */
    padding: calc(var(--card-h) * 0.08) calc(var(--card-h) * 0.085);
    box-shadow: 0 50px 90px -40px rgba(91, 58, 41, 0.5), 0 12px 30px rgba(91, 58, 41, 0.12);
  }
}

.gate__inner {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: clamp(8px, 1.6svh, 16px);
}

.monogram {
  display: flex;
  align-items: baseline;
  justify-content: center;
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(4.4rem, 24vw, 7.4rem);
  line-height: 0.9;
  margin: 2px 0 -4px;
}

.monogram span {
  display: inline-block;
  color: var(--choc);
  transition: transform 1.8s var(--ease-out), opacity 1.8s var(--ease-out);
  transition-delay: calc(var(--d, 0ms) + 150ms);
}

.monogram:not(.is-in) .monogram__k { opacity: 0; transform: translateX(-0.22em); }
.monogram:not(.is-in) .monogram__r { opacity: 0; transform: translateX(0.22em); }
.monogram .amp { transition: opacity 1.4s var(--ease-out) calc(var(--d, 0ms) + 700ms); }
.monogram:not(.is-in) .amp { opacity: 0; }

.monogram .amp {
  font-size: 0.62em;
  color: var(--clay);
  margin: 0 0.1em;
}

.gate__names {
  font-family: var(--caps);
  font-size: 0.8rem;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--choc);
  margin-right: -0.42em;
}


.gate__date {
  font-style: italic;
  font-size: 1.15rem;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.code-form {
  width: 100%;
  margin-top: clamp(6px, 2svh, 18px);
}

.code-form__label {
  display: block;
  margin-bottom: 14px;
  font-family: var(--caps);
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--choc);
}

.code-boxes {
  position: relative;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: clamp(5px, 1.8vw, 10px);
  width: min(100%, 330px);
  margin: 0 auto;
}

.code-boxes input {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  opacity: 0;
  border: 0;
  font-size: 16px; /* stops iOS zooming in */
  color: transparent;
  caret-color: transparent;
  background: transparent;
  cursor: text;
}

.code-box {
  --i: 0;
  font-variant-numeric: lining-nums;
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 5;
  border-radius: 6px;
  background: rgba(255, 252, 246, 0.82);
  border: 1px solid rgba(169, 138, 100, 0.38);
  box-shadow: inset 0 1px 2px rgba(91, 58, 41, 0.07);
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.45rem, 7vw, 2rem);
  line-height: 1;
  color: var(--choc);
  transition: border-color 0.25s, box-shadow 0.25s, background 0.5s, color 0.5s, transform 0.5s var(--ease-out);
  transition-delay: calc(var(--i) * 70ms);
}

.code-box.is-filled { background: #FFFDF9; transform: translateY(-1px); }

.code-box.is-active {
  border-color: var(--clay);
  box-shadow: 0 0 0 3px rgba(201, 106, 74, 0.14);
}

.code-box.is-active::after {
  content: '';
  position: absolute;
  width: 1.5px;
  height: 42%;
  background: var(--clay);
  animation: caret 1s steps(1) infinite;
}

.code-box.is-active.is-filled::after { display: none; }

@keyframes caret { 50% { opacity: 0; } }

.code-boxes.is-error .code-box { border-color: rgba(164, 74, 63, 0.6); }
.code-boxes.is-error { animation: shake 0.45s var(--ease-out); }

@keyframes shake {
  20% { transform: translateX(-8px); }
  40% { transform: translateX(7px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(2px); }
}

.code-boxes.is-unlocked .code-box {
  color: var(--choc);
  border-color: var(--clay);
  background: #F4E8DA;
  box-shadow: none;
  transform: none;
}

.code-form .btn { margin-top: 6px; }

.gate__help {
  font-style: italic;
  font-size: 1rem;
  color: var(--muted);
}

.gate.is-leaving { opacity: 0; }

/* ==========================================================================
   2 · Envelope scene
   Press and hold the seal, the flap opens, the letter rises; swipe it up.
   ========================================================================== */

.scene {
  position: fixed;
  inset: 0;
  z-index: 15;
  overflow: hidden;
  background: #F2DCC2;
  outline: none;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
  transition: opacity 1s var(--ease-out);
}

.scene__bg {
  position: absolute;
  inset: -4%;
  background: url('/img/envelope-scene.jpg') center 42% / cover no-repeat;
  animation: drift 26s ease-in-out infinite alternate;
  transition: opacity 1.2s var(--ease-out), transform 1.6s var(--ease-out);
}

@media (max-width: 480px) {
  /* nudge the roses towards the edge so the guest's name stays clear */
  .scene__bg { background-position: 34% 42%; }
}

@keyframes drift {
  from { transform: scale(1) translate(0, 0); }
  to   { transform: scale(1.07) translate(-1.2%, 1%); }
}

.scene__light {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 70% 45% at 50% 50%, rgba(255, 249, 238, 0.5), transparent 70%),
    radial-gradient(ellipse 120% 60% at 50% 115%, rgba(91, 58, 41, 0.2), transparent 60%);
  transition: opacity 1s;
}

.scene__stage {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(18px, 4.5svh, 44px);
  padding: 24px 16px calc(24px + var(--safe-b));
}

.scene__for {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
}

.scene__for .kicker { color: var(--choc); text-shadow: 0 0 12px rgba(255, 248, 236, 0.95); }
.is-long-name .scene__name { font-size: clamp(2.5rem, 11vw, 4.2rem); }
.is-long-name .hero__dear { font-size: clamp(1.9rem, 8.4vw, 2.4rem); }
.is-long-name .letter__dear { font-size: calc(var(--ew) * 0.056); }

.scene__name {
  font-family: var(--script);
  font-size: clamp(3.2rem, 15vw, 5.2rem);
  line-height: 1.15;
  color: var(--clay);
  text-align: center;
  text-wrap: balance;
  text-shadow: 0 0 22px rgba(255, 248, 236, 0.95), 0 0 6px rgba(255, 248, 236, 0.8);
  max-width: 92vw;
  overflow-wrap: anywhere;
}

/* entrance: a quiet fade and rise */
.scene.is-entering { animation: fade-in 0.9s var(--ease-out) both; }
.scene.is-entering .scene__for { animation: rise-in 1.2s 0.3s var(--ease-out) both; }
.scene.is-entering .envelope { animation: settle-in 1.5s 0.1s var(--ease-out) both; }

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

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

@keyframes settle-in {
  from { opacity: 0; transform: translateY(26px) rotate(-1.2deg) scale(0.97); }
  to   { opacity: 1; transform: none; }
}

/* ---------------------------------------------------------------- envelope */

.envelope {
  /* Everything inside scales from the envelope width (works without container queries). */
  --ew: min(92vw, 560px, 62vh);
  --lift: 0%;
  --drag: 0px;
  --gw: clamp(72px, calc(var(--ew) * 0.23), 112px);
  position: relative;
  width: var(--ew);
  aspect-ratio: 1.42;
  perspective: 1600px;
  transition: transform 1.3s var(--ease-in-out);
}

@supports (height: 1svh) {
  .envelope { --ew: min(92vw, 560px, 62svh); }
}

.envelope__back {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: calc(var(--ew) * 0.011);
  background: #B9694A;
  box-shadow:
    0 calc(var(--ew) * 0.034) calc(var(--ew) * 0.065) calc(var(--ew) * -0.024) rgba(76, 45, 25, 0.5),
    0 calc(var(--ew) * 0.01) calc(var(--ew) * 0.022) rgba(76, 45, 25, 0.16);
  transition: opacity 0.9s var(--ease-out), transform 1s var(--ease-in);
}

.envelope__back svg,
.envelope__pocket {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.defs { position: absolute; width: 0; height: 0; overflow: hidden; }

.letter {
  position: absolute;
  left: 4.5%;
  right: 4.5%;
  top: 5%;
  height: 88%;
  z-index: 2;
  border-radius: calc(var(--ew) * 0.007);
  background: var(--cream-hi) var(--grain);
  box-shadow: 0 calc(var(--ew) * 0.003) calc(var(--ew) * 0.012) rgba(76, 45, 25, 0.22);
  transform: translateY(calc(var(--lift) * -1 + var(--drag)));
  transition: transform 1.5s var(--ease-out), box-shadow 1s;
  will-change: transform;
}

.letter__inner {
  position: absolute;
  inset: calc(var(--ew) * 0.026);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: calc(var(--ew) * 0.045);
  text-align: center;
  border: 1px solid rgba(169, 138, 100, 0.55);
  box-shadow: inset 0 0 0 calc(var(--ew) * 0.007) var(--cream-hi), inset 0 0 0 calc(calc(var(--ew) * 0.007) + 1px) rgba(169, 138, 100, 0.3);
  transition: opacity 0.35s var(--ease-out);
}

.letter__dear {
  font-family: var(--script);
  font-size: calc(var(--ew) * 0.076);
  line-height: 1.15;
  color: var(--clay);
  max-width: 90%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.letter__line {
  margin-top: calc(var(--ew) * 0.016);
  font-family: var(--caps);
  font-size: calc(var(--ew) * 0.02);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--muted);
}

.letter__names {
  margin-top: calc(var(--ew) * 0.014);
  font-weight: 400;
  font-size: calc(var(--ew) * 0.075);
  line-height: 1.1;
  color: var(--choc);
}

.letter__names .amp { color: var(--clay); }

.letter__date {
  margin-top: calc(var(--ew) * 0.02);
  font-family: var(--caps);
  font-size: calc(var(--ew) * 0.022);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--clay);
}

.envelope__pocket {
  z-index: 3;
  overflow: visible;
  filter: drop-shadow(0 calc(var(--ew) * -0.0025) calc(var(--ew) * 0.005) rgba(76, 45, 25, 0.12));
  transition: opacity 0.9s var(--ease-out), transform 1s var(--ease-in);
}

.envelope__flap {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 4;
  width: 100%;
  height: 60%;
  transform-origin: 50% 0;
  transform-style: preserve-3d;
  transition: transform 1.1s var(--ease-in-out), opacity 0.8s var(--ease-out);
}

.flap {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.flap svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: drop-shadow(0 calc(var(--ew) * 0.005) calc(var(--ew) * 0.006) rgba(76, 45, 25, 0.2));
}

.flap--inner { transform: rotateY(180deg); }
.flap--inner svg { filter: none; }

.envelope.is-flap-open .envelope__flap { transform: rotateX(180deg); }
.envelope.is-flap-behind .envelope__flap { z-index: 1; }

/* ---------------------------------------------------------------- seal */

.seal {
  position: absolute;
  left: 50%;
  top: 58.5%;
  z-index: 5;
  width: calc(var(--ew) * 0.35);
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  transform: translate(-50%, -50%);
  transition: opacity 0.6s var(--ease-out), transform 0.8s var(--ease-out);
}

.seal:focus-visible { outline: none; }
.seal:focus-visible .seal__track { stroke: rgba(91, 58, 41, 0.5); }

.seal img {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  -webkit-user-drag: none;
  transition: transform 0.45s var(--ease-out), filter 0.45s var(--ease-out);
}

/* the progress ring, just outside the wax */
.seal__ring {
  position: absolute;
  left: -4.2%;
  top: -4.2%;
  width: 106%;
  height: 106%;
  overflow: visible;
  pointer-events: none;
  transform: rotate(-90deg);
  filter: drop-shadow(0 2px 6px rgba(76, 45, 25, 0.35));
}

.seal__ring circle { fill: none; stroke-width: 3.6; }

.seal__track {
  stroke: rgba(255, 251, 245, 0.95);
  opacity: 0;
  transition: opacity 0.3s;
}

.seal__progress {
  stroke: var(--clay);
  stroke-linecap: round;
  stroke-dasharray: 295.31;
  stroke-dashoffset: 295.31;
  opacity: 0;
  transition: stroke-dashoffset 0.45s var(--ease-out), opacity 0.3s;
}

/* Holding: the seal presses into the paper and warms up while the ring and bar fill. */
.scene.is-holding .seal__track,
.scene.is-holding .seal__progress { opacity: 1; }
.scene.is-holding .seal__progress { stroke-dashoffset: 0; transition: stroke-dashoffset var(--hold, 1100ms) linear, opacity 0.2s; }
.scene.is-holding .seal img {
  transform: scale(0.92);
  filter: brightness(1.08) drop-shadow(0 0 16px rgba(255, 222, 168, 0.95));
  transition: transform var(--hold, 1100ms) var(--ease-out), filter var(--hold, 1100ms) linear;
}
.scene.is-holding .envelope { transform: scale(1.025); transition: transform var(--hold, 1100ms) var(--ease-out); }

/* ---------------------------------------------------------------- opening */

.scene.is-opening .scene__for { animation: none; opacity: 0; transform: translateY(-12px); }
.scene.is-opening .seal { opacity: 0; transform: translate(-50%, -64%) scale(1.06); pointer-events: none; }
.scene.is-opening .seal__ring { opacity: 0; transition: opacity 0.3s; }

/* The letter rises out of the pocket; the envelope settles lower so both stay in view. */
.scene.is-letter-out .envelope { transform: translateY(min(calc(var(--ew) * 0.2), 7vh)); }
.scene.is-letter-out .letter { --lift: 70%; }
.scene.is-invited .letter { cursor: grab; transition: transform 0.6s var(--ease-out); }
.scene.is-dragging .letter { transition: none; cursor: grabbing; }

/* Swipe up: the letter slides free while the envelope falls away. */
.scene.is-leaving .letter { --lift: 116%; transition: transform 0.85s var(--ease-in-out); }
.scene.is-leaving .letter__inner { opacity: 0; transition: opacity 0.4s 0.35s var(--ease-out); }
.scene.is-leaving .envelope__back,
.scene.is-leaving .envelope__pocket { opacity: 0; transform: translateY(46%); }
.scene.is-leaving .envelope__flap { opacity: 0; }
.scene.is-leaving .scene__bg { opacity: 0.35; transform: scale(1.1); }

/* ---------------------------------------------------------------- hand gestures */

/* A hand shows guests what to do, and steps aside as soon as they start. */
.gesture {
  position: absolute;
  z-index: 6;
  width: 0;
  height: 0;
  pointer-events: none;
  visibility: hidden;
}

.gesture__mover {
  position: absolute;
  left: 0;
  top: 0;
}

/* the fingertip sits exactly on the anchor point */
.gesture__hand {
  position: absolute;
  left: calc(var(--gw) * -0.413);
  top: calc(var(--gw) * -0.043);
  width: var(--gw);
  height: calc(var(--gw) * 1.348);
  overflow: visible;
  transform-origin: 41.3% 3.2%;
  opacity: 0.72;
  filter: drop-shadow(0 6px 10px rgba(76, 45, 25, 0.28));
}

.hand__skin {
  fill: #FFFDF9;
  stroke: var(--choc);
  stroke-width: 2.6;
  stroke-linejoin: round;
}

.hand__line {
  fill: none;
  stroke: var(--choc);
  stroke-width: 2;
  stroke-linecap: round;
  opacity: 0.5;
}

/* Press and hold: the hand rises onto the middle of the seal and keeps it pressed,
   and the seal dips under it, so it reads as a long press rather than a tap. */
.gesture--hold { left: 50%; top: 58.5%; }

.scene.is-hint-hold .gesture--hold { visibility: visible; }
.scene.is-hint-hold .gesture--hold .gesture__mover { animation: hold-move 3.2s var(--ease-in-out) infinite; }
.scene.is-hint-hold .gesture--hold .gesture__hand { animation: hold-press 3.2s var(--ease-in-out) infinite; }
.scene.is-hint-hold .seal img { animation: seal-dip 3.2s var(--ease-in-out) infinite; }

@keyframes hold-move {
  0%       { opacity: 0; transform: translateY(calc(var(--gw) * 0.7)); }
  14%, 80% { opacity: 1; transform: none; }
  92%      { opacity: 0; transform: translateY(calc(var(--gw) * 0.4)); }
  100%     { opacity: 0; transform: translateY(calc(var(--gw) * 0.7)); }
}

@keyframes hold-press {
  0%, 16%  { transform: scale(1); }
  24%, 72% { transform: scale(0.88); }
  80%, 100% { transform: scale(1); }
}

@keyframes seal-dip {
  0%, 18%  { transform: scale(1); }
  26%, 72% { transform: scale(0.95); }
  80%, 100% { transform: scale(1); }
}

/* Swipe up: the hand touches the envelope and slides up, leaving a short trail. */
.gesture--swipe {
  --dist: calc(var(--ew) * -0.5);
  left: 50%;
  top: 90%;
}

.gesture__trail {
  position: absolute;
  left: -2px;
  bottom: 0;
  width: 4px;
  height: calc(var(--dist) * -1);
  border-radius: 4px;
  background: linear-gradient(to top, rgba(176, 96, 63, 0), rgba(176, 96, 63, 0.55));
  transform-origin: 50% 100%;
  transform: scaleY(0);
  opacity: 0;
}

.scene.is-hint-swipe .gesture--swipe { visibility: visible; }
.scene.is-hint-swipe .gesture--swipe .gesture__mover { animation: swipe-move 2.8s var(--ease-in-out) infinite; }
.scene.is-hint-swipe .gesture--swipe .gesture__hand { animation: swipe-press 2.8s var(--ease-in-out) infinite; }
.scene.is-hint-swipe .gesture--swipe .gesture__trail { animation: swipe-trail 2.8s var(--ease-in-out) infinite; }

@keyframes swipe-move {
  0%       { opacity: 0; transform: translateY(12px); }
  12%, 24% { opacity: 1; transform: none; }
  64%, 72% { opacity: 1; transform: translateY(var(--dist)); }
  86%, 100% { opacity: 0; transform: translateY(var(--dist)); }
}

@keyframes swipe-press {
  0%, 16%  { transform: scale(1); }
  24%, 64% { transform: scale(0.88); }
  72%, 100% { transform: scale(1); }
}

@keyframes swipe-trail {
  0%, 24%  { opacity: 0; transform: scaleY(0); }
  28%      { opacity: 1; }
  64%      { opacity: 1; transform: scaleY(1); }
  82%, 100% { opacity: 0; transform: scaleY(1); }
}

/* the letter lifts a little as the hand pushes it */
.scene.is-hint-swipe:not(.is-dragging) .letter { animation: letter-nudge 2.8s var(--ease-in-out) infinite; }

@keyframes letter-nudge {
  0%, 24%  { translate: 0 0; }
  60%      { translate: 0 -16px; }
  76%, 100% { translate: 0 0; }
}

/* phones held sideways: keep the prompt clear of the envelope */
@media (max-height: 500px) {
  .scene.is-letter-out .envelope { transform: translateY(3vh); }
}

.scene.is-gone { opacity: 0; pointer-events: none; }

/* ---------------------------------------------------------------- unfold */

/* A sheet of the letter's paper that opens out from the letter to fill the screen. */
.unfold {
  position: fixed;
  inset: 0;
  z-index: 36;
  background: var(--cream-hi) var(--grain);
  pointer-events: none;
  will-change: clip-path;
  transition: clip-path 0.95s var(--ease-in-out), opacity 1s var(--ease-out);
}

.unfold.is-fading { opacity: 0; }

/* ---------------------------------------------------------------- ambient motes */

.motes {
  position: fixed;
  inset: 0;
  z-index: 40;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* ==========================================================================
   3 · Invitation
   ========================================================================== */

.invitation {
  position: relative;
  opacity: 0;
  transition: opacity 1s var(--ease-out);
}

.invitation.is-shown { opacity: 1; }

.section {
  position: relative;
  padding: clamp(76px, 14vw, 140px) var(--gutter);
}

.section--sand { background: var(--sand-lo) var(--grain); }

.section-head {
  text-align: center;
  max-width: 640px;
  margin: 0 auto clamp(36px, 7vw, 64px);
}

.section-head::after {
  content: '';
  display: block;
  width: 128px;
  height: 18px;
  margin: 22px auto 0;
  background: url('/img/divider.svg') center / contain no-repeat;
}

.section-title {
  margin-top: 10px;
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(2.6rem, 10.5vw, 4.4rem);
  line-height: 1.02;
  letter-spacing: -0.01em;
  color: var(--choc);
}

.section-lead {
  margin: 16px auto 0;
  max-width: 30em;
  font-style: italic;
  font-size: 1.15rem;
  color: var(--muted);
}

/* -------------------------------------------------------------- hero */

.hero {
  position: relative;
  min-height: 100svh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(ellipse at 50% 20%, rgba(255, 250, 242, 0.9), transparent 70%),
    var(--sand-lo) var(--grain);
}

.hero__paper {
  width: 100%;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(11svh, 60px) 13% max(12svh, 72px);
}

@media (min-width: 720px) and (min-height: 660px) {
  .hero { padding: 3svh 0; }
  .hero__paper {
    --card-h: min(94svh, 1000px);
    width: auto;
    min-height: 0;
    height: var(--card-h);
    aspect-ratio: 2 / 3;
    padding: calc(var(--card-h) * 0.07) calc(var(--card-h) * 0.08);
    box-shadow: 0 50px 90px -40px rgba(91, 58, 41, 0.5), 0 12px 30px rgba(91, 58, 41, 0.12);
  }
}

.hero__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(8px, 1.5svh, 16px);
  text-align: center;
}

.hero__dear {
  text-wrap: balance;
  font-family: var(--script);
  font-size: clamp(2.3rem, 10.5vw, 3.3rem);
  line-height: 1.15;
  color: var(--clay);
  overflow-wrap: anywhere;
}

.hero__kicker { color: var(--muted); font-size: 0.68rem; letter-spacing: 0.22em; }

.hero__names {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(3.3rem, 16vw, 5.8rem);
  line-height: 0.95;
  margin: 2px 0;
}

.hero__name {
  color: var(--choc);
  padding: 0 0.05em;
}

.hero__amp {
  font-size: 0.5em;
  line-height: 1;
  color: var(--clay);
  margin: 0.08em 0 0.04em;
}

.hero__invite {
  max-width: 15.5em;
  font-style: italic;
  font-size: clamp(1.1rem, 4.6vw, 1.35rem);
  line-height: 1.4;
  color: var(--muted);
}

.datebar {
  display: grid;
  justify-items: center;
  gap: 6px;
  margin-top: 4px;
}

.datebar__month,
.datebar__year {
  font-family: var(--caps);
  font-size: 0.8rem;
  letter-spacing: 0.44em;
  text-transform: uppercase;
  color: var(--choc);
  margin-right: -0.44em;
}

.datebar__row {
  display: flex;
  align-items: center;
  gap: clamp(10px, 3.5vw, 18px);
}

.datebar__side {
  min-width: 6em;
  padding: 7px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-family: var(--caps);
  font-size: 0.72rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--choc);
}

.datebar__day {
  font-variant-numeric: lining-nums;
  font-weight: 300;
  font-size: clamp(3.2rem, 14vw, 4.6rem);
  line-height: 1;
  color: var(--clay);
}

.hero__place {
  font-family: var(--caps);
  font-size: 0.74rem;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--muted);
  margin-right: -0.4em;
}

@media (max-width: 400px) {
  .hero__paper { padding-left: 10%; padding-right: 10%; }
  .datebar__row { gap: 8px; }
  .datebar__side { min-width: 5.4em; font-size: 0.66rem; letter-spacing: 0.16em; }
}

.scroll-cue {
  position: absolute;
  left: 50%;
  bottom: calc(18px + var(--safe-b));
  width: 30px;
  height: 46px;
  transform: translateX(-50%);
  display: grid;
  justify-items: center;
}

.scroll-cue span {
  width: 1px;
  height: 100%;
  background: linear-gradient(var(--sand), transparent);
  transform-origin: top;
  animation: cue 2.4s var(--ease-in-out) infinite;
}

@keyframes cue {
  0%   { transform: scaleY(0); opacity: 1; }
  60%  { transform: scaleY(1); opacity: 1; }
  100% { transform: scaleY(1); opacity: 0; }
}

@media (min-width: 720px) and (min-height: 660px) {
  .scroll-cue { bottom: 0.4svh; height: 2.4svh; }
}

/* -------------------------------------------------------------- hero entrance */

/* After the letter unfolds, the page writes itself in: the greeting is inked
   left to right, the names settle, the date rules draw out from the middle. */
.hero.is-pre [data-enter] { opacity: 0; }
.hero.is-entering [data-enter] { animation: enter-rise 1.3s var(--ease-out) both; animation-delay: var(--d, 0ms); }
.hero.is-entering [data-enter='write'] { animation: enter-write 1.7s var(--ease-in-out) both; animation-delay: var(--d, 0ms); }
.hero.is-entering [data-enter='name'] { animation: enter-name 1.6s var(--ease-out) both; animation-delay: var(--d, 0ms); }
.hero.is-entering [data-enter='amp'] { animation: enter-amp 1.4s var(--ease-out) both; animation-delay: var(--d, 0ms); }
.hero.is-entering [data-enter='spread'] { animation: enter-spread 1.6s var(--ease-out) both; animation-delay: var(--d, 0ms); }
.hero.is-entering [data-enter='rule'] { animation: enter-rule 1.2s var(--ease-in-out) both; animation-delay: var(--d, 0ms); }
.hero.is-entering [data-enter='day'] { animation: enter-day 1.5s var(--ease-out) both; animation-delay: var(--d, 0ms); }
.hero.is-entering .hero__paper { animation: paper-settle 2.2s var(--ease-out) both; }

@keyframes enter-rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

@keyframes enter-write {
  from { opacity: 1; clip-path: inset(-40% 100% -40% -6%); }
  to   { opacity: 1; clip-path: inset(-40% -6% -40% -6%); }
}

@keyframes enter-name {
  from { opacity: 0; letter-spacing: 0.14em; filter: blur(5px); }
  to   { opacity: 1; letter-spacing: 0; filter: blur(0); }
}

@keyframes enter-amp {
  from { opacity: 0; transform: scale(0.7) rotate(-10deg); }
  to   { opacity: 1; transform: none; }
}

@keyframes enter-spread {
  from { opacity: 0; letter-spacing: 0.9em; }
  to   { opacity: 1; }
}

@keyframes enter-rule {
  from { opacity: 0; clip-path: inset(0 50% 0 50%); }
  to   { opacity: 1; clip-path: inset(0 0 0 0); }
}

@keyframes enter-day {
  from { opacity: 0; transform: scale(0.82); }
  to   { opacity: 1; transform: none; }
}

@keyframes paper-settle {
  from { transform: scale(1.025); }
  to   { transform: none; }
}

/* -------------------------------------------------------------- final check */

.final-check {
  padding: 36px var(--gutter) 0;
  background: var(--sand-lo) var(--grain);
}

.final-check__card {
  max-width: 620px;
  margin: 0 auto;
  padding: clamp(24px, 6vw, 40px);
  text-align: center;
  border-radius: 10px;
  background: var(--cream-hi);
  box-shadow: var(--shadow-card), inset 0 0 0 1px rgba(201, 106, 74, 0.35);
}

.final-check__title {
  margin: 6px 0 10px;
  font-weight: 400;
  font-size: clamp(1.9rem, 7vw, 2.5rem);
  line-height: 1.1;
  color: var(--choc);
}

.final-check__text { color: var(--muted); font-style: italic; }

.final-check__actions {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

@media (min-width: 560px) {
  .final-check__actions { grid-template-columns: 1fr 1fr; }
}

/* -------------------------------------------------------------- countdown */

.countdown {
  text-align: center;
  padding-top: clamp(64px, 11vw, 110px);
  padding-bottom: clamp(64px, 11vw, 110px);
}

/* Flip cards: each unit is a folded paper card that turns over as time passes. */
.countdown__kicker { margin-bottom: 18px; }

.flips {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(8px, 2.6vw, 18px);
  max-width: 520px;
  margin: 0 auto;
}

.flip {
  display: grid;
  gap: 10px;
  justify-items: center;
}

.flip small {
  font-family: var(--caps);
  font-size: 0.62rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--clay);
}

.flip__card {
  --h: 1.34em;
  position: relative;
  width: 100%;
  height: var(--h);
  font-weight: 400;
  font-size: clamp(2.3rem, 11vw, 3.9rem);
  line-height: 1;
  color: var(--choc);
  font-variant-numeric: lining-nums tabular-nums;
  perspective: 5em;
  border-radius: 6px;
  box-shadow: 0 1px 1px rgba(91, 58, 41, 0.08), 0 14px 26px -16px rgba(91, 58, 41, 0.45);
}

.flip[data-unit='days'] .flip__card { letter-spacing: -0.02em; }

.flip__half {
  position: absolute;
  left: 0;
  right: 0;
  height: 50%;
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.flip__half b {
  display: block;
  height: var(--h);
  line-height: var(--h);
  font-weight: inherit;
  text-align: center;
}

.flip__top {
  top: 0;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(#FFFDF9, #F8F1E7);
  transform-origin: 50% 100%;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.flip__bottom {
  bottom: 0;
  border-radius: 0 0 6px 6px;
  background: linear-gradient(#F3EADD, #FBF7F1);
  transform-origin: 50% 0;
}

.flip__bottom b { transform: translateY(-50%); }

/* the fold */
.flip__card::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  z-index: 3;
  height: 1px;
  margin-top: -0.5px;
  background: rgba(91, 58, 41, 0.14);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
}

.flip__leaf { display: none; z-index: 2; }
.flip.is-flipping .flip__leaf { display: block; }
.flip.is-flipping .flip__top.flip__leaf { animation: leaf-down 0.32s var(--ease-in) both; }
.flip.is-flipping .flip__bottom.flip__leaf { animation: leaf-land 0.34s 0.3s var(--ease-out) both; }

@keyframes leaf-down {
  from { transform: rotateX(0); }
  to   { transform: rotateX(-90deg); filter: brightness(0.9); }
}

@keyframes leaf-land {
  from { transform: rotateX(90deg); filter: brightness(1.06); }
  to   { transform: rotateX(0); }
}

.countdown__done {
  font-family: var(--script);
  font-size: clamp(2.6rem, 11vw, 4rem);
  color: var(--clay);
}

/* -------------------------------------------------------------- the day: timeline */

.timeline {
  --rail: 11px;
  position: relative;
  list-style: none;
  max-width: 520px;
  margin: 0 auto;
  padding: 0 0 0 42px;
}

.timeline__rail {
  position: absolute;
  left: var(--rail);
  top: 20px;
  bottom: 60px;
  width: 1px;
  background: var(--line);
}

.timeline__rail span {
  position: absolute;
  inset: 0;
  background: linear-gradient(var(--clay), #C98B6C);
  transform-origin: 50% 0;
  transform: scaleY(var(--p, 0));
}

.stop { position: relative; }

.stop__node,
.journey__node {
  position: absolute;
  left: calc(var(--rail) - 42px - 7px);
  top: 13px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--cream);
  box-shadow: inset 0 0 0 1px var(--line);
  transition: box-shadow 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}

.stop.is-reached .stop__node {
  transform: scale(1.1);
  box-shadow: inset 0 0 0 1.5px var(--clay), inset 0 0 0 4px var(--cream), inset 0 0 0 8px var(--clay);
}

.stop__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 14px;
}

.stop__hour {
  font-weight: 300;
  font-size: clamp(3rem, 13vw, 4rem);
  line-height: 1;
  color: var(--clay);
  font-variant-numeric: lining-nums;
}

.stop__ampm {
  margin-left: -8px;
  font-family: var(--caps);
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  color: var(--clay);
}

.stop__label {
  flex-basis: 100%;
  margin-top: 6px;
  font-family: var(--caps);
  font-size: 0.72rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--choc);
}

/* Arched frames, like a church window */
.stop__media {
  position: relative;
  width: min(100%, 360px);
  margin: 20px 0 22px;
  aspect-ratio: 4 / 4.7;
  overflow: hidden;
  border-radius: 999px 999px 8px 8px;
  background: var(--sand-lo) var(--grain);
  box-shadow: 0 1px 2px rgba(91, 58, 41, 0.08), 0 26px 44px -26px rgba(91, 58, 41, 0.55);
  isolation: isolate;
}

.stop__media::after {
  content: '';
  position: absolute;
  inset: 9px;
  z-index: 2;
  border: 1px solid rgba(255, 250, 242, 0.75);
  border-radius: 999px 999px 4px 4px;
  pointer-events: none;
}

.stop__media--art { background: radial-gradient(ellipse at 50% 100%, #F1E4D3, #EADBC8 70%) ; }
.stop__media--art::after { border-color: rgba(176, 96, 63, 0.3); }

.stop__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.1);
  transition: transform 9s var(--ease-out);
}

.stop.is-in .stop__media img { transform: scale(1); }

.art {
  position: absolute;
  left: 7%;
  bottom: 3%;
  width: 86%;
  height: auto;
  overflow: visible;
}

.art__sun { fill: rgba(201, 106, 74, 0.09); transform-origin: 100px 92px; transform: scale(0.6); opacity: 0; transition: transform 2.4s var(--ease-out), opacity 2.4s var(--ease-out); }

.art__lines > * {
  fill: none;
  stroke: var(--clay);
  stroke-width: 1.15;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

.stop.is-in .art__sun { transform: none; opacity: 1; }
.stop.is-in .art__lines > * {
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1.6s var(--ease-in-out);
  transition-delay: calc(var(--i, 0) * 90ms + 200ms);
}

.stop__body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stop__name {
  font-weight: 500;
  font-size: clamp(1.8rem, 7vw, 2.2rem);
  line-height: 1.1;
  color: var(--choc);
}

.stop__note {
  font-style: italic;
  color: var(--muted);
}

.stop__addr {
  margin-top: 8px;
  font-style: normal;
  font-size: 1.05rem;
  line-height: 1.5;
  color: var(--ink);
}

.stop__extra {
  margin-top: 8px;
  font-size: 1rem;
  color: var(--muted);
}

.stop__extra a { color: var(--clay); text-underline-offset: 3px; }

.stop__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.stop__actions .btn { flex: 1 1 auto; }

/* The drive between the two */
.journey {
  position: relative;
  padding: clamp(46px, 10vw, 64px) 0;
}

.journey__node {
  top: 50%;
  width: 9px;
  height: 9px;
  margin-top: -4.5px;
  left: calc(var(--rail) - 42px - 4px);
  background: var(--sand);
  box-shadow: none;
}

.journey__text {
  font-style: italic;
  font-size: 1.12rem;
  color: var(--muted);
}

.journey__text span {
  display: block;
  font-family: var(--caps);
  font-style: normal;
  font-size: 0.66rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--clay);
  margin-bottom: 4px;
}

@media (min-width: 900px) {
  .timeline {
    --rail: 50%;
    max-width: 1000px;
    padding: 0;
  }

  .timeline__rail { margin-left: -0.5px; top: 30px; bottom: 30px; }

  .stop {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    column-gap: 120px;
  }

  .stop__node { left: 50%; top: 50%; margin: -7.5px 0 0 -7.5px; }
  .journey__node { left: 50%; margin-left: -4.5px; }

  .stop__media { grid-column: 1; grid-row: 1 / -1; justify-self: end; margin: 0; width: 100%; max-width: 380px; }
  .stop__head { grid-column: 2; grid-row: 1; align-self: end; }
  .stop__body { grid-column: 2; grid-row: 2; align-self: start; margin-top: 18px; }

  .stop--flip .stop__media { grid-column: 2; justify-self: start; }
  .stop--flip .stop__head,
  .stop--flip .stop__body { grid-column: 1; text-align: right; }
  .stop--flip .stop__head { justify-content: flex-end; }
  .stop--flip .stop__body { align-items: flex-end; }
  .stop--flip .stop__actions { justify-content: flex-end; }
  .stop__actions .btn { flex: 0 0 auto; }

  .journey { text-align: center; padding: 64px 0; }
  .journey__text { display: inline-block; padding: 10px 22px; background: var(--cream); }
}

.calendar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: clamp(44px, 8vw, 64px);
}

/* -------------------------------------------------------------- rsvp */

.rsvp {
  overflow: hidden;
  background: var(--cream) var(--grain);
  padding-top: clamp(64px, 12vw, 120px);
}

/* The K&R hands drift towards each other behind the heading as it scrolls in. */
.rsvp__top {
  position: relative;
  isolation: isolate;
  padding: clamp(40px, 9vw, 90px) 0 clamp(8px, 2vw, 20px);
}

.rsvp__top .section-head { position: relative; margin-bottom: clamp(36px, 7vw, 56px); }

.hands {
  --apart: 1;
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: -1;
  width: max(172vw, 640px);
  max-width: 1180px;
  aspect-ratio: 1024 / 516;
  transform: translate(-50%, -60%);
  opacity: 0.2;
  pointer-events: none;
  /* the photo's edges (shirt cuffs) melt into the paper */
  -webkit-mask-image: linear-gradient(90deg, transparent 2%, #000 16%, #000 84%, transparent 98%);
  mask-image: linear-gradient(90deg, transparent 2%, #000 16%, #000 84%, transparent 98%);
}

@media (min-width: 720px) {
  .hands { width: min(118vw, 1180px); opacity: 0.17; transform: translate(-50%, -56%); }
}

.hands img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  user-select: none;
  -webkit-user-drag: none;
}

.hands__l { translate: calc(var(--apart) * -15%) 0; animation: float-l 9s ease-in-out infinite alternate; }
.hands__r { translate: calc(var(--apart) * 15%) 0; animation: float-r 11s ease-in-out infinite alternate; }

@keyframes float-l {
  from { transform: translateY(1.5%) rotate(-0.6deg); }
  to   { transform: translateY(-1.5%) rotate(0.4deg); }
}

@keyframes float-r {
  from { transform: translateY(-1.2%) rotate(0.5deg); }
  to   { transform: translateY(1.8%) rotate(-0.4deg); }
}

.rsvp__card {
  position: relative;
  max-width: 680px;
  margin: 0 auto;
  padding: clamp(22px, 6vw, 48px);
  border-radius: 12px;
  background: var(--cream-hi);
  box-shadow: var(--shadow-card), inset 0 0 0 1px rgba(169, 138, 100, 0.28);
}

.rsvp__card::before {
  content: '';
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(169, 138, 100, 0.18);
  border-radius: 8px;
  pointer-events: none;
}

.choices {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  border: 0;
}

@media (min-width: 640px) {
  .choices { grid-template-columns: repeat(3, 1fr); }
}

.choice {
  --accent: var(--terracotta);
  --tint: rgba(201, 106, 74, 0.08);
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: 'mark title' 'mark sub';
  align-items: center;
  column-gap: 16px;
  min-height: 84px;
  padding: 16px 18px;
  border-radius: 10px;
  background: #FFFDF9;
  box-shadow: inset 0 0 0 1px rgba(169, 138, 100, 0.35);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: box-shadow 0.3s var(--ease-out), background 0.3s, transform 0.3s var(--ease-out);
}

.choice[data-choice='tentative'] { --accent: #A07E5E; --tint: rgba(160, 126, 94, 0.1); }
.choice[data-choice='no'] { --accent: #7D6252; --tint: rgba(125, 98, 82, 0.08); }

@media (min-width: 640px) {
  .choice {
    grid-template-columns: 1fr;
    grid-template-areas: 'mark' 'title' 'sub';
    justify-items: center;
    text-align: center;
    row-gap: 4px;
    padding: 24px 12px 20px;
  }
}

.choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.choice__mark {
  grid-area: mark;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1.5px var(--line);
  transition: box-shadow 0.3s var(--ease-out);
}

@media (min-width: 640px) {
  .choice__mark { margin-bottom: 10px; }
}

.choice__title {
  grid-area: title;
  font-weight: 500;
  font-size: 1.35rem;
  line-height: 1.15;
  color: var(--choc);
}

.choice__sub {
  grid-area: sub;
  font-style: italic;
  font-size: 1rem;
  color: var(--muted);
}

@media (hover: hover) {
  .choice:hover { transform: translateY(-2px); box-shadow: inset 0 0 0 1px var(--accent), 0 10px 22px -16px rgba(91, 58, 41, 0.5); }
}

.choice:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 3px; }

.choice.is-selected {
  background: var(--tint);
  box-shadow: inset 0 0 0 1.5px var(--accent), 0 12px 26px -18px rgba(91, 58, 41, 0.55);
}

.choice.is-selected .choice__mark {
  box-shadow: inset 0 0 0 1.5px var(--accent), inset 0 0 0 6px #FFFDF9, inset 0 0 0 12px var(--accent);
}

.rsvp-note {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 8px;
  background: var(--sand-lo);
  font-style: italic;
  font-size: 1.05rem;
  line-height: 1.5;
  color: var(--choc);
  animation: rise-in 0.6s var(--ease-out);
}

.rsvp-more { animation: rise-in 0.6s var(--ease-out); }

.who {
  margin: 26px 0 0;
  padding: 0;
  border: 0;
}

.who__list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.who__item {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 8px 18px 8px 12px;
  border-radius: 999px;
  background: #FFFDF9;
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: 1.1rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.25s, box-shadow 0.25s;
}

.who__item input { position: absolute; opacity: 0; pointer-events: none; }

.who__tick {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1.5px var(--line);
  transition: box-shadow 0.25s;
}

.who__item:has(input:checked) {
  background: rgba(201, 106, 74, 0.08);
  box-shadow: inset 0 0 0 1.5px var(--terracotta);
}

.who__item:has(input:checked) .who__tick { box-shadow: inset 0 0 0 1.5px var(--terracotta), inset 0 0 0 5px #FFFDF9, inset 0 0 0 11px var(--terracotta); }
.who__item:has(input:focus-visible) { outline: 2px solid var(--terracotta); outline-offset: 2px; }

.field { margin-top: 26px; }

.field__label {
  display: block;
  margin-bottom: 8px;
  padding: 0;
  font-family: var(--caps);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--choc);
}

.field__label span { text-transform: none; letter-spacing: 0.02em; font-family: var(--serif); font-style: italic; font-size: 1rem; color: var(--muted); }

.field input,
.field textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid rgba(169, 138, 100, 0.38);
  border-radius: 8px;
  background: #FFFDF9;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.15rem; /* ≥16px so iOS doesn't zoom */
  line-height: 1.45;
  color: var(--ink);
  transition: border-color 0.25s, box-shadow 0.25s;
  -webkit-appearance: none;
  appearance: none;
}

.field textarea { resize: vertical; min-height: 96px; }

.field input::placeholder,
.field textarea::placeholder { color: #B7A08C; font-style: italic; }

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: #BE9B78;
  box-shadow: 0 0 0 3px rgba(216, 194, 168, 0.35);
}

/* Optional phone and email, for the one-month reminder */
.contact { margin: 26px 0 0; padding: 0; border: 0; min-width: 0; }
.contact > .field__label { margin-bottom: 4px; }
.contact__hint { margin: 0; font-family: var(--serif); font-style: italic; font-size: 1.02rem; line-height: 1.45; color: var(--muted); }
.contact__row { display: grid; gap: 0 16px; }
.contact__row .field { margin-top: 16px; }

@media (min-width: 620px) {
  .contact__row { grid-template-columns: 1fr 1fr; }
}

.rsvp-form .form-error { text-align: left; margin-top: 16px; }
.rsvp-form .btn { margin-top: 4px; }

.rsvp-done {
  text-align: center;
  padding: 8px 0;
  outline: none;
  animation: rise-in 0.8s var(--ease-out);
}

.rsvp-done__title {
  margin: 8px 0 12px;
  font-weight: 400;
  font-size: clamp(1.9rem, 7vw, 2.5rem);
  line-height: 1.1;
  color: var(--choc);
}

.rsvp-done__text { max-width: 30em; margin: 0 auto; color: var(--ink); }

.rsvp-done__who {
  white-space: pre-line;
  margin-top: 14px;
  font-style: italic;
  color: var(--muted);
}

.rsvp-done__next {
  max-width: 30em;
  margin: 18px auto 24px;
  padding: 14px 16px;
  border-radius: 8px;
  background: var(--sand-lo);
  font-size: 1.02rem;
  font-style: italic;
  color: var(--choc);
}

.rsvp-done__next:empty { display: none; }

/* -------------------------------------------------------------- hashtag */

.hashtag { text-align: center; }

.hashtag__art {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 18px auto 6px;
  font-family: var(--caps);
  color: var(--choc);
  line-height: 1;
}

.hashtag__l1 {
  font-size: clamp(2rem, 10vw, 3.6rem);
  letter-spacing: 0.06em;
  white-space: nowrap;
}


.hashtag__art em {
  font-family: var(--script);
  font-style: normal;
  font-size: 1.45em;
  letter-spacing: 0;
  color: var(--clay);
  margin: 0 0.02em 0 0.04em;
  line-height: 0.8;
}

.hashtag__l2 {
  margin-top: 0.35em;
  font-size: clamp(0.95rem, 4.4vw, 1.5rem);
  letter-spacing: 0.34em;
  text-transform: uppercase;
}

.hashtag__l2 em {
  font-size: 2.2em;
  margin-left: 0.2em;
  text-transform: none;
  letter-spacing: 0;
  color: var(--clay);
}

.hashtag .btn { margin-top: 26px; }

/* -------------------------------------------------------------- faq */

.faq__list {
  max-width: 720px;
  margin: 0 auto;
  border-top: 1px solid var(--line);
}

.faq__item { border-bottom: 1px solid var(--line); }

.faq__q {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: 100%;
  min-height: 64px;
  padding: 18px 2px;
  border: 0;
  background: none;
  text-align: left;
  font-weight: 500;
  font-size: 1.3rem;
  line-height: 1.3;
  color: var(--choc);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.faq__icon {
  flex: none;
  width: 11px;
  height: 11px;
  margin-right: 6px;
  border-right: 1.5px solid var(--clay);
  border-bottom: 1.5px solid var(--clay);
  transform: translateY(-3px) rotate(45deg);
  transition: transform 0.4s var(--ease-out);
}

.faq__item.is-open .faq__icon { transform: translateY(2px) rotate(-135deg); }

.faq__a {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.45s var(--ease-out);
}

.faq__a > div { overflow: hidden; }

.faq__a p {
  padding: 0 44px 22px 2px;
  color: var(--muted);
  font-size: 1.12rem;
}

.faq__item.is-open .faq__a { grid-template-rows: 1fr; }

.faq__empty {
  text-align: center;
  font-style: italic;
  color: var(--muted);
  padding: 24px 0;
}

/* -------------------------------------------------------------- footer */

.footer {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: clamp(64px, 12vw, 110px) var(--gutter) calc(clamp(90px, 14vw, 120px) + var(--safe-b));
  text-align: center;
  background: #4A2F21 var(--grain);
  color: var(--cream);
}

.footer__seal {
  width: 132px;
  height: 132px;
  margin-bottom: 6px;
}


.footer__names {
  font-weight: 300;
  font-size: clamp(2.2rem, 9vw, 3rem);
  line-height: 1.1;
  color: var(--cream);
}

.footer__names .amp { color: var(--sand); }

.footer__date {
  font-family: var(--caps);
  font-size: 0.74rem;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--sand);
}

.footer .link-quiet {
  margin-top: 22px;
  color: rgba(245, 239, 230, 0.6);
  text-decoration-color: rgba(216, 194, 168, 0.4);
  font-size: 0.95rem;
}

.footer__credit {
  margin-top: 34px;
  padding-top: 20px;
  width: min(100%, 300px);
  border-top: 1px solid rgba(216, 194, 168, 0.18);
  font-family: var(--caps);
  font-size: 0.62rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: rgba(245, 239, 230, 0.5);
}

.footer__credit a {
  display: inline-block;
  margin-top: 6px;
  color: var(--sand);
  text-decoration: none;
  border-bottom: 1px solid rgba(216, 194, 168, 0.35);
  padding-bottom: 2px;
  transition: color 0.3s, border-color 0.3s;
}

@media (hover: hover) {
  .footer__credit a:hover { color: var(--cream); border-color: var(--cream); }
}

/* -------------------------------------------------------------- fab & toast */

.fab {
  position: fixed;
  right: 16px;
  bottom: calc(16px + var(--safe-b));
  z-index: 30;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 24px;
  border-radius: 999px;
  background: linear-gradient(135deg, #C96A4A, #A8573C);
  color: #FFF8EE;
  font-family: var(--caps);
  font-size: 0.8rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  text-decoration: none;
  box-shadow: 0 16px 30px -12px rgba(91, 38, 25, 0.6), inset 0 0 0 1px rgba(255, 236, 205, 0.3);
  transition: transform 0.5s var(--ease-out), opacity 0.4s;
  -webkit-tap-highlight-color: transparent;
}

.fab.is-hidden {
  transform: translateY(calc(100% + 30px));
  opacity: 0;
  pointer-events: none;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(84px + var(--safe-b));
  z-index: 80;
  max-width: calc(100vw - 32px);
  padding: 12px 20px;
  border-radius: 999px;
  background: rgba(74, 47, 33, 0.94);
  color: var(--cream);
  font-size: 1rem;
  font-style: italic;
  text-align: center;
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s, transform 0.45s var(--ease-out);
}

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

/* -------------------------------------------------------------- idle */

/* No input for a minute, or the tab is hidden: the looping decoration holds still
   (the light motes stop too, in invite.js). Any touch, scroll or key brings it back. */
.is-idle .scene__bg,
.is-idle .gesture__mover,
.is-idle .gesture__hand,
.is-idle .gesture__trail,
.is-idle .seal img,
.is-idle .letter,
.is-idle .hands img,
.is-idle .scroll-cue span,
.is-idle .boot__seal { animation-play-state: paused !important; }

/* -------------------------------------------------------------- motion */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
  .hero.is-pre [data-enter] { opacity: 1; }
  /* a still hand in place of the moving one */
  .gesture__mover,
  .gesture__hand,
  .gesture__trail,
  .scene.is-hint-hold .seal img { animation: none !important; }
  .motes { display: none; }
}
