/* ============================================================
   Birthday · scroll story
   Palette: navy / champagne gold / ivory
   ============================================================ */

:root {
  --bg-0: #050d18;
  --bg-1: #0a1a2f;
  --bg-2: #102a48;
  --ink: #f1f4fa;
  --ink-soft: #abbdd4;
  --ink-faint: #6d86a6;
  --gold: #d8bc84;
  --gold-bright: #f0d9a8;
  --gold-deep: #b9955a;
  --gold-glow: rgba(240, 217, 168, 0.22);
  --line: rgba(216, 188, 132, 0.26);
  --line-soft: rgba(167, 185, 210, 0.14);
  --glow-blue: rgba(84, 133, 190, 0.2);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-smooth: cubic-bezier(0.45, 0.05, 0.2, 0.99);
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  color: var(--ink);
  font-family: "Helvetica Neue", "Segoe UI", system-ui, -apple-system, Arial,
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(1200px 760px at 80% -16%, rgba(64, 112, 170, 0.28) 0%, transparent 60%),
    radial-gradient(940px 680px at 4% 10%, rgba(28, 64, 110, 0.4) 0%, transparent 60%),
    radial-gradient(1100px 840px at 50% 116%, rgba(16, 44, 78, 0.65) 0%, transparent 64%),
    linear-gradient(168deg, #040c18 0%, #08162b 50%, #0a1a2f 100%);
  background-attachment: fixed;
  overflow-x: hidden;
}

::selection {
  background: rgba(216, 188, 132, 0.3);
  color: #fff;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  color: var(--ink);
  font-family: "Helvetica Neue", "Segoe UI", system-ui, -apple-system, Arial,
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(1100px 720px at 82% -14%, rgba(74, 126, 188, 0.3) 0%, transparent 62%),
    radial-gradient(900px 640px at 2% 8%, rgba(30, 75, 128, 0.5) 0%, transparent 62%),
    radial-gradient(1000px 760px at 52% 114%, rgba(20, 51, 90, 0.7) 0%, transparent 66%),
    linear-gradient(165deg, #06101e 0%, #0a1a2f 50%, #0b2038 100%);
  background-attachment: fixed;
  overflow-x: hidden;
}

::selection {
  background: rgba(216, 188, 132, 0.32);
  color: #fff;
}

/* ---------- background ---------- */

.deco {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.35;
  animation: blobDrift 34s ease-in-out infinite alternate;
}

.blob-a {
  width: 480px;
  height: 480px;
  left: -160px;
  top: 6%;
  background: #1b4370;
}

.blob-b {
  width: 380px;
  height: 380px;
  right: -130px;
  top: -8%;
  background: #265389;
  animation-delay: -10s;
}

.blob-c {
  width: 540px;
  height: 540px;
  right: 10%;
  bottom: -240px;
  background: #14325a;
  animation-delay: -18s;
}

@keyframes blobDrift {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }
  to {
    transform: translate3d(28px, -36px, 0) scale(1.06);
  }
}

/* faint star field */
.deco::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1.2px 1.2px at 40px 60px, rgba(240, 217, 168, 0.5), transparent 100%),
    radial-gradient(1px 1px at 180px 210px, rgba(255, 255, 255, 0.3), transparent 100%),
    radial-gradient(1px 1px at 280px 110px, rgba(157, 188, 221, 0.34), transparent 100%);
  background-size: 340px 340px;
  opacity: 0.42;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, rgba(0, 0, 0, 0.4) 68%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 0%, rgba(0, 0, 0, 0.4) 68%, transparent 100%);
}

/* ---------- progress ---------- */

.progress {
  position: fixed;
  inset: 0 0 auto;
  height: 2px;
  z-index: 60;
  background: rgba(255, 255, 255, 0.04);
  pointer-events: none;
}

