/* ============================================================
   FOR YOU — A cinematic click-through birthday experience
   ------------------------------------------------------------
   Palette:
     --bg          #080808   primary background (near black)
     --bg-2        #111111   secondary
     --text        #F5F1EB   warm ivory
     --gold        #D6A85F   warm accent (candlelight)
     --gold-soft   #E8D5B5   secondary warm accent
   ============================================================ */

:root {
  --bg:        #080808;
  --bg-2:      #111111;
  --bg-3:      #171310;
  --text:      #F5F1EB;
  --text-dim:  rgba(245, 241, 235, 0.62);
  --text-mute: rgba(245, 241, 235, 0.42);
  --gold:      #D6A85F;
  --gold-soft: #E8D5B5;
  --gold-glow: rgba(214, 168, 95, 0.28);

  --serif: "Fraunces", "Cormorant Garamond", "Playfair Display", Georgia, serif;
  --sans:  "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --ease-cinema: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out-soft: cubic-bezier(0.16, 1, 0.3, 1);

  --pad-x: clamp(20px, 6vw, 80px);
}

/* ---------- Reset & Base ---------- */
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;   /* kills the blue tap flash on mobile */
}
html, body { margin: 0; padding: 0; }

/* Prevent the accidental text-selection blue box when tapping rapidly on
   pages designed for "tap anywhere to continue" (Page 6, Page 8). */
