/* =================================================================
   home.css — landing page only. All selectors live under `.home-*`
   so this file never touches the rest of the app.

   Inherits design tokens from base.css (colors, fonts, radii, etc).
   ================================================================= */

.home-hero,
.home-story,
.home-fuel,
.home-pick,
.home-categories,
.home-cta {
  position: relative;
  margin: 0 -32px;        /* break out of the .app 32px side padding */
  padding: 64px 32px;
}
@media (min-width: 1024px) {
  .home-hero,
  .home-story,
  .home-fuel,
  .home-pick,
  .home-categories,
  .home-cta {
    padding: 96px 32px;
  }
}

.home-section-head {
  /* No hard cap on the head itself: long titles (e.g. "A mascot, a meadow,
     and a tank to refill.") need to extend past 760 px on wide screens so
     they stay on a single line. The eyebrow + sub-copy reapply their own
     reading-width caps below. */
  margin: 0 0 40px;
}
.home-section-head--center {
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}
.home-section-title {
  font-family: var(--font-h);
  font-weight: 900;
  font-size: clamp(28px, 3.6vw, 44px);
  line-height: 1.08;
  letter-spacing: -0.01em;
  margin: 8px 0 12px;
  color: var(--text);
  /* Don't break to a new line just because the parent is narrow — only
     wrap when the viewport actually can't fit the title. `max-content`
     lets the element grow to the natural one-line text width, and
     `max-width: 100%` clamps it to the parent on small screens, which
     re-enables normal wrapping. */
  width: max-content;
  max-width: 100%;
  text-wrap: balance;
}
.home-section-sub {
  /* Keep body copy at a comfortable reading width even though the head
     itself no longer caps. */
  font-size: clamp(15px, 1.6vw, 18px);
  color: var(--text-muted);
  max-width: 640px;
  margin: 0;
}
.home-section-head--center .home-section-title,
.home-section-head--center .home-section-sub {
  margin-left: auto;
  margin-right: auto;
}
.home-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(123, 77, 255, 0.14);
  color: var(--purple-light);
  font-family: var(--font-h);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.home-eyebrow i {
  width: 14px;
  height: 14px;
}
.home-grad {
  background: linear-gradient(135deg, #FFD18A 0%, #F5A623 35%, #FF7BB0 70%, #AA8AFF 100%);
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
}

/* =================================================================
   Reveal animation — gated by prefers-reduced-motion in JS
   ================================================================= */
[data-reveal],
.home-scene {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .7s var(--easing), transform .7s var(--easing);
  will-change: opacity, transform;
}
[data-reveal].is-revealed,
.home-scene.is-revealed {
  opacity: 1;
  transform: none;
}

/* =================================================================
   Buttons — aligned with the brand pattern from lesson.html .btn-primary
   (warm orange gradient + dark text + soft warm shadow). Pill shape
   matches the rest of the home page's rounded language.
   ================================================================= */
.home-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 24px;
  border-radius: 999px;
  font-family: var(--font-b);            /* match brand body font */
  font-weight: 700;
  font-size: 16px;
  line-height: 1;
  letter-spacing: 0.005em;
  text-decoration: none;
  border: 1px solid transparent;
  transition: transform .15s var(--easing),
              box-shadow .2s var(--easing),
              background .2s, color .2s, border-color .2s;
}
.home-btn i {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.home-btn--lg {
  padding: 18px 30px;
  font-size: 18px;
}
.home-btn:active { transform: translateY(1px); }
.home-btn:focus-visible {
  outline: 3px solid rgba(245, 166, 35, 0.55);
  outline-offset: 3px;
}

/* Primary CTA — warm orange gradient, dark text, brand-aligned with
   .btn-primary in lesson.html. The thin top highlight + warm shadow
   give it depth without the gimmicky conic glow we had before. */
.home-btn--primary {
  background: linear-gradient(135deg, #F5A623 0%, #FFCC66 100%);
  color: #2A1B02;
  font-weight: 800;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    inset 0 -1px 0 rgba(0, 0, 0, 0.12),
    0 12px 28px rgba(245, 166, 35, 0.38);
}
@media (hover: hover) { .home-btn--primary:hover {
  transform: translateY(-2px);
  background: linear-gradient(135deg, #FFB13C 0%, #FFD580 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.6),
    inset 0 -1px 0 rgba(0, 0, 0, 0.12),
    0 18px 38px rgba(245, 166, 35, 0.55);
} }

/* Optional shine sweep — runs once on hover. We keep the .home-btn__glow
   element so existing markup still works, but it's now a subtle white
   shine rather than the giant rotating conic blur. */
.home-btn__glow {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
  opacity: 0;                            /* hidden until hover */
  transition: opacity .2s;
}
.home-btn__glow::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 40%;
  left: -50%;
  background: linear-gradient(105deg,
    transparent 0%,
    rgba(255, 255, 255, 0.55) 50%,
    transparent 100%);
  transform: skewX(-18deg);
}
@media (hover: hover) { .home-btn--primary:hover .home-btn__glow { opacity: 1; } }
@media (hover: hover) { .home-btn--primary:hover .home-btn__glow::before {
  animation: home-btn-shine 0.9s var(--easing) forwards;
} }
@keyframes home-btn-shine {
  to { left: 110%; }
}
.home-btn > i,
.home-btn > span { position: relative; z-index: 1; }

/* Secondary CTA — glass pill with the dark theme brand surface */
.home-btn--ghost {
  color: var(--text);
  background: var(--card-fill);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}
@media (hover: hover) { .home-btn--ghost:hover {
  background: var(--card-hover);
  border-color: var(--card-border-hover);
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.24);
} }
@media (prefers-reduced-motion: reduce) {
  @media (hover: hover) { .home-btn,
  .home-btn__glow,
  .home-btn--primary:hover .home-btn__glow::before { animation: none !important; } }
  @media (hover: hover) { .home-btn:hover { transform: none; } }
}

/* =================================================================
   Hero — full-width text-only intro
   =================================================================
   Cosmic ambience is provided entirely by the global
   <canvas id="starfield"> behind the page. The hero itself is just
   centered copy + CTA + stats — no decorative gradients, mascot
   art, or in-hero starfield. Designed for AA contrast and mobile.
   ================================================================= */
.home-hero {
  position: relative;
  padding-top: clamp(48px, 8vh, 96px);
  padding-bottom: clamp(72px, 12vh, 140px);
  min-height: clamp(560px, 80vh, 820px);
  display: flex;
  align-items: center;
  justify-content: center;
  isolation: isolate;
}

/* (The cosmic starfield canvas + its CSS now live globally in
   base.html / base.css, so every page extending base.html — worlds,
   categories, world detail, etc. — gets the same "space theme"
   without re-declaring it here.) */

/* ---------- Layout ----------
   Single full-width centered column. No grid split — the mascot
   stage was removed. Text is centered for a clean modern landing
   pattern that reads well on every screen size. */
.home-hero__inner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 0 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 28px;
}
@media (min-width: 720px) {
  .home-hero__inner { gap: 32px; }
}