.progress span {
  display: block;
  height: 100%;
  width: 100%;
  transform: scaleX(0);
  transform-origin: 0 50%;
  background: linear-gradient(90deg, #8a6f3f, var(--gold-bright));
}

/* ---------- generic ---------- */

main {
  position: relative;
  z-index: 1;
}

h1,
h2,
p {
  margin: 0;
}

.svg-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.line-icon {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.35;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 116px 24px 116px;
  text-align: center;
}

.hero::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 46%;
  width: min(680px, 96vw);
  height: min(680px, 96vw);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(74, 120, 174, 0.16), transparent 66%);
  pointer-events: none;
}

.hero-eyebrow {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 16px;
  font-size: 0.64rem;
  font-weight: 500;
  letter-spacing: 0.44em;
  text-indent: 0.44em;
  color: var(--gold);
  text-transform: uppercase;
  animation: fadeUp 1s var(--ease) 0.1s both;
}

.hero-eyebrow::before,
.hero-eyebrow::after {
  content: "";
  width: 42px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(216, 188, 132, 0.6));
}

.hero-eyebrow::after {
  background: linear-gradient(90deg, rgba(216, 188, 132, 0.6), transparent);
}

.hero-name-wrap {
  position: relative;
  max-width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(10px, 2vw, 24px);
  animation: fadeUp 1.1s var(--ease) 0.2s both;
}

.hero-name {
  position: relative;
  max-width: 100%;
  font-family: Georgia, "Songti SC", "Noto Serif SC", "STSong", "Times New Roman", serif;
  font-style: italic;
  font-weight: 400;
  font-size: clamp(3.6rem, 14vw, 8rem);
  line-height: 1.02;
  letter-spacing: -0.015em;
  overflow-wrap: break-word;
  background: linear-gradient(110deg, #fcf8f0 6%, #f0d9a8 50%, #cdab6e 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 22px 38px rgba(0, 0, 0, 0.55));
}

.hero-cat {
  width: clamp(64px, 9vw, 104px);
  height: auto;
  flex: none;
  margin-bottom: clamp(8px, 1.4vw, 16px);
  color: var(--gold);
  opacity: 0.9;
  filter: drop-shadow(0 12px 20px rgba(0, 0, 0, 0.45))
    drop-shadow(0 0 20px rgba(240, 217, 168, 0.14));
  animation: catFloat 6s ease-in-out infinite;
  transform-origin: 50% 90%;
}

@keyframes catFloat {
  0%,
  100% {
    transform: translateY(0) rotate(-1.5deg);
  }
  50% {
    transform: translateY(-7px) rotate(1.5deg);
  }
}

.hero-sub {
  position: relative;
  margin-top: 4px;
  font-size: clamp(0.92rem, 2.6vw, 1.02rem);
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  animation: fadeUp 1.1s var(--ease) 0.34s both;
}

.hero-meta {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
  font-size: 0.66rem;
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  text-transform: uppercase;
  color: var(--ink-faint);
  animation: fadeUp 1.1s var(--ease) 0.44s both;
}

.hero-meta .sep {
  width: 22px;
  height: 1px;
  background: rgba(216, 188, 132, 0.45);
}

.scroll-cue {
  position: absolute;
  left: 50%;
  bottom: 44px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  font-size: 0.56rem;
  letter-spacing: 0.38em;
  text-indent: 0.38em;
  text-transform: uppercase;
  color: var(--ink-faint);
  transition: opacity 0.5s ease;
  animation: fadeIn 1.2s ease 0.8s both;
}

.scroll-cue i {
  position: relative;
  display: block;
  width: 1px;
  height: 40px;
  overflow: hidden;
  background: rgba(167, 185, 210, 0.2);
}

.scroll-cue i::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent, var(--gold-bright));
  transform: translateY(-100%);
  animation: cueRun 2.4s ease-in-out infinite;
}

body.is-scrolled .scroll-cue {
  opacity: 0;
}

