/* ==========================================================================
   Krazee Story - one design system. Light + dark. Plain CSS, no build step.
   The rules live in DESIGN.md. Order of this file:
     1 Tokens        2 Base          3 Layout primitives
     4 Components    5 Utilities     6 Dark-mode overrides
   Rule: every length, colour, radius, shadow, duration comes from a token in
   section 1. Change a look by changing a token, not by adding a one-off rule.
   Breakpoints (media queries cannot read tokens): 40rem = small, 52rem = medium.
   ========================================================================== */

/* ==========================================================================
   1 TOKENS
   ========================================================================== */
:root {
  /* colour (light) - roles, never raw values, in the rules below.
     v3 (2026-11-17): every value comes from the icon #8 KS Splash-Dragon. */
  --bg: #FFF8EC;          /* page: the icon's cream (the K, the sticker border) */
  --bg2: #FDE6EE;         /* alternate band, hover wash: pale sunburst pink */
  --card: #FFFFFF;        /* raised surface */
  --text: #0D2430;        /* the icon's ink outline */
  --muted: #435868;
  --primary: #4CC4EA;     /* the dragon's aqua; always with the ink outline */
  --on-primary: #0D2430;
  --link: #166891;
  --pink: #F2A2B8;        /* playful action: the sunburst pink */
  --gold: #F3CF72;        /* highlight: the sparkles */
  --teal: #1E9AA3;        /* check marks, note rule */
  --line: #F0CBD7;        /* hairlines and dividers */
  --focus: #B4306A;
  --ink: #0D2430;         /* deep sea: video stage, overlays, footer */
  --on-ink: #FFF8EC;
  --on-accent: #0D2430;   /* text on pink and gold */
  --sky: #E3F6FC;         /* pale aqua: note callout */
  --hot: #EF6F95;         /* the dragon's tongue: tiny accents only, never text */

  /* sticker kit: the icon's thick ink outline + white sticker border + soft shadow */
  --edge: #0D2430;        /* outline of every surface (cards, inputs, ghost buttons) */
  --outline: #0D2430;     /* outline of every sticker shape (buttons, chips, kicker, pictures) */
  --sticker: #FFFFFF;     /* die-cut border round pictures */
  --lift: #0D2430;        /* the hard "sticker lift" shadow under buttons and cards */
  --outline-w: 3px;       /* ~2% of the icon: the outline weight for buttons, cards, pictures */
  --outline-w-sm: 2px;    /* chips, kicker, small tools */
  --sticker-w: 6px;       /* white border round framed pictures */
  --lift-y: 4px;          /* hard shadow drop */
  --lift-y-lg: 6px;

  /* motifs: sunburst rays and the gold four-point sparkle */
  --burst-a: #FBD9E3;     /* ray */
  --burst-b: #FDE6EE;     /* gap between rays */
  --burst-step: 9deg;     /* 20 rays round the circle, like the icon */
  --burst-ink: #10293A;   /* ray on the ink footer */
  --sparkle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M50 5Q61 39 95 50Q61 61 50 95Q39 61 5 50Q39 39 50 5Z' fill='%23F3CF72' stroke='%230D2430' stroke-width='7' stroke-linejoin='round'/%3E%3C/svg%3E");
  --sparkle-lg: 2rem;
  --sparkle-sm: 1.125rem;

  /* playful tilt: stickers only (kicker, framed pictures, logo). Never text blocks, never the reader. */
  --tilt: -2deg;
  --tilt-pic: 1.5deg;
  --tilt-hover: -1deg;

  /* type */
  --font-head: 'Fredoka', 'Arial Rounded MT Bold', 'Nunito', system-ui, sans-serif;
  --font-body: 'Nunito', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  --text-h1: clamp(2.1rem, 5.5vw, 3.6rem);
  --text-h2: clamp(1.6rem, 3.6vw, 2.3rem);
  --text-h3: clamp(1.2rem, 2.4vw, 1.4rem);
  --text-lead: clamp(1.1rem, 2vw, 1.25rem);
  --text-body: 1.0625rem;
  --text-small: 0.95rem;
  --text-xs: 0.8rem;
  --fw-regular: 400;
  --fw-semi: 600;
  --fw-bold: 700;
  --fw-heavy: 800;
  --lh-tight: 1.15;
  --lh-snug: 1.5;
  --lh-body: 1.65;

  /* spacing scale (4 / 8 / 12 / 16 / 24 / 32 / 48 / 64) */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;

  /* page rhythm: ONE section padding, ONE page-top offset, ONE gutter */
  --section-y: clamp(var(--space-6), 4vw, var(--space-7));
  --page-top: var(--space-6);
  --gutter: var(--space-4);

  /* containers */
  --w-main: 70rem;        /* 1120px: every page */
  --w-narrow: 47.5rem;    /* 760px: reading measure, centred closing bands */

  /* radii */
  --radius-sm: 0.5rem;
  --radius-md: 1rem;
  --radius-lg: 1.375rem;  /* cards, media frames */
  --radius-pill: 999px;

  /* borders and focus ring */
  --hair: 1px;
  --border: 2px;
  --border-strong: 4px;
  --ring-w: 3px;
  --ring-offset: 3px;

  /* elevation */
  --shadow-card: 0 var(--lift-y-lg) 0 var(--lift), 0 14px 26px rgba(13, 36, 48, 0.14);
  --shadow-pop: 0 6px 22px rgba(13, 36, 48, 0.35);
  --shadow-soft: 0 10px 28px rgba(13, 36, 48, 0.16);   /* the calm reader: no sticker lift */
  --shadow-btn: 0 var(--lift-y) 0 var(--lift);
  --shadow-pic: 0 0 0 var(--outline-w) var(--outline), 0 14px 24px rgba(13, 36, 48, 0.22);

  /* motion */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur-1: 150ms;
  --dur-2: 250ms;
  --dur-3: 350ms;
  --dur-4: 500ms;

  /* controls (touch targets) */
  --control-sm: 2.75rem;  /* 44px */
  --control-md: 3rem;     /* 48px */
  --control-lg: 3.5rem;   /* 56px */
  --opacity-disabled: 0.5;

  /* sizes of parts */
  --logo-h: 4rem;
  --logo-h-sm: 2.75rem;
  --media-col: 18.75rem;  /* picture column in a part card */
  --story-col: 15rem;     /* cover column on a story page */
  --grid-min: 18rem;      /* narrowest card in an auto grid */
  --thumb-min: 6.875rem;
  --input-max: 26rem;
  --ratio-photo: 3 / 2;
  --ratio-video: 16 / 9;
  --ratio-video-n: calc(16 / 9);
  --dot: 0.875rem;
  --cover-max-h: 60vh;

  /* reader (full-window book and film): sizes follow the window */
  --book-pad-y: clamp(0.4rem, 1.2vmin, 0.875rem);
  --book-pad-x: clamp(0.5rem, 2vmin, 1.5rem);
  --book-gap: clamp(0.4rem, 1.2vmin, 0.875rem);
  --book-stage-gap: clamp(0.5rem, 1.6vmin, 1.25rem);
  --book-side: clamp(15rem, 30vw, 28.75rem);
  --book-title: clamp(1rem, 2.4vmin, 1.4rem);
  --book-sub: clamp(0.75rem, 1.6vmin, 0.95rem);
  --book-words-pad: clamp(0.65rem, 2.2vmin, 1.75rem);
  --book-text: clamp(1rem, 2.6vmin, 1.65rem);
  --book-text-tall: clamp(1rem, 3.6vw, 1.6rem);
  --book-nav: clamp(3rem, 7vmin, 4.25rem);
  --book-nav-icon: clamp(1.6rem, 4vmin, 2.2rem);
  --book-small: clamp(0.85rem, 1.8vmin, 1rem);
  --book-end-title: clamp(1.8rem, 6vmin, 3.4rem);
  --book-words-max: 38dvh;
  --z-header: 50;
  --z-skip: 100;
  --z-book: 1000;

  color-scheme: light;

  /* legacy names, kept so brand/BRAND.html keeps working */
  --radius: var(--radius-lg);
  --shadow: var(--shadow-card);
}

