/* Lamp-lit bedroom at night: deep plum walls, warm bulbs, pastel paper. */
:root {
  --night: #1f1731;
  --night-2: #2b2145;
  --night-3: #3a2d5c;
  --ink: #fff4e8;
  --ink-dim: rgba(255, 244, 232, 0.64);
  --ink-faint: rgba(255, 244, 232, 0.36);
  --lamp: #ffc98b;
  --lamp-deep: #f4a261;
  --paper: #fff8ee;
  --paper-ink: #3a2e4f;
  --paper-line: rgba(122, 104, 160, 0.18);
  --pink: #ffa3c8;

  --f-display: 'Young Serif', Georgia, serif;
  --f-body: 'Hanken Grotesk', system-ui, sans-serif;
  --f-hand: 'Nanum Pen Script', 'Segoe Print', cursive;
  --f-mono: 'DM Mono', ui-monospace, monospace;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--night); }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(1100px 700px at 85% -10%, rgba(255, 201, 139, 0.22), transparent 60%),
    radial-gradient(900px 600px at -10% 110%, rgba(205, 176, 247, 0.16), transparent 60%),
    linear-gradient(180deg, var(--night-2), var(--night) 900px);
  background-repeat: no-repeat;
  color: var(--ink);
  font: 400 17px/1.55 var(--f-body);
  overflow-x: hidden;
}
/* paper-grain over everything, very faint */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.09;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: 50;
}

a { color: var(--lamp); }
:focus-visible { outline: 2px solid var(--lamp); outline-offset: 3px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- ambient: fairy lights + drifting bokeh ---------- */
.lights { position: absolute; top: 0; left: 0; width: 100%; height: 130px; pointer-events: none; z-index: 2; }
.lights-wire { fill: none; stroke: #4a3d63; stroke-width: 2; }
.bulb-glow { opacity: 0.35; filter: blur(7px); animation: twinkle 4s ease-in-out infinite; }
@keyframes twinkle { 0%, 100% { opacity: 0.22; } 50% { opacity: 0.75; } }
.lights { transform-origin: 50% 0; animation: sway 9s ease-in-out infinite; }
@keyframes sway { 0%, 100% { transform: rotate(0.25deg); } 50% { transform: rotate(-0.25deg); } }

.bokeh { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.bokeh span {
  position: absolute;
  border-radius: 50%;
  filter: blur(18px);
  opacity: 0.18;
  animation: drift 26s ease-in-out infinite alternate;
}
.bokeh span:nth-child(1) { width: 220px; height: 220px; left: 70%; top: 12%; background: var(--lamp); }
.bokeh span:nth-child(2) { width: 140px; height: 140px; left: 8%; top: 55%; background: #cdb0f7; animation-duration: 32s; }
.bokeh span:nth-child(3) { width: 90px; height: 90px; left: 48%; top: 78%; background: var(--pink); animation-duration: 22s; }
.bokeh span:nth-child(4) { width: 60px; height: 60px; left: 22%; top: 18%; background: #a9b8ff; animation-duration: 28s; }
@keyframes drift { to { transform: translate(40px, -60px) scale(1.15); } }

/* ---------- the jar ---------- */
.jar { position: relative; aspect-ratio: 400 / 520; width: 100%; transform-origin: 50% 96%; }
.jar > * { position: absolute; left: 0; width: 100%; }
.jar-back { top: 0; height: 100%; }
.jar-stars { top: 0; height: 100%; }
.jar-front { top: calc(-60 / 520 * 100%); height: calc(580 / 520 * 100%); pointer-events: none; overflow: visible; }
.jar-tag-text { font: 400 24px var(--f-hand); fill: var(--paper-ink); }
.jar-tag-sub { font: 400 10px var(--f-mono); fill: #8a7aa6; letter-spacing: 0.04em; }
.jar-lid { display: none; transform-box: fill-box; transform-origin: 50% 100%; }
.jar--lidded .jar-lid { display: inline; }
.jar--lidded .jar-twine { display: none; }
.jar--unlidding .jar-lid { display: inline; animation: lid-off 1.1s var(--ease-out) forwards; }
@keyframes lid-off {
  30% { transform: translateY(-14px) rotate(-4deg); }
  100% { transform: translate(140px, -260px) rotate(38deg); opacity: 0; }
}
.jar--wobble { animation: wobble 0.7s var(--ease-out); }
@keyframes wobble {
  20% { transform: rotate(-2.4deg); }
  45% { transform: rotate(1.8deg); }
  70% { transform: rotate(-0.8deg); }
}

/* ---------- countdown ---------- */
.countdown { display: flex; gap: clamp(10px, 2.4vw, 22px); align-items: flex-start; }
.cd-unit { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.cd-digits {
  display: flex;
  gap: 3px;
  font: 400 clamp(44px, 7.4vw, 84px) / 1 var(--f-display);
  color: var(--ink);
  filter: drop-shadow(0 0 22px rgba(255, 201, 139, 0.3));
}
.cd-digit {
  position: relative;
  display: inline-block;
  width: 0.68em;
  height: 1.08em;
  overflow: hidden;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.cd-digit i { position: absolute; inset: 0; font-style: normal; line-height: 1.08; }
.cd-digit i.in { animation: digit-in 0.55s var(--ease-out) both; }
.cd-digit i.out { animation: digit-out 0.55s var(--ease-out) both; }
@keyframes digit-in { from { transform: translateY(70%); opacity: 0; filter: blur(3px); } }
@keyframes digit-out { to { transform: translateY(-70%); opacity: 0; filter: blur(3px); } }
.cd-label { font: 400 11px var(--f-mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-faint); }

/* ---------- shared type ---------- */
.eyebrow { font: 400 12px var(--f-mono); letter-spacing: 0.16em; text-transform: uppercase; color: var(--lamp); margin: 0 0 18px; }
.eyebrow span { color: var(--ink-faint); }
h1 {
  font: 400 clamp(46px, 7vw, 92px) / 0.98 var(--f-display);
  letter-spacing: -0.02em;
  margin: 0 0 18px;
  text-wrap: balance;
}
h1 em { font-style: normal; color: var(--lamp); }
.lede { color: var(--ink-dim); max-width: 34ch; margin: 0 0 34px; font-size: 18px; text-wrap: pretty; }

.btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  font: 600 16px var(--f-body);
  padding: 14px 24px;
  border-radius: 999px;
  background: var(--lamp);
  color: #3a2410;
  box-shadow: 0 8px 30px -8px rgba(255, 201, 139, 0.7), inset 0 -2px 0 rgba(0, 0, 0, 0.12);
  transition: transform 0.25s var(--ease-spring), box-shadow 0.25s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 14px 36px -8px rgba(255, 201, 139, 0.85), inset 0 -2px 0 rgba(0, 0, 0, 0.12); }
.btn:active { transform: translateY(1px) scale(0.98); }
.btn:disabled { opacity: 0.6; cursor: progress; transform: none; }
.btn--ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink-faint); }
.btn--ghost:hover { box-shadow: inset 0 0 0 1.5px var(--ink-dim); }

.flying-star { position: fixed; left: 0; top: 0; pointer-events: none; z-index: 40; will-change: transform; }

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