/* ---------- Fonts (self-hosted, no external requests) ---------- */
@font-face { font-family: "Baloo 2"; src: url("/assets/fonts/baloo-2-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Baloo 2"; src: url("/assets/fonts/baloo-2-800.woff2") format("woff2"); font-weight: 800; font-display: swap; }
@font-face { font-family: "Nunito"; src: url("/assets/fonts/nunito-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Nunito"; src: url("/assets/fonts/nunito-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Nunito"; src: url("/assets/fonts/nunito-800.woff2") format("woff2"); font-weight: 800; font-display: swap; }

/* ---------- Design tokens ---------- */
:root {
  --bg: #FFF8EC;
  --surface: #FFFFFF;
  --ink: #1F2433;
  --ink-soft: #4A5168;
  --line: #EADFCB;
  --sun: #FFC53D;   --sun-soft: #FFEFC2;
  --coral: #FF6B6B; --coral-soft: #FFE0DE;
  --teal: #12B886;  --teal-soft: #D3F9EA;
  --violet: #7950F2;--violet-soft: #E9E2FF;
  --sky: #339AF0;   --sky-soft: #DCEEFF;
  --radius: 22px;
  --shadow: 0 6px 0 rgba(31, 36, 51, .12);
  --font-head: "Baloo 2", "Trebuchet MS", system-ui, sans-serif;
  --font-body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  --wrap: 1080px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 1.125rem/1.65 var(--font-body); overflow-x: hidden; }
img { max-width: 100%; height: auto; display: block; }
main { overflow-x: clip; }
a { color: var(--violet); font-weight: 700; }
h1, h2, h3 { font-family: var(--font-head); font-weight: 800; line-height: 1.1; margin: 0 0 .5em; }
h1 { font-size: clamp(2.3rem, 6vw, 4rem); }
h2 { font-size: clamp(1.6rem, 3.6vw, 2.3rem); }
h3 { font-size: 1.4rem; }
p { margin: 0 0 1em; }
.wrap { width: min(100% - 32px, var(--wrap)); margin-inline: auto; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 16px; z-index: 50; background: var(--ink); color: #fff; padding: 8px 12px; border-radius: 8px; }
:focus-visible { outline: 3px solid var(--violet); outline-offset: 3px; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: .4em; border: 3px solid var(--ink); background: var(--sun); color: var(--ink); font: 800 1.05rem/1 var(--font-body); padding: .8em 1.3em; border-radius: 999px; box-shadow: var(--shadow); cursor: pointer; text-decoration: none; transition: transform .15s, box-shadow .15s; }
.btn:hover { transform: translateY(-2px); box-shadow: 0 8px 0 rgba(31,36,51,.14); }
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(31,36,51,.14); }
.btn--small { font-size: .9rem; padding: .55em 1em; }
.btn--big { font-size: 1.2rem; padding: .95em 1.6em; }
.btn--ghost { background: var(--surface); }
.btn--true { background: var(--teal-soft); }
.btn--false { background: var(--coral-soft); }
.btn--next { background: var(--violet); color: #fff; }

/* ---------- Header / footer ---------- */
.header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; max-width: var(--wrap); margin: 0 auto; }
.logo { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font: 800 1.4rem/1 var(--font-head); }
.header__nav { display: flex; align-items: center; gap: 16px; }
.header__nav a { color: var(--ink); text-decoration: none; }
.footer { text-align: center; padding: 48px 16px 40px; margin-top: 64px; border-top: 3px dashed var(--line); color: var(--ink-soft); }
.footer__small { font-size: .9rem; }

/* ---------- Home ---------- */
.eyebrow { font: 800 1rem/1.2 var(--font-body); color: var(--violet); text-transform: uppercase; letter-spacing: .06em; }
.lead { font-size: 1.25rem; color: var(--ink-soft); max-width: 36em; }
.hl { background: linear-gradient(transparent 60%, var(--sun) 60%); padding: 0 .1em; }
.hero { padding: 24px 0 56px; }
.hero__grid { display: grid; grid-template-columns: 1.15fr .85fr; align-items: center; gap: 32px; }
.hero__art { position: relative; display: grid; place-items: center; min-height: 320px; }
.hero__art img { position: relative; z-index: 1; width: min(320px, 80%); }
.blob { position: absolute; border-radius: 50%; }
.blob--sun { width: 78%; aspect-ratio: 1; background: var(--sun-soft); }
.blob--teal { width: 26%; aspect-ratio: 1; background: var(--teal-soft); right: 4%; top: 6%; }
.section-title { text-align: center; margin: 24px 0 28px; }
.chapters { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; }
.card { position: relative; background: var(--surface); border: 3px solid var(--ink); border-radius: var(--radius); padding: 24px 22px 22px; box-shadow: var(--shadow); transition: transform .2s; }
.card:hover { transform: translateY(-4px) rotate(-.5deg); }
.card h3 a { color: inherit; text-decoration: none; }
.card h3 a::after { content: ""; position: absolute; inset: 0; }
.card__n { position: absolute; top: -18px; left: 18px; width: 40px; height: 40px; display: grid; place-items: center; border: 3px solid var(--ink); border-radius: 50%; font: 800 1.1rem/1 var(--font-head); background: var(--accent, var(--sun)); }
.card__era { font-size: .85rem; font-weight: 800; color: var(--ink-soft); margin: 4px 0 6px; }
.card p:last-of-type { margin-bottom: 0; font-size: 1rem; }
.card--sun { --accent: var(--sun); } .card--coral { --accent: var(--coral); } .card--teal { --accent: var(--teal); } .card--violet { --accent: var(--violet); } .card--sky { --accent: var(--sky); }
.card--soon { background: #FBF6EC; border-style: dashed; box-shadow: none; }
.card--soon:hover { transform: none; }
.badge { display: inline-block; margin-top: 12px; font-size: .8rem; font-weight: 800; background: var(--line); border-radius: 999px; padding: 4px 10px; }
.teaser { display: flex; gap: 24px; align-items: center; margin-top: 56px; background: var(--violet-soft); border-radius: var(--radius); padding: 28px; }

/* ---------- Chapter ---------- */
.chapter-hero { position: relative; padding: 40px 0 72px; margin-bottom: 24px; overflow: hidden; }
.chapter-hero--sun { background: var(--sun-soft); } .chapter-hero--coral { background: var(--coral-soft); } .chapter-hero--teal { background: var(--teal-soft); } .chapter-hero--violet { background: var(--violet-soft); } .chapter-hero--sky { background: var(--sky-soft); }
.chapter-hero::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 40px; background: var(--bg); clip-path: ellipse(60% 100% at 50% 100%); }
.chapter-hero .wrap { position: relative; z-index: 1; }
.chapter-hero__mascot { position: absolute; right: max(16px, calc((100% - var(--wrap)) / 2)); bottom: 24px; width: 160px; }
.chapter-hero .lead { max-width: 32em; }

.chapter { position: relative; padding-left: 8px; }
.chapter::before { content: ""; position: absolute; left: 47px; top: 0; bottom: 0; border-left: 4px dotted var(--line); }
.milestone { position: relative; display: grid; grid-template-columns: 80px 1fr 200px; gap: 24px; align-items: start; padding: 28px 0; }
.milestone__year { position: sticky; top: 16px; z-index: 1; }
.milestone__year span { display: inline-block; background: var(--ink); color: #fff; font: 800 .95rem/1.2 var(--font-head); padding: 8px 10px; border-radius: 14px; text-align: center; min-width: 80px; }
.milestone__body h2 { margin-top: 4px; }
.milestone__art { margin: 0; background: var(--surface); border: 3px solid var(--ink); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.milestone:nth-of-type(even) .milestone__art { transform: rotate(2deg); }
.milestone:nth-of-type(odd) .milestone__art { transform: rotate(-2deg); }
.callout { display: flex; gap: 18px; align-items: center; background: var(--teal-soft); border-radius: var(--radius); padding: 22px 24px; margin: 24px 0 0 104px; }
.callout p { margin: 0; }

/* ---------- Fact tooltip ---------- */
.fact { position: relative; display: inline; font: inherit; color: var(--violet); font-weight: 800; background: var(--violet-soft); border: 0; border-bottom: 3px dotted var(--violet); padding: 0 .2em; border-radius: 6px 6px 0 0; cursor: pointer; }
.fact__bubble { position: absolute; left: 50%; bottom: calc(100% + 12px); width: min(300px, 80vw); transform: translateX(-50%) scale(.9); transform-origin: 50% 100%; opacity: 0; pointer-events: none; background: var(--ink); color: #fff; text-align: left; font-weight: 400; font-size: 1rem; line-height: 1.45; padding: 14px 16px; border-radius: 16px; transition: opacity .18s, transform .18s; z-index: 20; }
.fact__bubble::after { content: ""; position: absolute; left: 50%; top: 100%; border: 9px solid transparent; border-top-color: var(--ink); transform: translateX(-50%); }
.fact__head { display: block; font: 800 .8rem/1 var(--font-body); color: var(--sun); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 6px; }
.fact__text { display: block; }
.fact:hover .fact__bubble, .fact:focus-visible .fact__bubble, .fact[aria-expanded="true"] .fact__bubble { opacity: 1; transform: translateX(-50%) scale(1); pointer-events: auto; }
.fact.is-left .fact__bubble { left: 0; transform: none; } .fact.is-left .fact__bubble::after { left: 24px; }
.fact.is-right .fact__bubble { left: auto; right: 0; transform: none; } .fact.is-right .fact__bubble::after { left: auto; right: 24px; }

/* ---------- Facts dialog ---------- */
.facts { border: 3px solid var(--ink); border-radius: 28px; padding: 0; width: min(560px, calc(100% - 32px)); max-height: 85vh; background: var(--surface); color: var(--ink); box-shadow: 0 10px 0 rgba(31,36,51,.18); }
.facts::backdrop { background: rgba(31, 36, 51, .45); }
.facts__inner { padding: 24px; }
.facts__head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.facts__head h2 { margin: 0; flex: 1; }
.facts__close { border: 3px solid var(--ink); background: var(--coral-soft); width: 44px; height: 44px; border-radius: 50%; font-size: 1.6rem; line-height: 1; cursor: pointer; }
.facts__list { margin: 0; padding-left: 1.4em; }
.facts__list li { padding: 10px 0; border-bottom: 2px dashed var(--line); }
.facts__list li.is-hit { background: var(--sun-soft); border-radius: 10px; }

/* ---------- Quiz ---------- */
.quiz { margin-top: 56px; }
.quiz__card { background: var(--surface); border: 3px solid var(--ink); border-radius: 28px; padding: 32px; box-shadow: var(--shadow); text-align: center; }
.quiz__progress { font-weight: 800; color: var(--ink-soft); }
.quiz__list { list-style: none; padding: 0; margin: 0; }
.quiz__text { font: 800 1.45rem/1.3 var(--font-head); max-width: 28em; margin: 0 auto 20px; }
.quiz__buttons { display: flex; justify-content: center; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.quiz__buttons .btn[disabled] { opacity: .45; cursor: default; transform: none; }
.quiz__buttons .btn.is-picked { opacity: 1; outline: 4px solid var(--ink); outline-offset: 2px; }
.quiz__why { max-width: 32em; margin: 0 auto 16px; padding: 14px 18px; border-radius: 16px; background: var(--sun-soft); }
.quiz__why.is-right { background: var(--teal-soft); } .quiz__why.is-wrong { background: var(--coral-soft); }
.quiz__result img { margin: 0 auto 8px; }
.quiz__score { font: 800 1.8rem/1.2 var(--font-head); }
.chapter-nav { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 40px; }
.chapter-nav__next { color: var(--ink-soft); font-weight: 700; }

/* Before JS, reveal targets are visible; JS hides then animates them in */
.js [data-reveal] { opacity: 0; }

/* ---------- Mobile ---------- */
@media (max-width: 760px) {
  body { font-size: 1.05rem; }
  .header__nav a { display: none; }
  .hero__grid { grid-template-columns: 1fr; }
  .hero__art { order: -1; min-height: 220px; }
  .hero__art img { width: 200px; }
  .chapter-hero__mascot { width: 96px; bottom: 8px; opacity: .9; }
  .chapter-hero { padding-bottom: 96px; }
  .chapter::before { left: 18px; }
  .milestone { grid-template-columns: 1fr; gap: 12px; padding-left: 40px; }
  .milestone__year { position: static; margin-left: -40px; }
  .milestone__art { max-width: 200px; }
  .callout { margin-left: 0; flex-direction: column; text-align: center; }
  .teaser { flex-direction: column; text-align: center; }
  .quiz__card { padding: 24px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
  .js [data-reveal] { opacity: 1; }
}
