:root {
  --sat: 0;            /* 0 = grey world, 1 = full colour; driven by app.js */
  --ink: #f3ede6;
  --muted: #a7a19a;
  --bg: #121212;
  --card: #1c1c1c;
  --line: rgba(255, 255, 255, .09);
  --shade: #bbbbbb;

  --silly: #ff8a3d;
  --sleepy: #a99bff;
  --graceful: #e0245e;
  --adventurous: #19b5a5;
  --bookish: #4fa66b;
  --proud: #e8b931;
  --glowing: #ff6fa8;

  --serif: "Cormorant Garamond", Georgia, serif;
  --hand: "Kalam", "Segoe Print", cursive;
  --deva: "Rozha One", "Kohinoor Devanagari", serif;
  --ease: cubic-bezier(.22, 1, .36, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font-family: var(--serif);
  font-size: 20px;
  line-height: 1.55;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
body.locked { overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
img, video { display: block; max-width: 100%; }

/* Colour slowly bleeds into the whole page as --sat rises */
body::before {
  content: "";
  position: fixed; inset: -20%;
  z-index: -1;
  pointer-events: none;
  opacity: var(--sat);
  background:
    radial-gradient(40% 35% at 15% 20%, rgba(255, 111, 168, .16), transparent 70%),
    radial-gradient(35% 30% at 85% 30%, rgba(25, 181, 165, .13), transparent 70%),
    radial-gradient(40% 35% at 70% 85%, rgba(232, 185, 49, .12), transparent 70%),
    radial-gradient(35% 30% at 20% 80%, rgba(169, 155, 255, .14), transparent 70%);
  transition: opacity .6s linear;
}

.hand { font-family: var(--hand); font-weight: 300; color: var(--muted); font-size: 1.05em; }

/* ---------- Gate ---------- */
.gate {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center;
  padding: 24px 16px;
  background: radial-gradient(80% 60% at 50% 40%, #1e1e1e, #0d0d0d);
  text-align: center;
  transition: opacity 1.4s var(--ease), visibility 1.4s;
}
.gate.gone { opacity: 0; visibility: hidden; }
.gate-kicker { font-family: var(--hand); color: var(--muted); letter-spacing: .04em; margin: 0; }
.gate-name {
  font-family: var(--deva); font-weight: 400;
  font-size: clamp(84px, 26vw, 200px);
  line-height: 1.25; margin: .05em 0 .1em;
  color: #6d6a67;
  background: linear-gradient(100deg, #5a5856 30%, #a8a39e 50%, #5a5856 70%);
  background-size: 250% 100%;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 5s linear infinite;
}
@keyframes shimmer { from { background-position: 125% 0; } to { background-position: -125% 0; } }
.gate-line { font-style: italic; font-size: 1.2em; margin: 0 0 18px; color: #cfc9c2; }
.gate-hint { font-size: .85em; color: var(--muted); margin-top: 22px; }
.cd-grid { display: grid; grid-template-columns: repeat(4, minmax(64px, 96px)); gap: 10px; justify-content: center; }
.cd-grid div {
  border: 1px solid var(--line); border-radius: 18px;
  padding: 14px 4px 10px; background: rgba(255, 255, 255, .03);
}
.cd-grid span { display: block; font-family: var(--hand); font-weight: 700; font-size: clamp(30px, 9vw, 46px); line-height: 1.1; font-variant-numeric: tabular-nums; }
.cd-grid small { color: var(--muted); font-size: 13px; }
.open-btn {
  position: relative;
  display: inline-flex; align-items: center; gap: 12px;
  padding: 18px 30px; border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .25);
  background: rgba(255, 255, 255, .06);
  font-size: 1.15em;
  transition: transform .3s var(--ease), background .3s;
}
.open-btn:active { transform: scale(.96); }
.open-btn::after {
  content: ""; position: absolute; inset: -6px; border-radius: inherit;
  border: 2px solid transparent;
  background: conic-gradient(from var(--a, 0deg), var(--silly), var(--glowing), var(--sleepy), var(--adventurous), var(--proud), var(--silly)) border-box;
  -webkit-mask: linear-gradient(#000 0 0) padding-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  animation: spin 4s linear infinite;
}
@property --a { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@keyframes spin { to { --a: 360deg; } }
.open-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--glowing); box-shadow: 0 0 14px var(--glowing); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.6); opacity: .6; } }

/* ---------- Reveal ---------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 1s var(--ease), transform 1s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Hero ---------- */
.hero {
  min-height: 100svh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 80px 16px 60px;
  position: relative;
}
.hero-ne { font-family: var(--deva); color: var(--muted); margin: 0; font-size: 1.1em; }
.hero-name { font-family: var(--deva); font-weight: 400; margin: 0; font-size: clamp(96px, 30vw, 260px); line-height: 1.3; }
#name-ink {
  background: linear-gradient(90deg, var(--silly), var(--glowing), var(--graceful), var(--sleepy), var(--adventurous), var(--bookish), var(--proud)) 0 0 / 0% 100% no-repeat, #6d6a67;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  transition: background-size 3.2s var(--ease);
}
#name-ink.inked { background-size: 100% 100%, auto; }
.hero-sub { font-size: clamp(26px, 6vw, 40px); margin: 0; }
.hero-sub em { font-family: var(--hand); font-style: normal; color: var(--glowing); }
.hero-count { color: var(--muted); font-style: italic; margin-top: 18px; }
.scroll-hint { position: absolute; bottom: 96px; width: 24px; height: 40px; border: 1.5px solid var(--muted); border-radius: 14px; }
.scroll-hint span { position: absolute; left: 50%; top: 8px; width: 4px; height: 8px; margin-left: -2px; border-radius: 2px; background: var(--ink); animation: drop 1.8s ease-in-out infinite; }
@keyframes drop { 60% { transform: translateY(12px); opacity: 0; } 100% { opacity: 0; } }

/* ---------- Prose ---------- */
.prose { max-width: 640px; margin: 0 auto; padding: 18vh 20px; text-align: center; }
.prose .big { font-size: clamp(30px, 7vw, 46px); line-height: 1.2; margin: 0 0 .3em; }
.prose p { margin: 0 0 1.2em; }

/* ---------- Chapters ---------- */
.chapter { max-width: 1120px; margin: 0 auto; padding: 12vh 16px; }
.ch-head { text-align: center; margin-bottom: 44px; }
.ch-num { font-family: var(--hand); color: var(--muted); letter-spacing: .2em; font-size: .9em; }
.ch-head h2 { font-weight: 500; font-style: italic; font-size: clamp(40px, 10vw, 76px); line-height: 1.05; margin: .1em 0 .2em; }
.ch-head .hand { max-width: 520px; margin: 0 auto; }
.tip { text-align: center; font-family: var(--hand); color: var(--muted); font-size: .85em; margin-top: 18px; }

/* media that follows the grey-to-colour scroll */
.g img, .g video { filter: grayscale(calc(1 - var(--sat))); transition: filter .5s linear; }

/* ---------- Childhood prints ---------- */
.prints { display: flex; flex-wrap: wrap; justify-content: center; gap: 18px 14px; }
.print {
  width: min(46%, 250px);
  background: #f1ebe0; padding: 8px 8px 30px; border: 0; margin: 0; cursor: pointer;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .45);
  rotate: var(--r, 0deg);
  transition: rotate .5s var(--ease), opacity 1s var(--ease), transform 1s var(--ease);
}
.print:hover { rotate: 0deg; }
.print img { aspect-ratio: 4 / 5; object-fit: cover; width: 100%; filter: sepia(1) grayscale(.5) contrast(.85) brightness(.9); transition: filter 2.4s ease; }
.print.dev img { filter: none; }
.print figcaption { font-family: var(--hand); color: #4d4740; font-size: 15px; margin-top: 8px; text-align: center; }

/* ---------- Shades ---------- */
.chips {
  display: flex; gap: 10px; overflow-x: auto; padding: 6px 2px 14px;
  scroll-snap-type: x mandatory; scrollbar-width: none;
  justify-content: safe center;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; scroll-snap-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 10px 6px; min-width: 84px;
  background: none; border: 0;
}
.chip .swatch {
  width: 58px; height: 58px; border-radius: 50%;
  background: var(--c);
  filter: grayscale(1) brightness(.75);
  box-shadow: 0 0 0 2px var(--line);
  transition: filter .9s var(--ease), transform .5s var(--ease), box-shadow .5s;
}
.chip.found .swatch { filter: none; }
.chip[aria-selected="true"] .swatch { transform: scale(1.15); box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--c), 0 0 30px var(--c); }
.chip .label { font-size: 15px; color: var(--muted); }
.chip[aria-selected="true"] .label { color: var(--ink); }
.found { text-align: center; color: var(--muted); font-family: var(--hand); font-size: .9em; margin: 4px 0 28px; }
.found.all { color: var(--proud); }

.shade-panel {
  border-radius: 28px;
  padding: 28px 16px;
  min-height: 220px;
  background: radial-gradient(120% 80% at 50% 0%, color-mix(in srgb, var(--shade) 22%, transparent), transparent 70%), var(--card);
  border: 1px solid var(--line);
  transition: background .8s;
}
.shade-empty { text-align: center; color: var(--muted); font-family: var(--hand); margin: 70px 0; }
.shade-title { text-align: center; font-size: clamp(32px, 8vw, 54px); font-style: italic; margin: 0; color: var(--shade); }
.shade-cap { text-align: center; font-family: var(--hand); max-width: 520px; margin: 4px auto 26px; color: var(--ink); }
.shade-panel .masonry figure { animation: bloom .9s var(--ease) both; animation-delay: calc(var(--i) * 70ms); }
@keyframes bloom { from { opacity: 0; transform: translateY(18px) scale(.96); filter: grayscale(1); } to { opacity: 1; transform: none; filter: none; } }

/* ---------- Masonry ---------- */
.masonry { columns: 2; column-gap: 12px; }
@media (min-width: 760px) { .masonry { columns: 3; column-gap: 16px; } }
.masonry figure { break-inside: avoid; margin: 0 0 12px; position: relative; }
.tile { display: block; width: 100%; padding: 0; border: 0; background: #222; border-radius: 16px; overflow: hidden; position: relative; }
.tile img, .tile video { width: 100%; height: auto; transition: transform .8s var(--ease); }
.tile:hover img, .tile:hover video { transform: scale(1.04); }
.tile .badge { position: absolute; right: 10px; bottom: 10px; background: rgba(0, 0, 0, .55); border-radius: 999px; padding: 2px 10px; font-size: 13px; color: #fff; }

/* ---------- Birthdays ---------- */
.cakes { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; }
.cakes .tile { width: min(30%, 260px); border-radius: 14px; rotate: var(--r); box-shadow: 0 16px 40px rgba(0, 0, 0, .4); }
.wish { text-align: center; margin-top: 90px; }
.wish-title { font-size: clamp(28px, 7vw, 42px); font-style: italic; margin: 0; }
.cake { position: relative; width: 190px; height: 230px; margin: 30px auto 0; background: none; border: 0; display: block; }
.tier { position: absolute; left: 50%; transform: translateX(-50%); border-radius: 12px 12px 6px 6px; }
.t1 { bottom: 0; width: 190px; height: 70px; background: linear-gradient(#f6c6d8, #e98fb2); }
.t2 { bottom: 66px; width: 140px; height: 56px; background: linear-gradient(#fff4e6, #f6d9b4); }
.t1::before, .t2::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 14px; border-radius: 12px 12px 30px 30px; background: #fff; opacity: .85; }
.candle { position: absolute; left: 50%; bottom: 120px; width: 14px; height: 56px; margin-left: -7px; border-radius: 4px; background: repeating-linear-gradient(135deg, #fff 0 6px, var(--glowing) 6px 12px); }
.flame { position: absolute; left: 50%; bottom: 174px; width: 22px; height: 36px; margin-left: -11px; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; background: radial-gradient(circle at 50% 70%, #fff7c2, #ffb238 55%, #ff6a00 80%, transparent 82%); box-shadow: 0 0 40px 12px rgba(255, 170, 60, .45); animation: flicker .14s infinite alternate; transform-origin: 50% 90%; transition: opacity .3s, transform .3s; }
@keyframes flicker { to { transform: scale(.94, 1.05) rotate(-2deg); } }
.cake.out .flame { opacity: 0; transform: scale(.2) translateY(-20px); animation: none; }
.cake.out .candle::after { content: ""; position: absolute; left: 2px; top: -40px; width: 10px; height: 34px; border-radius: 50%; background: rgba(220, 220, 220, .35); filter: blur(4px); animation: smoke 2s ease-out forwards; }
@keyframes smoke { to { transform: translateY(-40px) scaleX(2); opacity: 0; } }
.wish-done { font-family: var(--hand); font-size: 1.5em; color: var(--glowing); margin-top: 20px; }

/* ---------- Finale ---------- */
.finale { position: relative; min-height: 100svh; display: grid; place-items: center; text-align: center; padding: 14vh 20px 22vh; overflow: hidden; touch-action: pan-y; }
#petals { position: absolute; inset: 0; width: 100%; height: 100%; }
.finale-inner { position: relative; max-width: 640px; pointer-events: none; }
.finale-inner button { pointer-events: auto; }
.finale-line {
  font-weight: 500; font-style: italic;
  font-size: clamp(46px, 12vw, 92px); line-height: 1.05; margin: 40px 0 20px;
  background: linear-gradient(90deg, var(--silly), var(--glowing), var(--graceful), var(--sleepy), var(--adventurous), var(--proud));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.sign { font-family: var(--deva); font-size: 1.4em; margin: 0; }
.replay { margin-top: 36px; background: none; border: 1px solid var(--line); border-radius: 999px; padding: 10px 22px; color: var(--muted); }

/* ---------- Player ---------- */
.player {
  position: fixed; z-index: 55; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px 6px 6px; border-radius: 999px;
  background: rgba(24, 24, 24, .78); border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  max-width: calc(100vw - 32px);
}
.disc { width: 40px; height: 40px; border-radius: 50%; border: 0; padding: 0; background: conic-gradient(var(--silly), var(--glowing), var(--sleepy), var(--adventurous), var(--proud), var(--silly)); position: relative; animation: rot 5s linear infinite; }
.disc span { position: absolute; inset: 14px; border-radius: 50%; background: #181818; }
.player.paused .disc { animation-play-state: paused; filter: grayscale(1); }
@keyframes rot { to { transform: rotate(360deg); } }
.track { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.track small { font-size: 11px; color: var(--muted); }
.track span { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 130px; }
.next { background: none; border: 0; font-size: 16px; padding: 6px 8px; color: var(--muted); }

/* ---------- Lightbox ---------- */
.lightbox { position: fixed; inset: 0; z-index: 60; background: rgba(8, 8, 8, .94); display: grid; place-items: center; }
.lightbox[hidden] { display: none; }
.lb-stage { width: 100%; height: 100%; display: grid; place-items: center; padding: 56px 12px; }
.lb-stage img, .lb-stage video { max-width: 100%; max-height: calc(100svh - 112px); border-radius: 12px; object-fit: contain; animation: lbin .4s var(--ease); }
@keyframes lbin { from { opacity: 0; transform: scale(.97); } }
.lb-close { position: absolute; top: calc(12px + env(safe-area-inset-top)); right: 12px; z-index: 2; background: rgba(255, 255, 255, .1); border: 0; width: 44px; height: 44px; border-radius: 50%; font-size: 18px; }
.lb-nav { position: absolute; top: 50%; z-index: 2; transform: translateY(-50%); background: rgba(255, 255, 255, .08); border: 0; width: 44px; height: 64px; border-radius: 12px; font-size: 34px; line-height: 1; }
.lb-prev { left: 8px; }
.lb-next { right: 8px; }
.lb-count { position: absolute; bottom: calc(10px + env(safe-area-inset-bottom)); margin: 0; color: var(--muted); font-size: 14px; }

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

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}

/* "Happy प्राप्ति's Day" */
.day-title { display: flex; flex-direction: column; align-items: center; margin: 0; font-weight: 400; line-height: 1; }
.day-en { font-family: var(--serif); font-style: italic; font-weight: 500; font-size: clamp(34px, 9vw, 64px); color: #cfc9c2; letter-spacing: .02em; }
.day-name { display: inline-flex; align-items: baseline; }
.day-s { font-family: var(--serif); font-style: italic; font-size: clamp(40px, 11vw, 84px); color: #8a8580; margin-left: .04em; }
.day-title .gate-name { font-size: clamp(84px, 25vw, 190px); margin: 0; }
.day-title .hero-name { display: inline-block; font-size: clamp(90px, 27vw, 230px); line-height: 1.3; margin: 0; }
.hero-title .day-s { color: var(--proud); }
.hero-title .day-en { color: var(--ink); }
.hero-sub { margin-top: 22px; }
.hero-ne { margin-top: 10px; }
.gate .day-title { margin: 14px 0 26px; }
.gate .day-title .gate-name { line-height: 1.15; }
.gate .day-s { color: #b9b3ac; }
.gate .day-en { margin: 2px 0; }
.day-title .hero-name { line-height: 1.12; }
#petals { z-index: 0; opacity: .8; } .finale-inner { z-index: 1; }

/* Her favourites: 🌻 🐒 🥑 🍉 🐘 */
.faves { display: flex; justify-content: center; gap: 14px; margin-top: 18px; font-size: 26px; filter: grayscale(1); opacity: .55; }
.faves span { animation: bob 2.4s ease-in-out infinite; }
.faves span:nth-child(2) { animation-delay: .2s; } .faves span:nth-child(3) { animation-delay: .4s; }
.faves span:nth-child(4) { animation-delay: .6s; } .faves span:nth-child(5) { animation-delay: .8s; }
@keyframes bob { 50% { transform: translateY(-7px) rotate(-6deg); } }
.drift { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; filter: grayscale(calc(1 - var(--sat))); opacity: calc(.18 + var(--sat) * .22); }
.drift span { position: absolute; top: 100%; font-size: var(--size); animation: rise var(--dur) linear var(--delay) infinite; }
@keyframes rise { to { transform: translate(var(--sway), calc(-100vh - 80px)) rotate(25deg); } }
main { position: relative; z-index: 1; }

.music-btn { margin-top: 22px; padding: 10px 20px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .2); background: rgba(255, 255, 255, .05); font-size: .9em; color: #cfc9c2; }
.music-btn[hidden] { display: none; }
