:root {
  --bg: #14100c;
  --bg-warm: #1d1610;
  --ink: #f4eadb;
  --muted: #b9aa92;
  --dim: rgba(244, 234, 219, 0.24);
  --amber: #e3a94c;
  --amber-deep: #b97a2a;

  --serif: "Fraunces", "Iowan Old Style", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

  --gutter: clamp(16px, 5vw, 64px);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: dark;
}

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

html {
  background: var(--bg);
  scrollbar-color: #4a3a26 var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

::selection { background: var(--amber); color: var(--bg); }

a { color: inherit; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 6px; border-radius: 4px; }

h1, h2, p, figure { margin: 0; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
  padding: 96px var(--gutter) 140px;
  background:
    radial-gradient(90% 60% at 50% 108%, rgba(227, 169, 76, 0.22), transparent 70%),
    radial-gradient(60% 45% at 50% 42%, rgba(227, 169, 76, 0.07), transparent 75%),
    var(--bg);
}

.hero__title {
  font-family: var(--serif);
  font-weight: 300;
  line-height: 0.95;
}

.hero__line { display: block; }

.hero__line--small {
  font-style: italic;
  font-weight: 350;
  font-size: clamp(1.5rem, 1rem + 3vw, 3rem);
  line-height: 1.2;
  color: var(--amber);
  letter-spacing: 0.005em;
}

.hero__line--big {
  font-size: clamp(5.5rem, 24vw, 13rem);
  font-variation-settings: "opsz" 144;
  letter-spacing: -0.035em;
  margin-top: 0.02em;
}

.hero__meta {
  margin-top: clamp(20px, 4vh, 40px);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.hero__meta span { margin: 0 0.6em; color: var(--amber-deep); }

.word { display: inline-block; white-space: nowrap; }
.ch {
  display: inline-block;
  opacity: 0;
  filter: blur(14px);
  transform: translateY(0.18em);
  animation: letter-in 1.2s var(--ease) forwards;
  animation-delay: calc(var(--i) * 55ms + 250ms);
}
@keyframes letter-in {
  to { opacity: 1; filter: blur(0); transform: none; }
}

.js .hero__meta, .js .cue {
  opacity: 0;
  animation: soft-in 1.4s var(--ease) 1.7s forwards;
}
@keyframes soft-in { to { opacity: 1; } }

.cue {
  position: absolute;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: grid;
  justify-items: center;
  gap: 12px;
  min-width: 88px;
  padding: 12px;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--muted);
  transition: color 0.3s;
}
.cue:hover { color: var(--amber); }
.cue__line { color: var(--amber); overflow: visible; }
.cue__line line {
  stroke-dasharray: 56;
  animation: cue 2.4s cubic-bezier(0.6, 0, 0.2, 1) infinite;
}
@keyframes cue {
  0% { stroke-dashoffset: 56; }
  50% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: -56; }
}

/* ---------- Photo journey ---------- */

.journey { position: relative; }

.shot img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: clamp(12px, 1.8vw, 22px);
  box-shadow:
    0 40px 90px -30px rgba(0, 0, 0, 0.85),
    0 12px 28px -12px rgba(0, 0, 0, 0.6);
  background: var(--bg-warm);
}
.shot picture { display: contents; }
.shot source { display: none; }

.shot figcaption {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 350;
  font-size: clamp(1.2rem, 1rem + 1vw, 1.7rem);
  line-height: 1.25;
  text-align: center;
  color: var(--ink);
  text-wrap: balance;
}

/* Stacked layout: no JavaScript, or reduced motion */
.stage {
  display: grid;
  gap: clamp(48px, 10vh, 120px);
  padding: clamp(48px, 10vh, 120px) var(--gutter);
  justify-items: center;
}
.shot { display: grid; gap: 20px; justify-items: center; }
.shot img {
  width: min(100%, calc(82vh * var(--ar, 1)));
  width: min(100%, calc(82svh * var(--ar, 1)));
  aspect-ratio: var(--ar, auto);
}
.progress { display: none; }

.js .stage .shot { opacity: 0; transition: opacity 0.9s ease; }
.js .stage .shot.in { opacity: 1; }

