/* ==========================================================================
   Sara & Moris — wedding invitation
   Two modes:
   - .story  : envelope opens, then a fixed sheet of paper shows 4 chapters
   - default : one long letter (reduced motion, ?static, no JS)
   Type and spacing follow the Figma "Letter" frame (Greece / blue variant).
   ========================================================================== */

/*
 * FONTS
 * PP Gatwick (names) is loaded from assets/fonts. It's the "Free for Personal
 * Use" version: Pangram Pangram's licence doesn't allow that version on a public
 * website, so buy the web licence before sharing the link widely.
 * PP Fragment (the big "24") isn't available, so Prata stands in for it.
 */
@font-face {
  font-family: "Gatwick Web";
  src: url("../assets/fonts/PPGatwick-GliderSemibold.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
/* To use PP Fragment for the "24", add PPFragment-SerifRegular.woff2 to
   assets/fonts and a matching @font-face named "Fragment Web". */

:root {
  /* Blue palette from the Figma "Greece" frame. The variable names are kept
     from the green version so the rest of the file is unchanged. */
  --olive: #263f75;
  --olive-dark: #263f75;
  --olive-soft: #5a72a3;
  --ink: rgb(61 80 91);
  --gold: #b8955a;
  --gold-line: rgb(184 149 90 / 0.5);
  --cream: #faf7ee;
  --sage-wash: rgb(214 223 234 / 0.3);

  --font-display: "Gatwick Web", "Yeseva One", Georgia, serif;
  --font-numeral: "Fragment Web", "Prata", Georgia, serif;
  --font-caps: "Marcellus", Georgia, serif;
  --font-body: "EB Garamond", Georgia, serif;
  --font-script: "Pinyon Script", "Snell Roundhand", cursive;

  --hairline: 0.66px;
  --ease-soft: cubic-bezier(0.22, 0.61, 0.36, 1);

  /* Set by JS in story mode */
  --pw: 374px;   /* paper width */
  --ph: 846px;   /* paper height */
  --ep: 8px;     /* envelope margin around the paper */
  --fs: 1;       /* florals scale */
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-body);
  background-color: var(--olive);
  background-image:
    radial-gradient(circle 860px at 20% 30%, rgb(255 255 255 / 0.06), transparent),
    radial-gradient(circle 1080px at 80% 70%, rgb(0 0 0 / 0.12), transparent),
    url("../assets/images/texture-linen-green.png");
  background-size: 100% 100%, 100% 100%, 160px 160px;
  background-attachment: fixed, fixed, scroll;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { display: block; max-width: 100%; }
h1, h2, p, figure, ol { margin: 0; }
[hidden] { display: none !important; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-motion {
  position: fixed;
  left: 12px;
  top: 12px;
  z-index: 20;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--cream);
  color: var(--olive-dark);
  font-family: var(--font-caps);
  font-size: 12px;
  letter-spacing: 1.5px;
  text-decoration: none;
  transform: translateY(-200%);
  transition: transform 0.3s var(--ease-soft);
}
.skip-motion:focus { transform: none; outline: 2px solid var(--gold); outline-offset: 2px; }
html:not(.story) .skip-motion { display: none; }

/* ==========================================================================
   Paper
   ========================================================================== */

.paper-wrap { position: relative; }

.card {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  text-align: center;
}

/* Hand-torn (deckled) paper: the same soft mask on every paper layer. */
.card::before,
.card-edge,
.card-inset {
  -webkit-mask:
    url("../assets/images/deckle-left.png") left top / 6px 240px repeat-y,
    url("../assets/images/deckle-right.png") right top / 6px 240px repeat-y,
    url("../assets/images/deckle-top.png") left top / 240px 6px repeat-x,
    url("../assets/images/deckle-bottom.png") left bottom / 240px 6px repeat-x,
    linear-gradient(#000, #000) center / calc(100% - 12px) calc(100% - 12px) no-repeat;
  mask:
    url("../assets/images/deckle-left.png") left top / 6px 240px repeat-y,
    url("../assets/images/deckle-right.png") right top / 6px 240px repeat-y,
    url("../assets/images/deckle-top.png") left top / 240px 6px repeat-x,
    url("../assets/images/deckle-bottom.png") left bottom / 240px 6px repeat-x,
    linear-gradient(#000, #000) center / calc(100% - 12px) calc(100% - 12px) no-repeat;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background-color: var(--cream);
  background-image:
    radial-gradient(120% 80% at 30% 20%, rgb(255 255 255 / 0.55), transparent 60%),
    radial-gradient(120% 90% at 80% 100%, rgb(214 200 168 / 0.25), transparent 60%),
    url("../assets/images/texture-paper.png");
  background-size: 100% 100%, 100% 100%, 160px 160px;
}

/* Paper thickness: a soft warm shade right at the torn edge. */
.card-edge {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  box-shadow:
    inset 0 0 1.5px 1px rgb(150 125 80 / 0.28),
    inset 0 0 10px rgb(150 125 80 / 0.12);
}

/* Shade cast by the envelope walls while the paper is still inside. */
.card-inset {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  opacity: 0;
  box-shadow: inset 0 0 40px 6px rgb(8 16 38 / 0.45);
}

.paper-shadow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: 4px;
}
.paper-shadow--contact { box-shadow: 0 1px 2px rgb(4 8 20 / 0.45), 0 2px 8px rgb(4 8 20 / 0.25); }
.paper-shadow--lift { box-shadow: 0 18px 30px rgb(6 12 30 / 0.28), 0 40px 70px rgb(6 12 30 / 0.35); }

.card-border {
  position: absolute;
  pointer-events: none;
  border-style: solid;
  border-width: var(--hairline);
}
.card-border--outer { inset: 12px; border-color: rgb(184 149 90 / 0.6); }
.card-border--inner { inset: 18px; border-color: rgb(184 149 90 / 0.25); }

/* ==========================================================================
   Content (shared by both modes)
   ========================================================================== */

.chapter-inner { width: 330px; margin: 0 auto; }

.eyebrow {
  font-family: var(--font-caps);
  font-weight: 400;
  font-size: 11px;
  line-height: 16.5px;
  letter-spacing: 4.4px;
  text-transform: uppercase;
  color: var(--olive);
}
.eyebrow--section { padding-top: 40px; }

.rule {
  display: block;
  height: 1px;
  background: var(--gold-line);
}

.divider {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 30px;
}
.garland { width: 250px; height: auto; }

/* Script lines can be "written" in with a soft left-to-right mask. */
.ink {
  display: inline-block;
  padding: 0.12em 0.4em;
  margin: -0.12em -0.4em;
}

/* ---------- Chapter 1 · hero ---------- */

.illustration {
  position: relative;
  width: 100%;
  aspect-ratio: 330 / 213;
}
.illustration-arch {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: auto;
}
.illustration-couple {
  position: absolute;
  left: 37.19%;
  top: 36.64%;
  width: 23.86%;
  height: 54.49%;
  overflow: hidden;
}
.illustration-couple img {
  width: 151.5%;
  height: auto;
  max-width: none;
  margin-left: -18.43%;
}

.eyebrow--families { padding-top: 42px; }
/* Stays on one line (and centred) while its letter spacing animates, so it
   never wraps to two lines and then jumps back. */
.story .eyebrow--families {
  display: flex;
  justify-content: center;
  white-space: nowrap;
}
.story .eyebrow--families .fchar { display: inline-block; }

.names { font-weight: 400; }

.name {
  display: block;
  font-family: var(--font-display);
  font-weight: 400;
  font-synthesis: none;
  font-size: 41.6px;
  line-height: 52px;
  letter-spacing: 3.328px;
  padding-left: 3.328px; /* balances the trailing letter-spacing */
  color: var(--olive-dark);
}
.name--first { padding-top: 24px; }
.name .char { display: inline-block; }

.and-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  height: 40px;
}
.and-row .rule { width: 48px; }
.and {
  font-family: var(--font-script);
  font-size: 36px;
  line-height: 40px;
  color: var(--gold);
}

.invite-text {
  padding-top: 32px;
  font-size: 18px;
  line-height: 29.25px;
  color: rgb(61 80 91 / 0.8);
}

.date {
  display: grid;
  grid-template-columns: 1fr 76px 1fr;
  align-items: center;
  margin-top: 40px;
  height: 64px;
}
.date-side {
  padding: 8px 0;
  border-block: var(--hairline) solid var(--gold-line);
  font-family: var(--font-caps);
  font-size: 13px;
  line-height: 18px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--olive);
}
.date-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  height: 64px;
  border-inline: var(--hairline) solid var(--gold-line);
}
.date-day {
  font-family: var(--font-numeral);
  font-size: 40px;
  line-height: 48px;
  color: var(--olive-dark);
}
.date-year {
  font-family: var(--font-caps);
  font-size: 15px;
  line-height: 18px;
  letter-spacing: 3.6px;
  padding-left: 3.6px;
  color: var(--olive);
}