@keyframes cueRun {
  0% {
    transform: translateY(-100%);
  }
  55%,
  100% {
    transform: translateY(100%);
  }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ---------- chapters ---------- */

.chapter {
  position: relative;
  width: min(820px, calc(100% - 48px));
  min-height: 100vh;
  min-height: 100svh;
  margin: 0 auto;
  padding: clamp(100px, 15vh, 170px) 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(22px, 3.6vh, 34px);
}

.chapter-head {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.36em;
  text-indent: 0.36em;
  text-transform: uppercase;
  color: var(--gold);
  align-self: center;
}

.chapter-head .num {
  color: var(--gold-bright);
  font-variant-numeric: tabular-nums;
}

.chapter-head .dash {
  width: 36px;
  height: 1px;
  background: linear-gradient(90deg, rgba(216, 188, 132, 0.75), transparent);
}

.chapter-title {
  font-family: Georgia, "Songti SC", "Noto Serif SC", "STSong", "Times New Roman", serif;
  font-weight: 400;
  font-size: clamp(2.25rem, 6.4vw, 3.8rem);
  line-height: 1.12;
  letter-spacing: 0.002em;
  color: var(--ink);
  text-align: center;
}

.chapter-title em {
  font-style: italic;
  background: linear-gradient(110deg, #f2dfb8, #c9a86b);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* long titles that must stay on one line */
.chapter-title.chapter-title--wide {
  white-space: nowrap;
  font-size: clamp(1.5rem, 4.8vw, 3.4rem);
  letter-spacing: 0;
  text-align: center;
}

.chapter--closing .chapter-title {
  text-align: center;
}

.chapter-text {
  max-width: 32em;
  font-size: clamp(0.96rem, 2.3vw, 1.04rem);
  line-height: 1.9;
  letter-spacing: 0.015em;
  color: var(--ink-soft);
  text-align: center;
}

/* ---------- orbit ---------- */

.orbit {
  width: min(100%, 560px);
  height: auto;
  margin: clamp(4px, 1.6vh, 16px) 0;
  overflow: visible;
}

.orbit-path {
  fill: none;
  stroke: rgba(216, 188, 132, 0.5);
  stroke-width: 1.1;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 2.2s var(--ease-smooth) 0.15s;
}

.orbit.is-visible .orbit-path {
  stroke-dashoffset: 0;
}

.orbit-star {
  fill: var(--gold-bright);
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
  filter: drop-shadow(0 0 8px rgba(240, 217, 168, 0.8));
  transition: opacity 0.9s ease 1.4s;
}

.orbit-star.star-b {
  fill: #cfe2f5;
  filter: drop-shadow(0 0 8px rgba(180, 214, 245, 0.7));
}

.orbit.is-visible .orbit-star {
  opacity: 1;
  animation: starPulse 5s ease-in-out infinite;
}

.orbit.is-visible .orbit-star.star-b {
  animation-delay: -2.5s;
}

@keyframes starPulse {
  0%,
  100% {
    transform: scale(0.9);
  }
  50% {
    transform: scale(1.12);
  }
}

/* ---------- note under the cake ---------- */

.animal-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(20px, 4.4vw, 32px);
  margin-top: clamp(8px, 1.6vh, 14px);
  color: var(--gold);
}

.animal-row::before,
.animal-row::after {
  content: "";
  width: clamp(28px, 6vw, 48px);
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(216, 188, 132, 0.45));
}

.animal-row::after {
  background: linear-gradient(90deg, rgba(216, 188, 132, 0.45), transparent);
}

.animal-icon {
  flex: none;
  width: clamp(28px, 6vw, 34px);
  height: auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.82;
  transition: opacity 0.4s ease, transform 0.4s var(--ease);
}

.animal-cat {
  width: clamp(34px, 7.5vw, 42px);
  color: var(--gold-bright);
  opacity: 0.95;
  filter: drop-shadow(0 0 10px rgba(240, 217, 168, 0.25));
}

.animal-row:hover .animal-icon {
  opacity: 0.95;
  transform: translateY(-2px);
}

/* ---------- cake ---------- */

.chapter--wish {
  align-items: center;
  text-align: center;
}

.chapter--wish .chapter-title {
  align-self: center;
}

.stage {
  position: relative;
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: clamp(52px, 10vh, 92px) 0 8px;
}

.stage::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: min(500px, 90vw);
  height: 200px;
  transform: translateX(-50%);
  background: radial-gradient(
    ellipse at center,
    rgba(157, 188, 221, 0.12) 0%,
    rgba(157, 188, 221, 0.03) 50%,
    transparent 74%
  );
  pointer-events: none;
}

