:root {
  --ink: #0b0a0a;
  --ivory: #f4efe8;
  --ivory-soft: rgb(244 239 232 / 0.78);
  --line: rgb(244 239 232 / 0.3);
  --font-serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --font-script: "Pinyon Script", "Italianno", "Snell Roundhand", cursive;
  --vh: 100vh;
  --pad-x: clamp(1.5rem, 6vw, 6rem);
  --pad-y: clamp(1.5rem, 7vh, 5rem);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

@supports (height: 100svh) {
  :root { --vh: 100svh; }
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  background: var(--ink);
  scrollbar-width: none;
  -webkit-text-size-adjust: 100%;
  /* The viewport is what Chrome pulls to refresh. Body alone does not catch it. */
  overscroll-behavior: none;
}
html::-webkit-scrollbar { display: none; }
html.is-locked,
html.is-locked body { overflow: hidden; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--ivory);
  font: 400 1rem/1.5 var(--font-serif);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

img { display: block; max-width: 100%; }
h1, h2, p, dl, dd, figure { margin: 0; }
button { font: inherit; color: inherit; }

/* ---------- Typography ---------- */
.eyebrow {
  font-size: clamp(0.72rem, 0.65rem + 0.3vw, 0.9rem);
  font-weight: 500;
  letter-spacing: 0.38em;
  text-transform: uppercase;
  color: var(--ivory-soft);
}

.title {
  font-size: clamp(2.4rem, 1.5rem + 4.4vw, 5.6rem);
  font-weight: 300;
  font-style: italic;
  line-height: 1.02;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.lead {
  font-size: clamp(1.1rem, 0.95rem + 0.6vw, 1.5rem);
  font-weight: 300;
  line-height: 1.45;
  color: var(--ivory-soft);
  text-wrap: pretty;
}

.names {
  font: 400 clamp(4.2rem, 2rem + 11vw, 11rem)/1.1 var(--font-script);
  padding-inline: 0.2em;
}
.names .amp { font-size: 0.6em; vertical-align: 0.15em; }

.time,
.date,
.countdown b,
.accounts dd,
.preloader__count { font-variant-numeric: lining-nums tabular-nums; }

.time,
.date {
  font-size: clamp(2rem, 1.2rem + 3.4vw, 4.2rem);
  font-weight: 300;
  letter-spacing: 0.08em;
}
.date span { color: var(--line); }

.note,
.place {
  font-size: clamp(0.95rem, 0.9rem + 0.25vw, 1.1rem);
  color: var(--ivory-soft);
}
.note { font-style: italic; }
.place {
  font-size: clamp(1.05rem, 0.95rem + 0.4vw, 1.35rem);
  letter-spacing: 0.04em;
}

.signature {
  font: 400 clamp(2.4rem, 1.6rem + 3vw, 4rem)/1.2 var(--font-script);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: 0.75em 2em;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgb(11 10 10 / 0.42);
  color: var(--ivory);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.5s var(--ease), color 0.5s var(--ease), border-color 0.5s var(--ease);
}
.btn:hover,
.btn:focus-visible,
.btn--solid {
  background: var(--ivory);
  border-color: var(--ivory);
  color: var(--ink);
}
.btn--solid:hover,
.btn--solid:focus-visible { background: transparent; color: var(--ivory); }
.btn--small { min-height: 2.25rem; padding: 0.4em 1.4em; font-size: 0.72rem; }
.btn:focus-visible { outline: 1px solid var(--ivory); outline-offset: 4px; }

/* ---------- Preloader ---------- */
/* Same light as the gate, so the title card can dissolve straight into the opener. */
.preloader {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding:
    max(var(--pad-y), env(safe-area-inset-top))
    max(var(--pad-x), env(safe-area-inset-right))
    max(var(--pad-y), env(safe-area-inset-bottom))
    max(var(--pad-x), env(safe-area-inset-left));
  background: radial-gradient(ellipse at 50% 40%, #191716 0%, var(--ink) 72%);
  overflow: hidden;
  overscroll-behavior: contain;
  touch-action: none;
  user-select: none;
}
.preloader__inner {
  display: grid;
  justify-items: center;
  gap: clamp(0.85rem, 2.2vh, 1.35rem);
  text-align: center;
  opacity: 0;
}
/* Held until the script face is ready, so the wordmark never paints in a fallback. */
html.is-typed .preloader__inner {
  animation: preloader-in 1.05s var(--ease) both;
}
@keyframes preloader-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
.preloader__names {
  font: 400 clamp(2.85rem, 1.3rem + 7.2vw, 6.25rem) / 0.95 var(--font-script);
  padding-inline: 0.12em;
}
.preloader__names .amp {
  font-size: 0.62em;
  vertical-align: 0.14em;
}
.preloader__meter {
  width: min(52vw, 13.5rem);
  height: 1px;
  margin-top: 0.35rem;
  background: rgb(244 239 232 / 0.2);
}
.preloader__meter span {
  display: block;
  height: 100%;
  background: var(--ivory);
  transform: scaleX(0);
  transform-origin: center;
}
.preloader__count {
  margin-top: -0.15rem;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.42em;
  text-indent: 0.42em;
  color: var(--ivory-soft);
}
.preloader__status {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---------- Gate ---------- */
.gate {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: var(--pad-y) var(--pad-x);
  background: radial-gradient(ellipse at 50% 40%, #191716 0%, var(--ink) 72%);
  overflow: hidden;
  overscroll-behavior: contain;
  touch-action: none;
}
.gate__prints {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
.gate__photo {
  position: absolute;
  height: auto;
  object-fit: cover;
  border: 3px solid rgb(244 239 232 / 0.9);
  box-shadow:
    0 22px 50px rgb(0 0 0 / 0.5),
    0 2px 8px rgb(0 0 0 / 0.35);
}
/*
 * Three prints, still tossed in three directions, but gathered toward the monogram.
 * The gap is measured from the logo so they stay near it on wide screens
 * without sitting on top of it.
 */
.gate__photo--1 {
  --print-w: clamp(8.75rem, 18vw, 16.25rem);
  width: var(--print-w);
  aspect-ratio: 2 / 3;
  top: clamp(3.5rem, 13vh, 7rem);
  left: max(0.75rem, calc(50% - min(31vw, 24vh, 13rem) - clamp(5rem, 6.75vw, 8rem) - var(--print-w)));
  transform: rotate(-14deg);
  transform-origin: 75% 55%;
}
.gate__photo--2 {
  --print-w: clamp(10.25rem, 25vw, 20.25rem);
  width: var(--print-w);
  aspect-ratio: 3 / 2;
  top: clamp(2.75rem, 10vh, 5.75rem);
  left: min(
    calc(100% - var(--print-w) - 0.75rem),
    calc(50% + min(31vw, 24vh, 13rem) + clamp(4.25rem, 5.25vw, 6.75rem))
  );
  transform: rotate(9deg);
  transform-origin: 25% 80%;
}
.gate__photo--3 {
  --print-w: clamp(8.25rem, 16.5vw, 15.25rem);
  width: var(--print-w);
  aspect-ratio: 2 / 3;
  bottom: clamp(1.75rem, 9vh, 5.25rem);
  left: min(
    calc(100% - var(--print-w) - 1rem),
    calc(50% + min(31vw, 24vh, 13rem) + clamp(4.75rem, 7vw, 8rem))
  );
  transform: rotate(13deg);
  transform-origin: 40% 15%;
}
/* Narrow screens: keep the prints in the corners so they stay off the monogram. */
@media (max-width: 820px) {
  .gate__photo--1 {
    --print-w: 6.85rem;
    top: 1.45rem;
    left: 1.85rem;
  }
  .gate__photo--2 {
    --print-w: 9.6rem;
    top: 1.15rem;
    left: auto;
    right: 1.45rem;
  }
  .gate__photo--3 {
    --print-w: 6.55rem;
    bottom: 1.45rem;
    left: auto;
    right: 1.05rem;
  }
}
.gate__inner {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: clamp(1rem, 3vh, 2rem);
  text-align: center;
}
.gate__logo {
  width: min(62vw, 48vh, 26rem);
  height: auto;
}
.gate__hint {
  font-size: 0.8rem;
  font-style: italic;
  letter-spacing: 0.08em;
  color: var(--ivory-soft);
}

/* ---------- Continuous, Joint Horizontal Story ---------- */
.story {
  position: relative;
  height: var(--vh);
  overflow: hidden;
  background: var(--ink);
}
.track {
  display: flex;
  width: max-content;
  height: 100%;
}

.chapter {
  position: relative;
  flex: 0 0 100vw;
  width: 100vw;
  height: 100%;
  display: grid;
  place-items: center;
  padding:
    max(var(--pad-y), env(safe-area-inset-top))
    max(var(--pad-x), env(safe-area-inset-right))
    max(calc(var(--pad-y) + 1.5rem), env(safe-area-inset-bottom))
    max(var(--pad-x), env(safe-area-inset-left));
}

.content {
  position: relative;
  z-index: 2;
  display: grid;
  justify-items: center;
  gap: clamp(0.85rem, 2.2vh, 1.5rem);
  max-width: 44rem;
  text-align: center;
}

/*
 * Seamless, joint canvas across slides:
 * Each chapter's media bleeds 8vw past its left and right boundaries (-8vw)
 * and feathers softly into the neighbouring chapter so there is never a hard seam
 * or line between slides on any device. The dissolve is kept narrow so it reads as
 * a soft edge rather than a dark wall over the picture.
 */
.media {
  --seam-blend: linear-gradient(
    to right,
    transparent 0%,
    #000 13%,
    #000 87%,
    transparent 100%
  );
  position: absolute;
  top: 0;
  bottom: 0;
  left: -8vw;
  right: -8vw;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  -webkit-mask-image: var(--seam-blend);
  mask-image: var(--seam-blend);
}
.chapter:first-child .media {
  left: 0;
  --seam-blend: linear-gradient(to right, #000 0%, #000 87%, transparent 100%);
}
.chapter:last-child .media {
  right: 0;
  /* Fade only the off-screen bleed. A wider fade ghosts the couple, who sit on the left. */
  --seam-blend: linear-gradient(to right, transparent 0%, #000 7.5%, #000 100%);
}

.media img {
  position: absolute;
  top: 0;
  left: -6%;
  width: 112%;
  max-width: none;
  height: 100%;
  object-fit: cover;
  object-position: var(--focus, 50% 50%);
  /* Scale is scrubbed on this. Without the hint Chrome re-rasterises the
     photo at every new scale, which reads as stutter under a slow drag. */
  will-change: transform;
}

/* Gentle bottom-weighted scrim for legible typography while keeping photos bright and strong */
.media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgb(11 10 10 / 0.76) 0%,
    rgb(11 10 10 / 0.24) 44%,
    rgb(11 10 10 / 0.06) 72%,
    rgb(11 10 10 / 0.24) 100%
  );
}
.media--dim::after {
  background: linear-gradient(
    to top,
    rgb(11 10 10 / 0.82) 0%,
    rgb(11 10 10 / 0.48) 50%,
    rgb(11 10 10 / 0.62) 100%
  );
}

/* Hero */
.chapter--hero .content { max-width: none; }
.chapter--hero .media::after {
  background: linear-gradient(
    to top,
    rgb(11 10 10 / 0.8) 0%,
    rgb(11 10 10 / 0.28) 50%,
    rgb(11 10 10 / 0.4) 100%
  );
}
.scroll-hint {
  position: absolute;
  bottom: max(1.65rem, env(safe-area-inset-bottom));
  left: 50%;
  z-index: 2;
  display: grid;
  justify-items: center;
  gap: 0.7rem;
  margin: 0;
  translate: -50% 0;
  pointer-events: none;
  color: rgb(244 239 232 / 0.88);
}
.scroll-hint__label {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}
.scroll-hint__label > span {
  font-size: 0.95rem;
  font-weight: 400;
  font-style: italic;
  letter-spacing: 0.32em;
  padding-inline-start: 0.32em;
  line-height: 1;
  text-shadow: 0 10px 28px rgb(11 10 10 / 0.55);
}
.scroll-hint__label::before,
.scroll-hint__label::after {
  content: "";
  width: clamp(1.35rem, 4.5vw, 2.25rem);
  height: 1px;
  background: linear-gradient(90deg, transparent, rgb(244 239 232 / 0.7));
}
.scroll-hint__label::after {
  background: linear-gradient(90deg, rgb(244 239 232 / 0.7), transparent);
}
.scroll-hint__cue {
  display: grid;
  justify-items: center;
}
.scroll-hint__cue::before {
  content: "";
  width: 1px;
  height: 1.35rem;
  margin-bottom: 0.2rem;
  background: linear-gradient(to bottom, rgb(244 239 232 / 0.72), rgb(244 239 232 / 0));
}
.scroll-hint__cue i {
  width: 0.46rem;
  height: 0.46rem;
  margin-top: -0.16rem;
  border-right: 1px solid rgb(244 239 232 / 0.92);
  border-bottom: 1px solid rgb(244 239 232 / 0.92);
  rotate: 45deg;
  animation: hint 2.4s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}
.scroll-hint__cue i:first-child { margin-top: 0; }
.scroll-hint__cue i:last-child { animation-delay: 0.28s; }
@keyframes hint {
  0%, 100% { opacity: 0.15; translate: 0 -0.12rem; }
  46% { opacity: 1; translate: 0 0.18rem; }
  78% { opacity: 0.2; translate: 0 0.38rem; }
}

/*
 * Bokeh stage for non-wide (portrait) photos:
 * a tiny pre-blurred copy of the same photo is stretched across the whole slide,
 * oversized so its soft edges never show. The real photo is shown in full inside `.frame`.
 */
.media--stage img {
  top: -10%;
  left: -12%;
  width: 124%;
  height: 120%;
}
.media--stage::after {
  background:
    radial-gradient(ellipse 70% 60% at 50% 45%, rgb(11 10 10 / 0) 0%, rgb(11 10 10 / 0.42) 100%),
    linear-gradient(to top, rgb(11 10 10 / 0.72) 0%, rgb(11 10 10 / 0.08) 45%, rgb(11 10 10 / 0.18) 100%);
}
.media--stage.media--dim::after {
  background:
    radial-gradient(ellipse 70% 60% at 50% 45%, rgb(11 10 10 / 0.1) 0%, rgb(11 10 10 / 0.6) 100%),
    linear-gradient(to top, rgb(11 10 10 / 0.8) 0%, rgb(11 10 10 / 0.3) 50%, rgb(11 10 10 / 0.42) 100%);
}

/* ---------- Framed chapters: the photo as a gallery print ---------- */
.chapter--framed {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  align-items: center;
  justify-items: center;
  row-gap: clamp(1.1rem, 3vh, 2rem);
  padding-top: max(calc(var(--pad-y) * 0.8), env(safe-area-inset-top));
}
.chapter--framed .content {
  grid-row: 2;
  gap: clamp(0.6rem, 1.6vh, 1.1rem);
}

.frame {
  position: relative;
  z-index: 2;
  grid-row: 1;
  display: grid;
  place-items: center;
  align-self: stretch;
  justify-self: stretch;
  width: 100%;
  min-width: 0;
  min-height: 0;
  margin: 0;
}
.frame__inner {
  position: relative;
  max-width: 100%;
  max-height: 100%;
  height: 100%;
  aspect-ratio: 854 / 1280;
  overflow: hidden;
  background: #151312;
  will-change: transform; /* scaled by the scrub; see .media img */
  box-shadow:
    0 1px 0 rgb(244 239 232 / 0.18) inset,
    0 30px 70px -20px rgb(0 0 0 / 0.75),
    0 60px 120px -40px rgb(0 0 0 / 0.6);
}
.frame__inner img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}
/* Fine gallery mat: a hairline a few pixels off the print edge */
.frame__inner::before {
  content: "";
  position: absolute;
  inset: clamp(6px, 0.9vw, 12px);
  border: 1px solid rgb(244 239 232 / 0.38);
  pointer-events: none;
}
/* Light sweeping across the glass as the print travels */
.frame__sheen {
  position: absolute;
  inset: -20% -60%;
  background: linear-gradient(
    105deg,
    transparent 38%,
    rgb(255 255 255 / 0.05) 46%,
    rgb(255 255 255 / 0.16) 50%,
    rgb(255 255 255 / 0.05) 54%,
    transparent 62%
  );
  pointer-events: none;
}

/* Giant chapter numeral floating in the depth behind the print */
.numeral {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 50%;
  translate: -50% -56%;
  font-size: clamp(16rem, 70vh, 44rem);
  font-weight: 300;
  font-style: italic;
  line-height: 1;
  letter-spacing: -0.04em;
  color: transparent;
  -webkit-text-stroke: 1px rgb(244 239 232 / 0.16);
  pointer-events: none;
  user-select: none;
}

.chapter--framed .date {
  font-size: clamp(1.65rem, 0.85rem + 2.2vw, 3.3rem);
}
.chapter--framed .countdown {
  width: 100%;
  justify-self: stretch;
}
.chapter--framed .countdown p { min-width: 0; }

/* Hairline divider used on the date slide */
.rule {
  display: block;
  width: 1px;
  height: clamp(2rem, 6vh, 4rem);
  background: linear-gradient(transparent, var(--ivory), transparent);
}

/* Portrait screens: print above, words below. Chapters with more text pack their words tighter. */
.chapter--info.chapter--framed .content { gap: clamp(0.5rem, 1.4vh, 0.9rem); }

/* Landscape / wide screens: print on one side, words on the other, like a spread in a book. */
@media (orientation: landscape) and (min-width: 768px) {
  .chapter--framed {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    column-gap: clamp(2rem, 6vw, 7rem);
    padding-top: max(var(--pad-y), env(safe-area-inset-top));
  }
  .chapter--framed .frame {
    grid-row: 1;
    grid-column: 1;
    justify-self: end;
  }
  .chapter--framed .frame__inner { margin-inline-start: auto; }
  .chapter--framed .content {
    grid-row: 1;
    grid-column: 2;
    justify-self: start;
    justify-items: start;
    text-align: left;
    max-width: 34rem;
    gap: clamp(0.85rem, 2.2vh, 1.5rem);
  }
  .chapter--framed .actions { justify-content: flex-start; }

  .chapter--framed.is-reversed .frame {
    grid-column: 2;
    justify-self: start;
  }
  .chapter--framed.is-reversed .frame__inner { margin-inline-start: 0; margin-inline-end: auto; }
  .chapter--framed.is-reversed .content {
    grid-column: 1;
    justify-self: end;
    justify-items: end;
    text-align: right;
  }
  .chapter--framed.is-reversed .actions { justify-content: flex-end; }

  .numeral {
    left: 50%;
    translate: 0 -56%;
    font-size: clamp(18rem, 80vh, 52rem);
  }
  .is-reversed .numeral {
    left: auto;
    right: 50%;
  }

}

/* Short screens: keep the words small enough that the print still breathes */
@media (max-height: 640px) {
  .chapter--framed .title { font-size: clamp(1.7rem, 1.2rem + 2.4vw, 3.2rem); }
  .chapter--framed .lead { font-size: clamp(0.95rem, 0.9rem + 0.3vw, 1.15rem); }
  .chapter--framed .time { font-size: clamp(1.5rem, 1rem + 2vw, 2.6rem); }
}

/* Info chapters watermark */
.watermark {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 1;
  width: min(85vw, 85vh);
  height: auto;
  translate: -50% -50%;
  opacity: 0.04;
  pointer-events: none;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.9rem;
}
.actions--maps {
  width: min(100%, 40rem);
}
.actions--maps .btn {
  flex: 1 1 15rem;
  max-width: 100%;
  padding-inline: 1.2em;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  line-height: 1.35;
  text-align: center;
  white-space: normal;
}

/* Homes keeps a larger title over its framed print */
.chapter--panel .content { max-width: 46rem; }
.chapter--panel .title { font-size: clamp(2.15rem, 1.3rem + 3.4vw, 4.6rem); }

/*
 * RSVP: the portrait cannot cover a wide slide without cutting the couple off.
 * It is a gallery print (whole photo, true ratio) on the soft stage, and the
 * reply sits beside it on wide screens or just beneath it on a phone.
 * The form takes the height it needs; the print receives everything left.
 */
.chapter--rsvp {
  grid-template-rows: minmax(0, 1.15fr) auto;
  align-items: stretch;
  row-gap: clamp(0.45rem, 1.2vh, 1rem);
  padding-block: max(0.65rem, env(safe-area-inset-top)) max(0.75rem, env(safe-area-inset-bottom));
}
.chapter--rsvp .frame { min-height: 0; }
.chapter--rsvp .content {
  justify-self: center;
  width: min(100%, 34rem);
  gap: clamp(0.32rem, 0.85vh, 0.7rem);
  max-width: 34rem;
  min-height: 0;
}
.chapter--rsvp .title { font-size: clamp(1.85rem, 1.15rem + 2.4vw, 3.35rem); }
.chapter--rsvp .lead {
  font-size: clamp(0.98rem, 0.9rem + 0.35vw, 1.2rem);
  line-height: 1.35;
}
.chapter--rsvp .lead span { white-space: nowrap; }

.rsvp {
  display: grid;
  width: min(100%, 32rem);
  padding: clamp(0.65rem, 1.25vh, 1.15rem);
  border: 1px solid var(--line);
  background: rgb(11 10 10 / 0.62);
  box-shadow: 0 22px 50px -28px rgb(0 0 0 / 0.8);
  text-align: left;
}
.rsvp [data-rsvp-body] {
  display: grid;
  gap: clamp(0.5rem, 1.15vh, 0.95rem);
}
/* Author display rules must not override the hidden attribute. */
.rsvp [data-rsvp-body][hidden],
.rsvp__guests[hidden],
.rsvp__done[hidden],
.rsvp [data-calendar][hidden],
.rsvp [data-calendar-note][hidden],
.field[hidden] { display: none; }
.rsvp__choice {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}
.rsvp__option { position: relative; cursor: pointer; }
.rsvp__option input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
}
.rsvp__option span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2.85rem;
  padding: 0.55em 0.7em;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgb(11 10 10 / 0.35);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  line-height: 1.3;
  text-align: center;
  text-transform: uppercase;
  transition: background-color 0.45s var(--ease), color 0.45s var(--ease), border-color 0.45s var(--ease);
}
.rsvp__option:hover span,
.rsvp__option input:focus-visible + span {
  border-color: var(--ivory);
}
.rsvp__option input:checked + span {
  background: var(--ivory);
  border-color: var(--ivory);
  color: var(--ink);
}
.rsvp__option input:focus-visible + span {
  outline: 1px solid var(--ivory);
  outline-offset: 3px;
}

.rsvp__guests {
  display: grid;
  gap: 0.75rem;
}
.rsvp__count {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.45rem 0.45rem 0.45rem 0.9rem;
  border: 1px solid var(--line);
}
.rsvp__count > span {
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  line-height: 1.35;
  text-transform: uppercase;
  color: var(--ivory-soft);
}
.stepper {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 0.2rem;
}
.stepper button {
  display: grid;
  place-items: center;
  width: 2.15rem;
  height: 2.15rem;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.4s var(--ease), color 0.4s var(--ease);
}
.stepper button:hover,
.stepper button:focus-visible {
  background: var(--ivory);
  color: var(--ink);
}
.stepper button:focus-visible { outline: 1px solid var(--ivory); outline-offset: 3px; }
.stepper button[aria-disabled="true"] {
  opacity: 0.32;
  cursor: default;
}
.stepper button[aria-disabled="true"]:hover {
  background: transparent;
  color: inherit;
}
.stepper b {
  min-width: 1.4rem;
  font-size: 1.35rem;
  font-weight: 300;
  text-align: center;
}

.field { display: grid; gap: 0.28rem; }
.field span {
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ivory-soft);
}
.field input {
  width: 100%;
  padding: 0.45rem 0.05rem 0.5rem;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--ivory);
  font: 400 1.35rem/1.3 var(--font-serif);
}
.field input::placeholder {
  color: rgb(244 239 232 / 0.34);
  font-style: italic;
}
.field input:focus {
  outline: none;
  border-bottom-color: var(--ivory);
}
.field input.is-invalid { border-bottom-color: #e4cbb8; }

.rsvp .btn { width: 100%; }
.rsvp__done {
  display: grid;
  justify-items: center;
  gap: 0.55rem;
  padding-block: 0.35rem 0.15rem;
  text-align: center;
}
.rsvp__thanks {
  font-size: clamp(1.8rem, 1.2rem + 2vw, 2.7rem);
  font-weight: 300;
  font-style: italic;
  line-height: 1.05;
}
.rsvp__done .btn { width: auto; }
.rsvp__done [data-calendar] { width: 100%; }
.rsvp__reminder {
  margin: 0;
  max-width: 24rem;
  font-size: 1.05rem;
  font-weight: 300;
  font-style: italic;
  line-height: 1.35;
  color: var(--ivory-soft);
}

@media (max-width: 330px) {
  .rsvp__choice { grid-template-columns: 1fr; }
}

/* Portrait: keep the reply clear of the music control, which sits in the bottom corner. */
@media (orientation: portrait) {
  .chapter--rsvp {
    padding-bottom: max(4.5rem, calc(env(safe-area-inset-bottom) + 3.6rem));
  }
}

/* Phones: one-line replies. Each guest name keeps its own row under the print. */
@media (max-width: 540px) {
  .rsvp__option span {
    min-height: 2.6rem;
    padding-inline: 0.45em;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
  }
  .rsvp__guests { gap: 0.45rem; }
  .field { gap: 0.12rem; }
  .field input { padding-block: 0.12rem 0.28rem; }
  .chapter--rsvp.is-attending .content { gap: 0.22rem; }
  .chapter--rsvp.is-attending .title { font-size: 1.55rem; }
  .chapter--rsvp.is-attending .lead { font-size: 0.94rem; }
}

/* Short phones: a denser card so the print stays large even with both guest names open. */
@media (orientation: portrait) and (max-height: 720px) {
  .chapter--rsvp { row-gap: 0.4rem; padding-top: 0.45rem; }
  .chapter--rsvp .content { gap: 0.25rem; }
  .chapter--rsvp .title { font-size: 1.65rem; }
  .chapter--rsvp .lead { font-size: 0.95rem; line-height: 1.3; }
  .rsvp { padding: 0.5rem 0.65rem; }
  .rsvp [data-rsvp-body] { gap: 0.4rem; }
  .rsvp__option span {
    min-height: 2.45rem;
    padding: 0.4em 0.45em;
    font-size: 0.7rem;
    letter-spacing: 0.04em;
  }
  .rsvp__guests { gap: 0.4rem; }
  .rsvp__count { padding-block: 0.28rem; }
  .field input { padding-block: 0.2rem 0.28rem; font-size: 1.22rem; }
  .rsvp .btn { min-height: 2.3rem; }
}

/* Wide screens: print and reply as a spread, the photograph at full height. */
@media (orientation: landscape) and (min-width: 768px) {
  .chapter--rsvp {
    grid-template-rows: minmax(0, 1fr);
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    column-gap: clamp(1.5rem, 4vw, 4.5rem);
    padding-top: max(1.25rem, env(safe-area-inset-top));
    padding-bottom: max(1.75rem, env(safe-area-inset-bottom));
  }
  .chapter--rsvp .frame {
    grid-row: 1;
    grid-column: 1;
    justify-self: end;
  }
  .chapter--rsvp .content {
    grid-row: 1;
    grid-column: 2;
    justify-self: start;
    justify-items: start;
    align-self: center;
    width: min(100%, 32rem);
    text-align: left;
    max-width: 32rem;
    gap: clamp(0.65rem, 1.5vh, 1.1rem);
  }
  .chapter--rsvp .title { font-size: clamp(2.15rem, 1.3rem + 2vw, 3.5rem); }
  .rsvp { padding: clamp(0.85rem, 1.6vh, 1.2rem); }
  .rsvp [data-rsvp-body] { gap: clamp(0.65rem, 1.3vh, 1rem); }
}

.accounts {
  display: grid;
  gap: 1rem;
  width: min(100%, 34rem);
}
.accounts div {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.25rem 1rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--line);
  background: rgb(11 10 10 / 0.45);
  text-align: left;
}
.accounts dt {
  grid-column: 1;
  font-size: 0.72rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ivory-soft);
}
.accounts dd {
  grid-column: 1;
  font-size: clamp(1rem, 0.9rem + 0.5vw, 1.25rem);
  letter-spacing: 0.06em;
  overflow-wrap: anywhere;
}
.accounts .btn { grid-column: 2; grid-row: 1 / span 2; }