.time {
  padding-top: 16px;
  font-style: italic;
  font-size: 14px;
  line-height: 20px;
  color: var(--olive);
}

/* ---------- Chapter 2 · photo + countdown ---------- */

.photo-frame {
  aspect-ratio: 329.8 / 412.26;
  padding: 8px;
  overflow: hidden;
  border: var(--hairline) solid var(--gold-line);
  border-radius: 999px 999px 0 0;
  background: var(--sage-wash);
}
.photo-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover; /* photo is pre-cropped to this frame's proportions */
  border-radius: 999px 999px 0 0;
}

.photo-caption {
  padding-top: 16px;
  height: 52px;
  font-family: var(--font-script);
  font-size: 30px;
  line-height: 36px;
  color: var(--olive);
}

.ch-moment .divider { margin-top: 30px; }

.countdown {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-top: 24px;
  height: 56px;
}
.countdown-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  border-right: var(--hairline) solid rgb(184 149 90 / 0.3);
}
.countdown-cell:last-child { border-right: 0; }
.countdown-num {
  display: inline-block;
  font-family: var(--font-caps);
  font-size: 30px;
  line-height: 36px;
  color: var(--olive-dark);
  font-variant-numeric: tabular-nums;
}
.countdown-num.tick { animation: tick 0.6s var(--ease-soft); }
@keyframes tick {
  0% { transform: translateY(-35%); opacity: 0; filter: blur(2px); }
  100% { transform: none; opacity: 1; filter: none; }
}
.countdown-label {
  padding-top: 4px;
  font-style: italic;
  font-size: 12px;
  line-height: 16px;
  color: var(--olive);
}
.countdown-done {
  margin-top: 20px;
  font-family: var(--font-script);
  font-size: 34px;
  line-height: 40px;
  color: var(--olive-dark);
}