.cake {
  --cake-w: min(64vw, 300px);
  position: relative;
  width: var(--cake-w);
  height: calc(var(--cake-w) * 0.8);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  filter: drop-shadow(0 22px 30px rgba(0, 0, 0, 0.44));
  transition: transform 0.4s var(--ease), filter 0.4s var(--ease);
}

.cake:hover {
  transform: translateY(-3px);
  filter: drop-shadow(0 28px 32px rgba(0, 0, 0, 0.52))
    drop-shadow(0 0 22px rgba(240, 217, 168, 0.08));
}

.cake:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 10px;
  border-radius: 10px;
}

.cake.is-out {
  cursor: default;
}

.cake.is-out:hover {
  transform: none;
  filter: drop-shadow(0 22px 28px rgba(0, 0, 0, 0.42));
}

.cake-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.cake-lines path,
.cake-lines circle {
  vector-effect: non-scaling-stroke;
}

.cake-tier {
  fill: none;
  stroke: url(#cakeGold);
  stroke-width: 1.3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cake-drip {
  fill: none;
  stroke: rgba(240, 217, 168, 0.5);
  stroke-width: 1;
  stroke-linecap: round;
  stroke-dasharray: 3 5;
}

.cake-halo {
  fill: none;
  stroke: rgba(157, 188, 221, 0.45);
  stroke-width: 1;
  stroke-linecap: round;
}

.cake-halo--dash {
  stroke-dasharray: 2 7;
  opacity: 0.5;
}

.cake-motif {
  fill: rgba(240, 217, 168, 0.9);
  stroke: none;
  filter: drop-shadow(0 0 6px rgba(240, 217, 168, 0.5));
}

.cake-dot {
  fill: rgba(240, 217, 168, 0.5);
  stroke: none;
}

.cake-spark {
  fill: rgba(240, 217, 168, 0.9);
  stroke: none;
  transform-box: fill-box;
  transform-origin: center;
  animation: cakeTwinkle 5s ease-in-out infinite;
}

.cake-spark.s1 { animation-delay: -1.2s; }
.cake-spark.s2 { animation-delay: -2.4s; }
.cake-spark.s3 { animation-delay: -3.3s; }
.cake-spark.s4 { animation-delay: -0.6s; }

@keyframes cakeTwinkle {
  0%, 100% { opacity: 0.25; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.15); }
}

/* candles: thin stems and tiny star flames */

.candles {
  position: absolute;
  left: 28%;
  width: 44%;
  bottom: 69%;
  height: 14%;
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  z-index: 4;
}

.candle {
  position: relative;
  width: 2px;
  height: 84%;
  border-radius: 1px;
  background: linear-gradient(
    180deg,
    rgba(240, 217, 168, 0.95),
    rgba(216, 188, 132, 0.25)
  );
}

.candle.c1 { height: 68%; opacity: 0.82; }
.candle.c2 { height: 96%; }

.flame {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 3px);
  width: 12px;
  height: 12px;
  transform: translateX(-50%);
  transform-origin: bottom center;
  background: linear-gradient(180deg, #fff8e8, #f0d9a8 55%, #d8bc84);
  clip-path: polygon(
    50% 0%,
    60% 40%,
    100% 50%,
    60% 60%,
    50% 100%,
    40% 60%,
    0% 50%,
    40% 40%
  );
  filter: drop-shadow(0 0 6px rgba(240, 200, 120, 0.55));
  animation: flicker 2.8s ease-in-out infinite alternate;
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.candle:nth-child(2n) .flame { animation-delay: -0.8s; }
.candle:nth-child(3n) .flame { animation-delay: -1.6s; }

@keyframes flicker {
  0% {
    transform: translateX(-50%) scale(0.9) rotate(-4deg);
    opacity: 0.8;
  }
  50% {
    transform: translateX(-50%) scale(1) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateX(-50%) scale(1.08) rotate(4deg);
    opacity: 0.9;
  }
}

.smoke {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 6px);
  width: 2px;
  height: 9px;
  border-radius: 999px;
  background: linear-gradient(to top, rgba(196, 210, 226, 0.4), transparent);
  filter: blur(1px);
  opacity: 0;
  transform: translateX(-50%);
  pointer-events: none;
}

.cake.is-out .flame {
  opacity: 0;
  transform: translateX(-50%) scale(0.2) translateY(3px);
  animation: none;
}

.cake.is-out .smoke {
  animation: smokeUp 2.6s ease-out forwards;
}

.cake.is-out .candle:nth-child(2n) .smoke { animation-delay: 0.2s; }
.cake.is-out .candle:nth-child(3n) .smoke { animation-delay: 0.4s; }

@keyframes smokeUp {
  0% {
    opacity: 0.45;
    transform: translate(-50%, 0) scaleY(0.6);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -34px) scaleY(1.8);
  }
}