button, [role="button"], .choice, .photo-choice, .envelope, .tiny-heart,
.page--little, .page--letter, .btn-primary, .btn-back, .music-toggle {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

html {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-weight: 300;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;                /* no page scroll in paged mode */
  overscroll-behavior: none;
}

img { display: block; max-width: 100%; height: auto; user-select: none; -webkit-user-drag: none; }
button { font-family: inherit; }

::selection { background: rgba(214, 168, 95, 0.35); color: var(--text); }

/* ---------- Typography ---------- */
.serif   { font-family: var(--serif); font-weight: 300; letter-spacing: -0.005em; }
.serif--xl { font-size: clamp(2.4rem, 8vw, 5rem);   line-height: 1.05; }
.serif--lg { font-size: clamp(1.9rem, 5.4vw, 3.4rem); line-height: 1.12; }
.serif--md { font-size: clamp(1.4rem, 3.6vw, 2.2rem); line-height: 1.25; }
.serif--sm { font-size: clamp(1.1rem, 2.4vw, 1.45rem); line-height: 1.4; }
.italic { font-style: italic; }
.muted  { color: var(--text-dim); }
.small  { font-size: 13px; letter-spacing: 0.02em; }

.eyebrow {
  font-family: var(--sans);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.42em;
  color: var(--gold);
  margin: 0 0 22px;
  font-weight: 400;
}
.eyebrow--dark { color: rgba(90, 65, 30, 0.75); }

.hint {
  font-size: 11px;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin: 0 0 34px;
}

/* ---------- Grain overlay ---------- */
.grain {
  position: fixed;
  inset: -50%;
  z-index: 100;
  pointer-events: none;
  opacity: 0.075;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' seed='7'/><feColorMatrix values='0 0 0 0 0.95  0 0 0 0 0.9  0 0 0 0 0.83  0 0 0 0.55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  background-size: 240px 240px;
  animation: grainShift 8s steps(6) infinite;
}
@keyframes grainShift {
  0%   { transform: translate(0, 0); }
  25%  { transform: translate(-4%, 3%); }
  50%  { transform: translate(2%, -5%); }
  75%  { transform: translate(-3%, 2%); }
  100% { transform: translate(0, 0); }
}

/* ---------- Ambient glow ---------- */
.ambient-glow {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.35;
  will-change: transform, opacity;
}
.glow-a {
  width: 55vmax; height: 55vmax;
  left: -20vmax; top: -18vmax;
  background: radial-gradient(circle at center, rgba(214, 168, 95, 0.55), transparent 60%);
  animation: driftA 22s var(--ease-cinema) infinite alternate;
}
.glow-b {
  width: 48vmax; height: 48vmax;
  right: -18vmax; bottom: -20vmax;
  background: radial-gradient(circle at center, rgba(180, 120, 60, 0.35), transparent 65%);
  animation: driftB 28s var(--ease-cinema) infinite alternate;
}
@keyframes driftA { to { transform: translate(6vmax, 4vmax) scale(1.05); } }
@keyframes driftB { to { transform: translate(-5vmax, -3vmax) scale(0.95); } }

/* ---------- Music toggle ---------- */
.music-toggle {
  position: fixed;
  top: max(18px, env(safe-area-inset-top));
  right: max(18px, env(safe-area-inset-right));
  z-index: 60;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px 9px 12px;
  color: var(--text-dim);
  background: rgba(20, 15, 10, 0.35);
  border: 1px solid rgba(245, 241, 235, 0.08);
  border-radius: 999px;
  backdrop-filter: blur(10px) saturate(140%);
  -webkit-backdrop-filter: blur(10px) saturate(140%);
  cursor: pointer;
  transition: color .3s var(--ease-cinema), border-color .3s var(--ease-cinema), background .3s var(--ease-cinema), opacity .5s var(--ease-cinema);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  opacity: 0;
  pointer-events: none;
}
.music-toggle.is-visible { opacity: 1; pointer-events: auto; }
.music-toggle:hover { color: var(--gold-soft); border-color: rgba(214, 168, 95, 0.35); }
.music-toggle.is-playing { color: var(--gold); border-color: rgba(214, 168, 95, 0.4); }
.music-toggle__text { font-family: var(--sans); font-weight: 400; }

@media (max-width: 480px) {
  .music-toggle__text { display: none; }
  .music-toggle { padding: 10px; }
}

/* ---------- Back button ---------- */
.btn-back {
  position: fixed;
  top: max(18px, env(safe-area-inset-top));
  left: max(18px, env(safe-area-inset-left));
  z-index: 60;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px 8px 10px;
  color: var(--text-mute);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  transition: color .3s var(--ease-cinema), border-color .3s var(--ease-cinema), opacity .4s var(--ease-cinema);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  opacity: 0;
  pointer-events: none;
}
.btn-back.is-visible { opacity: 1; pointer-events: auto; }
.btn-back:hover { color: var(--gold-soft); border-color: rgba(214, 168, 95, 0.2); }
@media (max-width: 480px) {
  .btn-back span { display: none; }
  .btn-back { padding: 10px; }
}

/* ---------- Progress dots ---------- */
.progress {
  position: fixed;
  bottom: max(20px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 55;
  display: flex;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(20, 15, 10, 0.28);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .5s var(--ease-cinema);
}
.progress.is-visible { opacity: 1; }
.progress__dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: rgba(245, 241, 235, 0.14);
  transition: background .4s var(--ease-cinema), transform .4s var(--ease-cinema), box-shadow .5s var(--ease-cinema);
}
.progress__dot.is-active {
  background: var(--gold);
  box-shadow: 0 0 8px var(--gold-glow);
  transform: scale(1.6);
}
.progress__dot.is-done { background: rgba(214, 168, 95, 0.55); }

/* ============================================================
   PAGE SYSTEM — each page fills the viewport; one is active
   ============================================================ */
.pages {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  z-index: 2;
}
.page {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(60px, 8vh, 100px) var(--pad-x) clamp(60px, 8vh, 100px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: scale(1.02);
  transition:
    opacity .9s var(--ease-cinema),
    transform 1.1s var(--ease-cinema),
    visibility 0s linear .95s;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  isolation: isolate;
}
.page::-webkit-scrollbar { display: none; }

.page.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: scale(1);
  transition:
    opacity .95s var(--ease-cinema) .1s,
    transform 1.1s var(--ease-cinema),
    visibility 0s linear 0s;
  z-index: 3;
}

.page__inner {
  width: 100%;
  max-width: 720px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-items: stretch;
}
.page__inner--center {
  text-align: center;
  align-items: center;
}
.page__inner--center > * { max-width: 720px; }

/* ---------- Reveal animation classes ---------- */
[data-anim] {
  opacity: 0;
}
.page.is-active [data-anim="fade"] {
  animation: revealFade 1s var(--ease-cinema) forwards;
  animation-delay: var(--d, 0.2s);
}
.page.is-active [data-anim="line"] {
  animation: revealLine 1.15s var(--ease-cinema) forwards;
  animation-delay: var(--d, 0.3s);
}
.page.is-active [data-anim="scale-in"] {
  animation: revealScale 1.1s var(--ease-cinema) forwards;
  animation-delay: var(--d, 0.3s);
}
.page.is-active [data-anim="drop"] {
  animation: revealDrop 1.4s var(--ease-out-soft) forwards;
  animation-delay: var(--d, 0.4s);
}

@keyframes revealFade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes revealLine { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes revealScale { from { opacity: 0; transform: scale(0.94); } to { opacity: 1; transform: none; } }
@keyframes revealDrop { from { opacity: 0; transform: translateY(70px) scale(1.14); } to { opacity: 1; transform: none; } }

/* Staggered children: parent shows immediately, children stagger in */
.page.is-active [data-anim="stagger"] {
  opacity: 1;
}
.page.is-active [data-anim="stagger"] > * {
  animation: revealFade 1s var(--ease-cinema) forwards;
  opacity: 0;
}
.page.is-active [data-anim="stagger"] > *:nth-child(1) { animation-delay: 0.35s; }
.page.is-active [data-anim="stagger"] > *:nth-child(2) { animation-delay: 0.5s; }
.page.is-active [data-anim="stagger"] > *:nth-child(3) { animation-delay: 0.65s; }
.page.is-active [data-anim="stagger"] > *:nth-child(4) { animation-delay: 0.8s; }
.page.is-active [data-anim="stagger"] > *:nth-child(5) { animation-delay: 0.95s; }
.page.is-active [data-anim="stagger"] > *:nth-child(6) { animation-delay: 1.1s; }

/* ============================================================
   PRIMARY BUTTON
   ============================================================ */
.btn-primary {
  --btn-color: var(--gold-soft);
  align-self: center;
  margin-top: 20px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 16px 34px;
  background: transparent;
  color: var(--btn-color);
  border: 1px solid rgba(214, 168, 95, 0.4);
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  cursor: pointer;
  overflow: hidden;
  position: relative;
  transition: color .4s var(--ease-cinema), border-color .4s var(--ease-cinema), transform .4s var(--ease-cinema);
}
.btn-primary:hover, .btn-primary:focus-visible {
  color: var(--text);
  border-color: rgba(232, 213, 181, 0.85);
  outline: none;
}
.btn-primary:active { transform: scale(0.98); }
.btn-primary__arrow {
  display: inline-block;
  transition: transform .4s var(--ease-cinema);
}
.btn-primary:hover .btn-primary__arrow { transform: translateX(4px); }

.btn-primary--soft {
  border-color: rgba(214, 168, 95, 0.28);
  color: var(--text-dim);
}

.is-hidden { display: none !important; }

/* ============================================================
   CHOICE BUTTONS (multi-choice questions)
   ============================================================ */
.choices {
  display: grid;
  gap: 12px;
  margin-top: 32px;
}
.choice {
  padding: 18px 22px;
  background: rgba(20, 15, 10, 0.35);
  border: 1px solid rgba(245, 241, 235, 0.08);
  border-radius: 4px;
  color: var(--text);
  font-family: var(--serif);
  font-size: clamp(16px, 2.4vw, 20px);
  font-weight: 300;
  font-style: italic;
  text-align: left;
  letter-spacing: 0.005em;
  cursor: pointer;
  transition:
    background .35s var(--ease-cinema),
    border-color .35s var(--ease-cinema),
    color .35s var(--ease-cinema),
    transform .35s var(--ease-cinema);
  position: relative;
  overflow: hidden;
}
.choice::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(214, 168, 95, 0.08) 50%, transparent 70%);
  opacity: 0;
  transition: opacity .5s var(--ease-cinema);
  pointer-events: none;
}
.choice:hover, .choice:focus-visible {
  background: rgba(30, 22, 14, 0.55);
  border-color: rgba(214, 168, 95, 0.35);
  color: var(--gold-soft);
  outline: none;
}
.choice:hover::before { opacity: 1; }
.choice.is-chosen {
  border-color: var(--gold);
  color: var(--text);
  background: rgba(50, 34, 18, 0.5);
  transform: scale(1.02);
}

