/* ============================================================
   AI in Education: layout, header, sections, motion
   ------------------------------------------------------------
   Uses tokens.css only. Scroll reveals are one-way: an element
   with [data-reveal] gains .in-view once (js/scroll.js) and then
   stays. Do not add a rule that removes .in-view.
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
/* ============================================================
   Page skin (site-wide, first built for page one)
   ------------------------------------------------------------
   Every .screen owns a hue (--hue on the section). The page's
   own hue (--page-hue on <html>) is driven by scroll
   (js/stripes.js) and tints the background. Headings, links and
   tags on a screen use the screen's hue. The skewed stripe at
   each section's top and the progress rail are part of the skin.
   ============================================================ */
:root {
  --page-hue: 228;
  --tint-l: 96.5%;
  --tint-c: 0.018;
  --band-l: 88%;
  --band-c: 0.09;
  --ink-l: 42%;
  --ink-c: 0.17;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --tint-l: 17%; --tint-c: 0.02; --band-l: 30%; --band-c: 0.08; --ink-l: 78%; --ink-c: 0.13; }
}
:root[data-theme="dark"] { --tint-l: 17%; --tint-c: 0.02; --band-l: 30%; --band-c: 0.08; --ink-l: 78%; --ink-c: 0.13; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-3);
  line-height: var(--lh-body);
  color: var(--text);
  /* tinted by the current screen's hue; no transition, the scrub sets it every frame */
  background: oklch(var(--tint-l) var(--tint-c) var(--page-hue));
  -webkit-font-smoothing: antialiased;
  transition: none;
}
img, svg { max-width: 100%; height: auto; }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

h1, h2, h3, h4 { line-height: var(--lh-tight); margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: var(--fs-7); font-weight: 700; letter-spacing: -0.025em; }
h2 { font-size: var(--fs-6); }
h3 { font-size: var(--fs-4); }
p { margin: 0; max-width: var(--measure); }
p + p { margin-top: 1em; }
strong { font-weight: 600; }
.mono { font-family: var(--font-mono); font-size: 0.85em; }

.wrap { max-width: var(--max-w); margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--border);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  min-height: 60px;
}
.wordmark {
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
  color: var(--text);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.wordmark-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: conic-gradient(from 200deg, var(--accent), var(--accent-2), var(--good), var(--accent));
}
.site-nav { display: flex; gap: var(--sp-1); margin-left: var(--sp-3); }
.site-nav a {
  color: var(--text-2);
  text-decoration: none;
  white-space: nowrap;
  font-size: var(--fs-2);
  font-weight: 500;
  padding: 6px 10px;
  border-radius: var(--radius-pill);
  transition: background var(--dur-fast) ease, color var(--dur-fast) ease;
}
.site-nav a:hover { background: var(--surface-2); color: var(--text); }
.site-nav a[aria-current="page"] { background: var(--accent-bg); color: var(--accent); }
.site-nav a.is-soon { opacity: 0.55; }
.header-tools { margin-left: auto; display: flex; align-items: center; gap: var(--sp-2); }

.tool-btn {
  font: inherit;
  font-size: var(--fs-1);
  font-weight: 500;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 6px 12px;
  min-height: 34px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: border-color var(--dur-fast) ease, background var(--dur-fast) ease;
}
.tool-btn:hover { border-color: var(--border-strong); }
.tool-btn[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.tool-btn .sw { width: 10px; height: 10px; border-radius: 50%; background: currentColor; opacity: 0.7; }

.nav-toggle { display: none; }
@media (max-width: 1120px) {
  .site-nav {
    display: none;
    position: absolute;
    left: 0; right: 0; top: 100%;
    flex-direction: column;
    padding: var(--sp-3) var(--gutter) var(--sp-4);
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-md);
  }
  .site-header.nav-open .site-nav { display: flex; }
  .nav-toggle { display: inline-flex; }
  .header-tools .tool-label { display: none; }
}
.label-short { display: none; }
@media (max-width: 600px) {
  .label-long { display: none; }
  .label-short { display: inline; }
  .site-header .wrap { gap: var(--sp-2); }
}

