:root {
  --wine-950: oklch(0.21 0.06 5);        /* burgundy velvet, from the cover */
  --wine-900: oklch(0.29 0.09 5);
  --wine-700: oklch(0.42 0.12 5);
  --mist: oklch(0.86 0.03 350);          /* muted text on wine */
  --ivory: oklch(0.975 0.008 60);
  --ivory-2: oklch(0.935 0.02 30);
  --ink: oklch(0.26 0.06 5);
  --ink-2: oklch(0.44 0.05 5);
  --rose: oklch(0.56 0.13 355);          /* peony pink accent, on ivory */
  --blush: oklch(0.86 0.06 350);
  --veil: oklch(0.975 0.008 60 / .86);

  --script: 'Pinyon Script', cursive;
  --serif: 'Libre Bodoni', 'Didot', Georgia, serif;   /* has ə/Ə */
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-io: cubic-bezier(.65, 0, .35, 1);
  --col: min(100vw, 480px);              /* page column; the scene is fixed to it */

  --z-scene: 0;
  --z-page: 1;
  --z-petals: 5;
  --z-music: 6;
  --z-gategate: 9;
  --z-gate: 10;
}

* { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--wine-950);
  color: var(--ink);
  font: 400 1.0625rem/1.65 var(--serif);
  -webkit-font-smoothing: antialiased;
}
body.locked { overflow: hidden; height: 100svh; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
h1, h2 { font-weight: 400; text-wrap: balance; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 240px; padding: 19px 34px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--wine-900); color: var(--ivory);
  font: 600 .86rem/1 var(--serif); letter-spacing: .2em; text-transform: uppercase; padding-left: calc(34px + .2em);
  text-decoration: none;
  box-shadow: 0 14px 30px -12px oklch(0.21 0.06 5 / .6), inset 0 1px 0 oklch(1 0 0 / .12);
  transition: transform .4s var(--ease-out);
}
.btn:active { transform: scale(.97); }
.btn.light { background: var(--ivory); color: var(--wine-950); box-shadow: 0 16px 34px -10px rgb(0 0 0 / .6); }

.title { font: 400 clamp(2.8rem, 12.5vw, 3.4rem)/1.15 var(--script); color: var(--wine-700); }
.title::after {   /* small watercolor spray under each heading */
  content: ''; display: block; width: 150px; height: 58px; margin: 0 auto;
  background: url(assets/florals-spray.webp) center / contain no-repeat;
}