/* ==========================================================================
   2 BASE / RESET
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-body);
  line-height: var(--lh-body);
}
main { flex: 1 0 auto; }
img, video { max-width: 100%; height: auto; }
h1, h2, h3 {
  margin: 0;
  font-family: var(--font-head);
  font-weight: var(--fw-semi);
  line-height: var(--lh-tight);
  letter-spacing: 0.005em;
}
h1 { font-size: var(--text-h1); font-weight: var(--fw-bold); }
h2 { font-size: var(--text-h2); }
h3 { font-size: var(--text-h3); }
p, dl, dd, figure { margin: 0; }
ul, ol { margin: 0; padding-left: var(--space-5); }
a { color: var(--link); text-underline-offset: var(--ring-offset); }
a:hover { text-decoration-thickness: var(--ring-w); }
:focus-visible { outline: var(--ring-w) solid var(--focus); outline-offset: var(--ring-offset); }
button:not(:disabled), a[href], summary, [role="button"], label[for], select { cursor: pointer; }
[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

.skip {
  position: absolute; left: -999px; top: 0; z-index: var(--z-skip);
  padding: var(--space-3) var(--space-4);
  background: var(--primary); color: var(--on-primary);
  border-radius: 0 0 var(--radius-sm) 0;
}
.skip:focus { left: 0; }

/* ==========================================================================
   3 LAYOUT PRIMITIVES
   Page shell on every page: header, <main> of .section blocks, footer.
   ========================================================================== */
.wrap {
  width: min(var(--wrap-max, var(--w-main)), 100% - 2 * var(--gutter));
  margin-inline: auto;
}
.narrow { --wrap-max: var(--w-narrow); }
.wrap > *, .split > *, .part-card > *, .tap-box > *, .story-head > * { min-width: 0; }

/* the ONE section rule: same padding on every page */
.section, .block { padding-block: var(--section-y); }
main > .section:first-child { padding-top: var(--page-top); }
/* alternate band: pale pink; on wide windows two gold sparkles sit in the right margin (the icon's sparkles) */
.section-alt { background: var(--bg2); }
@media (min-width: 80rem) {
  .section-alt {
    background:
      var(--sparkle) no-repeat right calc(50% - var(--w-main) / 2 - var(--space-7)) top var(--space-5) / var(--sparkle-lg),
      var(--sparkle) no-repeat right calc(50% - var(--w-main) / 2 - var(--space-6)) top var(--space-8) / var(--sparkle-sm),
      var(--bg2);
  }
}
/* hero: the icon's sunburst, faded to the page colour behind the words */
.section-hero {
  position: relative; overflow: hidden;
  background:
    radial-gradient(ellipse 55% 85% at 22% 50%, var(--bg) 0 40%, transparent 78%),
    repeating-conic-gradient(from calc(-6deg + var(--burst-rot)) at 72% 58%, var(--burst-a) 0 var(--burst-step), var(--burst-b) var(--burst-step) calc(var(--burst-step) * 2));
  border-bottom: var(--outline-w) solid var(--edge);
}
.section-hero > .wrap { position: relative; z-index: 1; }
.section-hero::before, .section-hero::after {
  content: ""; position: absolute; pointer-events: none;
  background: var(--sparkle) no-repeat center / contain;
}
.section-hero::before { width: var(--sparkle-lg); height: var(--sparkle-lg); top: var(--space-4); right: max(var(--space-2), calc(50% - var(--w-main) / 2 - var(--space-7))); }
.section-hero::after { width: var(--sparkle-sm); height: var(--sparkle-sm); bottom: var(--space-4); left: max(var(--space-2), calc(50% - var(--w-main) / 2 - var(--space-6))); }

/* legacy: brand/BRAND.html still uses .block sections */
.block > * + * { margin-top: var(--space-3); }

/* stack: vertical rhythm between siblings */
.stack > * + * { margin-top: var(--space-4); }
.stack-sm > * + * { margin-top: var(--space-2); }
.stack-lg > * + * { margin-top: var(--space-6); }

/* cluster: a wrapping row (buttons, links, chips) */
.cluster {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: var(--space-3);
  list-style: none; padding: 0;
}
.cluster-center { justify-content: center; }
.cluster-between { justify-content: space-between; }

/* grid-auto: cards that fill the row */
.grid-auto {
  display: grid;
  gap: var(--space-5);
  grid-template-columns: repeat(auto-fill, minmax(min(var(--grid-min), 100%), 1fr));
}