/* ---------- Eyebrow ---------- */
.home-eyebrow--live {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(170, 138, 255, 0.45);
  color: #F1EBFF;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.home-eyebrow__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #34D399;
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.18);
  animation: home-dot 1.6s ease-in-out infinite;
}
@keyframes home-dot {
  0%, 100% { box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.18); }
  50%      { box-shadow: 0 0 0 8px rgba(52, 211, 153, 0.06); }
}

/* ---------- Title ----------
   Solid colours only — no gradient text — so the headline reads
   crisply at every size and stays accessible to color-blind users.
   `text-wrap: balance` keeps both lines visually even. */
.home-hero__title {
  font-family: var(--font-h);
  font-weight: 900;
  font-size: clamp(44px, 9vw, 104px);
  line-height: 1.02;
  letter-spacing: -0.025em;
  margin: 0;
  color: var(--text);
  text-wrap: balance;
  max-width: 18ch;
}
.home-shimmer {
  color: #FFB74D;          /* solid brand orange — high contrast on dark sky */
}

/* ---------- Sub copy ----------
   Bumped to a higher-contrast white-purple so the body text comfortably
   passes WCAG AA on the cosmic background, and capped at ~60ch for
   readable line length. */
.home-hero__sub {
  font-size: clamp(17px, 2vw, 21px);
  line-height: 1.6;
  color: #E6E1F8;
  max-width: 60ch;
  margin: 0 auto;
}

.home-mark {
  background: transparent;
  color: var(--text);
  font-weight: 800;
  padding: 0 4px;
  border-radius: 3px;
  /* Solid orange highlighter line — replaces the previous CSS gradient
     so the mark reads as a clean accent under the text. */
  box-shadow: inset 0 -0.32em 0 rgba(245, 166, 35, 0.55);
}