/* =================== The scene (fixed) =================== */
.scene {
  position: fixed; top: 0; bottom: 0; left: 50%; width: var(--col); translate: -50% 0;
  z-index: var(--z-scene); overflow: hidden; background: #f5d9d4;   /* = the scene's sky */
}
/* full width, pinned to the bottom: on tall phones the sky color fills above it, keeping the pavilion below the names */
.scene-bg {
  position: absolute; bottom: 0; width: 100%; height: auto; transform: scale(1.14); transform-origin: 50% 62%;
  -webkit-mask-image: linear-gradient(transparent, #000 10%); mask-image: linear-gradient(transparent, #000 10%);
}
.revealing .scene-bg { transform: scale(1); transition: transform 3.4s var(--ease-out) 1.2s; }

.floral-gate {
  position: fixed; top: 0; bottom: 0; left: 50%; width: var(--col); height: 100%; translate: -50% 0;
  z-index: var(--z-gategate); object-fit: cover; pointer-events: none;
}
/* curtains clear by ~2.2s; the arch holds a beat, then the camera flies through it */
.revealing .floral-gate { transform: scale(2.8); opacity: 0; transition: transform 2.2s var(--ease-io) 1.7s, opacity 1.1s ease 2.6s; }

/* =================== Cover: curtains =================== */
/* velvet backdrop fills the gap under the curtains' swept-up hems, then fades as they part */
.gate { position: fixed; inset: 0; z-index: var(--z-gate); overflow: hidden; background: var(--wine-950); transition: background-color .9s ease .3s; }
.gate.open { background-color: transparent; }
.curtain {
  position: absolute; top: 0; height: 100%; width: 57%;
  object-fit: cover; object-position: 100% 50%;
  filter: drop-shadow(0 0 18px rgb(0 0 0 / .45));
  transition: translate 2s var(--ease-io) .25s, scale 2s var(--ease-io) .25s;
}
.curtain-l { left: 0; transform-origin: 0 50%; }
.curtain-r { right: 0; transform: scaleX(-1); }   /* mirrored copy (flipped around its own center) */
/* peony clusters in two corners, as in the cover mockup */
.corner {
  position: absolute; width: min(62vw, 46svh, 380px); max-width: none; pointer-events: none;
  filter: drop-shadow(0 10px 14px rgb(0 0 0 / .35));
  transition: translate 1.8s var(--ease-io) .2s, opacity 1.2s ease .6s;
}
.corner-top { top: -2%; left: -4%; }
.corner-bottom { bottom: -2%; right: -4%; }
.cover {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  padding: 13svh 18px 5svh; text-align: center; color: var(--ivory);
  background: radial-gradient(ellipse 70% 45% at 50% 50%, oklch(0.18 0.06 5 / .55), transparent 70%);
  transition: opacity .7s ease, scale .9s var(--ease-out);
}
.wreath { position: relative; width: min(88vw, 400px); aspect-ratio: 930 / 920; }
.wreath > img { width: 100%; height: 100%; }
.wreath-text { position: absolute; inset: 20%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.cover-names { display: flex; flex-direction: column; font: 400 clamp(3.2rem, min(17vw, 9svh), 4.6rem)/1 var(--script); text-shadow: 0 2px 12px rgb(0 0 0 / .5); }
.cover-names .amp { font: italic 400 .42em/1.2 var(--serif); color: var(--blush); }
.cover-date { margin-top: -6px; font-size: 1.05rem; font-weight: 600; letter-spacing: .3em; color: var(--blush); padding-left: .3em; text-shadow: 0 1px 8px rgb(0 0 0 / .7); }
.cover-to { font-size: 1.25rem; line-height: 1.4; font-style: italic; color: var(--ivory); text-shadow: 0 1px 10px rgb(0 0 0 / .7); }
.cover-to strong { display: block; font: 400 2.8rem/1.2 var(--script); font-style: normal; color: var(--ivory); }

.gate.open .cover { opacity: 0; scale: .92; }
.gate.open .curtain-l { translate: -108% 0; scale: .78 1; }
.gate.open .curtain-r { translate: 108% 0; scale: .78 1; }
.gate.open .corner-top { translate: -60% -60%; opacity: 0; }
.gate.open .corner-bottom { translate: 60% 60%; opacity: 0; }

/* =================== Petals =================== */
.petals { position: fixed; inset: 0; z-index: var(--z-petals); pointer-events: none; overflow: hidden; }
.petals img { position: absolute; top: 0; opacity: .9; animation: fall linear infinite; }
@keyframes fall {
  from { transform: translate3d(0, -10vh, 0) rotate3d(1, .6, .2, 0deg); }
  to { transform: translate3d(var(--x), 110vh, 0) rotate3d(1, .6, .2, 720deg); }
}

/* =================== Page (scrolls over the scene) =================== */
main { position: relative; z-index: var(--z-page); max-width: 480px; margin: 0 auto; overflow: clip; }
section { position: relative; padding: 88px 26px; text-align: center; }

/* ---------- Hero: the scene itself ---------- */
.hero { height: 100svh; min-height: 620px; padding: 0; z-index: 2; }
.hero-swag { position: absolute; top: -3%; left: 50%; width: 122%; max-width: none; translate: -50% 0; }
.hero-text { position: relative; padding-top: clamp(104px, 17svh, 170px); }
body:not(.revealed) .hero-text { visibility: hidden; }   /* written in after the opening, not glimpsed through the curtains */
.kicker { font-size: .88rem; font-weight: 600; letter-spacing: .34em; text-transform: uppercase; color: var(--rose); padding-left: .34em; }
.names { display: flex; flex-direction: column; font: 400 clamp(3.3rem, min(19vw, 9.6svh), 5.2rem)/1 var(--script); color: var(--wine-700); margin-top: 6px; }
.names .n1, .names .n2 { display: block; padding: .1em .35em .18em; }
/* diagonal: groom steps up-left, bride down-right */
.names .n1 { margin-right: 26%; }
.names .n2 { margin-left: 26%; }
.names .amp { font: italic 400 .36em/1.3 var(--serif); color: var(--rose); margin: -.4em 0; }
/* overlaps into the next section; its straight cut-off bottom edge fades out so it never shows as a band */
.hero-fg {
  position: absolute; bottom: -90px; left: 50%; width: 150%; max-width: none; translate: -50% 0; pointer-events: none;
  -webkit-mask-image: linear-gradient(180deg, #000 62%, transparent 96%); mask-image: linear-gradient(180deg, #000 62%, transparent 96%);
}
/* scroll cue: frosted pill over the foreground flowers, appears once the names are written; tap = smooth scroll */
.scroll-cue {
  position: absolute; left: 50%; bottom: max(22px, env(safe-area-inset-bottom)); translate: -50% 0;
  display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 9px 18px 5px; border-radius: 999px;
  font-size: .68rem; font-weight: 600; letter-spacing: .24em; text-transform: uppercase; padding-left: calc(18px + .24em);
  color: var(--wine-700); text-decoration: none; white-space: nowrap;
  background: oklch(0.975 0.008 60 / .8); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  box-shadow: 0 6px 18px -8px oklch(0.26 0.06 5 / .4);
}
.scroll-cue svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; animation: nudge 1.6s var(--ease-io) infinite; }
@keyframes nudge { 50% { transform: translateY(4px); } }
body:not(.revealed) .scroll-cue { visibility: hidden; }
.revealed .scroll-cue { animation: rise 1s var(--ease-out) 3s both; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

/* names are written in, like ink, once the scene is revealed */
.n1, .n2 {
  -webkit-mask-image: linear-gradient(90deg, #000 40%, transparent 60%); mask-image: linear-gradient(90deg, #000 40%, transparent 60%);
  -webkit-mask-size: 260% 100%; mask-size: 260% 100%; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: 0 0; mask-position: 0 0;
}
.revealed .n1 { animation: ink 1.8s var(--ease-io) .1s both; }
.revealed .n2 { animation: ink 1.8s var(--ease-io) 1s both; }
.revealed .kicker, .revealed .names .amp { animation: rise 1.2s var(--ease-out) both; }
.revealed .names .amp { animation-delay: .8s; }
@keyframes ink { from { -webkit-mask-position: 100% 0; mask-position: 100% 0; } to { -webkit-mask-position: 0 0; mask-position: 0 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); filter: blur(6px); } }

/* ---------- Paper: a translucent veil so the scene glows through ---------- */
.paper { background: linear-gradient(180deg, transparent, var(--veil) 140px, var(--veil) calc(100% - 140px), transparent); }
.greeting { padding-top: 150px; }
.spray { width: 72%; margin: 0 auto; }
.verse { max-width: 30ch; margin: 18px auto 0; font-size: 1.4rem; line-height: 1.55; font-style: italic; text-wrap: pretty; }
.verse .w { display: inline-block; }

/* ---------- Date: wine band ---------- */
.date { background: oklch(0.27 0.09 5 / .93); color: var(--ivory); margin: 72px 0 40px; }
.date .title { color: var(--blush); }
.cal { max-width: 300px; margin: 18px auto 44px; }
.cal-head { font-size: .8rem; letter-spacing: .35em; text-transform: uppercase; color: var(--mist); margin-bottom: 16px; padding-left: .35em; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); row-gap: 8px; font-variant-numeric: lining-nums tabular-nums; }
.cal-grid .wd { font-size: .66rem; letter-spacing: .08em; color: var(--blush); text-transform: uppercase; padding-bottom: 6px; }
.cal-grid span { position: relative; line-height: 2.1; font-size: .95rem; }
.cal-grid .the-day { color: var(--wine-950); font-weight: 700; }
.the-day::before { content: ''; position: absolute; left: 50%; top: 50%; width: 34px; height: 34px; translate: -50% -50%; border-radius: 50%; background: var(--blush); z-index: -1; }
.cal-grid .the-day { z-index: 0; isolation: isolate; }
.the-day svg { position: absolute; inset: -10px -8px; width: calc(100% + 16px); height: calc(100% + 20px); overflow: visible; }
.the-day path { fill: none; stroke: var(--blush); stroke-width: 1.3; stroke-linecap: round; }
.timer { display: flex; justify-content: center; }
.timer div { flex: 1; max-width: 90px; overflow: hidden; }
.timer div + div { border-left: 1px solid oklch(0.88 0.05 350 / .3); }
.timer b { display: block; font: 400 2.6rem/1.15 var(--serif); font-variant-numeric: lining-nums tabular-nums; }
.timer span { font-size: .64rem; letter-spacing: .06em; text-transform: uppercase; color: var(--mist); }

/* ---------- Venue ---------- */
.v-day { font-style: italic; color: var(--ink-2); margin-top: 4px; }
.event { margin: 26px 0 34px; }
.event .e-title { font-size: .76rem; letter-spacing: .3em; text-transform: uppercase; color: var(--rose); padding-left: .3em; }
.event .e-time { font: 400 clamp(4rem, 22vw, 5.4rem)/1 var(--serif); letter-spacing: -.02em; margin: 6px 0 2px; font-variant-numeric: lining-nums; }
.event .e-place { font: 400 2.6rem/1.2 var(--script); color: var(--wine-700); }
.event .e-addr { color: var(--ink-2); }
.map { height: 300px; margin-bottom: 30px; border-radius: 160px 160px 18px 18px; overflow: hidden; box-shadow: 0 20px 40px -20px oklch(0.26 0.06 5 / .5); border: 5px solid var(--ivory); }
.map iframe { display: block; width: 100%; height: 100%; border: 0; filter: saturate(.75); }

/* ---------- Closing: back out into the scene ---------- */
.closing { min-height: 100svh; padding: 15svh 22px 0; overflow: hidden; }
.closing-wreath { margin: 0 auto; width: min(88vw, 380px); }
.closing-wreath .wreath-text { inset: 24% 22%; }
.thanks { font: 400 clamp(2rem, 9.6vw, 2.6rem)/1.1 var(--script); color: var(--wine-700); white-space: nowrap; }
.sig { margin-top: 6px; font: 400 1.3rem/1.2 var(--script); color: var(--rose); }
.closing-note {
  position: relative; z-index: 1; max-width: 32ch; margin: 18px auto 0; padding: 16px 20px; border-radius: 18px;
  font-style: italic; background: var(--veil); text-wrap: pretty;
}
.closing-fg { position: absolute; bottom: -3%; left: 50%; width: 150%; max-width: none; translate: -50% 0; }
footer { position: relative; padding: 22px; text-align: center; font-size: .72rem; letter-spacing: .3em; color: var(--mist); background: var(--wine-950); }

/* ---------- Music ---------- */
.music {
  position: fixed; right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); z-index: var(--z-music);
  width: 48px; height: 48px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--wine-900); color: var(--ivory); box-shadow: 0 6px 18px rgb(0 0 0 / .3);
  display: grid; place-items: center;
}
.music[hidden] { display: none; }
.music svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.music.playing { animation: spin 5s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* =================== Scroll-driven motion (progressive enhancement) =================== */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    /* depth: foreground flowers rise faster than the page, the hanging swag lifts away */
    .hero-fg { animation: fg-rise linear both; animation-timeline: view(); animation-range: exit 0% exit 100%; }
    .hero-swag { animation: swag-lift linear both; animation-timeline: view(); animation-range: exit 0% exit 100%; }
    .hero-text { animation: fade-up linear both; animation-timeline: view(); animation-range: exit 0% exit 70%; }
    .closing-fg { animation: fg-settle linear both; animation-timeline: view(); animation-range: entry 0% entry 100%; }
    .closing-wreath { animation: bloom linear both; animation-timeline: view(); animation-range: entry 20% entry 100%; }
    .verse .w { animation: word linear both; animation-timeline: view(); animation-range: cover calc(var(--i) * 1.4%) cover calc(18% + var(--i) * 1.4%); }
    .spray, .title { animation: grow-center linear both; animation-timeline: view(); animation-range: entry 10% cover 35%; }
    .the-day path { stroke-dasharray: 1; animation: draw linear both; animation-timeline: view(); animation-range: entry 40% cover 55%; }
    .event .e-time { animation: settle linear both; animation-timeline: view(); animation-range: entry 0% cover 35%; }
  }
}
@keyframes fg-rise { to { transform: translateY(-18%); } }
@keyframes fg-settle { from { transform: translateY(30%); } to { transform: none; } }
@keyframes swag-lift { to { transform: translateY(-40%); opacity: .2; } }
@keyframes fade-up { to { transform: translateY(-60px); opacity: 0; } }
@keyframes bloom { from { scale: .78; opacity: .1; rotate: -8deg; } to { scale: 1; opacity: 1; rotate: 0deg; } }
@keyframes word { from { opacity: .12; filter: blur(3px); } to { opacity: 1; filter: none; } }
@keyframes grow-center { from { clip-path: inset(0 50% 0 50%); opacity: 0; } to { clip-path: inset(0 0 0 0); opacity: 1; } }
@keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes settle { from { letter-spacing: .2em; opacity: 0; } to { letter-spacing: -.02em; opacity: 1; } }

/* =================== Reduced motion =================== */
@media (prefers-reduced-motion: reduce) {
  .petals { display: none; }
  .music.playing, .revealed * { animation: none !important; }
  .gate, .gate *, .floral-gate, .scene-bg { transition-duration: .2s !important; transition-delay: 0s !important; }
}