/* ---------- mode banner ---------- */
.mode-banner {
  display: none;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: var(--fs-2);
  padding: 8px 0;
}
:root[data-mode="teacher"] .mode-banner { display: block; }
.mode-banner .wrap { display: flex; gap: var(--sp-4); align-items: center; }
.mode-banner p { max-width: none; }

/* ---------- screens (the site-wide unit) ---------- */
.screen {
  position: relative;
  padding: clamp(72px, 10vh, 120px) 0 clamp(56px, 8vh, 104px);
  --ink: oklch(var(--ink-l) var(--ink-c) var(--hue));
  --band: oklch(var(--band-l) var(--band-c) var(--hue));
  --band-2: oklch(calc(var(--band-l) + 4%) calc(var(--band-c) * 0.7) calc(var(--hue) + 30));
}
.screen h1, .screen h2 { color: var(--ink); }
.screen .lede, .screen .section-head p { color: var(--text-2); }
.screen a:not(.tp-btn):not(.rail-dot) { color: var(--ink); }

/* the skewed band at the top of each screen */
.stripe {
  position: absolute;
  left: -6vw; right: -6vw;
  top: -70px;
  height: 150px;
  background: linear-gradient(100deg, var(--band), var(--band-2));
  transform: skewY(-3deg);
  z-index: 0;
  pointer-events: none;
  will-change: transform;
}
.screen:first-of-type .stripe { display: none; }
/* positioned, so the z-index keeps the copy above the stripe */
.screen > .wrap { position: relative; z-index: 1; }

.screen-n {
  font-family: var(--font-mono);
  font-size: var(--fs-1);
  color: var(--ink);
  margin-bottom: var(--sp-3);
  text-align: center;
  max-width: none;
}

/* a slot for an interactive that isn't built yet */
.placeholder {
  margin-top: var(--sp-6);
  border: 2px dashed color-mix(in oklab, var(--ink) 45%, transparent);
  border-radius: var(--radius-lg);
  padding: var(--sp-6);
  color: var(--text-2);
  background: color-mix(in oklab, var(--band) 35%, transparent);
}
.placeholder .tag { font-family: var(--font-mono); font-size: var(--fs-1); text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink); }
.placeholder h3 { margin-top: var(--sp-3); margin-bottom: var(--sp-2); }
.placeholder p { max-width: none; margin-top: var(--sp-2); }

/* ---------- progress rail ---------- */
.rail {
  position: fixed;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 15;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 6px;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  border: 1px solid var(--border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.rail-dot {
  position: relative;
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 2px solid oklch(var(--ink-l) var(--ink-c) var(--hue));
  background: transparent;
  display: block;
  transition: transform var(--dur-fast) var(--ease-out), background var(--dur) ease;
}
.rail-dot.is-seen { background: color-mix(in oklab, oklch(var(--ink-l) var(--ink-c) var(--hue)) 45%, transparent); }
.rail-dot.is-done { background: oklch(var(--ink-l) var(--ink-c) var(--hue)); }
.rail-dot.is-current { transform: scale(1.35); }
.rail-dot:hover { transform: scale(1.35); }
.rail-label {
  position: absolute;
  right: 22px; top: 50%;
  transform: translateY(-50%) translateX(6px);
  white-space: nowrap;
  font-size: var(--fs-1);
  font-weight: 500;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-fast) ease, transform var(--dur-fast) var(--ease-out);
}
.rail-dot:hover .rail-label, .rail-dot:focus-visible .rail-label { opacity: 1; transform: translateY(-50%) translateX(0); }
@media (max-width: 900px) {
  .rail {
    top: 60px; right: 0; left: 0;
    transform: none;
    flex-direction: row;
    justify-content: center;
    gap: 8px;
    padding: 6px;
    border-radius: 0;
    border-width: 0 0 1px;
  }
  .rail-dot { width: 10px; height: 10px; border-width: 2px; }
  .rail-label { display: none; }
  .rail-dot.is-current, .rail-dot:hover { transform: scale(1.3); }
}
@media (prefers-reduced-motion: reduce) { .rail-dot, .rail-label { transition: none; } }

/* ---------- hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  /* the bottom clears the next section's stripe, which rises toward the right edge */
  padding: clamp(64px, 10vh, 120px) 0 clamp(104px, 13vh, 150px);
  isolation: isolate;
}
.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--fs-1);
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: var(--sp-4);
}
.hero h1 { max-width: 14ch; margin-left: auto; margin-right: auto; text-align: center; }
.hero .lede {
  font-size: var(--fs-4);
  color: var(--text-2);
  margin-top: var(--sp-5);
  max-width: none;
}
.scroll-cue {
  margin-top: var(--sp-7);
  display: flex;
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: var(--fs-2);
  text-decoration: none;
}
.scroll-cue .arrow { display: inline-block; animation: cue-bob 1.8s ease-in-out infinite; }
@keyframes cue-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(5px); } }