/* Save the date countdown */
.countdown {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(0.5rem, 2vw, 1.5rem);
  margin-top: 0.5rem;
}
.countdown p {
  display: grid;
  justify-items: center;
  min-width: 4.2rem;
  padding: 0.6rem 0.25rem;
  border-top: 1px solid var(--line);
}
.countdown b {
  font-size: clamp(1.8rem, 1.2rem + 2.4vw, 3.4rem);
  font-weight: 300;
  line-height: 1.1;
}
.countdown span {
  font-size: 0.65rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ivory-soft);
}

/* Closing */
.closing__logo {
  width: min(42vw, 30vh, 16rem);
  height: auto;
}

/* The closing media hangs 8vw off the left of the slide. Park the photo on the
   visible screen and keep its left edge — both faces — in frame. */
.chapter--closing .media img {
  left: 8vw;
  width: 100vw;
  height: 100%;
  object-fit: cover;
  object-position: left 42%;
}

/*
 * Phones and tablets are narrower than the sunset. Cover the slide and anchor
 * to the left, where the two of them are, so the crop falls on the city.
 */
@media (max-aspect-ratio: 3/2) {
  .chapter--hero .media img {
    top: 0;
    right: auto;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    max-width: none;
    object-fit: cover;
    object-position: left 42%;
  }

  .chapter--closing .media img {
    top: 0;
    bottom: 0;
    left: 8vw;
    width: 100vw;
    height: 100%;
    margin: 0;
    max-width: none;
    object-fit: cover;
    object-position: left 42%;
  }
}