/* ---------- Chapter 3 · the day ---------- */

.script-title {
  padding-top: 32px;
  font-family: var(--font-script);
  font-weight: 400;
  font-size: 60px;
  line-height: 60px;
  color: var(--olive-dark);
}
.eyebrow--agenda { padding-top: 8px; }

.timeline-wrap {
  position: relative;
  margin-top: 28px;
  text-align: left;
}
.timeline-line {
  position: absolute;
  left: 60px;
  top: 8px;
  bottom: 16px;
  width: 1px;
  background: rgb(173 188 191 / 0.5);
  transform-origin: top center;
}
.timeline { list-style: none; padding: 0; }

.event {
  display: grid;
  grid-template-columns: 44px 32px 1fr;
  align-items: start;
  min-height: 88px;
  padding-bottom: 12px;
}
.event-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin-top: -8px;
}
.event-icon svg { overflow: visible; }
.event-dot {
  position: relative;
  width: 8px;
  height: 8px;
  margin: 6px 0 0 12px;
  border-radius: 50%;
  background: var(--olive-soft);
  box-shadow: 0 0 0 4px var(--cream);
}
/* Soft ring that ripples out when the moment arrives (story mode) */
.event-ring {
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  border: 1px solid var(--olive-soft);
  opacity: 0;
  pointer-events: none;
}