/* ---------- CTA row ----------
   Centered, wrapping, generous tap targets (≥48 px high via .home-btn).
   Keep buttons side-by-side from 480 px up; stack and full-width below
   that for one-thumb mobile use. */
.home-hero__cta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  width: 100%;
}
.home-hero .home-btn { overflow: hidden; }

@media (max-width: 480px) {
  .home-hero__cta { flex-direction: column; align-items: stretch; }
  .home-hero__cta .home-btn { width: 100%; justify-content: center; }
}

/* ---------- Microcopy ---------- */
.home-hero__microcopy {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #C5BCDD;
  margin: 0;
}
.home-hero__microcopy i {
  width: 16px;
  height: 16px;
  color: #34D399;
}

/* ---------- Stats ----------
   Solid white numerals (no gradient) for crisp legibility.
   Subtle translucent panel — no decorative gradient, just a soft
   tint so the strip reads as a card on top of the starfield. */
.home-hero__stats {
  list-style: none;
  margin: 0;
  padding: 18px 24px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.10);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  width: 100%;
  max-width: 520px;
}
.home-hero__stats li {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.home-hero__stats-num {
  font-family: var(--font-h);
  font-weight: 900;
  font-size: clamp(22px, 3.6vw, 28px);
  line-height: 1;
  color: #FFFFFF;
}
.home-hero__stats-label {
  font-size: 12px;
  color: #B6ACD0;
  letter-spacing: 0.02em;
  text-align: center;
}

@media (max-width: 480px) {
  .home-hero__stats { padding: 16px 18px; }
  .home-hero__stats-label { font-size: 11px; }
}

/* (Removed) Mascot stage, orbits, halo, platform, fuel-card, chip-card.
   The hero is now text-only; cosmic ambience comes from the global
   <canvas id="starfield"> + the deep `--bg` colour. */

/* ---------- Scroll cue (now a labeled pill) ---------- */
.home-scroll-cue {
  position: absolute;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--card-border);
  background: var(--card-fill);
  color: var(--text-muted);
  font-family: var(--font-h);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.02em;
  text-decoration: none;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: color .15s, background .15s, border-color .15s;
}
@media (hover: hover) { .home-scroll-cue:hover {
  color: var(--text);
  background: var(--card-hover);
  border-color: var(--card-border-hover);
} }
.home-scroll-cue i {
  width: 16px;
  height: 16px;
  animation: home-cue-arrow 1.8s ease-in-out infinite;
}
@keyframes home-cue-arrow {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(4px); }
}

/* ---------- Reduced motion: kill the remaining hero animations ---------- */
@media (prefers-reduced-motion: reduce) {
  .home-eyebrow__dot,
  .home-btn__glow,
  .home-scroll-cue i { animation: none !important; }
}

/* ---------- Responsive: tighter hero on smaller phones ---------- */
@media (max-width: 720px) {
  .home-hero { min-height: auto; padding-top: 56px; padding-bottom: 80px; }
}
@media (max-width: 480px) {
  .home-hero__stats { grid-template-columns: 1fr 1fr; }
  .home-hero__stats li:last-child { grid-column: span 2; }
}

/* =================================================================
   Story scenes — the meaty bit. Big alternating panels with
   blended JPGs + chapter numbers.
   ================================================================= */
/* No section-local backdrop — the global cosmic starfield in `base.html`
   provides all atmosphere here. Adding a radial-gradient tint produced a
   visible darker rectangle at the top of the story section, breaking the
   seamless space feel. */

.home-scenes {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 96px;
  max-width: 1280px;
  margin: 0 auto;
}
@media (min-width: 900px) {
  .home-scenes { gap: 140px; }
}

.home-scene {
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
  align-items: center;
}
@media (min-width: 900px) {
  .home-scene {
    grid-template-columns: 1.05fr 1fr;
    gap: 56px;
  }
  .home-scene[data-side="right"] {
    grid-template-columns: 1fr 1.05fr;
  }
  .home-scene[data-side="right"] .home-scene__media { order: 2; }
  .home-scene[data-side="right"] .home-scene__copy  { order: 1; }
}