/* Portrait: the photo is full-bleed, so the words sit low, under the faces. */
@media (orientation: portrait) {
  .chapter--hero {
    align-items: end;
    padding-bottom: max(8.75rem, calc(env(safe-area-inset-bottom) + 7.5rem));
  }
  .chapter--hero .scroll-hint {
    bottom: max(1.15rem, env(safe-area-inset-bottom));
  }
  .chapter--hero .media::after,
  .chapter--closing .media::after {
    background: linear-gradient(
      to top,
      rgb(11 10 10 / 0.86) 0%,
      rgb(11 10 10 / 0.5) 26%,
      rgb(11 10 10 / 0.06) 50%,
      rgb(11 10 10 / 0.22) 100%
    );
  }

  .chapter--closing {
    align-items: end;
    justify-items: center;
    padding-bottom: max(4.6rem, calc(env(safe-area-inset-bottom) + 3.5rem));
  }
  .chapter--closing .content {
    gap: clamp(0.35rem, 1.1vh, 0.75rem);
  }
  .chapter--closing .closing__logo {
    width: min(28vw, 16vh, 7.25rem);
  }
  .chapter--closing .title {
    font-size: clamp(1.85rem, 1.1rem + 3vw, 2.9rem);
  }
  .chapter--closing .lead {
    font-size: clamp(1rem, 0.92rem + 0.4vw, 1.2rem);
  }
}