.event-text { display: flex; flex-direction: column; }
.event-time {
  font-family: var(--font-caps);
  font-size: 14px;
  line-height: 20px;
  letter-spacing: 1.4px;
  color: var(--gold);
}
.event-title {
  font-family: var(--font-caps);
  font-size: 18px;
  line-height: 28px;
  color: var(--olive-dark);
}
.event-desc {
  font-style: italic;
  font-size: 16px;
  line-height: 22px;
  color: rgb(61 80 91 / 0.7);
}

/* ---------- Chapter 4 · venue, RSVP, signature ---------- */

.venue .eyebrow--section { padding-top: 32px; }
.venue-name {
  padding-top: 16px;
  font-family: var(--font-script);
  font-weight: 400;
  font-size: 48px;
  line-height: 48px;
  color: var(--olive-dark);
}
.venue-city {
  padding-top: 12px;
  font-family: var(--font-caps);
  font-size: 14px;
  line-height: 20px;
  letter-spacing: 3.5px;
  text-transform: uppercase;
  color: var(--olive);
}
.venue-address {
  padding-top: 4px;
  font-size: 16px;
  line-height: 24px;
  color: rgb(61 80 91 / 0.75);
}
.venue-map { margin-top: 18px; }
.attire {
  padding-top: 26px;
  font-style: italic;
  font-size: 16px;
  line-height: 22px;
  color: var(--olive);
}
.rsvp .eyebrow--section { padding-top: 36px; }
.rsvp-buttons {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding-top: 22px;
}

.signature { padding-top: 26px; }
.signature-with {
  font-style: italic;
  font-size: 16px;
  line-height: 24px;
  color: rgb(61 80 91 / 0.7);
}
.signature-names {
  font-family: var(--font-script);
  font-size: 36px;
  line-height: 40px;
  color: var(--olive-dark);
}

/* The thank-you heart beats softly */
.rsvp-thanks .heart { animation: heartbeat 2.8s ease-in-out infinite; }
@keyframes heartbeat {
  0%, 60%, 100% { transform: scale(1); }
  10% { transform: scale(1.16); }
  20% { transform: scale(1); }
  30% { transform: scale(1.1); }
}

/* ---------- Buttons ---------- */

.btn {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 12px 24px;
  border-radius: 999px;
  font-family: var(--font-caps);
  font-size: 12px;
  line-height: 16px;
  letter-spacing: 3px;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.45s var(--ease-soft), border-color 0.45s var(--ease-soft), transform 0.3s var(--ease-soft);
  -webkit-tap-highlight-color: transparent;
}
.btn-label { padding-left: 3px; } /* balances trailing letter-spacing */
.btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.btn:active { transform: scale(0.97); }

/* Fill that grows from the centre on hover */
.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  transform: scaleX(0);
  transition: transform 0.5s var(--ease-soft);
}

.btn--solid {
  border: 0;
  padding-inline: 28px;
  letter-spacing: 3.6px;
  background: var(--olive);
  color: var(--cream);
}
.btn--solid::before { background: var(--olive-dark); }
/* Light catching the map button every few seconds */
.btn--solid::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -40%;
  width: 30%;
  background: linear-gradient(100deg, transparent, rgb(255 248 225 / 0.35), transparent);
  transform: skewX(-18deg) translateX(-120%);
  animation: sheen 6s ease-in-out 2s infinite;
  pointer-events: none;
}
@keyframes sheen {
  0%, 70% { transform: skewX(-18deg) translateX(-120%); }
  100% { transform: skewX(-18deg) translateX(560%); }
}