/* ============================================================
   PAGE 3 — DATE REVEAL
   ============================================================ */
.date-context {
  color: var(--gold);
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  margin: 0 0 30px;
}
.date-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin: 0 0 30px;
  position: relative;
}
.date-block::before {
  content: "";
  position: absolute;
  left: 50%; top: 60%;
  width: 90%; height: 60%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(214, 168, 95, 0.22), transparent 55%);
  filter: blur(50px);
  z-index: -1;
}
.date-month {
  font-family: var(--serif);
  font-weight: 300;
  font-style: italic;
  font-size: clamp(1.2rem, 3vw, 1.7rem);
  letter-spacing: 0.32em;
  color: var(--gold-soft);
  text-transform: uppercase;
}
.date-day {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(9rem, 32vw, 20rem);
  line-height: 0.85;
  letter-spacing: -0.06em;
  color: transparent;
  background: linear-gradient(180deg, #f6ecd6 0%, #d6a85f 46%, #8a6a34 100%);
  -webkit-background-clip: text;
  background-clip: text;
  text-shadow: 0 0 40px rgba(214, 168, 95, 0.06);
}
.date-line {
  margin: 0 0 8px;
  color: var(--text);
  font-style: italic;
}
.date-sub {
  margin: 0 0 26px;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(0.95rem, 2.2vw, 1.15rem);
  color: var(--gold-soft);
  letter-spacing: 0.01em;
}

/* ---------- Rising gold sparks (Page 3 ambience) ---------- */
.date-sparks {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}
.date-spark {
  position: absolute;
  bottom: -20px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #F1D9A6;
  box-shadow:
    0 0 6px rgba(232, 213, 181, 0.9),
    0 0 12px rgba(214, 168, 95, 0.6);
  opacity: 0;
  animation: sparkFloat linear infinite;
  will-change: transform, opacity;
}
.date-spark--dim {
  background: #E8B770;
  box-shadow: 0 0 6px rgba(214, 168, 95, 0.7);
  width: 2px; height: 2px;
}
@keyframes sparkFloat {
  0%   { transform: translate3d(0, 0, 0) scale(0.6); opacity: 0; }
  10%  { opacity: 0.9; transform: translate3d(0, -10vh, 0) scale(1); }
  70%  { opacity: 0.7; }
  100% { transform: translate3d(var(--dx, 20px), -110vh, 0) scale(0.4); opacity: 0; }
}

/* ---------- Envelope open sparkle burst (Page 7) ---------- */
.envelope { overflow: visible; }
.envelope__sparkles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}
.env-spark {
  position: absolute;
  top: 50%; left: 50%;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: #F1D9A6;
  box-shadow: 0 0 6px rgba(232, 213, 181, 0.9), 0 0 12px rgba(214, 168, 95, 0.6);
  opacity: 0;
  transform: translate(-50%, -50%);
  animation: envSpark 900ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes envSpark {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.4); }
  20%  { opacity: 1; }
  100% { opacity: 0; transform:
           translate(calc(-50% + var(--tx, 0px)), calc(-50% + var(--ty, 0px)))
           scale(0.6); }
}