/* Landscape tablets are still narrower than the photo, so the couple fills the
   left of the frame. Keep the words along the bottom, clear of both faces. */
@media (max-aspect-ratio: 3/2) and (orientation: landscape) {
  .chapter--hero,
  .chapter--closing {
    align-items: end;
  }
  .chapter--hero {
    padding-bottom: max(6.5rem, calc(env(safe-area-inset-bottom) + 5rem));
  }
  .chapter--hero .scroll-hint {
    bottom: max(1.15rem, env(safe-area-inset-bottom));
  }
  .chapter--closing {
    padding-bottom: max(2.25rem, calc(env(safe-area-inset-bottom) + 1.5rem));
  }
  .chapter--closing .content {
    gap: clamp(0.3rem, 1vh, 0.65rem);
  }
  .chapter--closing .closing__logo {
    width: min(22vw, 18vh, 7.5rem);
  }
  .chapter--closing .title {
    font-size: clamp(1.7rem, 1rem + 2vw, 2.6rem);
  }
  .chapter--hero .media::after,
  .chapter--closing .media::after {
    background: linear-gradient(
      to top,
      rgb(11 10 10 / 0.84) 0%,
      rgb(11 10 10 / 0.42) 24%,
      rgb(11 10 10 / 0.08) 48%,
      rgb(11 10 10 / 0.24) 100%
    );
  }
}