.btn--outline {
  border: var(--hairline) solid var(--olive-soft);
  background: transparent;
  color: var(--olive);
}
.btn--outline::before { background: var(--olive); }

@media (hover: hover) {
  .btn:hover::before { transform: scaleX(1); }
  .btn--outline:hover { color: var(--cream); border-color: var(--olive); }
  .rsvp-close:hover { background: rgb(38 63 117 / 0.08); }
}

/* ==========================================================================
   Static mode (default): one long letter
   ========================================================================== */

html:not(.story) .scene { position: relative; }
html:not(.story) .envelope-back,
html:not(.story) .envelope-front,
html:not(.story) .scroll-hint,
html:not(.story) .scroll-space,
html:not(.story) .paper-cue,
html:not(.story) .paper-shadow--contact { display: none; }

html:not(.story) .paper-wrap {
  max-width: 402px;
  margin: 0 auto;
  padding: 16px 16px 96px;
}
html:not(.story) .paper-shadow { inset: 16px 16px 96px; }
html:not(.story) .card { padding: 27px 0 44px; }
html:not(.story) .chapter { padding: 0 20px; }
html:not(.story) .chapter + .chapter { padding-top: 72px; }
html:not(.story) .ch-moment { padding-top: 64px !important; }

/* Hide story mode content until it has measured itself (no flash). */
.story-pending:not(.story) .scene,
.story-pending:not(.story) .card { visibility: hidden; }

/* ==========================================================================
   Story mode: fixed paper, envelope, chapters
   ========================================================================== */

/* The blue background lives on the fixed scene instead of the (very tall)
   scrolling page, so scrolling never repaints it. */
.story body { overscroll-behavior-y: none; background-image: none; }
.story .scene {
  background-color: var(--olive);
  background-image:
    radial-gradient(circle 860px at 20% 30%, rgb(255 255 255 / 0.06), transparent),
    radial-gradient(circle 1080px at 80% 70%, rgb(0 0 0 / 0.12), transparent),
    url("../assets/images/texture-linen-green.png");
  background-size: 100% 100%, 100% 100%, 160px 160px;
}

/* Keep the paper texture on its own layer so animating text doesn't redraw it. */
.story .card::before,
.story .card-edge { transform: translateZ(0); }

.story .scene {
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  height: var(--app-h, 100vh);
  overflow: hidden;
}

.story .scroll-space { height: var(--scroll-len, 1000vh); }

.story .paper-wrap,
.story .envelope-back,
.story .envelope-front {
  position: absolute;
  left: calc(50% - var(--pw) / 2);
  top: calc(50% - var(--ph) / 2);
  width: var(--pw);
  height: var(--ph);
}
.story .envelope-back,
.story .envelope-front {
  left: calc(50% - var(--pw) / 2 - var(--ep));
  top: calc(50% - var(--ph) / 2 - var(--ep));
  width: calc(var(--pw) + var(--ep) * 2);
  height: calc(var(--ph) + var(--ep) * 2);
}

.story .envelope-back { z-index: 1; }
.story .paper-wrap { z-index: 2; }
.story .envelope-front { z-index: 3; perspective: 2200px; pointer-events: none; }

.story .card {
  position: absolute;
  inset: 0;
}

.story .chapter {
  position: absolute;
  inset: 34px 0 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  visibility: hidden;
}
.story .chapter-inner {
  flex: none;
  transform: scale(var(--s, 1));
}

/* Inside of the envelope */
.envelope-back {
  border-radius: 26px;
  background:
    radial-gradient(ellipse at 50% 40%, rgb(255 255 255 / 0.04), transparent 65%),
    linear-gradient(180deg, #13244a 0%, #0e1b39 100%);
  box-shadow: 0 30px 60px rgb(5 10 25 / 0.5), 0 6px 14px rgb(5 10 25 / 0.35);
}
.envelope-pocket {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.04), inset 0 8px 30px rgb(0 0 0 / 0.55);
}