.wish-line {
  min-height: 1.8em;
  font-size: clamp(0.85rem, 2.3vw, 0.93rem);
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  transition: color 0.6s ease;
}

.wish-line.is-done {
  color: var(--gold-bright);
}

.special-note {
  display: flex;
  flex-direction: column;
  max-width: 480px;
  margin-top: clamp(18px, 3vh, 28px);
  font-family: Georgia, "Songti SC", "Noto Serif SC", "STSong", serif;
  font-size: clamp(1.2rem, 3.4vw, 1.55rem);
  line-height: 1.5;
  letter-spacing: 0.005em;
  text-align: center;
}

.note-wish {
  color: var(--gold-bright);
  font-style: italic;
}

.note-you {
  color: var(--ink);
  margin-top: clamp(2px, 0.4vh, 4px);
}

.note-you em {
  font-style: italic;
  color: var(--gold-bright);
}

/* ---------- closing ---------- */

.chapter--closing {
  gap: clamp(24px, 3.6vh, 34px);
  padding-bottom: clamp(120px, 18vh, 200px);
}

/* the little dog signs off — runs in a path around a caption */

.dog-scene {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(16px, 2.8vh, 24px);
  margin-top: clamp(20px, 3.4vh, 32px);
  width: 100%;
  max-width: 360px;
}

.dog-caption {
  font-family: Georgia, "Songti SC", "Noto Serif SC", "STSong", serif;
  font-style: italic;
  font-size: clamp(0.95rem, 2.6vw, 1.15rem);
  line-height: 1.55;
  letter-spacing: 0.01em;
  text-align: center;
  color: var(--ink-soft);
}

.dog-track {
  position: relative;
  width: clamp(120px, 22vw, 180px);
  height: clamp(40px, 8vw, 60px);
  overflow: hidden;
}

.dog-track::before {
  content: "";
  position: absolute;
  inset: 50% 0 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(216, 188, 132, 0.35), transparent);
  top: 50%;
  transform: translateY(-50%);
}

.sign-dog {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gold-bright);
  animation: dogRun 4.8s ease-in-out infinite;
  will-change: left, transform;
}

.dog-art {
  width: clamp(36px, 7vw, 48px);
  height: auto;
  display: block;
  color: var(--gold);
  filter: drop-shadow(0 0 16px rgba(240, 217, 168, 0.2));
  transform-origin: center center;
}