/* ============================================================
   PAGE 4 — PHOTO CHOICES
   ============================================================ */
.photo-choices {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(10px, 2vw, 16px);
  margin-top: 22px;
  max-width: 560px;
  width: 100%;
  align-self: center;
}
/* Wider screens: put all 4 in one row so nothing overflows vertically */
@media (min-width: 900px) {
  #p-memory-q .page__inner { max-width: 880px; }
  .photo-choices {
    grid-template-columns: repeat(4, 1fr);
    max-width: 100%;
    gap: 14px;
  }
}
@media (max-width: 500px) {
  .photo-choices { gap: 8px; max-width: 92vw; }
}
.photo-choice {
  position: relative;
  aspect-ratio: 3/4;
  overflow: hidden;
  border-radius: 4px;
  background: var(--bg-2);
  border: 1px solid rgba(245, 241, 235, 0.06);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
  cursor: pointer;
  padding: 0;
  /* Never exceed half the viewport in height — prevents overflow on short screens */
  max-height: 46vh;
  transition: transform .5s var(--ease-cinema), box-shadow .5s var(--ease-cinema), border-color .4s var(--ease-cinema);
}
/* On short viewports, drop the row to a single line if possible */
@media (max-height: 720px) and (min-width: 700px) {
  .photo-choices { grid-template-columns: repeat(4, 1fr); max-width: 780px; }
  .photo-choice  { max-height: 60vh; }
}
.photo-choice img {
  width: 100%; height: 100%;
  object-fit: cover;
  filter: saturate(0.94) contrast(1.03) brightness(0.9);
  transition: filter .6s var(--ease-cinema), transform 1.2s var(--ease-cinema);
}
.photo-choice::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 60%, rgba(0, 0, 0, 0.55) 100%);
  pointer-events: none;
  transition: opacity .5s var(--ease-cinema);
}
.photo-choice:hover, .photo-choice:focus-visible {
  transform: translateY(-4px);
  border-color: rgba(214, 168, 95, 0.5);
  outline: none;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.7);
}
.photo-choice:hover img { filter: saturate(1) contrast(1.06) brightness(1); transform: scale(1.04); }