.flap,
.flap-shade {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: fill;
  user-select: none;
  pointer-events: none;
}
.flap { backface-visibility: visible; }
.flap-shade { opacity: 0.8; }
.flap--top, .flap-shade--top { transform-origin: 50% 0%; }
.flap--bottom, .flap-shade--bottom { transform-origin: 50% 100%; }
.flap--left, .flap-shade--left { transform-origin: 0% 50%; }
.flap--right, .flap-shade--right { transform-origin: 100% 50%; }
/* Each shadow sits slightly off its flap, like light from the top left */
.flap-shade--top { transform: translate(3px, 9px); }
.flap-shade--bottom { transform: translate(3px, -4px); }
.flap-shade--left { transform: translate(9px, 4px); }
.flap-shade--right { transform: translate(-8px, 5px); }

/* The seal keeps its own proportions whatever the envelope shape */
.seal-wrap {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(49.75%, 210px);
  aspect-ratio: 440 / 397; /* centred by JS (xPercent/yPercent) */
}
.seal {
  position: relative;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 2px 2px rgb(0 0 0 / 0.35)) drop-shadow(0 8px 16px rgb(0 0 0 / 0.3));
  animation: seal-breathe 4.5s ease-in-out infinite;
}
.seal img { width: 100%; height: 100%; }
.seal-sheen {
  position: absolute;
  inset: 0;
  -webkit-mask: url("../assets/images/wax-seal.webp") center / 100% 100% no-repeat;
  mask: url("../assets/images/wax-seal.webp") center / 100% 100% no-repeat;
  background: linear-gradient(115deg, transparent 35%, rgb(255 246 214 / 0.55) 50%, transparent 65%) no-repeat;
  background-size: 300% 100%;
  background-position: 120% 0;
  mix-blend-mode: soft-light;
  animation: seal-sheen 5s ease-in-out 1.2s infinite;
}
@keyframes seal-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.025); }
}
@keyframes seal-sheen {
  0%, 55% { background-position: 120% 0; }
  100% { background-position: -20% 0; }
}