/* Short phones: keep the scroll hint clear of the names. */
@media (orientation: portrait) and (max-height: 740px) {
  .chapter--hero {
    padding-bottom: max(6.4rem, calc(env(safe-area-inset-bottom) + 5.2rem));
  }
}

/* Short landscape phones */
@media (max-height: 500px) {
  .content { gap: 0.5rem; }
  .names { font-size: clamp(3rem, 16vh, 6rem); }
  .title { font-size: clamp(1.8rem, 9vh, 3rem); }
  .time, .date { font-size: clamp(1.4rem, 8vh, 2.4rem); }
  .lead { font-size: 1rem; }
  .countdown b { font-size: 1.6rem; }
  .accounts { gap: 0.5rem; }
  .accounts div { padding: 0.5rem 1rem; }
  .closing__logo { width: 22vh; }
  .chapter--panel .title { font-size: clamp(1.55rem, 7.5vh, 2.5rem); }
  .chapter--rsvp { padding-block: 0.45rem; row-gap: 0.35rem; }
  .chapter--rsvp .content { gap: 0.28rem; }
  .chapter--rsvp .title { font-size: clamp(1.45rem, 6.4vh, 2.1rem); }
  .chapter--rsvp .lead { font-size: 0.92rem; }
  .chapter--rsvp .btn { min-height: 2.35rem; }
  .rsvp__reminder { font-size: 0.92rem; }
  .rsvp { padding: 0.55rem 0.75rem; }
  .rsvp [data-rsvp-body] { gap: 0.4rem; }
  .rsvp__option span { min-height: 2.15rem; }
  .rsvp__guests { gap: 0.4rem; }
  .rsvp__count { padding-block: 0.3rem; }
  .field input { padding-block: 0.25rem; font-size: 1.18rem; }
  .stepper button { width: 1.9rem; height: 1.9rem; }
}