@keyframes dogRun {
  0% {
    left: 0;
    transform: translateY(-50%) scaleX(1);
  }
  8% {
    transform: translateY(calc(-50% - 2px)) scaleX(1);
  }
  16% {
    transform: translateY(-50%) scaleX(1);
  }
  24% {
    transform: translateY(calc(-50% - 3px)) scaleX(1);
  }
  38% {
    transform: translateY(-50%) scaleX(1);
  }
  45% {
    left: calc(100% - clamp(36px, 7vw, 48px));
    transform: translateY(-50%) scaleX(1);
  }
  50% {
    left: calc(100% - clamp(36px, 7vw, 48px));
    transform: translateY(-50%) scaleX(-1);
  }
  58% {
    transform: translateY(calc(-50% - 2px)) scaleX(-1);
  }
  66% {
    transform: translateY(-50%) scaleX(-1);
  }
  74% {
    transform: translateY(calc(-50% - 3px)) scaleX(-1);
  }
  88% {
    transform: translateY(-50%) scaleX(-1);
  }
  95% {
    left: 0;
    transform: translateY(-50%) scaleX(-1);
  }
  100% {
    left: 0;
    transform: translateY(-50%) scaleX(1);
  }
}

/* three ways to say it */

.birthday-forms {
  width: 100%;
  max-width: 560px;
  margin-top: clamp(8px, 2vh, 18px);
  border-top: 1px solid var(--line-soft);
}

.form-row {
  display: flex;
  flex-direction: column;
  padding: clamp(18px, 2.8vh, 26px) 0;
  border-bottom: 1px solid var(--line-soft);
}

.form-script {
  font-family: "Segoe Script", "Bradley Hand", "Snell Roundhand", "Apple Chancery",
    "Lucida Handwriting", "Brush Script MT", cursive;
  font-size: clamp(2.2rem, 6.6vw, 3.6rem);
  line-height: 1.2;
  color: var(--gold-bright);
  letter-spacing: 0;
  transform: rotate(-2deg);
  transform-origin: left center;
  text-shadow: 0 0 30px rgba(240, 217, 168, 0.18);
}

.form-german {
  font-family: Georgia, "Songti SC", "Noto Serif SC", "STSong", serif;
  font-style: italic;
  font-size: clamp(1.18rem, 3.4vw, 1.6rem);
  line-height: 1.5;
  letter-spacing: 0.015em;
  color: var(--ink);
}

.braille {
  --dot: 4px;
  --dot-gap: 4px;
  --cell-gap: 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px var(--cell-gap);
  min-height: 34px;
  padding: 4px 0;
  color: var(--gold-bright);
}

.braille-cell {
  display: grid;
  grid-template-columns: repeat(2, var(--dot));
  grid-auto-rows: var(--dot);
  gap: var(--dot-gap);
}

.braille-cell i {
  width: var(--dot);
  height: var(--dot);
  border-radius: 50%;
  background: transparent;
}

.braille-cell i.on {
  background: currentColor;
  box-shadow: 0 0 6px rgba(240, 217, 168, 0.55);
}

.braille-gap {
  width: 9px;
}

/* ---------- footer ---------- */

.footer {
  position: relative;
  z-index: 1;
  width: min(820px, calc(100% - 48px));
  margin: 0 auto;
  padding: 34px 0 54px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 0.6rem;
  letter-spacing: 0.26em;
  text-indent: 0.26em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.footer .dot {
  color: rgba(216, 188, 132, 0.6);
}

/* ---------- reveal ---------- */

html.js-ready .reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
}

html.js-ready .reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
  /* restore animation on the dog after reveal */
}

html.js-ready .reveal .dog-art {
  opacity: 1;
  transform: none;
}

/* ---------- canvas ---------- */

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

/* ---------- music ---------- */

.music {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px 8px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(8, 20, 36, 0.68);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 14px 30px -18px rgba(0, 0, 0, 0.9);
  transition: transform 0.25s var(--ease), background 0.25s, color 0.25s,
    border-color 0.25s;
  -webkit-tap-highlight-color: transparent;
}