.scroll-hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(5vh + env(safe-area-inset-bottom));
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  font-family: var(--font-caps);
  font-size: 11px;
  letter-spacing: 4.4px;
  text-transform: uppercase;
  color: #ecdcb3;
  text-shadow: 0 1px 8px rgb(0 0 0 / 0.6);
  pointer-events: none;
}
.scroll-hint span:first-child { padding-left: 4.4px; }
.scroll-hint-line,
.paper-cue-line {
  display: block;
  width: 1px;
  height: 36px;
  background: linear-gradient(#ecdcb3, transparent);
  transform-origin: top;
  animation: hint-line 2.4s ease-in-out infinite;
}
@keyframes hint-line {
  0% { transform: scaleY(0); opacity: 1; }
  60% { transform: scaleY(1); opacity: 1; }
  100% { transform: scaleY(1); opacity: 0; }
}

/* Small "keep scrolling" cue on the paper */
.paper-cue {
  position: absolute;
  left: 50%;
  bottom: 26px;
  z-index: 4;
  transform: translateX(-50%);
  opacity: 0;
  pointer-events: none;
}
.paper-cue-line { height: 30px; background: linear-gradient(var(--gold), transparent); }

/* Starting states for story animations (so nothing flashes before JS) */
.story .ink {
  --ink: -25;
  -webkit-mask-image: linear-gradient(90deg, #000 calc(var(--ink) * 1%), transparent calc(var(--ink) * 1% + 25%));
  mask-image: linear-gradient(90deg, #000 calc(var(--ink) * 1%), transparent calc(var(--ink) * 1% + 25%));
}
.story .draw path { stroke-dasharray: 1; stroke-dashoffset: 1; }


/* ==========================================================================
   RSVP dialog
   ========================================================================== */

.rsvp-dialog {
  width: min(420px, calc(100vw - 24px));
  max-width: none;
  max-height: calc(100dvh - 24px);
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  overflow: visible;
}
.rsvp-dialog::backdrop {
  background: rgb(8 14 34 / 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.rsvp-dialog[open] .rsvp-sheet { animation: sheet-in 0.55s cubic-bezier(0.2, 0.8, 0.2, 1); }
.rsvp-dialog[open]::backdrop { animation: fade-in 0.4s ease; }

@keyframes sheet-in {
  from { opacity: 0; transform: translateY(24px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.rsvp-sheet {
  position: relative;
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
  padding: 44px 32px 36px;
  border-radius: 20px;
  text-align: center;
  background-color: var(--cream);
  background-image: url("../assets/images/texture-paper.png");
  background-size: 160px 160px;
  box-shadow: 0 30px 60px rgb(8 14 34 / 0.45);
}
.rsvp-sheet::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: var(--hairline) solid rgb(184 149 90 / 0.6);
  border-radius: 12px;
  pointer-events: none;
}

.rsvp-close {
  position: absolute;
  top: 18px;
  right: 18px;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--olive);
  cursor: pointer;
}
.rsvp-close:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.rsvp-title {
  margin-top: 10px;
  font-family: var(--font-script);
  font-weight: 400;
  font-size: 34px;
  line-height: 1.15;
  color: var(--olive-dark);
}

.rsvp-form { display: flex; flex-direction: column; }

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 24px;
  text-align: left;
}
.field[hidden] { display: none; }

.field label,
.field-label {
  font-family: var(--font-caps);
  font-size: 11px;
  line-height: 16px;
  letter-spacing: 2.4px;
  text-transform: uppercase;
  color: var(--olive);
}
.optional { letter-spacing: 1px; text-transform: none; font-family: var(--font-body); font-style: italic; font-size: 13px; }

.field input[type="text"],
.field textarea {
  width: 100%;
  padding: 10px 2px;
  border: 0;
  border-bottom: 1px solid rgb(38 63 117 / 0.35);
  border-radius: 0;
  background: transparent;
  color: var(--olive-dark);
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.4;
  transition: border-color 0.2s ease;
}
.field textarea {
  resize: vertical;
  min-height: 84px;
  padding: 10px 12px;
  border: 1px solid rgb(38 63 117 / 0.3);
  border-radius: 10px;
}
.field input::placeholder,
.field textarea::placeholder { color: rgb(61 80 91 / 0.45); font-style: italic; }
.field input:focus,
.field textarea:focus { outline: none; border-color: var(--olive); box-shadow: 0 1px 0 var(--olive); }
.field textarea:focus { box-shadow: 0 0 0 1px var(--olive); }
.field input[aria-invalid="true"] { border-color: #9a3b2a; }

.field-hint {
  font-style: italic;
  font-size: 14px;
  line-height: 18px;
  color: rgb(61 80 91 / 0.6);
}
.field-error,
.form-error {
  min-height: 0;
  font-style: italic;
  font-size: 14px;
  line-height: 18px;
  color: #9a3b2a;
}
.field-error:empty,
.form-error:empty { display: none; }
.form-error { margin-top: 18px; text-align: center; }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.rsvp-submit { margin-top: 28px; align-self: center; min-width: 220px; padding-block: 14px; }
.rsvp-submit[disabled] { opacity: 0.6; cursor: progress; }

.rsvp-thanks { display: flex; flex-direction: column; align-items: center; gap: 6px; padding-top: 8px; }
.rsvp-thanks[hidden] { display: none; }
.rsvp-thanks:focus { outline: none; }
.rsvp-thanks-text {
  margin: 8px 0 26px;
  font-size: 18px;
  line-height: 1.6;
  color: rgb(61 80 91 / 0.8);
}

body.dialog-open { overflow: hidden; }

/* ==========================================================================
   Reduced motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