/* ============================================================
   PAGE 5 — HERO PHOTO
   ============================================================ */
.hero-photo {
  margin: 0 auto 22px;
  /* Bound both by width AND viewport height so it always fits on-screen */
  width: min(400px, 82vw);
  height: min(520px, 54vh);
  overflow: hidden;
  border-radius: 4px;
  background: var(--bg-2);
  box-shadow: 0 40px 90px rgba(0, 0, 0, 0.6), inset 0 0 0 1px rgba(214, 168, 95, 0.12);
}
.hero-photo img {
  width: 100%; height: 100%;
  object-fit: cover;
  filter: saturate(0.95) contrast(1.03);
}
@media (max-height: 640px) {
  .hero-photo { height: 40vh; width: 30vh; }
}

/* ============================================================
   PAGE 6 — LITTLE THINGS
   ============================================================ */
.page--little { cursor: pointer; }
.page--little .btn-primary,
.page--little .choice,
.page--little a,
.page--little button { cursor: pointer; }

.little-eyebrow { margin-bottom: 40px; }

.little-stage {
  position: relative;
  min-height: 30vh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.little-slide {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity .8s var(--ease-cinema), transform .9s var(--ease-cinema);
  pointer-events: none;
}
.little-slide.is-active {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
.little-slide p {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(1.6rem, 4.6vw, 3rem);
  line-height: 1.25;
  color: var(--text);
  margin: 0;
  max-width: 720px;
  text-align: center;
}
.little-slide p em {
  color: var(--gold-soft);
  font-style: italic;
}

.tap-hint {
  margin-top: 44px;
  font-size: 10px;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--text-mute);
  animation: pulseHint 2.8s ease-in-out infinite;
}
@keyframes pulseHint {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.9; }
}

/* ============================================================
   PAGE 7 — ENVELOPES
   ============================================================ */
