/* ==========================================================
   Happy Birthday, Geraldine — Chapter Thirty-Eight
   ========================================================== */

/* Fonts (self-hosted, SIL Open Font License) */
@font-face { font-family: 'Cormorant'; font-style: normal; font-weight: 500; font-display: swap; src: url('fonts/cormorant-garamond-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Cormorant'; font-style: normal; font-weight: 600; font-display: swap; src: url('fonts/cormorant-garamond-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Cormorant'; font-style: italic; font-weight: 500; font-display: swap; src: url('fonts/cormorant-garamond-latin-500-italic.woff2') format('woff2'); }
@font-face { font-family: 'Cormorant'; font-style: italic; font-weight: 600; font-display: swap; src: url('fonts/cormorant-garamond-latin-600-italic.woff2') format('woff2'); }
@font-face { font-family: 'Courier Prime'; font-style: normal; font-weight: 400; font-display: swap; src: url('fonts/courier-prime-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Courier Prime'; font-style: normal; font-weight: 700; font-display: swap; src: url('fonts/courier-prime-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Amiri'; font-style: normal; font-weight: 700; font-display: swap; src: url('fonts/amiri-arabic-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Caveat'; font-style: normal; font-weight: 700; font-display: swap; src: url('fonts/caveat-latin-700-normal.woff2') format('woff2'); }

:root {
  --paper: #F7F2E8;
  --paper-2: #EFE6D6;
  --ink: #1F2A44;
  --ink-soft: #5C6478;
  --red: #B5333B;
  --red-dark: #8E2229;
  --olive: #6B7F3A;
  --olive-light: #A9B86E;
  --sea-1: #8DB6CF;
  --sea-2: #5F8FB4;
  --sea-3: #2F5D86;
  --gold: #E3A94D;

  --serif: 'Cormorant', 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --type: 'Courier Prime', 'Courier New', monospace;
  --hand: 'Caveat', 'Segoe Print', cursive;
  --arabic: 'Amiri', 'Geeza Pro', 'Noto Naskh Arabic', serif;
  --ease-pop: cubic-bezier(.2, .9, .25, 1.25);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-weight: 500;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
body.locked { overflow: hidden; height: 100svh; }
button { font: inherit; color: inherit; }

body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: .4;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5  0 0 0 0 .45  0 0 0 0 .38  0 0 0 .2 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

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

/* ================= TIDE TRANSITION ================= */
#tide { position: fixed; inset: 0; z-index: 70; pointer-events: none; overflow: hidden; }
#tide .layer {
  position: absolute; left: -5%; right: -5%;
  top: 0; height: 100%;
  transform: translateY(115%);
}
#tide .layer::before, #tide .layer::after {
  content: "";
  position: absolute; left: 0; right: 0;
  height: 60px;
  background-repeat: repeat-x;
  background-size: 240px 60px;
  animation: waveSlide 2.2s linear infinite;
}
#tide .layer::before { top: -59px; }
#tide .layer::after  { bottom: -59px; transform: scaleY(-1); }
#tide .l1 { background: var(--sea-1); }
#tide .l2 { background: var(--sea-2); }
#tide .l3 { background: var(--paper); }
#tide .l1::before, #tide .l1::after { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 240 60'%3E%3Cpath d='M0 40 Q60 10 120 40 T240 40 V60 H0Z' fill='%238DB6CF'/%3E%3C/svg%3E"); }
#tide .l2::before, #tide .l2::after { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 240 60'%3E%3Cpath d='M0 40 Q60 10 120 40 T240 40 V60 H0Z' fill='%235F8FB4'/%3E%3C/svg%3E"); animation-duration: 1.7s; }
#tide .l3::before, #tide .l3::after { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 240 60'%3E%3Cpath d='M0 40 Q60 10 120 40 T240 40 V60 H0Z' fill='%23F7F2E8'/%3E%3C/svg%3E"); animation-duration: 2.6s; }
#tide.rise .layer { transition: transform 1.1s cubic-bezier(.55, .05, .3, 1); transform: translateY(0); }
#tide.rise .l2 { transition-delay: .18s; }
#tide.rise .l3 { transition-delay: .36s; }
#tide.done { opacity: 0; transition: opacity .6s ease; }

/* ================= INTRO ================= */
.intro {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-items: center;
  background: var(--paper);
  transition: opacity .5s ease, visibility .5s ease;
}
.intro.gone { opacity: 0; visibility: hidden; }
.intro-inner { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 24px; text-align: center; }
.intro-kicker {
  font-family: var(--type);
  font-size: 13px;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--ink-soft);
  opacity: 0; animation: rise .9s ease forwards .2s;
}
.intro-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(36px, 8.5vw, 62px);
  line-height: 1.02;
  letter-spacing: -.01em;
  opacity: 0; animation: rise .9s ease forwards .45s;
}
.intro-title em { color: var(--red); }
.boat-btn {
  position: relative;
  width: min(320px, 78vw);
  background: none; border: 0;
  padding: 8px 0 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  opacity: 0; animation: rise .9s ease forwards .75s;
  outline-offset: 6px;
}
.paper-boat {
  display: block;
  width: 72%; margin: 0 auto -14px;
  height: auto; overflow: visible;
  position: relative; z-index: 1;
  animation: bobBoat 3.2s ease-in-out infinite;
}
.boat-btn:hover .paper-boat, .boat-btn:focus-visible .paper-boat { animation: bobBoat 1.4s ease-in-out infinite; }
.boat-num { font-family: var(--type); font-weight: 700; font-size: 12px; fill: var(--red); letter-spacing: .1em; }
.intro-waves { display: block; width: 100%; height: 36px; position: relative; z-index: 2; overflow: hidden; }
.intro-waves .w1 { fill: var(--sea-1); animation: waveX 3s linear infinite; }
.intro-waves .w2 { fill: var(--sea-2); animation: waveX 2.2s linear infinite reverse; }
.boat-btn.sail .paper-boat { animation: sailAway 1.6s cubic-bezier(.5, 0, .7, .4) forwards; }
.intro-hint {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--type);
  font-size: 12px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-top: 8px;
  opacity: 0; animation: rise .9s ease forwards 1.1s;
}
.intro-hint .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--red); animation: pulse 1.6s ease-in-out infinite; }