/* ---------- Scene image: the edge-blending treatment -----------
   Strategy: the JPG is masked twice — first by a soft elliptical
   radial gradient (kills the rectangle silhouette) and second by an
   even softer inverse vignette. The frame itself has NO border-radius
   so the mask alone defines the shape; nothing ever shows a hard edge.
*/
.home-scene__media {
  position: relative;
  margin: 0;
  isolation: isolate;
  padding: 2% 2%;          /* small breathing room for the halo */
}

/* The frame is the rounded-rect crop. `overflow: hidden` clips the img
   and any in-frame overlays (noise, twinkle) to the rounded shape.
   The "border" is rendered as an outer box-shadow ring so it doesn't
   eat into the frame's content area — otherwise a 1px sliver of the
   frame background would show between the image and the rounded edge,
   which reads as a thin dark band on photos with dark edge content. */
.home-scene__frame {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  border-radius: 28px;
  aspect-ratio: 16 / 10;   /* uniform crop for all five scenes */
  background: rgba(12, 4, 30, 0.45);
  box-shadow:
    0 18px 48px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(255, 255, 255, 0.10);
}

/* Outer purple halo — sits BEHIND the frame and bleeds past it via a
   negative-inset positioned wrap. Rendered on the parent so we can keep
   `overflow: hidden` on the frame for clean rounded clipping. */
.home-scene__media::before {
  content: "";
  position: absolute;
  inset: -8% -6%;
  z-index: -1;
  background:
    radial-gradient(50% 45% at 50% 50%,
      rgba(170, 138, 255, 0.55), transparent 70%),
    radial-gradient(70% 55% at 50% 50%,
      rgba(123, 77, 255, 0.30), transparent 75%);
  filter: blur(60px);
  opacity: 0.95;
  pointer-events: none;
}

/* The image itself — absolutely positioned with `inset: 0` so it
   covers the rounded frame edge-to-edge with no sliver of frame
   background visible. `object-fit: cover` keeps the aspect ratio. */
.home-scene__frame img {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* Subtle film-grain overlay for unified texture. Clipped by the frame's
   `overflow: hidden`, so it follows the rounded corners automatically. */
.home-scene__noise {
  position: absolute;
  inset: 0;
  pointer-events: none;
  mix-blend-mode: overlay;
  opacity: 0.07;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='0.9'/></svg>");
}

/* Tiny twinkle particles in front of the frame for atmosphere. */
.home-scene__twinkle {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.home-scene__twinkle span {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.85));
  animation: home-twinkle 3s ease-in-out infinite;
}
.home-scene__twinkle span:nth-child(1) { top: 8%;  left: 12%; animation-delay: 0s;   }
.home-scene__twinkle span:nth-child(2) { top: 18%; left: 78%; animation-delay: 0.7s; width: 4px; height: 4px; }
.home-scene__twinkle span:nth-child(3) { top: 70%; left: 84%; animation-delay: 1.4s; width: 5px; height: 5px; }
.home-scene__twinkle span:nth-child(4) { top: 86%; left: 16%; animation-delay: 2.1s; width: 4px; height: 4px; }
@keyframes home-twinkle {
  0%, 100% { opacity: 0;   transform: scale(0.6); }
  50%      { opacity: 0.9; transform: scale(1);   }
}
@media (prefers-reduced-motion: reduce) {
  .home-scene__twinkle span { animation: none; opacity: 0.6; }
}