.envelopes-grid {
  display: grid;
  /* 6 envelopes: 3 cols on desktop, 2 cols on mobile */
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: clamp(12px, 2vw, 22px);
  margin-top: 28px;
  width: 100%;
  align-self: center;
  max-width: 820px;
}
@media (min-width: 720px) {
  .envelopes-grid { grid-template-columns: repeat(3, 1fr); }
}
.envelope {
  --e-h: clamp(190px, 24vw, 240px);
  position: relative;
  height: var(--e-h);
  cursor: pointer;
  perspective: 1200px;
  background: transparent;
  border: none;
  padding: 0;
  color: var(--text);
  font-family: inherit;
  outline: none;
}
.envelope__card {
  position: absolute;
  inset: 0;
  border-radius: 6px;
  background: linear-gradient(160deg, #1a1510 0%, #100c08 60%, #08060a 100%);
  box-shadow:
    0 30px 60px rgba(0, 0, 0, 0.6),
    inset 0 0 0 1px rgba(214, 168, 95, 0.14);
  overflow: hidden;
  transition: transform 0.7s var(--ease-cinema), box-shadow .5s var(--ease-cinema);
}
.envelope__flap {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 55%;
  background: linear-gradient(180deg, rgba(214, 168, 95, 0.08), transparent);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform-origin: top center;
  transition: transform 0.9s var(--ease-cinema), opacity 0.5s var(--ease-cinema);
  z-index: 3;
  border-bottom: 1px solid rgba(214, 168, 95, 0.14);
}
.envelope__flap::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 0%, rgba(214, 168, 95, 0.28), transparent 55%);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}
.envelope__seal {
  position: absolute;
  top: 46%; left: 50%;
  width: 34px; height: 34px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #e0b26a, #8a5a1e 60%, #4a2e10 100%);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(255, 220, 160, 0.4);
  z-index: 4;
  transition: transform .5s var(--ease-cinema), opacity .4s var(--ease-cinema);
}
.envelope__seal::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  border: 1px dashed rgba(255, 220, 160, 0.4);
}
.envelope__seal::after {
  content: "27";
  position: absolute;
  inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif);
  font-style: italic;
  font-size: 11px;
  color: rgba(255, 235, 200, 0.85);
}
.envelope__label {
  position: absolute;
  bottom: 22px;
  left: 22px; right: 22px;
  font-family: var(--serif);
  font-style: italic;
  color: var(--gold-soft);
  font-size: 14px;
  line-height: 1.35;
  z-index: 2;
  transition: opacity .4s var(--ease-cinema);
}
.envelope__note {
  position: absolute;
  inset: 12px;
  padding: 22px;
  background: linear-gradient(180deg, #f5efe1 0%, #ece2cf 100%);
  color: #322415;
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.55;
  border-radius: 4px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(60, 40, 20, 0.08);
  opacity: 0;
  transform: translateY(20px) scale(0.98);
  transition: opacity .6s var(--ease-cinema) 0.35s, transform .8s var(--ease-cinema) 0.3s;
  z-index: 1;
  display: flex; align-items: center; justify-content: center;
  text-align: center;
}
.envelope__note::before {
  content: "";
  position: absolute;
  top: 8px; left: 8px; right: 8px; bottom: 8px;
  border: 1px solid rgba(120, 85, 40, 0.18);
  border-radius: 3px;
  pointer-events: none;
}
.envelope.is-open .envelope__card { transform: translateY(-6px); }
.envelope.is-open .envelope__flap { transform: rotateX(-170deg); }
.envelope.is-open .envelope__seal { opacity: 0; transform: translate(-50%, -50%) scale(0.6); }
.envelope.is-open .envelope__label { opacity: 0; }
.envelope.is-open .envelope__note { opacity: 1; transform: translateY(0) scale(1); }
.envelope:hover .envelope__card,
.envelope:focus-visible .envelope__card {
  box-shadow: 0 40px 80px rgba(0, 0, 0, 0.7), inset 0 0 0 1px rgba(214, 168, 95, 0.28);
}

/* ============================================================
   PAGE 8 — LETTER
   ============================================================ */
.page--letter { padding-top: clamp(80px, 10vh, 120px); padding-bottom: clamp(80px, 10vh, 120px); align-items: flex-start; }
.page--letter .letter-paper { margin: auto; cursor: pointer; }

.letter-paper {
  position: relative;
  max-width: 640px;
  width: 100%;
  padding: clamp(36px, 5vw, 60px) clamp(28px, 5vw, 56px);
  background:
    radial-gradient(circle at 20% 10%, rgba(255, 240, 210, 0.05), transparent 55%),
    linear-gradient(180deg, #f7ecd6 0%, #efe0c3 100%);
  color: #2a1f14;
  border-radius: 3px;
  box-shadow:
    0 60px 120px rgba(0, 0, 0, 0.7),
    0 10px 30px rgba(0, 0, 0, 0.5),
    inset 0 0 0 1px rgba(80, 60, 30, 0.1);
  font-family: var(--serif);
}
.letter-paper::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='p'><feTurbulence baseFrequency='0.6' numOctaves='2' seed='4'/><feColorMatrix values='0 0 0 0 0.6  0 0 0 0 0.5  0 0 0 0 0.3  0 0 0 0.35 0'/></filter><rect width='100%' height='100%' filter='url(%23p)'/></svg>");
  background-size: 220px 220px;
  opacity: 0.15;
  mix-blend-mode: multiply;
}
.letter-paper::after {
  content: "";
  position: absolute;
  top: 10px; left: 10px; right: 10px; bottom: 10px;
  border: 1px solid rgba(80, 60, 30, 0.14);
  pointer-events: none;
  border-radius: 2px;
}
.letter-head {
  color: #3a2814;
  margin: 8px 0 4px;
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.4rem, 3.4vw, 2rem);
}
.letter-body {
  margin-top: 26px;
  display: grid;
  gap: 16px;
  min-height: 220px;
}
.letter-p {
  font-size: clamp(15px, 2vw, 17px);
  line-height: 1.7;
  color: #3a2814;
  margin: 0;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .8s var(--ease-cinema), transform .9s var(--ease-cinema);
}
.letter-p.is-visible {
  opacity: 1;
  transform: none;
}
.letter-p--em {
  font-style: italic;
  color: #5a3a15;
  font-size: clamp(17px, 2.4vw, 20px);
  text-align: center;
}
.letter-signoff {
  margin-top: 26px;
  text-align: right;
  color: #3a2814;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .9s var(--ease-cinema), transform 1s var(--ease-cinema);
}
.letter-signoff.is-visible { opacity: 1; transform: none; }
.letter-signoff p { margin: 0; font-family: var(--serif); }
.letter-signoff__prefix {
  font-size: 14px;
  font-style: italic;
  color: rgba(60, 40, 20, 0.7);
  letter-spacing: 0.02em;
}
.letter-signoff__name {
  font-size: clamp(22px, 3.4vw, 30px);
  color: #4a3016;
  margin-top: 4px !important;
}