/* Short but wide: keep the print beside the reply instead of stacking into the letterbox. */
@media (max-height: 500px) and (min-width: 560px) {
  .chapter--rsvp {
    grid-template-rows: minmax(0, 1fr);
    grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr);
    column-gap: 0.75rem;
    row-gap: 0;
    padding-top: 0.85rem;
    padding-bottom: 3.4rem;
  }
  .chapter--rsvp .frame {
    grid-row: 1;
    grid-column: 1;
    justify-self: center;
  }
  .chapter--rsvp .content {
    grid-row: 1;
    grid-column: 2;
    justify-self: stretch;
    justify-items: start;
    align-self: center;
    width: 100%;
    text-align: left;
    max-width: none;
  }
  .rsvp__guests {
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem 0.75rem;
  }
  .rsvp__count { grid-column: 1 / -1; }
}

/* ---------- Cinematic chrome ---------- */
/* Letterbox curtains: closed behind the gate, they draw open to reveal the picture */
.letterbox {
  position: fixed;
  inset: 0;
  z-index: 25; /* above the story, beneath the gate */
  pointer-events: none;
}
.letterbox span {
  position: absolute;
  left: 0;
  right: 0;
  height: 50.5%;
  background: var(--ink);
}
.letterbox span:first-child { top: 0; transform-origin: top; }
.letterbox span:last-child { bottom: 0; transform-origin: bottom; }