/* ================= HERO ================= */
main { position: relative; z-index: 2; }
.hero {
  position: relative;
  min-height: 100svh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  padding: 72px 20px 230px;
  overflow: hidden;
}
.floaters { position: absolute; inset: 0; pointer-events: none; }
.floaters span { position: absolute; opacity: 0; animation: drift var(--dur, 14s) ease-in-out infinite var(--delay, 0s); }
.revealed .floaters span { opacity: var(--op, .55); transition: opacity 1.5s ease var(--fade, 0s); }
.floaters svg { width: 100%; height: 100%; display: block; }

.eyebrow {
  font-family: var(--type);
  font-size: 12px;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--red);
  opacity: 0;
}
.eyebrow::before, .eyebrow::after { content: "—"; margin: 0 .8em; opacity: .5; }
.revealed .eyebrow { animation: rise .8s ease forwards .1s; }

.typed {
  margin-top: 16px;
  min-height: 1.3em;
  font-family: var(--type);
  font-size: clamp(22px, 4.6vw, 34px);
  color: var(--ink);
}
.caret {
  display: inline-block;
  width: .55em; height: 1.05em;
  margin-left: 2px;
  vertical-align: -.15em;
  background: var(--red);
  opacity: 0;
}
.revealed .caret { opacity: 1; animation: blink 1s steps(1) infinite; }
.caret.gone { display: none; }

.name-wrap { position: relative; margin-top: 2px; padding: 0 12px; }
.name {
  position: relative; z-index: 1;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 600;
  font-size: clamp(74px, 17.5vw, 196px);
  line-height: 1;
  letter-spacing: -.02em;
  color: var(--ink);
  padding: 0 .08em .06em;
}
.name .ch {
  display: inline-block;
  opacity: 0;
  filter: blur(10px);
  transform: translateY(12px);
}
.name.ink .ch { animation: ink .9s cubic-bezier(.2, .7, .2, 1) forwards; animation-delay: calc(var(--i) * 80ms); }
.underline {
  position: absolute; left: 6%; right: 6%; bottom: 2%;
  width: 88%; height: 18%;
  overflow: visible; z-index: 0;
}
.underline path { fill: none; stroke: var(--red); stroke-width: 5; stroke-linecap: round; stroke-dasharray: 640; stroke-dashoffset: 640; }
.revealed .underline path { animation: draw 1s ease forwards 3.1s; }