.letter-hint {
  margin-top: 20px;
  color: rgba(60, 40, 20, 0.5);
  font-size: 10px;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  font-family: var(--sans);
  text-align: center;
  animation: pulseHint 2.8s ease-in-out infinite;
}

/* "One more →" sits ON the cream letter paper — needs dark ink, not gold */
.letter-paper .btn-primary {
  display: flex;
  margin: 24px auto 0;
  color: #4a3016;
  border-color: rgba(80, 60, 30, 0.32);
  background: rgba(255, 250, 235, 0.4);
}
.letter-paper .btn-primary:hover,
.letter-paper .btn-primary:focus-visible {
  color: #2a1f14;
  border-color: rgba(80, 60, 30, 0.75);
  background: rgba(255, 250, 235, 0.7);
}

/* ============================================================
   PAGE 9 — FINAL
   ============================================================ */
.page--final {
  background: radial-gradient(ellipse at center, #0d0906 0%, #050403 65%, #000 100%);
  overflow: hidden;
}
/* Soft dark stage behind the copy so it reads over the drift photos */
.page--final::before {
  content: "";
  position: absolute;
  inset: 12% 8%;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0.35) 40%, transparent 75%);
  z-index: 1;
  pointer-events: none;
}
.final-halo {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, rgba(214, 168, 95, 0.22), transparent 45%);
  filter: blur(20px);
  opacity: 0;
  pointer-events: none;
  z-index: 0;
  transition: opacity 2.5s var(--ease-cinema);
}
.page--final.is-active .final-halo { opacity: 1; }