/* Soft lens vignette over the whole picture */
.vignette {
  position: fixed;
  inset: 0;
  z-index: 34;
  background:
    radial-gradient(ellipse 120% 95% at 50% 50%, transparent 55%, rgb(11 10 10 / 0.55) 100%),
    linear-gradient(to bottom, rgb(11 10 10 / 0.3), transparent 14%, transparent 86%, rgb(11 10 10 / 0.35));
  pointer-events: none;
}

/* Living film grain */
.grain {
  position: fixed;
  inset: -100px;
  z-index: 36;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  background-size: 220px 220px;
  opacity: 0.075;
  mix-blend-mode: soft-light;
  pointer-events: none;
  animation: grain 0.9s steps(6) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); }
  20% { transform: translate(-30px, 18px); }
  40% { transform: translate(22px, -40px); }
  60% { transform: translate(-44px, -12px); }
  80% { transform: translate(36px, 30px); }
  100% { transform: translate(-10px, 46px); }
}

/* ---------- UI chrome ---------- */
.petals {
  position: fixed;
  inset: 0;
  z-index: 40;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.progress {
  position: fixed;
  inset: auto 0 0;
  z-index: 50;
  height: 2px;
  background: rgb(244 239 232 / 0.12);
}
.progress span {
  display: block;
  height: 100%;
  background: var(--ivory);
  transform: scaleX(0);
  transform-origin: left;
}

.sound {
  position: fixed;
  right: max(1.25rem, env(safe-area-inset-right));
  bottom: max(1.25rem, env(safe-area-inset-bottom));
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  width: 2.9rem;
  height: 2.9rem;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgb(11 10 10 / 0.45);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
}
.sound span {
  flex: 1;
  height: 100%;
  background: var(--ivory);
  transform: scaleY(0.2);
  transform-origin: bottom;
  animation: eq 1.1s ease-in-out infinite alternate paused;
}
.sound span:nth-child(2) { animation-delay: -0.4s; }
.sound span:nth-child(3) { animation-delay: -0.8s; }
.sound span:nth-child(4) { animation-delay: -0.2s; }
.sound[aria-pressed="true"] span { animation-play-state: running; }
@keyframes eq {
  from { transform: scaleY(0.2); }
  to { transform: scaleY(1); }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(2rem, env(safe-area-inset-bottom));
  z-index: 55;
  padding: 0.6rem 1.4rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgb(11 10 10 / 0.85);
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  translate: -50% 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/*
 * A fast flick was promoting every slide at once — full-bleed masks, transforms,
 * and the turbulence grain blended over the whole page. Phones run out of GPU
 * memory, blank the tab, and reload it. Only the slides beside the viewport stay
 * painted; the script toggles .is-parked as the story moves.
 *
 * Parked slides are hidden with visibility, not display: nothing is re-laid out
 * or re-measured mid-flick, and a hidden layer holds no raster memory. The
 * raster hint is released on them so the browser can drop those layers too.
 */
@media (pointer: coarse) {
  .chapter.is-parked { visibility: hidden; }
  .chapter.is-parked .frame__inner { will-change: auto; }
  /*
   * The slide background is not panned on touch (see parallax()), so it must not be
   * composited either: it then paints into the stage's own tiles, and the seam mask
   * costs nothing persistent. Composited, each slide held a full-screen photo layer
   * plus a second full-screen layer for its mask — about 33 MB per slide at 3x.
   */
  .media img { will-change: auto; }
  /* The pinned stage is its own layer; an ink fill there is 11 MB the page already paints. */
  .story { background: transparent; }
  /* A faint gradient that cost 18 MB per print. The print still tilts and settles. */
  .frame__sheen { display: none; }
  /* The shadow's reach is part of the print's layer. Keep it tight on a phone. */
  .frame__inner {
    box-shadow:
      0 1px 0 rgb(244 239 232 / 0.18) inset,
      0 16px 36px -14px rgb(0 0 0 / 0.72);
  }
  .grain { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .scroll-hint__cue i,
  .grain,
  .sound span,
  .preloader__inner { animation: none; }
  html.is-typed .preloader__inner { opacity: 1; }
  .scroll-hint__cue i { opacity: 0.85; translate: 0 0.12rem; }
}