/* Scroll-driven layout */
.scrolly .journey {
  height: calc(var(--n, 11) * 80vh + 100vh);
  height: calc(var(--n, 11) * 80svh + 100svh);
}
.scrolly .stage {
  position: sticky;
  top: 0;
  display: block;
  height: 100vh;
  height: 100svh;
  padding: 0;
  overflow: hidden;
}
.scrolly .stage .shot {
  --cap: clamp(72px, 12svh, 104px);
  position: absolute;
  inset: clamp(20px, 5svh, 56px) var(--gutter) 0;
  display: grid;
  grid-template: minmax(0, 1fr) var(--cap) / minmax(0, 1fr);
  gap: 0;
  place-items: stretch;
  opacity: 0;
  pointer-events: none;
  transition: none;
}
.scrolly .shot__frame {
  min-height: 0;
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  place-items: center;
}
.scrolly .shot img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
}
/* Fill the frame at the photo's own shape, whichever edge it meets first */
@supports (width: 1cqw) {
  .scrolly .shot__frame { container-type: size; }
  .scrolly .shot img {
    width: min(100cqw, calc(100cqh * var(--ar)));
    aspect-ratio: var(--ar);
    max-width: none;
    max-height: none;
  }
}
.scrolly .shot figcaption {
  align-self: center;
  justify-self: center;
  max-width: 24ch;
}

.scrolly .progress {
  display: block;
  position: absolute;
  left: var(--gutter);
  right: var(--gutter);
  top: max(10px, env(safe-area-inset-top));
  height: 2px;
  border-radius: 2px;
  background: rgba(244, 234, 219, 0.12);
  overflow: hidden;
}
.progress__fill {
  display: block;
  height: 100%;
  background: var(--amber);
  transform: scaleX(0);
  transform-origin: left;
}

/* ---------- Letter ---------- */

.letter {
  padding: clamp(96px, 22vh, 220px) var(--gutter);
}
.letter__inner {
  max-width: 44rem;
  margin: 0 auto;
  font-family: var(--serif);
  font-weight: 350;
  font-size: clamp(1.5rem, 1rem + 2.2vw, 2.6rem);
  line-height: 1.32;
  letter-spacing: -0.01em;
}
.letter__hello {
  font: inherit;
  font-style: italic;
  color: var(--amber);
}
.letter p { margin-top: 1.1em; text-wrap: pretty; }

.scrolly .w { color: var(--dim); transition: color 0.6s ease; }
.scrolly .w.on { color: var(--ink); }

/* ---------- Closing ---------- */

.closing {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 96px var(--gutter);
  background:
    radial-gradient(80% 55% at 50% 100%, rgba(227, 169, 76, 0.2), transparent 70%),
    var(--bg);
}
.closing__title {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(2.75rem, 1.4rem + 7vw, 6rem);
  line-height: 1.02;
  letter-spacing: -0.03em;
  text-wrap: balance;
}
.closing__title em { color: var(--amber); font-weight: 350; }

.sign {
  margin-top: clamp(40px, 8vh, 72px);
  display: grid;
  gap: 6px;
  justify-items: center;
}
.sign__with, .sign__and {
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.sign__name {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 350;
  font-size: clamp(2rem, 1.4rem + 2.4vw, 3rem);
  line-height: 1.15;
}

.js .reveal {
  opacity: 0;
  filter: blur(10px);
  transform: translateY(18px);
  transition: opacity 1.4s var(--ease), filter 1.4s var(--ease), transform 1.4s var(--ease);
}
.js .reveal.in { opacity: 1; filter: blur(0); transform: none; }
.js .sign.reveal { transition-delay: 0.35s; }

.confetti {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
  display: none;
}
.confetti.on { display: block; }

/* ---------- Reduced motion: simple fades only ---------- */

@media (prefers-reduced-motion: reduce) {
  .js .hero__title { opacity: 0; animation: soft-in 1s ease 0.1s forwards; }
  .js .hero__meta, .js .cue { animation-delay: 0.6s; animation-duration: 1s; }
  .cue__line line { animation: none; }
  .js .reveal { filter: none; transform: none; transition: opacity 1s ease; }
}
