/* base.css — shared layout for the birthday templates. Each scene.css only overrides the tokens + skins. */
:root {
  --bg: #fff7f0; --bg-2: #ffe9e0;
  --surface: #ffffff; --surface-2: #fff4ee;
  --text: #4a3428; --muted: #8b7266;
  --accent: #ff8fa3; --accent-2: #ffc46b; --accent-ink: #ffffff;
  --line: rgba(74, 52, 40, .16); --line-soft: rgba(74, 52, 40, .08);
  --danger: #d9485f; --ok: #2f9e6e;
  --f-display: 'Alexandria', 'IBM Plex Sans Arabic', system-ui, sans-serif;
  --f-ui: 'IBM Plex Sans Arabic', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
  --s1: 6px; --s2: 12px; --s3: 18px; --s4: 28px; --s5: 44px;
  --r-sm: 14px; --r-md: 20px; --r-lg: 28px; --r-pill: 999px;
  --ease: cubic-bezier(.22, .8, .24, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --tap: 52px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; color: var(--text); background: var(--bg);
  font: 400 16px/1.7 var(--f-ui); overflow-x: hidden;
}
body.locked { overflow: hidden; height: 100dvh; }
img, svg { display: block; max-width: 100%; }
button, input, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

/* ===== Intro stage (each template fills it) ===== */
.intro {
  position: fixed; inset: 0; z-index: 30; overflow: hidden;
  padding: max(var(--s3), env(safe-area-inset-top)) var(--s3) max(var(--s3), env(safe-area-inset-bottom));
  transition: opacity .55s ease, transform .55s var(--ease);
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
}
.intro.is-leaving { opacity: 0; transform: scale(1.04); pointer-events: none; }
.skip {
  position: absolute; z-index: 20; inset-inline: 0; margin-inline: auto; width: max-content;
  bottom: max(22px, calc(env(safe-area-inset-bottom) + 12px)); min-height: 48px; padding: 10px 26px;
  border-radius: var(--r-pill); border: 1.5px solid var(--line); background: var(--surface); color: var(--text);
  font: 600 16px/1.2 var(--f-ui); cursor: pointer; box-shadow: 0 8px 24px rgba(0,0,0,.14);
  opacity: 0; transform: translateY(14px); pointer-events: none; transition: opacity .45s ease, transform .45s var(--ease);
}
.skip.is-show { opacity: 1; transform: none; pointer-events: auto; }
.skip.is-cta { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-size: 18px; padding: 12px 34px; animation: ctaPulse 2s ease-in-out infinite 1s; }
@keyframes ctaPulse { 50% { transform: scale(1.05); } }

.mute {
  position: fixed; z-index: 40; top: max(14px, env(safe-area-inset-top)); inset-inline-end: 12px; width: 42px; height: 42px;
  display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer;
}
.mute-slash { position: absolute; width: 26px; height: 2px; background: var(--danger); border-radius: 2px; transform: rotate(-45deg); }
.mute[aria-pressed="true"] .mute-slash { opacity: 0; }

/* ===== Details page ===== */
.page { width: 100%; max-width: 480px; margin-inline: auto; padding: max(var(--s3), env(safe-area-inset-top)) var(--s3) calc(var(--s4) + env(safe-area-inset-bottom)); }
.page.is-in .r { animation: rise .75s var(--ease) both; animation-delay: calc(var(--i, 0) * 100ms); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
.js .rv { opacity: 0; transform: translateY(18px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.js .rv.in { opacity: 1; transform: none; }

.card { padding: var(--s2) 0 var(--s3); }
.card-frame {
  position: relative; text-align: center; padding: 28px 20px 28px; border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--line); box-shadow: 0 18px 44px rgba(0,0,0,.10);
}
.card-hero { display: grid; place-items: center; min-height: 10px; margin: -4px auto 6px; }
.card-hero svg { width: 150px; height: auto; }
.card-kicker { margin: 0 0 6px; font: 700 13px/1.4 var(--f-ui); letter-spacing: .02em; color: var(--accent); }
.card-host { margin: 0; display: grid; gap: 2px; }
.host-name { font: 700 19px/1.5 var(--f-display); color: var(--text); }
.host-intro { font-size: 15.5px; color: var(--muted); }
.kid { margin: 10px 0 4px; font: 900 clamp(56px, 19vw, 76px)/1.25 var(--f-display); color: var(--accent); text-wrap: balance; }
.kid:focus { outline: none; }
.age-line { margin: 0 0 var(--s3); display: inline-flex; align-items: center; gap: 10px; font: 600 17px/1.4 var(--f-ui); color: var(--text); }
.age-badge {
  display: inline-grid; place-items: center; min-width: 44px; height: 44px; padding: 0 8px; border-radius: 50%;
  background: var(--accent-2); color: var(--text); font: 900 24px/1 var(--f-display);
}
.facts { list-style: none; margin: 0 0 var(--s2); padding: 0; display: grid; gap: 10px; text-align: start; }
.facts li { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line-soft); }
.facts svg { flex: none; color: var(--accent); }
.facts span { display: grid; line-height: 1.45; min-width: 0; }
.facts .fl { display: none; font-style: normal; }
.facts strong { font: 600 16.5px/1.45 var(--f-ui); color: var(--text); }
.facts small { font-size: 13.5px; color: var(--muted); }
.facts small:empty { display: none; }
.notes { display: flex; align-items: flex-start; gap: 10px; margin: var(--s2) 0 0; padding: 12px 14px; text-align: start; border-radius: var(--r-sm); border: 1.5px dashed var(--accent); color: var(--text); font-size: 15px; line-height: 1.65; }
.notes svg { flex: none; margin-top: 2px; color: var(--accent); }
.closing { margin: var(--s3) 0 0; font: 700 17px/1.6 var(--f-display); color: var(--accent); }

.block { padding: var(--s4) 0 var(--s2); }
.h2 { margin: 0 0 var(--s3); text-align: center; font: 800 24px/1.35 var(--f-display); color: var(--text); }
.h2::after { content: ''; display: block; width: 40px; height: 4px; margin: 10px auto 0; background: var(--accent); border-radius: 4px; }

.countdown { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.cd { display: grid; justify-items: center; gap: 2px; padding: 14px 4px 10px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); }
.cd b { font: 800 clamp(28px, 9vw, 36px)/1.2 var(--f-display); color: var(--accent); font-variant-numeric: tabular-nums; }
.cd span { font-size: 13.5px; color: var(--muted); }
.cd-msg { margin: var(--s3) 0 0; text-align: center; font: 700 20px/1.6 var(--f-display); color: var(--accent); }

.actions { display: grid; gap: var(--s2); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: var(--tap); padding: 10px 20px;
  border: 1.5px solid var(--line); border-radius: var(--r-pill); background: var(--surface); color: var(--text);
  font: 600 16px/1.3 var(--f-ui); text-decoration: none; cursor: pointer; text-align: center;
  transition: transform .15s var(--ease), filter .2s, border-color .2s; -webkit-tap-highlight-color: transparent;
}
.btn:hover { border-color: var(--accent); }
.btn:active { transform: scale(.97); }
.btn svg { flex: none; }
.btn-main { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn-main:hover { filter: brightness(1.05); border-color: transparent; }
.btn-ghost { background: transparent; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .6; cursor: progress; }

.form { display: grid; gap: var(--s3); }
.field { display: grid; gap: 8px; border: 0; margin: 0; padding: 0; min-width: 0; }
.field label, .field legend, .lbl { font-weight: 600; font-size: 15px; color: var(--text); padding: 0; }
.opt { color: var(--muted); font-weight: 400; }
input[type="text"], textarea {
  width: 100%; min-height: var(--tap); padding: 12px 16px; border-radius: var(--r-sm); font-size: 16px;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--text);
}
textarea { resize: vertical; min-height: 96px; line-height: 1.6; }
::placeholder { color: var(--muted); opacity: .75; }
input[type="text"]:focus, textarea:focus { outline: 3px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choice label {
  display: grid; place-items: center; min-height: var(--tap); padding: 8px 10px; text-align: center; line-height: 1.3;
  border: 1.5px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: var(--text); cursor: pointer; font-weight: 600;
  transition: background-color .2s, border-color .2s, color .2s;
}
.choice input:checked + label { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.choice input[value="no"]:checked + label { background: transparent; color: var(--danger); border-color: var(--danger); }
.choice input:focus-visible + label { outline: 3px solid var(--accent); outline-offset: 3px; }
.stepper { display: inline-grid; grid-template-columns: var(--tap) minmax(64px, auto) var(--tap); align-items: center; width: max-content; border: 1.5px solid var(--line); border-radius: var(--r-pill); background: var(--surface); overflow: hidden; }
.stepper button { height: var(--tap); border: 0; background: transparent; color: var(--accent); font-size: 26px; line-height: 1; cursor: pointer; }
.stepper button[disabled] { opacity: .3; cursor: default; }
.stepper output { text-align: center; font: 800 22px/1 var(--f-display); }
.hint { color: var(--muted); font-size: 13.5px; }
.error { margin: 0; padding: 10px 14px; border-radius: var(--r-sm); color: var(--danger); border: 1.5px solid var(--danger); background: var(--surface); font-size: 15px; }

.thanks { text-align: center; padding: var(--s4) var(--s3); border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); display: grid; justify-items: center; gap: 8px; }
.thanks:focus { outline: none; }
.thanks-ic { display: grid; place-items: center; width: 60px; height: 60px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); margin-bottom: 4px; }
.thanks-t { margin: 0; font: 800 21px/1.5 var(--f-display); }
.thanks-s { margin: 0 0 var(--s2); color: var(--muted); }

.foot { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: var(--s5); padding-top: var(--s3); border-top: 1px solid var(--line-soft); font-size: 12.5px; color: var(--muted); }
.foot img { border-radius: 5px; }

@media (min-width: 560px) { .actions { grid-template-columns: 1fr 1fr; } .actions .btn-main { grid-column: 1 / -1; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; transition-delay: 0s !important; scroll-behavior: auto !important; }
  .js .rv { opacity: 1; transform: none; }
}

.foot a { color: inherit; text-decoration: none; }
.foot a:hover, .foot a:focus-visible { text-decoration: underline; }

/* ===== Video render mode (?autoplay=1&video=1, used by fulfil/make-video.mjs): no interactive UI, only the scene + the card ===== */
.vid .skip, .vid .mute, .vid .foot, .vid .block, .vid [id$="Hint"], .vid [id$="HintWrap"], .vid #sLaunchCap,
.vid .fb-swipe, .vid .s-launch, .vid .s-launch-wrap, .vid .s-cap, .vid .r-panel, .vid .p-ring, .vid .h-ring { display: none !important; }
.vid, .vid body { cursor: none; }
.vid .page { position: fixed; inset: 0; max-width: none; padding: 0; overflow: hidden; display: block; }
.vid .page .card { position: absolute; top: 50%; left: 50%; width: min(480px, calc(100% - 36px)); padding: 0; transform: translate(-50%, -50%) scale(var(--vz, 1)); transform-origin: 50% 50%; }
.vid .card-frame { padding: 18px 16px 18px; }
.vid .kid { font-size: 60px; margin: 4px 0 2px; }
.vid .age-line { margin-bottom: 10px; }
.vid .facts { gap: 6px; margin-bottom: 6px; }
.vid .facts li { padding: 8px 12px; }
.vid .closing { margin-top: 10px; }