.final-drift {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.final-drift .drift-photo {
  position: absolute;
  width: clamp(88px, 12vw, 140px);
  aspect-ratio: 4/5;
  border-radius: 3px;
  overflow: hidden;
  opacity: 0;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  filter: blur(1px) saturate(0.85);
  will-change: transform, opacity;
}
.final-drift .drift-photo img { width: 100%; height: 100%; object-fit: cover; }

.page--final .page__inner { position: relative; z-index: 2; }
.final-eyebrow { color: var(--gold); }
.final-happy { color: var(--gold-soft); }
/* Final page: make sure text stays legible over the halo + drift photos */
.page--final .muted { color: rgba(245, 241, 235, 0.86); }        /* was 0.62 */
.page--final .final-happy { color: #F1D9A6; text-shadow: 0 0 30px rgba(214, 168, 95, 0.35); }
.page--final .final-eyebrow { color: #E8B770; }

.final-signoff {
  margin-top: 48px;
  padding-top: 24px;
  position: relative;
  color: rgba(245, 241, 235, 0.9);
  font-size: 12px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  line-height: 1.9;
  text-align: center;
}
/* Small centered gold rule above the signoff */
.final-signoff::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 56px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(214, 168, 95, 0.7), transparent);
}
.final-signoff__prefix {
  display: inline-block;
  color: #E8D5B5;
  margin-bottom: 6px;
}
.final-signoff__name {
  display: inline-block;
  text-transform: none;
  font-size: clamp(26px, 4.4vw, 36px);
  letter-spacing: 0.01em;
  color: #F1D9A6;
  font-style: italic;
  text-shadow: 0 0 24px rgba(214, 168, 95, 0.4);
}

.tiny-heart {
  color: var(--gold);
  font-size: 0.55em;
  cursor: pointer;
  transition: transform .3s var(--ease-cinema), color .3s var(--ease-cinema);
  display: inline-block;
  padding: 0 6px;
  vertical-align: middle;
}
.tiny-heart:hover, .tiny-heart:focus-visible { color: #ffd28a; transform: scale(1.2); outline: none; }

/* ============================================================
   EASTER EGG MODAL
   ============================================================ */
.egg-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(4, 3, 2, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .5s var(--ease-cinema);
}
.egg-modal.is-open { opacity: 1; pointer-events: auto; }
.egg-modal__card {
  max-width: 460px;
  width: 100%;
  padding: 40px 32px 28px;
  border-radius: 4px;
  background: linear-gradient(180deg, #1a140d, #100b06);
  color: var(--text);
  text-align: center;
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.7), inset 0 0 0 1px rgba(214, 168, 95, 0.2);
  transform: translateY(20px) scale(0.98);
  transition: transform .6s var(--ease-cinema);
}
.egg-modal.is-open .egg-modal__card { transform: translateY(0) scale(1); }
.egg-modal__close {
  margin-top: 26px;
  padding: 10px 24px;
  background: transparent;
  color: var(--gold-soft);
  border: 1px solid rgba(214, 168, 95, 0.4);
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.36em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color .3s var(--ease-cinema), color .3s var(--ease-cinema);
}
.egg-modal__close:hover { color: var(--text); border-color: var(--gold); }

/* ---------- Focus ---------- */
:focus-visible {
  outline: 2px solid rgba(214, 168, 95, 0.55);
  outline-offset: 3px;
  border-radius: 2px;
}
.btn-primary:focus-visible, .choice:focus-visible, .photo-choice:focus-visible { outline: none; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.2s !important;
  }
  .glow-a, .glow-b, .grain { animation: none !important; }
  [data-anim] { opacity: 1 !important; transform: none !important; }
  .page--final .drift-photo { opacity: 0.3 !important; }
  .page--final .final-halo { opacity: 1 !important; }
}