/* Big glowing chapter number, anchored to the top corner */
.home-scene__num {
  position: absolute;
  top: -28px;
  left: -12px;
  z-index: 3;
  margin: 0;
}
@media (min-width: 900px) {
  .home-scene__num { top: -36px; left: -24px; }
  .home-scene[data-side="right"] .home-scene__num { left: auto; right: -24px; }
}
.home-scene__num span {
  display: inline-block;
  font-family: var(--font-h);
  font-weight: 900;
  font-size: clamp(56px, 9vw, 120px);
  line-height: 1;
  background: linear-gradient(135deg, #FFD18A 0%, #F5A623 40%, #FF7BB0 80%, #AA8AFF 100%);
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
  filter: drop-shadow(0 8px 24px rgba(245, 166, 35, 0.35));
  letter-spacing: -0.04em;
}

/* If the image fails to load, swap to a coloured placeholder
   so the layout doesn't collapse. */
.home-scene__frame.is-broken img { display: none; }
.home-scene__frame.is-broken {
  aspect-ratio: 16 / 9;
  background:
    radial-gradient(ellipse at center, rgba(123, 77, 255, 0.4), transparent 70%),
    var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}
.home-scene__frame.is-broken::after {
  content: "scene art coming soon";
  font-family: var(--font-h);
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* ---------- Scene copy (right of the image) ----------- */
.home-scene__copy { padding: 8px 0; }
.home-scene__chapter {
  display: inline-block;
  font-family: var(--font-h);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--purple-light);
  margin-bottom: 12px;
}
.home-scene__title {
  font-family: var(--font-h);
  font-weight: 900;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin: 0 0 16px;
  color: var(--text);
}
.home-scene__body {
  font-size: clamp(17px, 1.6vw, 20px);
  line-height: 1.6;
  color: var(--text-soft);
  margin: 0;
  max-width: 540px;
}
.home-scene__body em {
  font-style: normal;
  background: linear-gradient(180deg, transparent 60%, rgba(245, 166, 35, 0.35) 60%);
  padding: 0 2px;
  font-weight: 700;
  color: var(--text);
}
.home-scene__body strong {
  color: var(--text);
  font-weight: 800;
}

/* =================================================================
   Knowledge Fuel meter
   ================================================================= */
.home-fuel {
  padding-top: 32px;
  padding-bottom: 32px;
}
.home-fuel__inner {
  max-width: 920px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 20px;
  align-items: center;
  padding: 24px;
  border-radius: 24px;
  background: var(--card-fill);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.home-fuel__icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #F5A623 0%, #FFD700 100%);
  color: #2a1700;
  box-shadow: 0 8px 24px rgba(245, 166, 35, 0.45);
}
.home-fuel__icon i { width: 26px; height: 26px; }
.home-fuel__label {
  font-family: var(--font-h);
  font-weight: 700;
  font-size: 15px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.home-fuel__bar {
  position: relative;
  height: 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--card-border);
  overflow: hidden;
}
.home-fuel__fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--fill, 0%);
  background: linear-gradient(90deg, #7B4DFF 0%, #F5A623 100%);
  border-radius: 999px;
  transition: width 1.6s var(--easing);
  overflow: hidden;
}
.home-fuel__shine {
  position: absolute;
  top: 0; bottom: 0;
  width: 30%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.45), transparent);
  animation: home-shine 2.4s linear infinite;
}
@keyframes home-shine {
  0%   { transform: translateX(-120%); }
  100% { transform: translateX(420%); }
}
@media (prefers-reduced-motion: reduce) {
  .home-fuel__shine { animation: none; }
}
.home-fuel__ticks {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4%;
  pointer-events: none;
}
.home-fuel__ticks span {
  width: 2px;
  height: 8px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 2px;
}
.home-fuel__caption {
  margin-top: 8px;
  font-size: 14px;
  color: var(--text-muted);
}
.home-fuel__caption strong {
  color: var(--text);
  font-weight: 800;
}

/* =================================================================
   Age picker — the call-to-action grid
   ================================================================= */
/* No section-local backdrop — same reasoning as `.home-story`: the
   global cosmic starfield in `base.html` carries the atmosphere, and
   any radial-gradient tint here renders as a visible darker band at
   the section boundary. */
.home-age-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: 1fr;
  max-width: 1180px;
  margin: 0 auto;
}
@media (min-width: 600px)  { .home-age-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px)  { .home-age-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1400px) { .home-age-grid { grid-template-columns: repeat(6, 1fr); } }

/* Frosted-glass age cards — the global `--card-fill` (4% white) is too
   faint to read as a container against the starfield, so we paint our
   own glass: a slightly opaque inner gradient + stronger border + a
   real backdrop blur so the cosmic background is softened behind the
   card. The hover state lifts and warms it with a purple→orange wash
   to echo the brand mascot's energy. */