.seal {
  position: absolute; z-index: 2;
  width: clamp(92px, 13vw, 128px);
  top: -16%; right: -8%;
  opacity: 0;
  transform: scale(2.2) rotate(-20deg);
  filter: drop-shadow(0 6px 10px rgba(142, 34, 41, .25));
}
.revealed .seal { animation: sealIn .55s cubic-bezier(.5, 0, .3, 1.4) forwards 3.4s; }
.seal-ring { font-family: var(--type); font-weight: 700; font-size: 9.5px; fill: #F7E3CF; }
.seal-num { font-family: var(--serif); font-weight: 600; font-size: 44px; fill: #F7E3CF; }

.hero-sub {
  margin-top: 26px;
  max-width: 520px;
  font-size: clamp(19px, 4.2vw, 23px);
  line-height: 1.45;
  color: var(--ink-soft);
  opacity: 0;
}
.revealed .hero-sub { animation: rise .9s ease forwards 3.6s; }

.dog-spot {
  position: absolute;
  left: max(5vw, 18px);
  bottom: 50px;
  width: clamp(140px, 16vw, 200px);
  opacity: 0;
  transform: translateY(40px);
}
.revealed .dog-spot { animation: dogIn 1s var(--ease-pop) forwards 3.9s; }
.dog-btn { display: block; width: 100%; background: none; border: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.dog-note { font-family: var(--hand); font-size: 20px; color: var(--ink-soft); transform: rotate(-3deg); }
.bubble {
  position: absolute;
  right: -30%; top: -4%;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 18px 18px 18px 4px;
  padding: 6px 13px;
  font-family: var(--hand);
  font-size: 22px;
  white-space: nowrap;
  transform: scale(0) rotate(5deg);
  transform-origin: bottom left;
  transition: transform .35s var(--ease-pop);
  pointer-events: none;
  z-index: 3;
}
.bubble.show { transform: scale(1) rotate(5deg); }

.scroll-hint {
  position: absolute; bottom: 22px; left: 50%;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-family: var(--type);
  font-size: 11px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--ink-soft);
  text-decoration: none;
  opacity: 0;
}
.revealed .scroll-hint { animation: rise .8s ease forwards 4.3s; }
.scroll-hint svg { animation: bob 1.8s ease-in-out infinite; }

/* ================= DOGS (shared) ================= */
.dog { width: 100%; height: auto; display: block; overflow: visible; }
.dog .tail { transform-box: view-box; transform-origin: var(--tx, 138px) var(--ty, 172px); animation: wag 1.1s ease-in-out infinite; }
.dog .head { transform-box: view-box; transform-origin: 100px 124px; animation: headTilt 7s ease-in-out infinite var(--hd, 0s); }
.dog .ear { transform-box: fill-box; transform-origin: 50% 10%; transition: transform .25s ease; }
.dog .lid { transform-box: fill-box; transform-origin: center; transition: transform .1s ease; }
.dog .blink .lid { transform: scaleY(.1); }
.dog .tongue { opacity: 0; transform: translateY(-4px); transform-box: fill-box; transform-origin: top; transition: opacity .2s, transform .25s var(--ease-pop); }
.dog.happy .tongue { opacity: 1; transform: none; }
.dog.happy .tail { animation-duration: .28s; }
.dog.happy .ear.l { transform: rotate(14deg); }
.dog.happy .ear.r { transform: rotate(-14deg); }
.dog.happy .lid { transform: scaleY(.45) translateY(2px); }

/* ================= SECTIONS ================= */
.section {
  position: relative;
  max-width: 900px;
  margin: 0 auto;
  padding: 110px 22px;
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
}
.label {
  font-family: var(--type);
  font-size: 12px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--ink-soft);
  display: flex; align-items: center; gap: 10px;
}
.label span { font-family: var(--serif); font-style: italic; font-size: 20px; letter-spacing: 0; color: var(--red); font-weight: 600; }
.title {
  margin-top: 12px;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(32px, 6.4vw, 52px);
  line-height: 1.08;
  letter-spacing: -.01em;
}
.title em { color: var(--red); }
.sub { margin-top: 14px; max-width: 520px; color: var(--ink-soft); font-size: clamp(18px, 4vw, 21px); line-height: 1.5; }

.reveal { opacity: 0; transform: translateY(26px); transition: opacity .9s ease, transform .9s cubic-bezier(.2, .8, .2, 1); }
.reveal.in { opacity: 1; transform: none; }

.ghost {
  margin-top: 6px;
  background: transparent;
  border: 1.5px solid rgba(31, 42, 68, .25);
  border-radius: 999px;
  padding: 10px 18px;
  font-family: var(--type);
  font-size: 13px;
  color: var(--ink-soft);
  cursor: pointer;
  transition: border-color .2s, color .2s, background .2s, transform .2s;
}
.ghost:hover { border-color: var(--ink); color: var(--ink); background: #fff; transform: translateY(-1px); }
.ghost.small { font-size: 12px; padding: 8px 14px; }
.ghost.listening { border-color: var(--red); color: var(--red); background: #fff; }

/* ================= CAKE ================= */
.cake-wrap { margin-top: 34px; }
.cake { width: min(360px, 84vw); height: auto; overflow: visible; }
.num-candle { font-family: var(--serif); font-weight: 600; font-size: 74px; stroke: #FFFDF8; stroke-width: 4px; paint-order: stroke; }
.flame-g { cursor: pointer; }
.flame { transform-box: fill-box; transform-origin: 50% 90%; animation: flicker .14s ease-in-out infinite alternate; transition: transform .35s ease, opacity .35s ease; }
.glow { animation: glow 1.6s ease-in-out infinite alternate; transition: opacity .3s; }
.smoke circle { fill: #C9C2CF; opacity: 0; }
.candle.out .flame { transform: scale(0); opacity: 0; animation: none; }
.candle.out .glow { opacity: 0; animation: none; }
.candle.out .smoke circle { animation: smoke 1.6s ease-out forwards; }
.candle.out .smoke circle:nth-child(2) { animation-delay: .12s; }
.candle.out .smoke circle:nth-child(3) { animation-delay: .24s; }
.candle.out .flame-g { cursor: default; }
.cake-actions { margin-top: 24px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.hint { font-family: var(--hand); font-size: 25px; color: var(--ink-soft); }
.wish-done { display: none; flex-direction: column; align-items: center; gap: 14px; margin-top: 18px; }
.wish-done.show { display: flex; animation: rise .7s ease forwards; }
.wish-text { font-size: 22px; }
.wish-text strong { font-style: italic; color: var(--red); font-weight: 600; }

/* ================= SUMUD ================= */
.sumud { position: relative; margin: 40px 0; background: #FBF8F1; }
.tatreez-band {
  height: 56px;
  background-color: #FBF8F1;
  background-image: var(--tatreez);
  background-repeat: repeat-x;
  background-position: center;
  background-size: auto 48px;
  border-top: 1.5px solid rgba(31, 42, 68, .12);
  border-bottom: 1.5px solid rgba(31, 42, 68, .12);
  animation: stitchSlide 40s linear infinite;
}
.sumud-inner { max-width: 1100px; margin: 0 auto; padding: 90px 22px 80px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.arabic {
  margin-top: 18px;
  font-family: var(--arabic);
  font-weight: 700;
  font-size: clamp(84px, 18vw, 160px);
  line-height: 1.1;
  color: var(--ink);
}
.arabic-gloss { font-family: var(--type); font-size: 13px; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-soft); margin-top: -4px; }
.arabic-gloss i { font-family: var(--serif); text-transform: none; letter-spacing: 0; font-size: 20px; color: var(--red); }

.sea-scene {
  position: relative;
  width: 100%;
  margin-top: 40px;
  aspect-ratio: 1200 / 420;
  min-height: 240px;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 30px 60px -36px rgba(31, 42, 68, .5);
}
.sea-scene svg { width: 100%; height: 100%; display: block; }
.sun { animation: sunPulse 6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.wave-row { animation: seaX 14s linear infinite; }
.r-mid { animation-duration: 10s; animation-direction: reverse; }
.r-front { animation-duration: 7s; }
.bird { animation: flap 1.2s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.b2 { animation-delay: .3s; } .b3 { animation-delay: .6s; }
.birds { animation: birdsDrift 26s linear infinite; }
.fleet { animation: fleetDrift var(--fd, 60s) linear infinite; animation-delay: var(--fdel, 0s); }
.fleet .bob { transform-box: fill-box; transform-origin: 50% 100%; animation: bobSea var(--bd, 3s) ease-in-out infinite; animation-delay: var(--bdel, 0s); }
.flag { transform-box: fill-box; transform-origin: 0 50%; animation: flagWave 1.4s ease-in-out infinite alternate; }

.sumud-text { margin-top: 56px; display: flex; flex-direction: column; align-items: center; }
.sumud-text .title { max-width: 760px; }
.body { margin-top: 18px; max-width: 600px; font-size: clamp(19px, 4vw, 22px); line-height: 1.6; color: var(--ink-soft); }
.olive-branch { width: min(320px, 76vw); margin-top: 26px; overflow: visible; }
.olive-branch .stem { fill: none; stroke: var(--olive); stroke-width: 2.5; stroke-linecap: round; stroke-dasharray: 340; stroke-dashoffset: 340; }
.olive-branch .leaves ellipse { fill: var(--olive-light); opacity: 0; transform-box: fill-box; transform-origin: center; transform: scale(0); }
.olive-branch .leaves .olive { fill: var(--olive); }
.olive-branch.in .stem { animation: draw 1.4s ease forwards .3s; }
.olive-branch.in .leaves ellipse { animation: leaf .5s var(--ease-pop) forwards; }

/* ================= PACK ================= */
.pack {
  margin-top: 44px;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  align-items: end;
}
.pup {
  background: none; border: 0;
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  opacity: 0;
  transform: translateX(-60vw);
}
.pack.in .pup { animation: runIn 1.1s cubic-bezier(.2, .8, .25, 1.05) forwards; animation-delay: calc(var(--i) * 140ms); }
.pack.in .pup .dog { animation: hop .28s ease-in-out 4 alternate; animation-delay: calc(var(--i) * 140ms); }
.pup .dog-wrap { width: calc(100% * var(--s, 1)); }
.pup .tag {
  margin-top: 6px;
  font-family: var(--hand);
  font-size: 22px;
  color: var(--ink);
  min-height: 1.2em;
}
.pup .woof {
  position: absolute; top: -18px; left: 50%;
  font-family: var(--hand); font-size: 22px; color: var(--red);
  transform: translate(-50%, 0) scale(0);
  transition: transform .3s var(--ease-pop), opacity .3s;
  opacity: 0;
  pointer-events: none;
}
.pup.barking .woof { transform: translate(-50%, -16px) scale(1); opacity: 1; }
.pup.barking .dog { animation: jump .45s ease; }
.pack-hint { margin-top: 18px; font-family: var(--hand); font-size: 22px; color: var(--ink-soft); }

/* ================= TYPEWRITER ================= */
.typewriter { margin-top: 40px; width: min(560px, 100%); position: relative; }
.paper {
  position: relative;
  width: 82%;
  margin: 0 auto -6px;
  background: #FFFDF8;
  border-radius: 4px 4px 0 0;
  box-shadow: 0 -2px 0 rgba(31, 42, 68, .04), 0 18px 40px -26px rgba(31, 42, 68, .5);
  --pt: 26px;
  padding: var(--pt) 26px 34px;
  transform-origin: 50% 100%;
  transition: transform .9s cubic-bezier(.6, 0, .3, 1), opacity .7s ease .2s, filter .6s;
  background-image: repeating-linear-gradient(transparent 0 31px, rgba(95, 143, 180, .18) 31px 32px);
  background-position: 0 calc(var(--pt) - 7px);
}
.paper.fold { transform: translateY(40px) scale(.15) rotate(18deg); opacity: 0; }
.paper.nudge { transform: translateX(-2px); transition: transform .05s; }
#wishText {
  display: block;
  width: 100%;
  min-height: 160px;
  border: 0; outline: 0; resize: none;
  background: transparent;
  font-family: var(--type);
  font-size: 17px;
  line-height: 32px;
  color: var(--ink);
  caret-color: var(--red);
}
.tw-body { display: block; width: 100%; height: auto; position: relative; z-index: 2; }
.tw-body .key { transition: transform .08s ease; transform-box: fill-box; transform-origin: center; }
.tw-body .key.down { transform: translateY(2px) scale(.9); }
.tw-body .space.down { transform: translateY(2px); }
.sail-btn {
  margin-top: 26px;
  border: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--type);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: .04em;
  padding: 14px 26px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 12px 26px -14px rgba(31, 42, 68, .8);
  transition: transform .2s, background .2s;
}
.sail-btn:hover { transform: translateY(-2px); background: #0F1830; }
.sail-btn[disabled] { opacity: .4; pointer-events: none; }
.mini-sea { position: relative; width: min(720px, 100%); height: 110px; margin-top: 24px; overflow: hidden; }
.mini-waves { position: absolute; left: 0; bottom: 0; width: 200%; height: 50px; animation: miniX 6s linear infinite; }
.mini-boat {
  position: absolute; bottom: 26px; left: 50%;
  width: 92px; height: auto;
  transform: translateX(-50%) scale(0);
  opacity: 0;
}
.mini-boat.show { animation: miniPop .5s var(--ease-pop) forwards; }
.mini-boat.go { animation: miniSail 3.6s cubic-bezier(.45, 0, .6, 1) forwards; }
.sent { display: none; flex-direction: column; align-items: center; gap: 14px; margin-top: 10px; }
.sent.show { display: flex; animation: rise .8s ease forwards; }
.sent p { font-size: 22px; line-height: 1.45; }
.sent em { color: var(--red); }

/* ================= LETTER ================= */
.closing { padding-top: 60px; }
.letter {
  position: relative;
  width: min(600px, 100%);
  text-align: left;
  background: #FFFDF8;
  padding: 46px 44px 40px;
  border-radius: 6px;
  box-shadow: 0 1px 0 rgba(31, 42, 68, .05), 0 30px 60px -34px rgba(31, 42, 68, .45);
  font-size: clamp(19px, 4.2vw, 22px);
  line-height: 1.6;
}
.letter.in { transform: rotate(-.8deg); }
.letter::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 8px;
  background-image: var(--tatreez); background-size: auto 8px; background-repeat: repeat-x; opacity: .8;
  border-radius: 6px 6px 0 0;
}
.letter p + p { margin-top: 14px; }
.letter-date { font-family: var(--type); font-size: 12px; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-soft); text-align: center; margin-bottom: 18px; }
.letter-hi { font-style: italic; font-size: 1.25em; }
.letter-sign { font-family: var(--hand); font-size: 32px; margin-top: 22px !important; }
.letter-sprig { position: absolute; right: 30px; bottom: 34px; width: 110px; }
.closing .ghost { margin-top: 34px; }
.foot { text-align: center; padding: 26px 20px 40px; font-family: var(--type); font-size: 11px; letter-spacing: .08em; color: var(--ink-soft); opacity: .8; }

.music-btn {
  position: fixed; right: 18px; bottom: 18px; z-index: 40;
  width: 46px; height: 46px;
  border-radius: 50%; border: 0;
  background: #fff;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 10px 26px -12px rgba(31, 42, 68, .5), inset 0 0 0 1.5px rgba(31, 42, 68, .1);
  opacity: 0; transform: scale(.6); pointer-events: none;
  transition: opacity .5s ease, transform .5s var(--ease-pop), background .2s;
}
.revealed .music-btn { opacity: 1; transform: scale(1); pointer-events: auto; transition-delay: 4.4s, 4.4s, 0s; }
.music-btn.playing { background: var(--gold); animation: beat .42s ease-in-out infinite alternate; }

/* ================= KEYFRAMES ================= */
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.7); opacity: .4; } }
@keyframes bobBoat { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-6px) rotate(3deg); } }
@keyframes waveX { from { transform: translateX(0); } to { transform: translateX(-120px); } }
@keyframes waveSlide { to { background-position-x: -240px; } }
@keyframes sailAway {
  0% { transform: translate(0, 0) rotate(0); }
  20% { transform: translate(-14px, 2px) rotate(-6deg); }
  100% { transform: translate(110vw, -10px) rotate(8deg); }
}
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes ink { to { opacity: 1; filter: blur(0); transform: none; } }
@keyframes sealIn {
  0% { opacity: 0; transform: scale(2.2) rotate(-20deg); }
  70% { opacity: 1; transform: scale(.92) rotate(10deg); }
  100% { opacity: 1; transform: scale(1) rotate(10deg); }
}
@keyframes dogIn { to { opacity: 1; transform: none; } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(5px); } }
@keyframes drift {
  0%, 100% { transform: translate(0, 0) rotate(var(--r0, 0deg)); }
  50% { transform: translate(var(--dx, 10px), var(--dy, -24px)) rotate(var(--r1, 20deg)); }
}
@keyframes wag { 0%, 100% { transform: rotate(-10deg); } 50% { transform: rotate(16deg); } }
@keyframes headTilt { 0%, 72%, 100% { transform: rotate(0); } 78%, 90% { transform: rotate(-7deg); } }
@keyframes flicker { from { transform: scale(1, 1) rotate(-2deg); } to { transform: scale(.94, 1.06) rotate(2deg); } }
@keyframes glow { from { opacity: .7; } to { opacity: 1; } }
@keyframes smoke { 0% { opacity: .8; transform: translate(0, 0) scale(.6); } 100% { opacity: 0; transform: translate(6px, -40px) scale(1.8); } }
@keyframes stitchSlide { to { background-position-x: 600px; } }
@keyframes seaX { to { transform: translateX(-1200px); } }
@keyframes sunPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04); } }
@keyframes flap { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(.4); } }
@keyframes birdsDrift { from { transform: translateX(-500px); } to { transform: translateX(1300px); } }
@keyframes fleetDrift { from { transform: translateX(var(--fx0, -300px)); } to { transform: translateX(var(--fx1, 1400px)); } }
@keyframes bobSea { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-5px) rotate(3deg); } }
@keyframes flagWave { from { transform: skewY(-6deg) scaleX(.94); } to { transform: skewY(6deg) scaleX(1); } }
@keyframes leaf { to { opacity: 1; transform: scale(1); } }
@keyframes runIn { to { opacity: 1; transform: none; } }
@keyframes hop { to { transform: translateY(-8px); } }
@keyframes jump { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-16px) rotate(-3deg); } }
@keyframes miniX { to { transform: translateX(-50%); } }
@keyframes miniPop { to { opacity: 1; transform: translateX(-50%) scale(1); } }
@keyframes miniSail {
  0% { opacity: 1; transform: translateX(-50%) rotate(0); }
  15% { transform: translateX(-56%) rotate(-5deg); }
  100% { opacity: 1; transform: translateX(560%) rotate(6deg); }
}
@keyframes beat { to { transform: scale(1.08); } }

