@font-face { font-family: 'Fraunces'; src: url('/fonts/fraunces-latin-wght-normal.woff2') format('woff2'); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: 'Fraunces'; src: url('/fonts/fraunces-latin-wght-italic.woff2') format('woff2'); font-weight: 100 900; font-style: italic; font-display: swap; }
@font-face { font-family: 'Outfit'; src: url('/fonts/outfit-latin-wght-normal.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }

:root {
  color-scheme: dark;
  --bg: #0a1126;
  --bg2: #0f1833;
  --surface: rgba(255, 255, 255, 0.045);
  --surface2: rgba(255, 255, 255, 0.075);
  --line: rgba(255, 255, 255, 0.12);
  --text: #f8f2e7;
  --text2: rgba(248, 242, 231, 0.76);
  --text3: rgba(248, 242, 231, 0.56);
  --gold: #f2c46d;
  --gold-h: #f7d48f;
  --on-gold: #1d1505;
  --ok: #8be3b0;
  --err: #ff9b8f;
  --serif: 'Fraunces', Georgia, serif;
  --sans: 'Outfit', ui-sans-serif, system-ui, sans-serif;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  background-image:
    radial-gradient(1px 1px at 12% 18%, rgba(255,245,220,.7), transparent 60%),
    radial-gradient(1px 1px at 72% 9%, rgba(255,245,220,.55), transparent 60%),
    radial-gradient(1.5px 1.5px at 88% 32%, rgba(255,245,220,.5), transparent 60%),
    radial-gradient(1px 1px at 34% 41%, rgba(255,245,220,.4), transparent 60%),
    radial-gradient(1px 1px at 55% 22%, rgba(255,245,220,.6), transparent 60%),
    radial-gradient(1px 1px at 22% 63%, rgba(255,245,220,.35), transparent 60%),
    radial-gradient(1.5px 1.5px at 81% 71%, rgba(255,245,220,.35), transparent 60%),
    radial-gradient(120% 60% at 50% -10%, #1b2a5c 0%, rgba(10,17,38,0) 60%);
  background-attachment: fixed;
  color: var(--text);
  font: 400 1rem/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body.sheet-open { overflow: hidden; }
a { color: var(--gold); }
img, canvas, svg { display: block; max-width: 100%; }
button, input, select { font: inherit; color: inherit; }
::selection { background: rgba(242, 196, 109, 0.35); }

.wrap { width: 100%; max-width: 560px; margin: 0 auto; padding: 0 16px; }

/* Header */
.top {
  position: sticky; top: 0; z-index: 20;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: rgba(10, 17, 38, 0.72);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  box-shadow: inset 0 -1px 0 rgba(255,255,255,.06);
}
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; font: 600 1.125rem/1 var(--serif); letter-spacing: -0.01em; }
.brand svg { color: var(--gold); }

/* Type */
h1, h2, h3 { font-family: var(--serif); font-weight: 600; margin: 0; text-wrap: balance; }
h1 { font-size: 2.35rem; line-height: 1.05; letter-spacing: -0.03em; }
h2 { font-size: 1.5rem; line-height: 1.15; letter-spacing: -0.02em; }
h3 { font-size: 1.125rem; line-height: 1.3; letter-spacing: -0.01em; }
.eyebrow { font: 600 0.7rem/1.2 var(--sans); letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold); margin: 0 0 10px; }
.lede { font-size: 1.0625rem; color: var(--text2); margin: 14px 0 0; }
.muted { color: var(--text2); }
.footnote { font-size: 0.8125rem; letter-spacing: 0.01em; color: var(--text3); }
.center { text-align: center; }
p { margin: 0; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 1.35rem; border-radius: 10px;
  border: 1.5px solid transparent; font: 600 1rem/1 var(--sans);
  text-decoration: none; cursor: pointer; user-select: none; -webkit-user-select: none;
  touch-action: manipulation; transition: transform 100ms ease-out, background-color 160ms ease, opacity 160ms ease;
}
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--gold); color: var(--on-gold); }
.btn.primary:hover { background: var(--gold-h); }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn.ghost:hover { background: var(--surface); }
.btn.small { min-height: 40px; padding: 0 0.9rem; font-size: 0.9375rem; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: 0.5; cursor: default; transform: none; }
.btn .arrow { transition: transform 160ms var(--ease); }
.btn:hover .arrow { transform: translateX(3px); }
.link { background: none; border: 0; padding: 0; color: var(--gold); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font: inherit; min-height: 44px; }
:focus-visible { outline: 2px solid rgba(255,255,255,.7); outline-offset: 2px; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px; }
.stack > * + * { margin-top: 16px; }

