/* ============================================================
   Fifteen letters — styles
   ============================================================ */

:root {
  --night: #0b0b1d;
  --gold: #f2c879;
  --gold-hi: #fff2d4;
  --gold-lo: #b47e3c;
  --rose: #ef8fa3;
  --wax: #a8182f;
  --cream: #fbf3e3;
  --ink: #2b1a12;

  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --ease-io: cubic-bezier(.65, 0, .35, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; background: var(--night); }
html.lock, html.lock body { overflow: hidden; }

body {
  min-height: 100vh;
  min-height: 100svh;
  background: var(--night);
  color: var(--cream);
  font-family: 'Fraunces', Georgia, 'Times New Roman', serif;
  font-optical-sizing: auto;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* hold every intro animation until fonts are ready */
body:not(.go) *, body:not(.go) *::before, body:not(.go) *::after { animation-play-state: paused !important; }

button { font: inherit; color: inherit; }

/* ---------- atmosphere ---------- */

.backdrop {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
  background:
    radial-gradient(130% 75% at 50% -8%, #2b1c58 0%, rgba(43, 28, 88, 0) 62%),
    linear-gradient(180deg, #130f30 0%, #0b0b1d 55%, #06070f 100%);
}
.backdrop i { position: absolute; border-radius: 50%; will-change: transform; }
.backdrop i:nth-child(1) {
  width: 75vmax; height: 42vmax; left: -18vmax; top: -12vmax;
  background: radial-gradient(closest-side, rgba(141, 64, 170, .5), transparent);
  animation: drift-a 28s ease-in-out infinite alternate;
}
.backdrop i:nth-child(2) {
  width: 62vmax; height: 38vmax; right: -22vmax; top: 8vh;
  background: radial-gradient(closest-side, rgba(232, 105, 140, .3), transparent);
  animation: drift-b 34s ease-in-out infinite alternate;
}
.backdrop i:nth-child(3) {
  width: 85vmax; height: 32vmax; left: 8vw; bottom: -16vmax;
  background: radial-gradient(closest-side, rgba(70, 165, 175, .2), transparent);
  animation: drift-c 40s ease-in-out infinite alternate;
}
body.bday .backdrop i:nth-child(2) { background: radial-gradient(closest-side, rgba(242, 160, 120, .42), transparent); }
@keyframes drift-a { to { transform: translate(18vw, 8vh) rotate(12deg) scale(1.1); } }
@keyframes drift-b { to { transform: translate(-22vw, 12vh) rotate(-10deg) scale(1.2); } }
@keyframes drift-c { to { transform: translate(-12vw, -10vh) scale(1.15); } }

#sky, #fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#sky { z-index: 0; }
#fx { z-index: 60; }

.grain {
  position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: .07;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* ---------- layout ---------- */

.wrap {
  position: relative; z-index: 2;
  max-width: 1060px; margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + clamp(48px, 9vh, 104px)) 16px calc(env(safe-area-inset-bottom) + 56px);
}

/* ---------- hero ---------- */

.hero { display: flex; flex-direction: column; align-items: center; text-align: center; }

.eyebrow {
  margin: 0; font-size: .68rem; font-weight: 500; letter-spacing: .34em; text-transform: uppercase;
  color: var(--gold); padding-left: .34em;
  animation: fadeUp 1.1s var(--ease-out) .1s both;
}

.hero-title { margin: .45em 0 0; font-weight: 300; line-height: .92; }
.hero-title .lead {
  display: block; margin-bottom: .12em;
  font-style: italic; font-weight: 300; font-size: clamp(1.3rem, 3.6vw, 2rem); color: var(--rose);
}
.hero-title .name {
  display: block; font-style: italic; font-weight: 380;
  font-size: clamp(3.1rem, 14vw, 8.6rem); letter-spacing: -.03em;
  filter: drop-shadow(0 0 28px rgba(242, 200, 121, .26));
}
.hero-title .word, .letter-title .word { display: inline-block; white-space: nowrap; }
.hero-title .ch {
  display: inline-block;
  animation: chIn 1.2s var(--ease-out) both;
  animation-delay: calc(var(--i) * 55ms + 250ms);
}
.hero-title .name .ch {
  background: linear-gradient(180deg, #fff4d8 8%, #f4cd84 52%, #b47e3c 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  padding: 0 .08em; margin: 0 -.08em;
}

/* countdown */
.countdown { margin-top: clamp(22px, 4vh, 36px); animation: fadeUp 1.1s var(--ease-out) 1s both; }
.cd { display: flex; align-items: flex-start; justify-content: center; gap: clamp(4px, 2.2vw, 18px); }
.unit { display: flex; flex-direction: column; align-items: center; min-width: 2.4em; }
.num {
  display: flex; font-size: clamp(2.1rem, 8.4vw, 3.6rem); font-weight: 300; line-height: 1;
  font-variant-numeric: lining-nums tabular-nums; color: var(--cream);
}
.dg {
  position: relative; display: block; width: .62em; height: 1.14em; overflow: hidden;
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 22%, #000 78%, transparent);
  mask-image: linear-gradient(180deg, transparent, #000 22%, #000 78%, transparent);
}
.dg > span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.lbl {
  margin-top: 6px; padding-left: .3em;
  font-size: .58rem; letter-spacing: .3em; text-transform: uppercase; color: rgba(251, 243, 227, .5);
}
.cd-sep {
  font-size: clamp(1.6rem, 6vw, 2.6rem); font-weight: 200; line-height: 1.3; color: rgba(242, 200, 121, .55);
  animation: breathe 2s ease-in-out infinite;
}
.cd-label, .today-line {
  margin: .8em 0 0; font-style: italic; font-weight: 300; color: var(--rose);
  font-size: clamp(1rem, 2.6vw, 1.15rem);
}
.today-line { font-size: clamp(1.3rem, 4vw, 1.8rem); margin: 0; color: var(--gold-hi); }

/* garland */
.garland { display: block; width: min(100%, 760px); height: auto; margin-top: clamp(14px, 3vh, 26px); overflow: visible; }
.garland .wire { fill: none; stroke: #3c355a; stroke-width: 2.4; }
.garland .wire2 { stroke: #2a2545; stroke-width: 1.4; }
.bulb-in { transform-box: fill-box; transform-origin: 50% 0; animation: bulbIn 1s var(--ease-spring) both; animation-delay: calc(var(--i) * 45ms + 1.15s); }
.bulb .cap { fill: #5d5775; }
.bulb .glass { fill: #262339; stroke: rgba(255, 255, 255, .08); stroke-width: 1; transition: fill .6s; }
.bulb .shine { fill: rgba(255, 255, 255, .12); }
.bulb .halo { fill: var(--c); opacity: 0; }
.bulb.lit .glass { fill: var(--c); }
.bulb.lit .shine { fill: rgba(255, 255, 255, .55); }
.bulb.lit .halo { opacity: .5; filter: url(#bulbGlow); animation: twinkle var(--t) ease-in-out var(--dl) infinite; }
.bulb.today .halo { animation: bulbPulse 1.6s ease-in-out infinite; }
@keyframes bulbIn { from { opacity: 0; transform: translateY(-26px) rotate(18deg); } to { opacity: 1; transform: none; } }
@keyframes twinkle { 0%, 100% { opacity: .55; } 50% { opacity: .25; } }
@keyframes bulbPulse { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }

.sub {
  margin: clamp(14px, 2.6vh, 24px) 0 0; max-width: 36ch;
  font-size: clamp(.98rem, 2.4vw, 1.08rem); font-weight: 300; line-height: 1.55; color: rgba(251, 243, 227, .78);
  animation: fadeUp 1.1s var(--ease-out) 1.3s both;
}

.cta {
  position: relative; overflow: hidden; margin-top: 20px; cursor: pointer;
  appearance: none; border: 0; border-radius: 999px; padding: .9em 1.6em; min-height: 46px;
  font-size: .98rem; font-style: italic; font-weight: 450; color: #2a1608;
  background: linear-gradient(180deg, #ffe7b0, #f0bd66);
  box-shadow: inset 0 0 0 1px rgba(255, 245, 215, .7), 0 12px 30px -10px rgba(242, 190, 100, .7), 0 0 44px rgba(242, 200, 121, .22);
  transition: transform .35s var(--ease-out), box-shadow .35s;
  animation: fadeUp 1.1s var(--ease-out) 1.5s both;
  -webkit-tap-highlight-color: transparent;
}
.cta::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .65) 50%, transparent 70%);
  transform: translateX(-120%); animation: sheen 3.6s ease-in-out 2.4s infinite;
}
.cta:hover { transform: translateY(-2px); box-shadow: inset 0 0 0 1px rgba(255, 245, 215, .8), 0 18px 36px -10px rgba(242, 190, 100, .8), 0 0 60px rgba(242, 200, 121, .3); }
.cta:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 4px; }
@keyframes sheen { 0%, 55% { transform: translateX(-120%); } 100% { transform: translateX(120%); } }

/* ---------- the calendar ---------- */

.grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 46px 16px;
  margin-top: clamp(70px, 11vh, 120px);
}
.door[data-day="15"] { grid-column: 2 / 4; grid-row: 5 / 7; align-self: end; }
@media (min-width: 720px) {
  .grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 80px 24px; }
  .door[data-day="15"] { grid-column: 5 / 7; grid-row: 2 / 4; }
}

.door {
  position: relative; isolation: isolate;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  appearance: none; background: none; border: 0; padding: 0; margin: 0; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  animation: doorIn 1s var(--ease-out) both;
  animation-delay: calc(var(--i) * 60ms + 900ms);
}
.door.is-locked { cursor: default; }
.door:focus { outline: none; }
.door:focus-visible .env { outline: 2px solid var(--gold); outline-offset: 7px; border-radius: 8px; }
.door.is-away .env-float { visibility: hidden; }
@keyframes doorIn { from { opacity: 0; transform: translateY(54px) rotate(var(--r)) scale(.9); } to { opacity: 1; transform: none; } }

.env-float { display: block; position: relative; width: 100%; }

/* --- envelope (shared by the tiles and the big one in the stage) --- */
.env {
  position: relative; display: block; width: 100%; aspect-ratio: 4 / 3;
  container-type: inline-size;
  transform: perspective(800px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(var(--lift, 0px));
  transition: transform .6s var(--ease-out), filter .6s;
}
.env > span { position: absolute; display: block; }

.env-back {
  z-index: 1; inset: 0; border-radius: 7px;
  background: linear-gradient(180deg, #c6ab83 0%, #e2cfab 42%, #eadbbd 100%);
  box-shadow: 0 22px 34px -16px rgba(0, 0, 0, .75), 0 6px 12px -6px rgba(0, 0, 0, .4);
}
.env-paper {
  z-index: 3; left: 8%; right: 8%; top: 7%; height: 82%; border-radius: 3px;
  background:
    repeating-linear-gradient(180deg, transparent 0 6.5cqw, rgba(110, 80, 50, .2) 6.5cqw calc(6.5cqw + 1px)) center 22% / 78% 62% no-repeat,
    #fffaf0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .18);
  transition: transform .7s var(--ease-out);
}
.env-front {
  z-index: 4; inset: 0; border-radius: 7px;
  clip-path: polygon(0 0, 50% 54%, 100% 0, 100% 100%, 0 100%);
  background: linear-gradient(160deg, #f3e6cc, #dcc6a0);
}
.env-front::before {
  content: ''; position: absolute; inset: 0;
  clip-path: polygon(0 100%, 50% 47%, 100% 100%);
  background: linear-gradient(0deg, #e9d8b6, #f8eed9);
}
.env-front::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(0, 0, 0, .07), transparent 20%, transparent 80%, rgba(0, 0, 0, .07));
}
.env-flapwrap { z-index: 5; inset: 0; pointer-events: none; filter: drop-shadow(0 3px 3px rgba(60, 30, 10, .24)); }
.env-flap {
  position: absolute; left: 0; right: 0; top: 0; height: 56%;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  border-radius: 7px 7px 0 0;
  background: linear-gradient(180deg, #f6ead2 0%, #e4d0ab 100%);
  transform-origin: 50% 0;
  transform: perspective(700px) rotateX(0deg);
  transition: transform .7s var(--ease-out);
}
.seal {
  z-index: 6; left: 50%; top: 56%; width: 27%; aspect-ratio: 1;
  transform: translate(-50%, -50%);
  display: grid !important; place-items: center;
  border-radius: 50% 47% 52% 49% / 49% 52% 47% 51%;
  background: radial-gradient(circle at 34% 30%, #e2475f 0%, #a8182f 42%, #650a1b 100%);
  box-shadow: 0 3px 6px -1px rgba(40, 0, 10, .55), inset 0 -2px 5px rgba(0, 0, 0, .4), inset 0 2px 3px rgba(255, 170, 170, .35);
  transition: opacity .3s;
}
.seal::before {
  content: ''; position: absolute; inset: 13%; border-radius: 50%;
  border: 1px solid rgba(255, 190, 190, .28); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .35);
}
.seal-num {
  position: relative; font-style: italic; font-weight: 500; font-size: 11cqw; line-height: 1;
  color: #ffd5c9; text-shadow: 0 -1px 0 rgba(0, 0, 0, .45), 0 1px 0 rgba(255, 200, 200, .25);
}
.seal-l { clip-path: polygon(0 0, 52% 0, 45% 20%, 56% 38%, 44% 57%, 55% 76%, 47% 100%, 0 100%); }
.seal-r { clip-path: polygon(52% 0, 100% 0, 100% 100%, 47% 100%, 55% 76%, 44% 57%, 56% 38%, 45% 20%); }

/* opened envelopes */
.door.is-read .env-flap, .env.flap-open .env-flap { transform: perspective(700px) rotateX(180deg); }
.door.is-read .env-flapwrap, .env.flap-open .env-flapwrap { z-index: 2; }
.door.is-read .seal, .env.flap-open .seal { opacity: 0; visibility: hidden; }
.door.is-read .env-paper, .env.paper-peek .env-paper { transform: translateY(-30%); }

/* the birthday envelope */
.env.bday .env-back { background: linear-gradient(180deg, #3a0918, #66152e 55%, #761c37); }
.env.bday .env-front { background: linear-gradient(160deg, #8e2442, #5a0f27); }
.env.bday .env-front::before { background: linear-gradient(0deg, #66132d, #9a2c4c); }
.env.bday .env-front::after {
  background:
    linear-gradient(90deg, transparent calc(50% - 2.6cqw), rgba(244, 202, 120, .95) calc(50% - 2.6cqw), #fbe3a6 50%, rgba(214, 160, 80, .95) calc(50% + 2.6cqw), transparent calc(50% + 2.6cqw)),
    linear-gradient(90deg, rgba(0, 0, 0, .14), transparent 20%, transparent 80%, rgba(0, 0, 0, .14));
}
.env.bday .env-flap { background: linear-gradient(180deg, #a8345a, #741937); }
.env.bday .env-flapwrap { filter: drop-shadow(0 0 1px rgba(255, 215, 140, .95)) drop-shadow(0 3px 4px rgba(0, 0, 0, .4)); }
.env.bday .env-paper { background-color: #fff6e4; }
.env.bday .seal {
  background: radial-gradient(circle at 34% 30%, #fff5cf 0%, #e9ba60 40%, #94601e 100%);
  box-shadow: 0 3px 8px -1px rgba(40, 20, 0, .6), inset 0 -2px 5px rgba(80, 40, 0, .45), inset 0 2px 3px rgba(255, 250, 220, .6), 0 0 16px rgba(255, 210, 130, .35);
}
.env.bday .seal::before { border-color: rgba(110, 60, 10, .35); }
.env.bday .seal-num { color: #6b3d0c; font-size: 9cqw; text-shadow: 0 1px 0 rgba(255, 240, 200, .6); }

/* states */
.door.is-locked .env { filter: saturate(.3) brightness(.5); }
.door.is-locked .seal { background: radial-gradient(circle at 34% 30%, #8d7076, #4f3b42 60%, #2c2026); }
.door.is-locked .seal-num { color: rgba(255, 230, 230, .6); }
.door.is-locked::before {
  content: ''; position: absolute; z-index: 3; top: -5px; left: 5%; right: 5%; height: 10px; pointer-events: none;
  border-radius: 10px 10px 6px 6px;
  background:
    radial-gradient(circle at 18% 100%, #e6eef9 3px, transparent 3.5px),
    radial-gradient(circle at 64% 100%, #e6eef9 2.5px, transparent 3px),
    linear-gradient(180deg, #ffffff, #dce6f4);
  box-shadow: 0 2px 4px rgba(0, 0, 0, .35);
  opacity: .9;
}

.door-date {
  padding-left: .24em; font-size: .66rem; font-weight: 500; letter-spacing: .24em; text-transform: uppercase;
  color: rgba(251, 243, 227, .7); transition: color .4s;
}
.door.is-locked .door-date { color: rgba(251, 243, 227, .3); }
.door.is-today .door-date, .door[data-day="15"]:not(.is-locked) .door-date { color: var(--gold); }

.door.is-today:not(.is-read) .env-float { animation: float 3.4s ease-in-out infinite; }
.door.is-today::after {
  content: ''; position: absolute; z-index: -1; left: 50%; top: 40%; width: 150%; aspect-ratio: 1.4; pointer-events: none;
  transform: translate(-50%, -50%);
  background: radial-gradient(closest-side, rgba(242, 200, 121, .42), rgba(242, 200, 121, 0));
  animation: halo 2.8s ease-in-out infinite;
}
.door.is-today.is-read::after { opacity: .3; animation: none; }
.door.is-today:not(.is-read) .seal { animation: sealGlow 2.8s ease-in-out infinite; }

@media (hover: hover) {
  .door:not(.is-locked):hover .env { --lift: -6px; }
  .door:not(.is-locked):not(.is-read):hover .env-flap { transform: perspective(700px) rotateX(28deg); }
  .door.is-read:hover .env-paper { transform: translateY(-40%); }
}

.tw {
  position: absolute; z-index: 2; left: var(--x); top: var(--y); pointer-events: none; line-height: 1;
  font-size: var(--s, 14px); color: var(--gold); text-shadow: 0 0 8px rgba(242, 200, 121, .9);
  animation: tw 2.6s ease-in-out var(--d) infinite;
}
.door.is-locked .tw { color: rgba(242, 200, 121, .55); }

@keyframes float { 0%, 100% { transform: translateY(0) rotate(-.6deg); } 50% { transform: translateY(-8px) rotate(.6deg); } }
@keyframes halo { 0%, 100% { opacity: .6; transform: translate(-50%, -50%) scale(.9); } 50% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); } }
@keyframes sealGlow {
  0%, 100% { box-shadow: 0 3px 6px -1px rgba(40, 0, 10, .55), inset 0 -2px 5px rgba(0, 0, 0, .4), inset 0 2px 3px rgba(255, 170, 170, .35), 0 0 0 0 rgba(255, 130, 150, 0); }
  50% { box-shadow: 0 3px 6px -1px rgba(40, 0, 10, .55), inset 0 -2px 5px rgba(0, 0, 0, .4), inset 0 2px 3px rgba(255, 170, 170, .35), 0 0 18px 5px rgba(255, 140, 150, .55); }
}
@keyframes tw { 0%, 100% { opacity: 0; transform: scale(.3) rotate(0); } 50% { opacity: 1; transform: scale(1) rotate(90deg); } }

.foot {
  margin-top: clamp(70px, 11vh, 120px); text-align: center;
  font-size: .8rem; font-style: italic; font-weight: 300; color: rgba(251, 243, 227, .42);
}
.foot b { font-weight: 500; color: rgba(251, 243, 227, .7); }

/* ---------- stage (the opened letter) ---------- */

.stage {
  position: fixed; inset: 0; z-index: 50;
  display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); place-items: center;
  padding: calc(env(safe-area-inset-top) + 70px) 14px calc(env(safe-area-inset-bottom) + 88px);
}
.stage-bg {
  position: absolute; inset: 0;
  background: radial-gradient(120% 90% at 50% 40%, rgba(36, 22, 70, .6), rgba(5, 6, 15, .92));
  -webkit-backdrop-filter: blur(12px) saturate(120%); backdrop-filter: blur(12px) saturate(120%);
}
.big { grid-area: 1 / 1; position: relative; z-index: 1; width: min(82vw, 460px); visibility: hidden; }
.big .env, .big .env * { transition: none !important; }
.big .env-back { box-shadow: 0 50px 80px -30px rgba(0, 0, 0, .8), 0 10px 20px -10px rgba(0, 0, 0, .5); }

.letter {
  grid-area: 1 / 1; position: relative; z-index: 2;
  width: min(100%, 620px); max-height: 100%;
  display: flex; flex-direction: column; visibility: hidden;
  border-radius: 3px; color: var(--ink);
  background:
    radial-gradient(120% 80% at 0% 0%, rgba(255, 255, 255, .75), transparent 50%),
    radial-gradient(100% 70% at 100% 100%, rgba(196, 160, 110, .2), transparent 60%),
    linear-gradient(180deg, #fdf7ea, #f5ead3);
  box-shadow: 0 50px 100px -30px rgba(0, 0, 0, .85), 0 0 0 1px rgba(80, 50, 20, .08);
}
.letter.on { visibility: visible; }
.letter::before {
  content: ''; position: absolute; inset: 0; pointer-events: none; border-radius: inherit; opacity: .28; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='p'><feTurbulence type='fractalNoise' baseFrequency='.7' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .55  0 0 0 0 .42  0 0 0 0 .28  0 0 0 .5 0'/></filter><rect width='100%' height='100%' filter='url(%23p)'/></svg>");
}
/* fold creases: strong while unfolding, then they settle into faint lines */
.letter::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 2.6s ease;
  background:
    linear-gradient(180deg, transparent calc(33.3% - 2px), rgba(120, 80, 40, .16) calc(33.3% - 1px), rgba(255, 255, 255, .7) 33.3%, transparent calc(33.3% + 3px)),
    linear-gradient(180deg, transparent calc(66.6% - 2px), rgba(120, 80, 40, .16) calc(66.6% - 1px), rgba(255, 255, 255, .7) 66.6%, transparent calc(66.6% + 3px));
}
.letter.on::after { opacity: 1; }
.letter.reveal::after { opacity: .35; }
.stage.is-bday .letter {
  box-shadow: 0 50px 100px -30px rgba(0, 0, 0, .85), 0 0 0 1px rgba(80, 50, 20, .08), inset 0 0 0 10px #fdf7ea, inset 0 0 0 11px rgba(180, 126, 60, .55);
}

.letter-inner {
  position: relative; z-index: 1; flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  padding: clamp(30px, 6vw, 58px) clamp(24px, 7vw, 64px) clamp(30px, 5vw, 50px);
  scrollbar-width: thin; scrollbar-color: rgba(120, 80, 40, .3) transparent;
}
.letter-inner:focus { outline: none; }
.letter-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  padding-bottom: 14px; border-bottom: 1px solid rgba(120, 80, 40, .2);
  font-size: .64rem; font-weight: 500; letter-spacing: .26em; text-transform: uppercase; color: #a0293f;
  opacity: 0;
}
.letter-title {
  margin: .55em 0 .6em; color: #2b1a12;
  font-weight: 400; font-style: italic; font-size: clamp(1.8rem, 6vw, 2.6rem); line-height: 1.08; letter-spacing: -.01em;
}
.letter-title .ch { display: inline-block; opacity: 0; }
.letter-body {
  font-family: 'Cormorant Garamond', Georgia, serif; font-weight: 500;
  font-size: clamp(1.18rem, 3.8vw, 1.36rem); line-height: 1.62; color: #3a2a1f;
}
.letter-body p { margin: 0 0 1em; }
.letter-body .w { display: inline-block; opacity: 0; }
.drop {
  float: left; margin: .07em .1em 0 -.02em; opacity: 0;
  font-family: 'Fraunces', Georgia, serif; font-style: italic; font-weight: 400; font-size: 3.5em; line-height: .8; color: #a0293f;
}
.letter-sign { margin: 1.3em 0 0; text-align: right; }
.signoff {
  display: block; opacity: 0;
  font-family: 'Cormorant Garamond', Georgia, serif; font-style: italic; font-size: 1.15rem; color: #5b4434;
}
.from {
  display: inline-block; padding: .12em .4em .28em .3em;
  font-family: 'Pinyon Script', 'Snell Roundhand', cursive; font-size: clamp(2rem, 6vw, 2.7rem); line-height: 1.2; color: #2b1a12;
  clip-path: inset(0 100% 0 0);
}
.ps { margin: 1.2em 0 0; opacity: 0; font-family: 'Cormorant Garamond', Georgia, serif; font-style: italic; font-size: 1.12rem; color: #5b4434; }
.letter-orn { margin-top: 1.1em; text-align: center; font-size: 1.3rem; color: #a0293f; opacity: 0; }

.letter.reveal .letter-head { animation: fadeUp .8s var(--ease-out) .05s both; }
.letter.reveal .letter-title .ch { animation: chIn .9s var(--ease-out) both; animation-delay: calc(var(--i) * 22ms + 140ms); }
.letter.reveal .drop { animation: dropIn 1.2s var(--ease-out) both; animation-delay: var(--d); }
.letter.reveal .letter-body .w { animation: wordIn .9s var(--ease-out) both; animation-delay: var(--d); }
.letter.reveal .signoff { animation: fadeUp .8s var(--ease-out) both; animation-delay: var(--sd); }
.letter.reveal .from { animation: ink 1.9s cubic-bezier(.45, .05, .3, 1) both; animation-delay: calc(var(--sd) + 300ms); }
.letter.reveal .ps { animation: fadeUp .9s var(--ease-out) both; animation-delay: calc(var(--sd) + 1700ms); }
.letter.reveal .letter-orn { animation: fadeUp .9s var(--ease-out) both; animation-delay: calc(var(--sd) + 2000ms); }

.stage-close, .stage-nav { position: fixed; z-index: 3; opacity: 0; pointer-events: none; transition: opacity .4s, transform .5s var(--ease-spring); }
.stage.ready .stage-close, .stage.ready .stage-nav { opacity: 1; pointer-events: auto; }
.stage-close {
  top: calc(env(safe-area-inset-top) + 14px); right: 14px; width: 46px; height: 46px; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center; transform: scale(.8);
  border: 1px solid rgba(251, 243, 227, .2); background: rgba(20, 16, 40, .5);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.stage.ready .stage-close { transform: none; }
.stage-close:hover { background: rgba(60, 40, 90, .6); }
.stage-nav {
  left: 50%; bottom: calc(env(safe-area-inset-bottom) + 18px); transform: translate(-50%, 20px);
  display: flex; align-items: center; gap: 4px; padding: 4px; border-radius: 999px;
  background: rgba(20, 16, 40, .55); border: 1px solid rgba(251, 243, 227, .14);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.stage.ready .stage-nav { transform: translate(-50%, 0); }
.nav-btn { width: 44px; height: 44px; border-radius: 50%; border: 0; background: transparent; cursor: pointer; display: grid; place-items: center; transition: background .2s, opacity .2s; }
.nav-btn:hover:not(:disabled) { background: rgba(251, 243, 227, .1); }
.nav-btn:disabled { opacity: .22; cursor: default; }
.nav-count { min-width: 5.4em; text-align: center; font-size: .7rem; letter-spacing: .24em; text-transform: uppercase; color: rgba(251, 243, 227, .75); padding-left: .24em; }
.stage-close:focus-visible, .nav-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------- bits ---------- */

.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 28px); z-index: 70;
  max-width: calc(100vw - 32px); padding: .8em 1.3em; border-radius: 999px; text-align: center; pointer-events: none;
  background: rgba(24, 18, 48, .8); border: 1px solid rgba(242, 200, 121, .3); color: var(--cream);
  font-style: italic; font-size: .95rem; font-weight: 300;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  box-shadow: 0 14px 40px -10px rgba(0, 0, 0, .6);
  opacity: 0; transform: translate(-50%, 24px); transition: opacity .35s, transform .55s var(--ease-spring);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.preview-pill {
  position: fixed; z-index: 40; top: calc(env(safe-area-inset-top) + 12px); left: 12px;
  padding: .55em 1em; border-radius: 999px; text-decoration: none;
  font-size: .64rem; font-weight: 500; letter-spacing: .18em; text-transform: uppercase;
  background: rgba(239, 143, 163, .16); border: 1px solid rgba(239, 143, 163, .45); color: #ffd0da;
}

.noscript { position: relative; z-index: 5; text-align: center; padding: 40px 16px; font-style: italic; }

@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes breathe { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
@keyframes chIn { from { opacity: 0; transform: translateY(.55em) rotate(10deg) scale(.9); filter: blur(10px); } to { opacity: 1; transform: none; filter: blur(0); } }
@keyframes wordIn { from { opacity: 0; transform: translateY(.45em); filter: blur(5px); } to { opacity: 1; transform: none; filter: blur(0); } }
@keyframes dropIn { from { opacity: 0; transform: scale(.6) rotate(-12deg); filter: blur(6px); } to { opacity: 1; transform: none; filter: blur(0); } }
@keyframes ink { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }

/* ---------- reduced motion: fades only ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important; transition-delay: 0s !important;
  }
}