/* a grid of exactly four cards: 2 x 2, then 4 across, never 3 + 1 */
@media (min-width: 40rem) { .grid-auto:has(> :nth-child(4):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 72rem) { .grid-auto:has(> :nth-child(4):last-child) { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* split: text beside a picture, stacked on small screens */
.split { display: grid; gap: var(--space-6); align-items: center; }
@media (min-width: 52rem) { .split { grid-template-columns: 1fr 1fr; } }

/* prose: long reading text at the reading measure, left aligned with the page */
.prose { max-width: var(--w-narrow); }
.prose > * + * { margin-top: var(--space-4); }
.prose > * + h2 { margin-top: var(--space-6); }
.prose > h2 + * { margin-top: var(--space-2); }

/* ==========================================================================
   4 COMPONENTS
   ========================================================================== */

/* ---- header, brand, nav, theme button ---- */
.site-header {
  position: sticky; top: 0; z-index: var(--z-header);
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: var(--outline-w) solid var(--edge);
}
.site-header .wrap {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: var(--space-2) var(--space-5);
  padding-block: var(--space-2);
}
.brand { display: flex; align-items: center; margin-right: auto; }
.brand img { display: block; height: var(--logo-h); width: auto; }
.brand img.logo-dark { display: none; }
.nav { display: flex; flex-wrap: wrap; gap: var(--space-1); list-style: none; padding: 0; }
.nav a {
  display: inline-flex; align-items: center;
  min-height: var(--control-sm); padding: 0 var(--space-4);
  border: var(--outline-w-sm) solid transparent; border-radius: var(--radius-pill);
  color: var(--text); text-decoration: none; font-weight: var(--fw-bold);
  transition: background-color var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease);
}
.nav a:hover { background: var(--bg2); border-color: var(--edge); }
.nav a[aria-current="page"] { background: var(--primary); color: var(--on-primary); border-color: var(--outline); box-shadow: 0 calc(var(--lift-y) / 2) 0 var(--lift); }

/* round tool buttons: theme toggle and the reader tools (small stickers: ink outline) */
.theme-btn, .book-tool {
  min-width: var(--control-sm); min-height: var(--control-sm);
  border: var(--outline-w-sm) solid var(--edge); border-radius: var(--radius-pill);
  background: var(--card); color: var(--text);
  font: var(--fw-bold) var(--text-body) var(--font-body);
  padding: 0 var(--space-4);
  transition: background-color var(--dur-1) var(--ease);
}
.theme-btn { box-shadow: 0 calc(var(--lift-y) / 2) 0 var(--lift); }
.theme-btn:hover, .book-tool:hover { background: var(--bg2); }
.theme-btn:active, .book-tool:active { transform: scale(0.97); }
.book-tool { padding: 0 var(--space-2); font-weight: var(--fw-heavy); }
/* theme toggle: a round sticker with a moon (light mode) or a sun (dark mode) */
.theme-btn { display: inline-grid; place-items: center; width: var(--control-sm); padding: 0; cursor: pointer; }
.theme-btn .ti { width: 26px; height: 26px; grid-area: 1 / 1; transition: transform var(--dur-2, .3s) var(--ease), opacity var(--dur-2, .3s) var(--ease); }
.theme-btn .ti-sun { opacity: 0; transform: rotate(-90deg) scale(.5); }
:root[data-theme="dark"] .theme-btn .ti-sun { opacity: 1; transform: none; }
:root[data-theme="dark"] .theme-btn .ti-moon { opacity: 0; transform: rotate(90deg) scale(.5); }
.theme-btn:hover .ti { transform: rotate(-12deg) scale(1.08); }
:root[data-theme="dark"] .theme-btn:hover .ti-moon, .theme-btn:hover .ti-sun { opacity: 0; }
:root[data-theme="dark"] .theme-btn:hover .ti-sun { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .theme-btn .ti { transition: none; } }

/* ---- buttons: .btn + variant + optional size ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: var(--control-md); padding: var(--space-2) var(--space-5);
  border: var(--outline-w) solid var(--outline); border-radius: var(--radius-pill);
  box-shadow: var(--shadow-btn);
  font: var(--fw-heavy) var(--text-body)/var(--lh-tight) var(--font-body);
  text-decoration: none; text-align: center;
  transition: transform var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease), background-color var(--dur-1) var(--ease);
}
/* sticker press: lifts on hover, squashes onto its shadow when pressed */
.btn:hover { transform: translateY(calc(var(--lift-y) / -2)); box-shadow: 0 calc(var(--lift-y) * 1.5) 0 var(--lift); }
.btn:active { transform: translateY(calc(var(--lift-y) / 2)); box-shadow: 0 calc(var(--lift-y) / 2) 0 var(--lift); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: var(--opacity-disabled); cursor: not-allowed; transform: none; box-shadow: var(--shadow-btn); }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: color-mix(in srgb, var(--primary) 70%, var(--card)); }
.btn-pink { background: var(--pink); color: var(--on-accent); }
.btn-pink:hover { background: var(--gold); }
.btn-ghost { background: var(--card); color: var(--text); border-color: var(--edge); }
.btn-ghost:hover { background: var(--bg2); }
.btn-sm { min-height: var(--control-sm); padding-inline: var(--space-4); font-size: var(--text-small); }
.btn-lg { min-height: var(--control-lg); padding-inline: var(--space-6); font-size: var(--text-lead); }
@media (max-width: 40rem) { .btn:not(.btn-sm) { width: 100%; } }

/* ---- surfaces: card, story-card, part-card, tap-box share one frame ---- */
.card, .story-card, .part-card, .tap-box {
  background: var(--card);
  border: var(--outline-w) solid var(--edge);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  color: var(--text);
}
.card { padding: var(--space-5); }

/* story-card: one story in the library (a whole-card link); hover = a sticker being picked up */
.story-card {
  display: flex; flex-direction: column; overflow: hidden; text-decoration: none;
  transition: transform var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease);
}
.story-card:hover { transform: translateY(calc(var(--lift-y) * -1)) rotate(var(--tilt-hover)); box-shadow: 0 calc(var(--lift-y-lg) * 1.5) 0 var(--lift), 0 18px 30px rgba(13, 36, 48, 0.18); }
.story-card img { display: block; width: 100%; aspect-ratio: var(--ratio-photo); object-fit: cover; border-bottom: var(--outline-w) solid var(--edge); }
.story-card-body { padding: var(--space-4); }
.story-card-body > * + * { margin-top: var(--space-2); }
.story-card h2 { font-size: var(--text-h3); }
.story-card-meta { color: var(--muted); font-weight: var(--fw-bold); font-size: var(--text-small); }
.story-card-blurb { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.story-card-new { font-weight: var(--fw-heavy); font-size: var(--text-small); color: var(--link); }

/* part-card: one part of a story, picture beside text */
.part-card { display: grid; gap: var(--space-4); padding: var(--space-4); }
.part-card img { display: block; width: 100%; aspect-ratio: var(--ratio-video); object-fit: cover; border-radius: var(--radius-md); border: var(--outline-w-sm) solid var(--edge); }
.part-card-body > * + * { margin-top: var(--space-3); }
@media (min-width: 40rem) { .part-card { grid-template-columns: var(--media-col) 1fr; align-items: center; } }

/* tap-box: one way to play (film or a tap-to-play book) */
.tap-box {
  display: grid; gap: var(--space-4); align-items: center; padding: var(--space-5);
  border-style: dashed; background: var(--sky); box-shadow: none;
}
.tap-box h3 + p { margin-top: var(--space-1); }
@media (min-width: 40rem) { .tap-box { grid-template-columns: 1fr auto; } }

/* story head: cover beside title (story page) */
.story-head { display: grid; gap: var(--space-5); align-items: center; }
.story-head img {
  display: block; width: 100%; border-radius: var(--radius-lg);
  border: var(--sticker-w) solid var(--sticker); box-shadow: var(--shadow-pic); transform: rotate(var(--tilt));
}
@media (min-width: 40rem) { .story-head { grid-template-columns: var(--story-col) 1fr; } }

/* ---- chips / badges: flat pale-aqua labels (not clickable, so no outline and no lift) ---- */
.badges { display: flex; flex-wrap: wrap; gap: var(--space-2); list-style: none; padding: 0; }
.chip, .badges li {
  display: inline-block;
  padding: var(--space-1) var(--space-3);
  background: var(--sky); border: var(--outline-w-sm) solid transparent; border-radius: var(--radius-pill);
  font-size: var(--text-small); font-weight: var(--fw-bold); line-height: var(--lh-tight);
}

/* ---- kicker, tagline, lead, crumbs ---- */
/* kicker: a little gold sticker, tilted */
.kicker {
  display: inline-block;
  padding: var(--space-1) var(--space-3);
  background: var(--gold); color: var(--on-accent);
  border: var(--outline-w-sm) solid var(--outline); border-radius: var(--radius-pill);
  box-shadow: 0 calc(var(--lift-y) / 2) 0 var(--lift);
  font-size: var(--text-small); font-weight: var(--fw-heavy); line-height: var(--lh-tight);
  transform: rotate(var(--tilt));
}
.tagline { font-family: var(--font-head); font-size: var(--text-lead); color: var(--muted); }
.lead { font-size: var(--text-lead); color: var(--muted); }
.crumbs, .caption { font-size: var(--text-small); color: var(--muted); }
.crumbs a { color: var(--link); font-weight: var(--fw-bold); text-decoration-color: var(--pink); text-decoration-thickness: var(--outline-w-sm); }

/* ---- media frames: framed picture and the film poster player = a die-cut sticker ---- */
.art, .player {
  display: block; width: 100%;
  border: var(--sticker-w) solid var(--sticker); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pic);
}
.art { transform: rotate(var(--tilt-pic)); }
.section-hero .player { transform: rotate(var(--tilt-pic)); }
.player { position: relative; overflow: hidden; aspect-ratio: var(--ratio-video); background: var(--ink); }
.player img, .player video { display: block; width: 100%; height: 100%; object-fit: cover; }
.play-btn {
  position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0;
  display: grid; place-items: center;
  background: linear-gradient(0deg, color-mix(in srgb, var(--ink) 35%, transparent), transparent 55%);
}
.play-btn .disc {
  display: grid; place-items: center;
  width: clamp(4.5rem, 14vw, 6.5rem); aspect-ratio: 1; border-radius: 50%;
  background: var(--pink); border: var(--outline-w) solid var(--outline);
  box-shadow: 0 0 0 var(--sticker-w) var(--sticker), var(--shadow-pop);
  transition: transform var(--dur-2) var(--ease);
}
.play-btn:hover .disc { transform: scale(1.08); }
.play-btn svg { width: 46%; height: 46%; margin-left: 8%; fill: var(--on-accent); }
.duration {
  position: absolute; right: var(--space-3); bottom: var(--space-3);
  padding: 0 var(--space-3);
  background: color-mix(in srgb, var(--ink) 80%, transparent); color: var(--on-ink);
  border-radius: var(--radius-pill); font-size: var(--text-small); font-weight: var(--fw-bold);
}