/* ================= RESPONSIVE ================= */
@media (max-width: 760px) {
  .pack { grid-template-columns: repeat(3, 1fr); row-gap: 26px; }
}
@media (max-width: 640px) {
  .hero { padding-top: 13svh; padding-bottom: 250px; justify-content: flex-start; }
  .br-desk { display: none; }
  .seal { position: relative; display: block; top: auto; right: auto; width: 96px; margin: 18px auto 0; }
  .underline { bottom: 112px; height: 16px; }
  .hero-sub { margin-top: 16px; }
  .dog-spot { left: 50%; width: 150px; bottom: 74px; transform: translate(-50%, 40px); }
  .scroll-hint { bottom: 14px; }
  .tatreez-band { height: 44px; background-size: auto 36px; }
  .revealed .dog-spot { animation-name: dogInMobile; }
  .bubble { right: -46%; }
  .section { padding: 84px 18px; }
  .title br { display: none; }
  .title { text-wrap: balance; }
  .sumud-inner { padding: 70px 16px 64px; }
  .sea-scene { border-radius: 14px; aspect-ratio: 4 / 3; }
  .letter { padding: 38px 24px 34px; }
  .letter-sprig { width: 84px; right: 18px; bottom: 30px; }
  .paper { width: 88%; --pt: 20px; padding: var(--pt) 18px 28px; }
  #wishText { font-size: 15px; min-height: 130px; }
  .music-btn { right: 12px; bottom: 12px; }
}
@keyframes dogInMobile { to { opacity: 1; transform: translate(-50%, 0); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