.home-age-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
  text-decoration: none;
  color: inherit;
  border-radius: 22px;
  background:
    linear-gradient(160deg,
      rgba(255, 255, 255, 0.10) 0%,
      rgba(255, 255, 255, 0.04) 60%,
      rgba(123, 77, 255, 0.06) 100%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.10),
    0 14px 32px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  overflow: hidden;
  transition: transform .2s var(--easing), border-color .2s, background .2s, box-shadow .2s;
}
.home-age-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 20% 0%,
    rgba(123, 77, 255, 0.22), transparent 55%);
  opacity: 0;
  transition: opacity .25s;
}
@media (hover: hover) { .home-age-card:hover {
  transform: translateY(-4px);
  border-color: rgba(170, 138, 255, 0.55);
  background:
    linear-gradient(160deg,
      rgba(255, 255, 255, 0.14) 0%,
      rgba(170, 138, 255, 0.10) 60%,
      rgba(245, 166, 35, 0.08) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    0 24px 48px rgba(123, 77, 255, 0.28);
} }
@media (hover: hover) { .home-age-card:hover::before { opacity: 1; } }

.home-age-card__badge {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: linear-gradient(135deg,
    rgba(123, 77, 255, 0.32) 0%,
    rgba(245, 166, 35, 0.28) 100%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  flex-shrink: 0;
}
.home-age-card__badge img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.35));
}
.home-age-card__num {
  position: absolute;
  bottom: -8px;
  right: -8px;
  font-family: var(--font-h);
  font-weight: 900;
  font-size: 14px;
  padding: 5px 10px;
  border-radius: 999px;
  background: #fff;
  color: var(--purple-dark);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.home-age-card__body { flex: 1; }
.home-age-card__title {
  font-family: var(--font-h);
  font-weight: 800;
  font-size: 19px;
  color: var(--text);
  margin-bottom: 4px;
}
.home-age-card__sub {
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-muted);
}
.home-age-card__cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-family: var(--font-h);
  font-weight: 700;
  font-size: 14px;
  color: var(--purple-light);
}
.home-age-card__cta i { width: 16px; height: 16px; transition: transform .2s; }
@media (hover: hover) { .home-age-card:hover .home-age-card__cta i { transform: translateX(4px); } }

/* =================================================================
   Categories preview strip
   ================================================================= */
.home-categories { padding-bottom: 64px; }
.home-cat-strip {
  display: flex;
  flex-wrap: wrap;
  /* Centre each row so chips fan out symmetrically from the middle —
     with the world list shuffled per request (see `home()` in
     app/routes/lessons.py) this gives a "colourful confetti" feel where
     vibrant chips pop out on both sides of every row instead of all
     hugging the left edge with a ragged right margin. */
  justify-content: center;
  gap: 10px;
  max-width: 1280px;
  margin: 0 auto;
}
.home-cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(var(--world-color-rgb), 0.14);
  border: 1px solid rgba(var(--world-color-rgb), 0.30);
  color: var(--text);
  font-family: var(--font-h);
  font-weight: 700;
  font-size: 14px;
}
.home-cat-chip__icon {
  display: inline-flex;
  width: 24px;
  height: 24px;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: rgba(var(--world-color-rgb), 0.30);
  color: var(--world-color);
}
.home-cat-chip__icon i { width: 14px; height: 14px; }

/* =================================================================
   Final CTA
   ================================================================= */
.home-cta {
  padding-bottom: 80px;
}
.home-cta__inner {
  max-width: 1080px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  align-items: center;
  padding: 36px;
  border-radius: 28px;
  background:
    radial-gradient(circle at 0% 0%, rgba(123, 77, 255, 0.32), transparent 55%),
    radial-gradient(circle at 100% 100%, rgba(245, 166, 35, 0.20), transparent 55%),
    var(--card-fill);
  border: 1px solid var(--card-border);
  position: relative;
  overflow: hidden;
}
@media (min-width: 700px) {
  .home-cta__inner {
    grid-template-columns: auto 1fr;
    padding: 48px;
  }
}
.home-cta__mascot {
  width: 160px;
  height: auto;
  filter: drop-shadow(0 18px 40px rgba(123, 77, 255, 0.45));
}
@media (min-width: 700px) {
  .home-cta__mascot { width: 200px; }
}
.home-cta__title {
  font-family: var(--font-h);
  font-weight: 900;
  font-size: clamp(26px, 3.4vw, 38px);
  line-height: 1.1;
  margin: 0 0 8px;
  color: var(--text);
}
.home-cta__sub {
  font-size: 16px;
  line-height: 1.55;
  color: var(--text-muted);
  margin: 0 0 22px;
  max-width: 540px;
}

/* Age-switcher styles moved to base.css so they're available on every
   directory page (worlds index, category, world) — those templates only
   load base.css and were rendering the picker as flat unstyled text. */

/* =================================================================
   Story narrator — floating mini-player
   -----------------------------------------------------------------
   Appears bottom-right of the viewport once the user clicks
   "Hear the story". Visual language matches .home-hero__fuel-card
   so it reads as part of the cockpit UI.
   ================================================================= */