/* ---------- section heads ---------- */
/* Titles are centred. The copy under them runs as wide as the
   activities below it and stays left-aligned for reading. */
.section-head { margin-bottom: var(--sp-6); }
.section-head .eyebrow { margin-bottom: var(--sp-3); }
.section-head h1, .section-head h2 { text-align: center; }
.section-head p { margin-top: var(--sp-4); color: var(--text-2); max-width: none; }
.prose > * + * { margin-top: 1em; }

/* two column facts */
.pair {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--sp-5);
  margin-top: var(--sp-6);
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  box-shadow: var(--shadow-sm);
}
.card h3 { margin-bottom: var(--sp-3); }
.card .label { font-weight: 600; font-size: var(--fs-2); color: var(--text-2); margin: var(--sp-4) 0 var(--sp-2); }
.card h3 + .label { margin-top: 0; }
.card ul { margin: 0; padding-left: 1.2em; }
.card li + li { margin-top: 0.5em; }
.card li p { max-width: none; }
.card p { max-width: none; }

/* a list of short claims that reveal one by one */
.claims { list-style: none; padding: 0; margin: var(--sp-6) 0 0; display: grid; gap: var(--sp-3); }
.claims li {
  display: grid;
  grid-template-columns: 2.2rem 1fr;
  gap: var(--sp-3);
  align-items: start;
  padding: var(--sp-4) var(--sp-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.claims .n {
  font-family: var(--font-mono);
  color: var(--accent);
  font-weight: 500;
  padding-top: 2px;
}
.claims p { max-width: none; }

/* the hand-off band to the next page */
.band-stage { overflow: hidden; }
.band {
  display: block;
  margin-top: var(--sp-4);
  padding: clamp(28px, 5vw, 56px) clamp(24px, 5vw, 64px);
  border-radius: var(--radius-lg);
  background: linear-gradient(110deg, var(--band), var(--band-2));
  color: var(--text);
  text-decoration: none;
  border: 1px solid color-mix(in oklab, var(--ink) 30%, transparent);
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) ease;
}
.band:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-md); }
.band-eyebrow { font-family: var(--font-mono); font-size: var(--fs-1); color: var(--ink); margin-bottom: var(--sp-2); }
.band-title { font-size: var(--fs-6); font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; color: var(--ink); }
.band-text { margin-top: var(--sp-3); color: var(--text-2); max-width: 44ch; }
.band-go { display: inline-block; margin-top: var(--sp-4); font-size: var(--fs-5); color: var(--ink); }
@media (prefers-reduced-motion: reduce) { .band { transition: none; } }

/* ---------- footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: var(--sp-7) 0;
  color: var(--muted);
  font-size: var(--fs-2);
}
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: var(--sp-4) var(--sp-6); justify-content: space-between; }
.site-footer p { max-width: none; }
.site-footer a { color: inherit; }

/* ---------- compare (two players, side by side) ---------- */
.compare { margin-top: var(--sp-6); }
.compare-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}
.compare-tabs { display: none; gap: 4px; margin-left: auto; }
.compare-panes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-4);
  align-items: start;
}
.compare-panes .tp { --tp-max-h: min(70vh, 640px); }
.compare-panes .tp-log { max-height: var(--tp-max-h); overflow-y: auto; }
@media (max-width: 860px) {
  .compare-tabs { display: inline-flex; }
  .compare-panes { grid-template-columns: 1fr; }
  .compare-panes .tp:not(.is-shown) { display: none; }
}