.music:hover {
  transform: translateY(-2px);
  background: rgba(14, 32, 54, 0.85);
  border-color: rgba(216, 188, 132, 0.5);
}

.music:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 4px;
}

.music-icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(216, 188, 132, 0.12);
  border: 1px solid rgba(216, 188, 132, 0.35);
  color: var(--gold-bright);
  font-size: 0.9rem;
  letter-spacing: 0;
  text-indent: 0;
  transition: transform 0.3s var(--ease);
}

.music[aria-pressed="true"] {
  color: var(--gold-bright);
  border-color: rgba(216, 188, 132, 0.5);
}

.music[aria-pressed="true"] .music-icon {
  animation: notePulse 2.4s ease-in-out infinite;
}

@keyframes notePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

/* ---------- responsive ---------- */

@media (max-width: 640px) {
  .hero {
    padding: 92px 20px 104px;
    gap: 16px;
  }

  .hero-eyebrow::before,
  .hero-eyebrow::after {
    width: 24px;
  }

  .hero-name-wrap {
    gap: 10px;
  }

  .hero-cat {
    width: clamp(50px, 14vw, 66px);
    margin-bottom: 6px;
  }

  .chapter {
    width: calc(100% - 40px);
    gap: 20px;
  }

  .chapter-head {
    letter-spacing: 0.28em;
    text-indent: 0.28em;
  }

  .chapter-head .dash {
    width: 26px;
  }

  .chapter-title {
    font-size: clamp(2.1rem, 9.4vw, 2.8rem);
  }

  .orbit {
    margin: 4px 0;
  }

  .animal-row {
    gap: 16px;
  }

  .braille {
    --dot: 3px;
    --dot-gap: 3px;
    --cell-gap: 6px;
    gap: 8px var(--cell-gap);
  }

  .braille-gap {
    width: 6px;
  }

  .form-script {
    font-size: clamp(1.9rem, 9.2vw, 2.7rem);
  }

  .cake {
    --cake-w: min(70vw, 264px);
  }

  .music {
    right: 14px;
    bottom: 14px;
    padding: 7px 14px 7px 9px;
  }
}

@media (max-width: 380px) {
  .music {
    width: 44px;
    height: 44px;
    padding: 0;
    justify-content: center;
  }

  .music-text {
    display: none;
  }
}

/* short viewports */
@media (max-height: 640px) and (min-width: 641px) {
  .hero {
    padding-top: 86px;
    padding-bottom: 90px;
    gap: 14px;
  }

  .scroll-cue {
    bottom: 26px;
  }

  .chapter {
    padding-top: 70px;
    padding-bottom: 70px;
    gap: 18px;
  }

  .cake {
    --cake-w: min(44vw, 210px);
  }

  .stage {
    padding-top: 44px;
  }
}

/* landscape phones */
@media (max-height: 520px) {
  .hero {
    min-height: 100svh;
    padding: 64px 20px 60px;
  }

  .hero-name {
    font-size: clamp(2.6rem, 9vw, 4rem);
  }

  .scroll-cue {
    display: none;
  }

  .chapter {
    min-height: auto;
    padding: 56px 0;
  }

  .chapter--wish {
    padding-bottom: 64px;
  }

  .stage {
    padding-top: 36px;
  }

  .cake {
    --cake-w: min(30vw, 190px);
  }
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .blob,
  .flame,
  .cake-spark,
  .sign-dog,
  .scroll-cue i::after,
  .hero-cat,
  .music-icon {
    animation: none !important;
  }

  .hero-eyebrow,
  .hero-name-wrap,
  .hero-sub,
  .hero-meta,
  .scroll-cue {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
  }

  html.js-ready .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .orbit-path {
    transition: none;
    stroke-dashoffset: 0;
  }

  .orbit-star {
    transition: none;
    opacity: 1;
    animation: none !important;
  }
}