.home-narrator {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 120;
  width: min(320px, calc(100vw - 32px));
  padding: 14px 16px 12px;
  border-radius: 16px;
  background: rgba(18, 14, 42, 0.82);
  border: 1px solid rgba(170, 138, 255, 0.30);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 22px 46px rgba(0, 0, 0, 0.45);
  color: var(--text);
  transform: translateY(12px);
  opacity: 0;
  animation: home-narrator-in 280ms var(--easing) forwards;
}
/* When the fixed Knowledge-Fuel rail is visible (≥1200 px), the
   narrator's default `right: 20px` puts it directly behind the
   orange pipe + label. Shift it left of the rail so both UIs sit
   side-by-side with breathing room. The rail itself widens (and
   gets a wider gutter) at 1440 px, so adjust the offset there too. */
@media (min-width: 1200px) {
  .home-narrator { right: calc(24px + 68px + 16px); }   /* gutter + pipe + gap */
}
@media (min-width: 1440px) {
  .home-narrator { right: calc(36px + 76px + 20px); }
}
.home-narrator[hidden] { display: none; }
@keyframes home-narrator-in {
  to { transform: none; opacity: 1; }
}

.home-narrator__row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.home-narrator__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, #7B4DFF, #AA8AFF);
  color: #fff;
  flex-shrink: 0;
}
.home-narrator__icon i { width: 16px; height: 16px; }
.home-narrator__label {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--font-h);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.01em;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.home-narrator__bar {
  position: relative;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
  margin-bottom: 10px;
}
.home-narrator__fill {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #7B4DFF, #F5A623);
  border-radius: inherit;
  transition: width .18s linear;
}

.home-narrator__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.home-narrator__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid rgba(170, 138, 255, 0.28);
  background: rgba(123, 77, 255, 0.08);
  color: var(--text);
  font-family: var(--font-h);
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  transition: background .15s var(--easing), border-color .15s var(--easing),
              transform .15s var(--easing);
}
@media (hover: hover) { .home-narrator__btn:hover {
  background: rgba(123, 77, 255, 0.18);
  border-color: rgba(170, 138, 255, 0.50);
} }
.home-narrator__btn:active { transform: translateY(1px); }
.home-narrator__btn i { width: 14px; height: 14px; }
.home-narrator__btn--primary {
  background: linear-gradient(135deg, #7B4DFF 0%, #AA8AFF 100%);
  border-color: transparent;
  color: #fff;
  padding: 0 14px;
  box-shadow: 0 8px 18px rgba(123, 77, 255, 0.28);
}
@media (hover: hover) { .home-narrator__btn--primary:hover {
  background: linear-gradient(135deg, #8a5eff 0%, #b8a0ff 100%);
} }
.home-narrator__btn--close {
  margin-left: auto;
  min-height: 28px;
  width: 28px;
  padding: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-dim, rgba(255, 255, 255, 0.68));
  flex-shrink: 0;
}
@media (hover: hover) { .home-narrator__btn--close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
} }

/* Active-chapter highlight for the scene currently being narrated. */
.home-scene.is-speaking .home-scene__frame {
  box-shadow:
    0 0 0 1px rgba(170, 138, 255, 0.55),
    0 22px 44px rgba(123, 77, 255, 0.35);
  animation: home-scene-speak 2.6s ease-in-out infinite;
}
.home-scene.is-speaking .home-scene__chapter {
  color: #AA8AFF;
}
@keyframes home-scene-speak {
  0%, 100% { box-shadow: 0 0 0 1px rgba(170, 138, 255, 0.45),
                         0 18px 36px rgba(123, 77, 255, 0.28); }
  50%      { box-shadow: 0 0 0 1px rgba(170, 138, 255, 0.75),
                         0 26px 52px rgba(123, 77, 255, 0.42); }
}

/* Small-screen adjustments: stretch the player to the full row. */
@media (max-width: 540px) {
  .home-narrator {
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto;
    padding: 12px 14px 10px;
  }
  .home-narrator__btn--primary span { display: none; }
}

/* Reduced-motion: drop the pulsing glow and entry animation. */
@media (prefers-reduced-motion: reduce) {
  .home-narrator { animation: none; opacity: 1; transform: none; }
  .home-scene.is-speaking .home-scene__frame { animation: none; }
}