/* ---------- reveals (one-way) ---------- */
[data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity var(--dur-reveal) var(--ease-out), transform var(--dur-reveal) var(--ease-out);
  transition-delay: calc(var(--i, 0) * var(--stagger));
}
[data-reveal="left"] { transform: translateX(-24px); }
[data-reveal="right"] { transform: translateX(24px); }
[data-reveal="scale"] { transform: scale(0.96); }
[data-reveal].in-view { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  [data-reveal] { transition: opacity var(--dur) ease; transform: none; transition-delay: 0s; }
  .scroll-cue .arrow { animation: none; }
}

/* ---------- glossary terms and hover cards ---------- */
.gloss {
  color: inherit;
  text-decoration: underline dotted;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  cursor: help;
}
.gloss:hover, .gloss:focus-visible { text-decoration-style: solid; }
.gloss-card {
  position: absolute;
  z-index: 40;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--fs-2);
  line-height: 1.5;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity var(--dur-fast) ease, transform var(--dur-fast) var(--ease-out);
}
.gloss-card.is-shown { opacity: 1; transform: none; }
.gloss-card-term { font-weight: 700; margin-bottom: 4px; max-width: none; }
.gloss-card-short { max-width: none; color: var(--text-2); }
.gloss-card-more { display: inline-block; margin-top: 8px; font-size: var(--fs-1); font-weight: 600; }

/* ---------- the glossary page ---------- */
.gloss-index { display: flex; flex-wrap: wrap; gap: 6px; margin: var(--sp-5) 0 var(--sp-6); }
.gloss-index-letter {
  font-family: var(--font-mono); font-weight: 500;
  width: 36px; height: 36px; display: grid; place-items: center;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  text-decoration: none; color: var(--text);
}
.gloss-index-letter:hover { border-color: var(--accent); color: var(--accent); }
.gloss-group + .gloss-group { margin-top: var(--sp-7); }
.gloss-letter { font-family: var(--font-mono); font-size: var(--fs-4); color: var(--muted); margin-bottom: var(--sp-3); }
.gloss-entry { padding: var(--sp-5) 0; border-top: 1px solid var(--border); scroll-margin-top: 90px; }
.gloss-entry.is-target { background: var(--accent-bg); margin: 0 calc(-1 * var(--sp-4)); padding-left: var(--sp-4); padding-right: var(--sp-4); border-radius: var(--radius); border-top-color: transparent; }
.gloss-term { margin-bottom: var(--sp-2); }
.gloss-term a { color: var(--text); text-decoration: none; }
.gloss-term a:hover { color: var(--accent); }
.gloss-full { max-width: none; }
.gloss-links { margin-top: var(--sp-3); font-size: var(--fs-2); color: var(--muted); max-width: none; }
.gloss-checked { margin-top: var(--sp-6); font-family: var(--font-mono); font-size: var(--fs-1); color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .gloss-card { transition: none; } }

/* ---------- student voice ---------- */
.voice { margin: var(--sp-6) 0; }
.voice-block { margin: 0; padding: var(--sp-4) var(--sp-5); border-left: 5px solid var(--accent-2); }
.voice-text { font-size: var(--fs-5); line-height: 1.35; font-weight: 500; letter-spacing: -0.01em; max-width: 30ch; }
.voice-text::before { content: '\201C'; color: var(--accent-2); margin-right: 2px; }
.voice-text::after { content: '\201D'; color: var(--accent-2); margin-left: 2px; }
.voice-by { margin-top: var(--sp-3); font-family: var(--font-mono); font-size: var(--fs-1); color: var(--muted); }
.voice--placeholder { padding: var(--sp-4) var(--sp-5); border: 2px dashed var(--border-strong); border-radius: var(--radius); }
.voice--placeholder .voice-text { font-size: var(--fs-2); font-weight: 400; color: var(--muted); font-style: italic; }
.voice--placeholder .voice-text::before, .voice--placeholder .voice-text::after { content: none; }