/* Fields */
.field { display: block; position: relative; }
.field > span { display: block; font: 600 0.7rem/1.2 var(--sans); letter-spacing: 0.14em; text-transform: uppercase; color: var(--text3); margin-bottom: 8px; }
.field input, .field select {
  width: 100%; min-height: 48px; padding: 0 14px; border-radius: 10px;
  background: rgba(255,255,255,.06); border: 1px solid var(--line);
  font-size: 16px; outline: none; transition: border-color 160ms ease, box-shadow 160ms ease;
  -webkit-appearance: none; appearance: none;
}
.field select { background-image: linear-gradient(45deg, transparent 50%, var(--text3) 50%), linear-gradient(135deg, var(--text3) 50%, transparent 50%); background-position: calc(100% - 20px) 21px, calc(100% - 15px) 21px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
.field select option { background: #141e3d; color: var(--text); }
.field input:focus, .field select:focus { border-color: rgba(255,255,255,.55); box-shadow: 0 0 0 3px rgba(255,255,255,.1); }
.field input::placeholder { color: var(--text3); }
.field.invalid input { border-color: var(--err); }
.field-error { color: var(--err); font-size: 0.8125rem; margin-top: 6px; min-height: 0; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; color: var(--text2); font-size: 0.9375rem; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--gold); margin: 0; }

.suggest {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 30;
  list-style: none; margin: 0; padding: 6px; max-height: 300px; overflow: auto;
  background: #141e3d; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 18px 40px rgba(0,0,0,.45);
}
.suggest[hidden] { display: none; }
.suggest li { padding: 12px 10px; border-radius: 6px; cursor: pointer; min-height: 44px; display: flex; justify-content: space-between; gap: 10px; }
.suggest li small { color: var(--text3); }
.suggest li[aria-selected="true"], .suggest li:hover { background: rgba(255,255,255,.08); }

/* Globe */
.globe-wrap { position: relative; width: min(100%, 460px); margin: 0 auto; aspect-ratio: 1; }
.globe-wrap canvas { width: 100%; height: 100%; cursor: grab; }
.globe-wrap canvas:active { cursor: grabbing; }
.globe-badge {
  position: absolute; left: 50%; bottom: 6%; transform: translateX(-50%);
  padding: 8px 12px; border-radius: 10px; white-space: nowrap;
  background: rgba(10,17,38,.72); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  font: 500 0.875rem/1.2 var(--sans); color: var(--text); font-variant-numeric: tabular-nums;
}
.globe-badge:empty { display: none; }

/* Landing */
.hero { text-align: center; padding: 8px 0 8px; }
.hero h1 { margin-top: 4px; }
.hero .btn { margin-top: 22px; }
.count { margin-top: 14px; color: var(--text2); font-size: 0.9375rem; font-variant-numeric: tabular-nums; }
.count b { color: var(--gold); font-weight: 600; }
.ticker { margin-top: 6px; color: var(--text3); font-size: 0.8125rem; min-height: 1.3em; transition: opacity 300ms ease; }
section { margin-top: 40px; }
.form-card h2 { margin-bottom: 4px; }
.kid-row { padding-top: 16px; }
.kid-row + .kid-row { border-top: 1px solid var(--line); margin-top: 16px; }
.kid-row .row-head { display: flex; justify-content: space-between; align-items: center; min-height: 32px; }
.kid-row .row-head h3 { font-size: 1rem; font-family: var(--sans); font-weight: 600; color: var(--text2); }
.kid-row .grid { display: grid; gap: 14px; }
.add-kid { margin-top: 16px; }
.gift-from[hidden] { display: none; }
.total { display: flex; justify-content: space-between; align-items: baseline; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.total b { font: 600 1.5rem/1 var(--serif); font-variant-numeric: tabular-nums; }
.cert-preview { margin-top: 20px; }
.cert-preview canvas { width: 100%; max-width: 360px; height: auto; margin: 0 auto; border-radius: 6px; box-shadow: 0 20px 50px rgba(0,0,0,.45); }
.cert-preview p { text-align: center; margin-top: 10px; }
.steps ol { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 12px; }
.steps li { display: grid; grid-template-columns: 40px 1fr; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.steps .num { font: 600 0.875rem/1.6 var(--sans); color: var(--gold); font-variant-numeric: tabular-nums; }
.steps h3 { margin-bottom: 4px; }
.steps p { color: var(--text2); font-size: 0.9375rem; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { list-style: none; cursor: pointer; padding: 16px 0; font-weight: 600; display: flex; justify-content: space-between; gap: 12px; min-height: 44px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; color: var(--text3); font-weight: 400; }
.faq details[open] summary::after { content: '\2212'; }
.faq details p { color: var(--text2); padding-bottom: 16px; font-size: 0.9375rem; }
footer { margin: 56px 0 0; padding: 24px 16px calc(env(safe-area-inset-bottom) + 32px); text-align: center; color: var(--text3); font-size: 0.8125rem; }
footer a { color: var(--text2); }

/* Kid page */
.kid-main { display: flex; flex-direction: column; gap: 20px; padding-bottom: 24px; }
.kid-main > section { margin-top: 0; }
.kid-head { text-align: center; padding-top: 18px; }
.kid-head h1 { font-size: 2.1rem; }
.kid-head .gift { margin-top: 8px; color: var(--text2); }
.meter-card { text-align: center; }
.gauge { position: relative; width: min(100%, 320px); margin: 4px auto 0; }
.gauge svg { width: 100%; height: auto; overflow: visible; }
.gauge .track { stroke: rgba(255,255,255,.1); }
.gauge .value { position: absolute; left: 0; right: 0; bottom: 4px; text-align: center; }
.gauge .value b { display: block; font: 600 3.4rem/1 var(--serif); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.gauge .value span { font-size: 0.875rem; color: var(--text3); }
.plus { position: absolute; left: 50%; top: 30%; transform: translateX(-50%); font: 600 1.5rem/1 var(--serif); color: var(--gold); pointer-events: none; animation: rise 1.1s var(--ease) forwards; }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 10px); } 20% { opacity: 1; } to { opacity: 0; transform: translate(-50%, -46px); } }
.spark { position: absolute; width: 6px; height: 6px; border-radius: 2px; background: var(--gold); pointer-events: none; animation: spark 900ms var(--ease) forwards; }
@keyframes spark { from { opacity: 1; transform: translate(0,0) rotate(0); } to { opacity: 0; transform: translate(var(--dx), var(--dy)) rotate(160deg); } }
.elf-line { margin: 14px auto 18px; max-width: 30ch; font: 400 1.125rem/1.4 var(--serif); color: var(--text); min-height: 2.8em; transition: opacity 200ms ease; }
.deeds { list-style: none; padding: 0; margin: 12px 0 0; }
.deeds li { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); font-size: 0.9375rem; }
.deeds li:first-child { border-top: 0; }
.deeds .pts { color: var(--gold); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.deeds .when { color: var(--text3); font-size: 0.8125rem; }
.empty { color: var(--text3); font-size: 0.9375rem; margin-top: 10px; }
.live h2 { font-size: 1.6rem; margin-top: 2px; }
.live .sub { color: var(--text2); margin-top: 8px; }
.stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.stat { background: rgba(255,255,255,.05); border-radius: 10px; padding: 14px; }
.stat b { display: block; font: 600 1.6rem/1.1 var(--serif); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.stat span { font-size: 0.8125rem; color: var(--text3); }
.log { list-style: none; padding: 0; margin: 18px 0 0; }
.log li { display: grid; grid-template-columns: 76px 1fr; gap: 8px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 0.9375rem; }
.log li time { color: var(--text3); font-variant-numeric: tabular-nums; }
.log li:first-child { color: var(--text); font-weight: 600; }
.cert-card canvas { width: 100%; max-width: 380px; height: auto; margin: 0 auto; border-radius: 6px; box-shadow: 0 20px 50px rgba(0,0,0,.45); }
.cert-card p { text-align: center; margin-top: 14px; color: var(--text2); }
.cert-card .btn { margin: 14px auto 0; display: flex; max-width: 320px; }
.actions { display: grid; gap: 10px; }
.kid-main[data-phase="before"] .live { display: none; }
.kid-main[data-phase="live"] .live, .kid-main[data-phase="delivered"] .live,
.kid-main[data-phase="live"] .globe-wrap { order: -1; }
.kid-main[data-phase="delivered"] .cert-card { order: -1; }
.kid-main .kid-head { order: -2; }
.state-msg { text-align: center; padding: 64px 16px; }
.state-msg h1 { font-size: 1.8rem; margin-bottom: 10px; }

/* Sheet */
.scrim { position: fixed; inset: 0; z-index: 50; background: rgba(3,6,16,.55); opacity: 0; transition: opacity 260ms var(--ease); }
.scrim.in { opacity: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 51;
  max-height: 92dvh; overflow: auto; overscroll-behavior: contain;
  margin: 0 auto; max-width: 560px;
  background: #121b3a; border-radius: 20px 20px 0 0; border: 1px solid var(--line); border-bottom: 0;
  padding: 8px 16px calc(env(safe-area-inset-bottom) + 20px);
  transform: translateY(105%); transition: transform 340ms cubic-bezier(0.32, 0.72, 0, 1);
}
.sheet.in { transform: translateY(0); }
.sheet-grab { width: 40px; height: 5px; border-radius: 3px; background: rgba(255,255,255,.25); margin: 4px auto 6px; touch-action: none; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 0 14px; touch-action: none; }
.sheet h2 { font-size: 1.35rem; }
.sheet form > * + * { margin-top: 16px; }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.choice {
  min-height: 48px; padding: 10px 12px; border-radius: 10px; text-align: left;
  background: rgba(255,255,255,.05); border: 1px solid var(--line); cursor: pointer;
  touch-action: manipulation; transition: transform 100ms ease-out, background-color 160ms ease;
}
.choice:active { transform: scale(0.97); }
.choice[aria-pressed="true"] { background: rgba(242,196,109,.16); color: var(--gold); font-weight: 600; }
.choice small { display: block; color: var(--text3); font-weight: 400; font-size: 0.8125rem; }
.choices.three { grid-template-columns: repeat(3, 1fr); }
.choices.three .choice { text-align: center; }
.choices.three .choice b { display: block; font: 600 1.25rem/1.2 var(--serif); }
.sheet .section-label { font: 600 0.7rem/1.2 var(--sans); letter-spacing: 0.14em; text-transform: uppercase; color: var(--text3); }
.sheet hr { border: 0; border-top: 1px solid var(--line); margin: 24px 0 8px; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 20px); z-index: 60;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: #f8f2e7; color: #1a1406; padding: 12px 16px; border-radius: 10px;
  font-weight: 500; font-size: 0.9375rem; max-width: calc(100% - 32px); text-align: center;
  box-shadow: 0 12px 30px rgba(0,0,0,.4); transition: opacity 220ms var(--ease), transform 220ms var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Order */
.order-main { padding-top: 32px; }
.kid-link { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.kid-link + .kid-link { margin-top: 12px; }
.kid-link h3 { font-size: 1.25rem; }

/* Admin */
.admin table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.admin td, .admin th { text-align: left; padding: 10px 6px; border-top: 1px solid var(--line); vertical-align: top; }
.admin th { color: var(--text3); font-weight: 600; font-size: 0.75rem; letter-spacing: .08em; text-transform: uppercase; }
.admin .stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.admin .hidden-row { opacity: .5; }
.admin .scroll { overflow-x: auto; }

/* Share page */
.share-main { text-align: center; padding-top: 32px; }
.share-main .big { font: 600 4rem/1 var(--serif); color: var(--gold); margin: 18px 0 6px; font-variant-numeric: tabular-nums; }

@media (min-width: 720px) {
  h1 { font-size: 3rem; }
  .kid-row .grid { grid-template-columns: 1fr 1fr; }
  .kid-row .grid .wide { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
}
@media (prefers-reduced-transparency: reduce) {
  .top, .globe-badge { background: var(--bg2); backdrop-filter: none; -webkit-backdrop-filter: none; }
}

/* ---------- Christmas dressing ---------- */
:root {
  --red: #c8362e;
  --red-h: #d6453c;
  --on-red: #fff8ee;
  --pine: #2f8a57;
}
body {
  background-image:
    radial-gradient(90% 35% at 50% 105%, rgba(47,138,87,.14), rgba(10,17,38,0) 70%),
    radial-gradient(120% 60% at 50% -10%, #1b2a5c 0%, rgba(10,17,38,0) 60%);
}
.snow { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
main, footer { position: relative; z-index: 1; }

.btn.primary { background: var(--red); color: var(--on-red); }
.btn.primary:hover { background: var(--red-h); }

/* String lights hang from the header */
.top { z-index: 20; }
.lights { position: absolute; left: 0; right: 0; top: 100%; height: 30px; pointer-events: none; overflow: hidden; }
.lights svg { display: block; }
.bulb { animation: twinkle 2.4s ease-in-out infinite; }
@keyframes twinkle { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }

/* Globe sitting in the sky over a snowy village */
.scene { position: relative; margin: 0 -16px; padding-top: 18px; overflow: hidden; }
.scene .globe-wrap { margin-bottom: 0; }
.village { position: absolute; left: 0; bottom: 0; width: 100%; height: clamp(120px, 34vw, 180px); pointer-events: none; z-index: 1; }
.scene::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 28px; z-index: 2; background: linear-gradient(rgba(10,17,38,0), var(--bg)); pointer-events: none; }
.globe-badge:not(.globe-wrap .globe-badge) { position: static; transform: none; display: table; margin: 14px auto 0; }
.smoke { animation: smoke 4s ease-in-out infinite; transform-box: fill-box; transform-origin: bottom; }
@keyframes smoke { 0%, 100% { transform: translateY(0); opacity: .55; } 50% { transform: translateY(-3px); opacity: .3; } }

.holly-div { display: flex; justify-content: center; margin: 40px 0 -16px; }
.holly { display: block; }
.hero .eyebrow { color: var(--gold); }

/* Candy cane meter */
.gauge .track { stroke: rgba(255,255,255,.1); }

.steps .num { color: var(--red-h); }
.steps li:nth-child(2) .num { color: #4cc07d; }
.steps li:nth-child(3) .num { color: var(--gold); }

@media (prefers-reduced-motion: reduce) {
  .bulb, .smoke { animation: none; }
}
/* Room for the string lights under the header */
.kid-head { padding-top: 40px; }
.order-main, .share-main { padding-top: 52px; }
.admin { padding-top: 48px !important; }
/* Cards stay readable over the snow */
.card, .steps li { background: rgba(16, 25, 54, 0.92); }
.faq { position: relative; }