/* home hero teaser: silent highlight loop, a caption sticker per moment, a "Watch the film" pill */
.teaser-hit { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; background: linear-gradient(0deg, color-mix(in srgb, var(--ink) 45%, transparent), transparent 40%); cursor: pointer; }
.teaser-cap {
  position: absolute; left: var(--space-3); top: var(--space-3); max-width: calc(100% - var(--space-6));
  padding: var(--space-1) var(--space-3); border: var(--outline-w-sm) solid #0D2430; border-radius: var(--radius-pill);
  background: #F3CF72; color: #0D2430; font: var(--fw-bold) var(--text-body)/1.3 var(--font-display, var(--font-body));
  box-shadow: 0 3px 0 #0D2430; transform: rotate(-2deg) translateY(-6px) scale(.9); opacity: 0;
  transition: opacity var(--dur-2) var(--ease), transform var(--dur-2) var(--ease); pointer-events: none;
}
.teaser-cap.on { opacity: 1; transform: rotate(-2deg); }
.teaser-btn {
  position: absolute; left: var(--space-3); bottom: var(--space-3);
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: var(--space-1) var(--space-4) var(--space-1) var(--space-1);
  border: var(--outline-w-sm) solid #0D2430; border-radius: var(--radius-pill);
  background: #FFF8EC; color: #0D2430; font: var(--fw-bold) var(--text-body) var(--font-body);
  box-shadow: 0 3px 0 #0D2430; cursor: pointer; transition: transform var(--dur-1) var(--ease);
}
.teaser-btn .disc { display: grid; place-items: center; width: 2.4rem; aspect-ratio: 1; border-radius: 50%; background: var(--pink); border: 2px solid #0D2430; }
.teaser-btn svg { width: 46%; height: 46%; margin-left: 8%; fill: #0D2430; }
.teaser-btn small { font-size: var(--text-small); opacity: .75; }
.teaser-btn:hover { transform: translateY(-2px) scale(1.03); }
.teaser-btn:active { transform: scale(.97); }
@media (prefers-reduced-motion: reduce) { .teaser-cap, .teaser-btn { transition: none; } }

/* floating share button (home, story, part): a round sticker bottom-right; tap it for the share list */
.share-fab { position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); z-index: 50; display: flex; flex-direction: column; align-items: flex-end; gap: var(--space-3); }
html.reading .share-fab { display: none; }
.share-toggle {
  position: relative; width: 60px; height: 60px; border-radius: 50%; padding: 0; display: grid; place-items: center; cursor: pointer;
  background: #F2A2B8; color: #0D2430; border: 3px solid #0D2430; box-shadow: 0 0 0 4px #FFF8EC, 0 5px 0 4px #0D2430;
  transition: transform .25s cubic-bezier(.3, 1.8, .5, 1);
}
.share-toggle svg { width: 28px; height: 28px; fill: #0D2430; transition: transform .25s var(--ease), opacity .2s; }
.share-x-ic { position: absolute; font: 900 34px/1 var(--font-body); opacity: 0; transform: rotate(-90deg); transition: transform .25s var(--ease), opacity .2s; }
.share-fab.open .share-toggle svg { opacity: 0; transform: rotate(90deg) scale(.5); }
.share-fab.open .share-x-ic { opacity: 1; transform: none; }
.share-toggle:hover { transform: rotate(-10deg) scale(1.07); }
.share-pop {
  width: min(340px, calc(100vw - 32px)); padding: var(--space-4); border-radius: var(--radius-lg);
  background: var(--card); color: var(--text); border: 3px solid #0D2430; box-shadow: 0 6px 0 #0D2430, var(--shadow-pic, 0 10px 30px rgba(0,0,0,.2));
  transform-origin: bottom right; animation: pop-up .3s cubic-bezier(.3, 1.5, .5, 1);
}
@keyframes pop-up { from { opacity: 0; transform: translateY(12px) scale(.85); } to { opacity: 1; transform: none; } }
.share-head { margin: 0 0 var(--space-2); font: var(--fw-heavy, 800) 1.15rem/1.2 var(--font-display, var(--font-body)); }
.share-msg { margin: 0 0 var(--space-3); padding: var(--space-2) var(--space-3); border-radius: var(--radius-md, 12px); background: var(--bg2); font-size: var(--text-small); line-height: 1.45; }
.share-list { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-3); list-style: none; margin: 0; padding: 0; justify-items: center; }
.share-btn {
  display: grid; place-items: center; width: 52px; height: 52px; padding: 0; border-radius: 50%;
  border: var(--outline-w-sm) solid #0D2430; box-shadow: 0 3px 0 #0D2430; color: #fff; cursor: pointer;
  transition: transform .2s cubic-bezier(.3, 1.8, .5, 1);
}
.share-fab.open .share-btn { animation: pop-in .35s cubic-bezier(.3, 1.6, .5, 1) both; animation-delay: calc(var(--i, 0) * 35ms); }
.share-btn svg { width: 24px; height: 24px; }
.share-btn:hover { transform: translateY(-3px) rotate(-8deg) scale(1.08); }
.share-btn:active { transform: scale(.94); }
.share-facebook { background: #1877F2; } .share-x { background: #000; } .share-threads { background: #101010; }
.share-instagram { background: radial-gradient(circle at 30% 107%, #fdf497 0 5%, #fd5949 45%, #d6249f 60%, #285AEB 90%); }
.share-whatsapp { background: #25D366; } .share-pinterest { background: #E60023; }
.share-email { background: #F3CF72; color: #0D2430; } .share-link { background: #4CC4EA; color: #0D2430; }
.share-note { margin: var(--space-2) 0 0; min-height: 1.3em; font-weight: var(--fw-bold); font-size: var(--text-small); text-align: center; }
.share-more { width: 100%; margin-top: var(--space-2); }
@media (prefers-reduced-motion: no-preference) { .share-toggle { animation: fab-hello 1s cubic-bezier(.3, 1.6, .5, 1) 1.2s both; } }
@keyframes fab-hello { from { transform: scale(0) rotate(-120deg); } to { transform: none; } }
@media print { .share-fab { display: none; } }

/* part pages: feedback invitation */
.fb-in { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-4) var(--space-5); padding: var(--space-5); border: var(--outline-w) solid var(--edge); border-radius: var(--radius-lg); background: var(--card); box-shadow: 0 var(--lift-y) 0 var(--lift); }
.fb-in .stack-sm { flex: 1 1 18rem; } .fb-in h2 { margin: 0; }
.fb-art { font-size: 3rem; line-height: 1; transform: rotate(-8deg); }
@media (prefers-reduced-motion: no-preference) { .fb-art { animation: wiggle 4s ease-in-out 2s infinite; } }

/* forms: contact page + subscribe box */
.form .field { display: grid; gap: var(--space-1); font-weight: var(--fw-bold); }
.form .field small { font-weight: normal; opacity: .75; }
.form .input { max-width: none; }
.form textarea.input { border-radius: var(--radius-lg); min-height: 8rem; resize: vertical; padding-top: var(--space-2); font: inherit; }
.form select.input { cursor: pointer; }
.check-row { display: flex; gap: var(--space-2); align-items: flex-start; cursor: pointer; }
.check-row input { width: 1.3rem; height: 1.3rem; margin-top: .15rem; accent-color: var(--primary, #4CC4EA); cursor: pointer; flex: none; }
.hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.form-status { margin: 0; min-height: 1.4em; font-weight: var(--fw-bold); }
.form-status.is-ok { color: var(--ok, #1f7a4d); } .form-status.is-err { color: var(--err, #b3261e); }
:root[data-theme="dark"] .form-status.is-ok { color: #7fe0a8; } :root[data-theme="dark"] .form-status.is-err { color: #ff9c8f; }
.subscribe { background: var(--bg2); border-top: var(--outline-w) solid var(--edge); }
.sub-in { display: grid; grid-template-columns: 1fr minmax(0, 1.1fr); gap: var(--space-5); align-items: center; }
@media (max-width: 760px) { .sub-in { grid-template-columns: 1fr; } }
.sub-in h2 { margin: 0; }
.sub-form { display: grid; gap: var(--space-2); }
.sub-row { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.sub-row .input { flex: 1 1 14rem; min-width: 0; }

/* ---- search input ---- */
.input {
  width: 100%; max-width: var(--input-max); min-height: var(--control-md);
  padding: 0 var(--space-4);
  border: var(--outline-w) solid var(--edge); border-radius: var(--radius-pill);
  background: var(--card); color: var(--text);
  font: var(--fw-semi) var(--text-body) var(--font-body);
}
.input:hover { background: var(--sky); }
.input:disabled { opacity: var(--opacity-disabled); cursor: not-allowed; }

/* ---- lists: check list, FAQ, note ---- */
.check { list-style: none; padding: 0; }
.check li { position: relative; padding-left: var(--space-6); }
.check li + li { margin-top: var(--space-2); }
.check li::before { content: "\2714"; position: absolute; left: 0; color: var(--teal); font-weight: var(--fw-heavy); }
.faq > dt { margin-top: var(--space-4); font-weight: var(--fw-heavy); }
.faq > dt:first-child { margin-top: 0; }
.faq > dd { margin-top: var(--space-1); }
.note {
  padding: var(--space-3) var(--space-4);
  background: var(--sky); border-left: var(--space-2) solid var(--teal); border-radius: var(--radius-md);
}

/* ---- picture-book section on the part page: start card, thumbs ---- */
.reader-cover {
  display: block; width: 100%; padding: 0; background: none;
  border: var(--outline-w) solid var(--edge); border-radius: var(--radius-md); overflow: hidden;
  box-shadow: var(--shadow-card);
}
.reader-cover img { display: block; width: 100%; max-height: var(--cover-max-h); object-fit: cover; }
.thumbs {
  display: grid; gap: var(--space-2); list-style: none; padding: 0;
  grid-template-columns: repeat(auto-fill, minmax(var(--thumb-min), 1fr));
}
.thumbs button {
  position: relative; display: block; width: 100%; padding: 0; overflow: hidden;
  border: var(--ring-w) solid transparent; border-radius: var(--radius-md); background: none;
  transition: border-color var(--dur-1) var(--ease);
}
.thumbs button:hover { border-color: var(--pink); }
.thumbs button[aria-current="true"] { border-color: var(--edge); }
.thumbs img { display: block; width: 100%; aspect-ratio: var(--ratio-photo); object-fit: cover; }
.thumbs button span {
  position: absolute; left: var(--space-1); bottom: var(--space-1);
  padding: 0 var(--space-2);
  background: color-mix(in srgb, var(--ink) 80%, transparent); color: var(--on-ink);
  border-radius: var(--radius-pill); font: var(--fw-heavy) var(--text-xs) var(--font-body);
}

/* ---- reader frame: the full-window book and film view (.book*) ---- */
html.reading, html.reading body { overflow: hidden; }
.book {
  --ts: 1;
  position: fixed; inset: 0; z-index: var(--z-book);
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100vh; height: 100dvh;
  padding: var(--book-pad-y) var(--book-pad-x); gap: var(--book-gap);
  background: var(--bg); color: var(--text);
}
.book-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.book-title { display: flex; flex-direction: column; min-width: 0; line-height: var(--lh-tight); }
.book-title strong {
  font: var(--fw-bold) var(--book-title) var(--font-head);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.book-title span { color: var(--muted); font-size: var(--book-sub); }
.book-tools { display: flex; gap: var(--space-2); flex-shrink: 0; }
/* stage: picture beside the words on wide windows, above them on tall ones */
.book-stage {
  display: grid; min-height: 0; gap: var(--book-stage-gap);
  grid-template-columns: minmax(0, 1fr) var(--book-side); grid-template-rows: minmax(0, 1fr);
}
.book-pic { display: flex; align-items: center; justify-content: center; min-height: 0; min-width: 0; }
.book-img {
  max-width: 100%; max-height: 100%; object-fit: contain;
  border-radius: var(--radius-md); box-shadow: var(--shadow-soft);
  user-select: none; -webkit-user-drag: none; cursor: pointer;
}
.book-words {
  display: flex; align-items: center; min-height: 0; overflow: auto;
  padding: var(--book-words-pad);
  background: var(--card); border: var(--outline-w-sm) solid var(--line); border-radius: var(--radius-md);
}
.book-text { margin: 0; font: var(--fw-semi) calc(var(--book-text) * var(--ts))/var(--lh-snug) var(--font-body); }
.book-ctl { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: var(--space-3); }
.book-nav {
  width: var(--book-nav); height: var(--book-nav); border: var(--outline-w) solid var(--outline); border-radius: 50%;
  background: var(--primary); color: var(--on-primary); box-shadow: var(--shadow-btn);
  font: var(--fw-heavy) var(--book-nav-icon)/1 var(--font-body);
}
.book-nav:disabled { opacity: var(--opacity-disabled); cursor: default; }
.book-mid { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); }
.book-count { font-weight: var(--fw-heavy); font-size: var(--book-small); }
.book-dots { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2); }
.book-dots button {
  width: var(--dot); height: var(--dot); padding: 0;
  border: var(--border) solid var(--edge); border-radius: 50%; background: transparent;
}
.book-dots button[aria-current="true"] { background: var(--primary); transform: scale(1.2); }
.book-stage.turn { animation: turn var(--dur-3) var(--ease); }
@keyframes turn { from { opacity: 0.25; transform: translateX(var(--space-3)); } to { opacity: 1; transform: none; } }
.book-read {
  min-height: var(--control-sm); padding: 0 var(--space-4);
  border: var(--outline-w-sm) solid var(--outline); border-radius: var(--radius-pill);
  background: var(--pink); color: var(--on-accent);
  font: var(--fw-heavy) var(--book-small) var(--font-body); white-space: nowrap;
}
.book-read[aria-pressed="true"] { background: var(--gold); }
.book-end {
  position: absolute; inset: 0; z-index: 2;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-2);
  padding: var(--space-5); text-align: center;
  background: color-mix(in srgb, var(--bg) 94%, transparent);
}
.book-end h2 { margin: 0; font: var(--fw-bold) var(--book-end-title) var(--font-head); }
.book-end-k { color: var(--muted); font-weight: var(--fw-heavy); }
@media (max-aspect-ratio: 5/4) {
  .book-stage { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .book-words { max-height: var(--book-words-max); }
  .book-text { font-size: calc(var(--book-text-tall) * var(--ts)); }
}
@media (max-width: 40rem) {
  .book-tools .book-tool:nth-child(2), .book-tools .book-tool:nth-child(3) { display: none; }
  .book-title span { display: none; }
}
/* words you can tap; read-aloud highlight */
.book-text .w {
  display: inline; margin: 0 0.2em 0 -0.08em; padding: 0 0.08em; border-radius: var(--radius-sm); cursor: pointer;
  transition: background-color var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}
.book-text .w:hover { background: color-mix(in srgb, var(--primary) 22%, transparent); }
.book-text .w.done { color: var(--muted); }
.book-text .w.on { background: var(--gold); color: var(--on-accent); }
.book-text .w.pop { animation: pop var(--dur-4) var(--ease); }
@keyframes pop { 0% { transform: none; } 40% { transform: scale(1.25); background: var(--pink); color: var(--on-accent); } 100% { transform: none; } }

/* ---- film view: same frame as the book, the video fills the stage ---- */
.film-view:has(.no-words) { grid-template-rows: auto minmax(0, 1fr); }
.book-stage.no-words { grid-template-columns: minmax(0, 1fr); }
.film-stage { min-height: 0; display: flex; align-items: center; justify-content: center; container-type: size; }
.film-full {
  width: min(100cqw, calc(100cqh * var(--ratio-video-n))); height: auto; aspect-ratio: var(--ratio-video);
  border-radius: var(--radius-md); background: var(--ink); box-shadow: var(--shadow-soft);
}
.film-full:focus { outline: none; }

/* ---- disclosure: every <summary> (page list, quiz peek, fact cards) ---- */
summary { display: list-item; min-height: var(--control-sm); padding-block: var(--space-2); font-weight: var(--fw-bold); color: var(--link); }
summary:hover { text-decoration: underline; text-decoration-thickness: var(--ring-w); }

/* ---- page list: every page's picture and words as plain HTML (part page, under the reader) ---- */
.page-list { display: grid; gap: var(--space-4); list-style: none; padding: 0; margin-top: var(--space-4); }
.page-item { display: grid; gap: var(--space-4); align-items: center; }
.page-item img { display: block; width: 100%; aspect-ratio: var(--ratio-photo); object-fit: cover; border-radius: var(--radius-md); }
.page-num { font-size: var(--text-small); font-weight: var(--fw-heavy); color: var(--muted); }
@media (min-width: 40rem) { .page-item { grid-template-columns: var(--media-col) 1fr; } }

/* ---- quiz: big answer pills, a cheer line, a peek at the answer. No scores. ---- */
.quiz-list { list-style: none; padding: 0; }
.quiz-opt {
  min-height: var(--control-md); padding: var(--space-2) var(--space-5);
  border: var(--outline-w) solid var(--outline); border-radius: var(--radius-pill);
  background: var(--card); color: var(--text); box-shadow: var(--shadow-btn);
  font: var(--fw-bold) var(--text-body)/var(--lh-tight) var(--font-body);
  transition: transform var(--dur-1) var(--ease), background-color var(--dur-1) var(--ease), opacity var(--dur-1) var(--ease);
}
.quiz-opt:hover { background: var(--sky); }
.quiz-opt:active { transform: scale(0.97); }
.quiz-opt.is-right { background: var(--gold); border-color: var(--outline); color: var(--on-accent); animation: pop var(--dur-4) var(--ease); }
.quiz-opt.is-right::before { content: "\2714\00a0"; }
.quiz-opt[aria-disabled="true"]:not(.is-right) { opacity: var(--opacity-disabled); cursor: not-allowed; text-decoration: line-through; }
.quiz-say { font-weight: var(--fw-heavy); }
.quiz-say:empty { display: none; }
.quiz-peek > p { margin-top: var(--space-2); }

/* ---- fact card: "Did you know?" teaser question; tap to open the true fact ---- */
.fact > summary { display: grid; justify-items: start; gap: var(--space-2); color: var(--text); list-style: none; }
.fact > summary::-webkit-details-marker { display: none; }
.fact > summary h3 { color: var(--text); }
.fact-hint { font-size: var(--text-small); font-weight: var(--fw-heavy); color: var(--link); }
.fact[open] .fact-hint { display: none; }
.fact > * + * { margin-top: var(--space-3); }

/* ---- Spot it!: a picture with a 4 x 3 grid of invisible look-here buttons; found things get a gold ring ---- */
.spot-pic {
  position: relative; max-width: var(--w-narrow); overflow: hidden;
  border: var(--sticker-w) solid var(--sticker); border-radius: var(--radius-lg); box-shadow: var(--shadow-pic);
}
.spot-pic img { display: block; width: 100%; height: auto; }
.spot-grid { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(3, 1fr); }
.spot-cell { padding: 0; border: 0; background: transparent; transition: background-color var(--dur-1) var(--ease); }
.spot-cell:hover { background: color-mix(in srgb, var(--on-ink) 14%, transparent); }
.spot-cell:focus-visible { outline-offset: calc(var(--ring-w) * -1); background: color-mix(in srgb, var(--on-ink) 14%, transparent); }
.spot-ring {
  position: absolute; left: var(--x); top: var(--y); width: var(--w); height: var(--h); pointer-events: none;
  border: var(--ring-w) solid var(--gold); border-radius: var(--radius-md); box-shadow: var(--shadow-pop);
  animation: spot-in var(--dur-3) var(--ease);
}
@keyframes spot-in { from { opacity: 0; transform: scale(1.4); } to { opacity: 1; transform: none; } }
.spot-list li.found { background: var(--gold); border-color: var(--outline); color: var(--on-accent); }
.spot-list li.found::before { content: "\2714\00a0"; }
.spot-ask { font: var(--fw-semi) var(--text-h3)/var(--lh-tight) var(--font-head); }
.spot-say { font-weight: var(--fw-heavy); }
.spot-say:empty { display: none; }
.spot-choices { grid-template-columns: repeat(auto-fill, minmax(min(calc(var(--thumb-min) * 2), 100%), 1fr)); }
.spot-choices button.is-right { border-color: var(--gold); }
.spot-choices button[aria-disabled="true"] { opacity: var(--opacity-disabled); cursor: not-allowed; }

/* ---- footer ---- */
.site-footer {
  padding-block: var(--space-6);
  background:
    var(--sparkle) no-repeat right max(var(--gutter), calc(50% - var(--w-main) / 2)) top var(--space-5) / var(--sparkle-lg),
    repeating-conic-gradient(from 0deg at 50% 140%, var(--burst-ink) 0 var(--burst-step), var(--ink) var(--burst-step) calc(var(--burst-step) * 2));
  color: var(--on-ink);
  border-top: var(--space-2) solid var(--pink);
}
.site-footer a { color: var(--on-ink); text-decoration-color: var(--pink); }
.site-footer .cluster { gap: var(--space-2) var(--space-5); }

/* ---- style guide page only (design-system.html) ---- */
.ds-grid { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fill, minmax(min(9rem, 100%), 1fr)); }
.sw { overflow: hidden; background: var(--card); border: var(--border) solid var(--line); border-radius: var(--radius-md); font-size: var(--text-small); }
.sw > i { display: block; height: var(--space-8); background: var(--c); border-bottom: var(--hair) solid var(--line); }
.sw > span { display: block; padding: var(--space-2) var(--space-3); }
.sw b { display: block; }
.sw-bg { --c: var(--bg); } .sw-bg2 { --c: var(--bg2); } .sw-card { --c: var(--card); } .sw-text { --c: var(--text); }
.sw-muted { --c: var(--muted); } .sw-primary { --c: var(--primary); } .sw-link { --c: var(--link); } .sw-pink { --c: var(--pink); }
.sw-gold { --c: var(--gold); } .sw-teal { --c: var(--teal); } .sw-line { --c: var(--line); } .sw-focus { --c: var(--focus); }
.sw-ink { --c: var(--ink); } .sw-sky { --c: var(--sky); } .sw-hot { --c: var(--hot); } .sw-burst { --c: var(--burst-a); }
.ds-specimen { display: grid; gap: var(--space-1) var(--space-5); align-items: baseline; }
@media (min-width: 40rem) { .ds-specimen { grid-template-columns: var(--media-col) 1fr; } }
.ds-specimen > code, .ds-bar-row > code { color: var(--muted); font-size: var(--text-small); }
.ds-bar-row { display: grid; gap: var(--space-1) var(--space-4); align-items: center; }
@media (min-width: 40rem) { .ds-bar-row { grid-template-columns: var(--media-col) 1fr; } }
.ds-bar { display: block; height: var(--space-4); background: var(--primary); border-radius: var(--radius-sm); }
.sp-1 { width: var(--space-1); } .sp-2 { width: var(--space-2); } .sp-3 { width: var(--space-3); } .sp-4 { width: var(--space-4); }
.sp-5 { width: var(--space-5); } .sp-6 { width: var(--space-6); } .sp-7 { width: var(--space-7); } .sp-8 { width: var(--space-8); }
.ds-wide { width: min(100%, var(--w-main)); } .ds-narrow { width: min(100%, var(--w-narrow)); }
.ds-radius { display: grid; place-items: center; height: var(--space-8); padding: var(--space-2); background: var(--bg2); border: var(--outline-w) solid var(--edge); font-size: var(--text-small); text-align: center; }
.rad-sm { border-radius: var(--radius-sm); } .rad-md { border-radius: var(--radius-md); } .rad-lg { border-radius: var(--radius-lg); } .rad-pill { border-radius: var(--radius-pill); }
.ds-shadow { display: grid; place-items: center; height: var(--space-8); padding: var(--space-2); background: var(--card); border-radius: var(--radius-md); font-size: var(--text-small); }
.sh-card { box-shadow: var(--shadow-card); border: var(--outline-w) solid var(--edge); } .sh-pop { box-shadow: var(--shadow-pop); }
.sh-btn { box-shadow: var(--shadow-btn); border: var(--outline-w) solid var(--outline); } .sh-pic { box-shadow: var(--shadow-pic); border: var(--sticker-w) solid var(--sticker); }
.ds-code { padding: 0 var(--space-1); background: var(--bg2); border-radius: var(--radius-sm); font-size: var(--text-small); }
.ds-frame { height: 22rem; overflow: hidden; border: var(--border) dashed var(--line); border-radius: var(--radius-lg); }
.ds-frame .book { position: static; z-index: auto; height: 100%; }
.ds-focus { outline: var(--ring-w) solid var(--focus); outline-offset: var(--ring-offset); }
.ds-icon { display: block; width: min(100%, 12rem); margin-inline: auto; transform: rotate(var(--tilt)); filter: drop-shadow(0 var(--lift-y) 0 var(--lift)); }
.ds-burst {
  position: relative; display: grid; place-items: center; min-height: 10rem; padding: var(--space-5);
  border: var(--outline-w) solid var(--edge); border-radius: var(--radius-lg); text-align: center; font-weight: var(--fw-bold);
  background: radial-gradient(circle at 50% 50%, var(--bg) 0 22%, transparent 60%),
    repeating-conic-gradient(from -6deg at 50% 50%, var(--burst-a) 0 var(--burst-step), var(--burst-b) var(--burst-step) calc(var(--burst-step) * 2));
}
.ds-sparkle { position: absolute; top: var(--space-3); right: var(--space-4); width: var(--sparkle-lg); height: var(--sparkle-lg); background: var(--sparkle) no-repeat center / contain; }

/* ==========================================================================
   5 UTILITIES (few)
   ========================================================================== */
.text-center { text-align: center; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* small screens */
@media (max-width: 40rem) {
  .nav a { padding-inline: var(--space-2); }
  .brand img { height: var(--logo-h-sm); }
}

/* menu button: hidden on wide screens; on phones and small tablets the header is one slim row */
.menu-btn { display: none; }
@media (max-width: 60rem) {
  .js .site-header .wrap { flex-wrap: nowrap; gap: var(--space-2); padding-block: var(--space-2); position: relative; }
  .js .brand img { height: var(--logo-h-sm, 34px); }
  .js .site-header .theme-btn { order: 2; flex: none; }
  .js .menu-btn {
    order: 3; display: inline-flex; align-items: center; gap: var(--space-1); flex: none;
    min-height: var(--control-sm); padding: 0 var(--space-3) 0 var(--space-2); cursor: pointer;
    border: var(--outline-w-sm) solid var(--edge); border-radius: var(--radius-pill);
    background: var(--card); color: var(--text); font: var(--fw-bold) var(--text-body) var(--font-body);
    box-shadow: 0 calc(var(--lift-y) / 2) 0 var(--lift);
  }
  .menu-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; }
  .menu-btn path { transition: transform .25s var(--ease), opacity .2s; transform-origin: 12px 12px; }
  .menu-open .menu-btn .l1 { transform: translateY(5px) rotate(45deg); }
  .menu-open .menu-btn .l2 { opacity: 0; }
  .menu-open .menu-btn .l3 { transform: translateY(-5px) rotate(-45deg); }
  .js .site-header nav {
    order: 4; position: absolute; left: 0; right: 0; top: 100%;
    margin-top: var(--outline-w); padding: var(--space-3) var(--space-4) var(--space-4);
    background: var(--bg); border-bottom: var(--outline-w) solid var(--edge);
    box-shadow: 0 14px 24px rgba(13, 36, 48, .18);
    display: none;
  }
  .js .menu-open nav { display: block; animation: rise-in .25s var(--ease) both; }
  .js .site-header .nav { flex-direction: column; gap: var(--space-1); margin: 0; }
  .js .site-header .nav a { display: flex; width: 100%; min-height: 48px; padding-inline: var(--space-4); font-size: 1.1rem; }
}
@keyframes rise-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ==========================================================================
   6 DARK-MODE OVERRIDES
   Tokens that change. Keep the two blocks identical: [data-theme="dark"] is what
   the toggle sets; the media block covers a first visit before the script runs.
   ========================================================================== */
:root[data-theme="dark"] {
  --bg: #0D2430; --bg2: #133142; --card: #173B4F; --text: #FFF8EC; --muted: #B7CCD3;
  --primary: #4CC4EA; --on-primary: #0D2430; --link: #8EDCF5;
  --line: #2D5568; --focus: #FFD36E; --sky: #143A4C;
  --edge: #4FA9CC; --sticker: #FFF8EC; --lift: #06141B;
  --burst-a: #15384B; --burst-b: #102C3A; --burst-ink: #133447;
  --shadow-card: 0 var(--lift-y-lg) 0 var(--lift), 0 14px 26px rgba(0, 0, 0, 0.35);
  --shadow-pic: 0 0 0 var(--outline-w) var(--outline), 0 14px 24px rgba(0, 0, 0, 0.45);
  --shadow-soft: 0 10px 28px rgba(0, 0, 0, 0.4);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #0D2430; --bg2: #133142; --card: #173B4F; --text: #FFF8EC; --muted: #B7CCD3;
    --primary: #4CC4EA; --on-primary: #0D2430; --link: #8EDCF5;
    --line: #2D5568; --focus: #FFD36E; --sky: #143A4C;
    --edge: #4FA9CC; --sticker: #FFF8EC; --lift: #06141B;
    --burst-a: #15384B; --burst-b: #102C3A; --burst-ink: #133447;
    --shadow-card: 0 var(--lift-y-lg) 0 var(--lift), 0 14px 26px rgba(0, 0, 0, 0.35);
    --shadow-pic: 0 0 0 var(--outline-w) var(--outline), 0 14px 24px rgba(0, 0, 0, 0.45);
    --shadow-soft: 0 10px 28px rgba(0, 0, 0, 0.4);
    color-scheme: dark;
  }
}
/* the horizontal logo has a light and a dark file */
:root[data-theme="dark"] .brand img.logo-light { display: none; }
:root[data-theme="dark"] .brand img.logo-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .brand img.logo-light { display: none; }
  :root:not([data-theme]) .brand img.logo-dark { display: block; }
}
:root[data-theme="dark"] .theme-btn .ti-sun g { stroke: #F3CF72; }


/* =================================================================================================
   MOTION (all of it switches off under prefers-reduced-motion, see the rule near the top)
   ================================================================================================= */
@property --burst-rot { syntax: "<angle>"; inherits: true; initial-value: 0deg; }
@media (prefers-reduced-motion: no-preference) {
  /* hero: the sunburst turns slowly, sparkles twinkle, bubbles rise, everything pops in once */
  .section-hero { animation: burst-spin 90s linear infinite; }
  @keyframes burst-spin { to { --burst-rot: 360deg; } }
  .section-hero::before { animation: twinkle 3.2s var(--ease) infinite; }
  .section-hero::after { animation: twinkle 2.6s var(--ease) 1.1s infinite; }
  @keyframes twinkle { 0%, 100% { transform: scale(1) rotate(0); opacity: 1; } 50% { transform: scale(.65) rotate(25deg); opacity: .7; } }
  .section-hero .kicker { animation: pop-in .5s var(--ease) both, wiggle 5s ease-in-out 1.5s infinite; display: inline-block; }
  .section-hero .tagline { animation: rise-in .6s var(--ease) .08s both; }
  .section-hero h1 { animation: rise-in .7s var(--ease) .16s both; }
  .section-hero .lead, .section-hero .lead + p { animation: rise-in .7s var(--ease) .26s both; }
  .section-hero #hero-actions { animation: rise-in .7s var(--ease) .36s both; }
  .section-hero .player { animation: swing-in .9s cubic-bezier(.3, 1.5, .5, 1) .2s both; }
  @keyframes pop-in { from { opacity: 0; transform: scale(.4) rotate(-12deg); } to { opacity: 1; transform: none; } }
  @keyframes rise-in { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
  @keyframes swing-in { from { opacity: 0; transform: rotate(8deg) translateY(30px) scale(.92); } to { opacity: 1; transform: rotate(var(--tilt-pic)); } }
  @keyframes wiggle { 0%, 86%, 100% { transform: rotate(0); } 89% { transform: rotate(-6deg); } 92% { transform: rotate(5deg); } 95% { transform: rotate(-3deg); } }

  .bubble {
    position: absolute; bottom: -40px; z-index: 0; pointer-events: none;
    width: var(--b, 18px); aspect-ratio: 1; border-radius: 50%;
    border: 2px solid color-mix(in srgb, var(--aqua, #4CC4EA) 75%, white);
    background: radial-gradient(circle at 32% 30%, rgba(255,255,255,.9) 0 14%, rgba(255,255,255,.15) 16% 100%);
    animation: bubble-up var(--d, 11s) linear var(--delay, 0s) infinite;
  }
  @keyframes bubble-up {
    0% { transform: translate(0, 0); opacity: 0; } 10% { opacity: .9; }
    50% { transform: translate(var(--sway, 18px), -55vh); }
    90% { opacity: .8; } 100% { transform: translate(0, -110vh); opacity: 0; }
  }

  /* scroll: things float up as they come into view (site.js adds .reveal, then .in) */
  .reveal { opacity: 0; transform: translateY(26px) scale(.98); transition: opacity .6s var(--ease), transform .7s cubic-bezier(.3, 1.4, .5, 1); transition-delay: calc(var(--i, 0) * 90ms); }
  .reveal.in { opacity: 1; transform: none; }
  .art.reveal { transform: translateY(26px) rotate(0); }
  .art.reveal.in { transform: rotate(var(--tilt-pic)); }

  /* hover: stickers lift and tip, the logo wobbles, the play disc pulses */
  .card, .story-card, .part-card, .tap-box { transition: transform .25s cubic-bezier(.3, 1.6, .5, 1), box-shadow .25s var(--ease); }
  .card:hover, .story-card:hover, .part-card:hover, .tap-box:hover { transform: translateY(-6px) rotate(-1.2deg); }
  .grid-auto > :nth-child(even):hover { transform: translateY(-6px) rotate(1.2deg); }
  .brand:hover img { animation: wobble .6s var(--ease); }
  @keyframes wobble { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-4deg) scale(1.04); } 60% { transform: rotate(3deg); } }
  .teaser-btn .disc, .play-btn .disc { animation: pulse 2.4s ease-in-out infinite; }
  @keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--pink, #F2A2B8) 70%, transparent); } 50% { box-shadow: 0 0 0 10px transparent; } }
  .site-footer .cluster a { display: inline-block; transition: transform .2s cubic-bezier(.3, 1.8, .5, 1); }
  .site-footer .cluster a:hover { transform: translateY(-3px) rotate(-3deg); }
}
