/* ==========================================================================
   Keystage Science — shared stylesheet
   Palette derives from universal indicator: each key stage keeps its colour
   across the whole site, so a student learns "I'm a green page" as wayfinding.
   ========================================================================== */

:root {
  /* Surface */
  --ink:        #16202D;
  --ink-soft:   #46566B;
  --ink-faint:  #8194A6;
  --paper:      #F1F4F2;
  --card:       #FFFFFF;
  --grid:       #DDE4E0;
  --rule:       #C9D3CD;

  /* Key stage spectrum */
  --ks1: #C8352B;
  --ks2: #DD7622;
  --ks3: #4E9A34;
  --ks4: #2A6DB5;
  --ks5: #38408F;

  /* Brand — from the KeyStageWiki mark. Reserved for chrome, never a key stage. */
  --brand:      #B81FA8;
  --brand-deep: #8A1580;

  /* Utility */
  --ink-inv:    #FFFFFF;   /* text drawn on top of --ink */
  --chrome-bg:  #16202D;   /* header / dark bands: does NOT flip with theme */
  --chrome-fg:  #EEF2F0;
  --chrome-card:#1D2937;
  --flag:       #F2C230;
  --focus:      #16202D;

  /* Type scale — driven by --scale so the A+ control resizes everything */
  --scale: 1;
  --skin-boost: 1;
  --z: calc(var(--scale) * var(--skin-boost));
  --t-xs:   calc(0.75rem   * var(--z));
  --t-sm:   calc(0.875rem  * var(--z));
  --t-base: calc(1.0625rem * var(--z));
  --t-lg:   calc(1.375rem  * var(--z));
  --t-xl:   calc(2rem      * var(--z));
  --t-2xl:  calc(3.25rem   * var(--z));

  /* Age skin defaults (middle) */
  --skin-lh: 1.65;
  --skin-radius: 6px;
  --skin-gap: 1.75rem;
  --skin-head-weight: 700;
  --skin-border: 2px;

  --measure: 62ch;
  --radius: 3px;
}

/* ---- Age skins ---------------------------------------------------------
   The site grows up with the reader. Junior is roomier, rounder and warmer;
   senior is denser and more precise, without becoming corporate. */

[data-skin="junior"] {          /* Key Stage 1-2, ages 5-11 */
  --skin-boost: 1.16;
  --skin-lh: 1.85;
  --skin-radius: 18px;
  --skin-gap: 2.5rem;
  --skin-head-weight: 800;
  --skin-border: 3px;
  --measure: 46ch;
}
[data-skin="middle"] {          /* Key Stage 3, ages 11-14 */
  --skin-boost: 1.06;
  --skin-lh: 1.72;
  --skin-radius: 10px;
  --skin-gap: 2rem;
  --measure: 58ch;
}
[data-skin="senior"] {          /* Key Stage 4-5, ages 14-18 */
  --skin-boost: 1;
  --skin-lh: 1.6;
  --skin-radius: 5px;
  --skin-gap: 1.5rem;
  --skin-head-weight: 700;
  --skin-border: 2px;
  --measure: 66ch;
}

/* Accessibility: high contrast mode */
[data-theme="contrast"] {
  --paper:     #FFFFFF;
  --card:      #FFFFFF;
  --ink:       #000000;
  --ink-soft:  #1A1A1A;
  --ink-faint: #333333;
  --grid:      transparent;
  --rule:      #000000;
  --ks1: #A81E15; --ks2: #9A4A00; --ks3: #245C12;
  --ks4: #0B3F7A; --ks5: #1F2568;
  --brand: #7A0F72; --brand-deep: #5C0A56;
  --ink-inv: #FFFFFF; --chrome-bg: #000000; --chrome-fg: #FFFFFF; --chrome-card: #000000;
}

/* Dark mode — white text on near-black, for students who prefer it */
[data-theme="dark"] {
  --ink:        #E6ECEA;
  --ink-soft:   #AEBDC6;
  --ink-faint:  #7F8E99;
  --paper:      #11161B;
  --card:       #1A2128;
  --grid:       #1B232A;
  --rule:       #35424C;
  --ink-inv:    #11161B;
  --chrome-bg:  #080C10;
  --chrome-fg:  #E6ECEA;
  --chrome-card:#161D24;
  --ks1: #E8574B; --ks2: #F0913F; --ks3: #6FBF52;
  --ks4: #5A99E0; --ks5: #7F88D2;
  --brand: #E052CE; --brand-deep: #B93AA6;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  font-family: "Atkinson Hyperlegible", "Verdana", system-ui, sans-serif;
  font-size: var(--t-base);
  line-height: var(--skin-lh);
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 28px 28px;
}

h1, h2, h3, h4 {
  font-family: "Poppins", "Century Gothic", "Trebuchet MS", sans-serif;
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin: 0;
  text-wrap: balance;
}

.eyebrow {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: var(--t-xs);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 0.75rem;
}

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }

:where(a, button, [tabindex]):focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip-link {
  position: absolute; left: 0.5rem; top: -100px;
  background: var(--ink); color: var(--ink-inv);
  padding: 0.75rem 1.25rem; z-index: 100;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 0.5rem; }

.shell { width: min(1140px, 100% - 2.5rem); margin-inline: auto; }

/* ---------- Utility bar ------------------------------------------------- */

.utility {
  position: sticky; top: 0; z-index: 50;
  background: var(--chrome-bg);
  color: var(--chrome-fg);
  border-bottom: 3px solid var(--brand);
}
.utility__inner {
  display: flex; align-items: center; gap: 1.5rem;
  justify-content: space-between;
  padding-block: 0.7rem;
  flex-wrap: wrap;
}
.wordmark {
  font-family: "Poppins", sans-serif;
  font-weight: 800; font-size: var(--t-lg);
  letter-spacing: -0.03em; text-decoration: none;
  display: inline-flex; align-items: baseline; gap: 0.5rem;
}
.wordmark span {
  font-family: "IBM Plex Mono", monospace;
  font-size: var(--t-xs); font-weight: 400;
  letter-spacing: 0.14em; color: var(--brand);
}

.a11y { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.a11y__label {
  font-family: "IBM Plex Mono", monospace;
  font-size: var(--t-xs); letter-spacing: 0.1em;
  text-transform: uppercase; color: #9FB0BF;
}
.a11y__group { display: flex; border: 1px solid #3D4C5C; border-radius: var(--skin-radius); overflow: hidden; }
.a11y__btn {
  font-family: "IBM Plex Mono", monospace;
  background: transparent; color: #EEF2F0;
  border: 0; border-right: 1px solid #3D4C5C;
  padding: 0.45rem 0.75rem; cursor: pointer;
  font-size: var(--t-xs); line-height: 1;
  min-height: 38px; min-width: 40px;
}
.a11y__btn:last-child { border-right: 0; }
.a11y__btn:hover { background: #26333F; }
.a11y__btn[aria-pressed="true"] { background: var(--flag); color: var(--ink); font-weight: 700; }

/* ---------- Hero -------------------------------------------------------- */

.hero { padding-block: clamp(3rem, 8vw, 6rem) 2rem; }
.hero__grid {
  display: grid; gap: clamp(2rem, 5vw, 4rem);
  grid-template-columns: 1fr;
}
@media (min-width: 940px) {
  .hero__grid { grid-template-columns: 1.05fr 1fr; align-items: center; }
}

.hero h1 {
  font-size: var(--t-2xl);
  margin-bottom: 1.25rem;
}
.hero h1 em {
  font-style: normal;
  display: block;
  color: var(--ks4);
}
.hero__lede {
  font-size: var(--t-lg);
  max-width: 34ch;
  color: var(--ink-soft);
  margin: 0 0 1.75rem;
}

.btn {
  display: inline-flex; align-items: center; gap: 0.6rem;
  font-family: "Poppins", sans-serif;
  font-weight: 700; font-size: var(--t-base);
  padding: 0.85rem 1.5rem; min-height: 48px;
  border: 2px solid var(--ink); border-radius: var(--skin-radius);
  background: var(--ink); color: var(--ink-inv);
  text-decoration: none; cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  box-shadow: 4px 4px 0 var(--flag);
}
.btn:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--flag); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--flag); }
.btn--ghost { background: transparent; color: var(--ink); box-shadow: 4px 4px 0 var(--rule); }
.btn--ghost:hover { box-shadow: 6px 6px 0 var(--rule); }

/* ---------- The Ladder (signature element) ------------------------------ */

.ladder {
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: var(--skin-radius);
  padding: 1.5rem 1.25rem 1.25rem;
  box-shadow: 8px 8px 0 rgba(22, 32, 45, 0.09);
}
.ladder__head {
  display: flex; justify-content: space-between;
  align-items: baseline; gap: 1rem;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0.75rem; margin-bottom: 0.5rem;
}
.ladder__head h2 { font-size: var(--t-base); letter-spacing: 0; }

.ladder__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column-reverse; }

.rung { border-bottom: 1px solid var(--rule); }
.rung:first-child { border-bottom: 0; }

.rung__btn {
  width: 100%; display: grid;
  grid-template-columns: 3.25rem 1fr auto;
  align-items: center; gap: 0.9rem;
  background: transparent; border: 0;
  padding: 0.85rem 0.5rem; cursor: pointer;
  text-align: left; color: inherit;
  font: inherit;
  border-left: 6px solid var(--stage);
  transition: background 0.15s ease, padding-left 0.15s ease;
}
.rung__btn:hover { background: color-mix(in srgb, var(--stage) 9%, transparent); padding-left: 0.85rem; }

.rung__num {
  font-family: "IBM Plex Mono", monospace;
  font-size: var(--t-lg); font-weight: 600;
  color: var(--stage); line-height: 1;
}
.rung__name {
  font-family: "Poppins", sans-serif;
  font-weight: 700; font-size: var(--t-base);
  display: block; line-height: 1.2;
}
.rung__meta {
  font-family: "IBM Plex Mono", monospace;
  font-size: var(--t-xs); color: var(--ink-faint);
}
.rung__count {
  font-family: "IBM Plex Mono", monospace;
  font-size: var(--t-xs); color: var(--ink-soft);
  white-space: nowrap;
}

/* Prerequisite highlighting — the whole point of the device */
.rung.is-prereq .rung__btn { background: color-mix(in srgb, var(--stage) 14%, transparent); }
.rung.is-prereq .rung__name::after {
  content: " — you'll need this";
  font-family: "IBM Plex Mono", monospace;
  font-size: var(--t-xs); font-weight: 400;
  color: var(--ink-soft); letter-spacing: 0;
}
.rung.is-target .rung__btn { background: var(--ink); color: var(--ink-inv); }
.rung.is-target .rung__num,
.rung.is-target .rung__count,
.rung.is-target .rung__meta { color: var(--ink-inv); }

.ladder__note {
  font-size: var(--t-sm); color: var(--ink-soft);
  margin: 0.9rem 0 0; padding-top: 0.9rem;
  border-top: 1px dashed var(--rule);
  min-height: 3.4em;
}

/* ---------- Sections ---------------------------------------------------- */

.section { padding-block: clamp(3rem, 7vw, 5rem); }
.section--dark { background: var(--chrome-bg); color: var(--chrome-fg); }
.section--dark .eyebrow { color: var(--flag); }
.section__head { max-width: var(--measure); margin-bottom: 2.5rem; }
.section__head h2 { font-size: var(--t-xl); margin-bottom: 0.75rem; }
.section__head p { color: var(--ink-soft); margin: 0; }
.section--dark .section__head p { color: #AFC0CE; }

/* Subject cards */
.stages { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }

.stage-card {
  background: var(--card); color: var(--ink);
  border: 2px solid var(--ink);
  border-top: 10px solid var(--stage);
  border-radius: var(--skin-radius);
  padding: 1.25rem;
  text-decoration: none;
  display: flex; flex-direction: column; gap: 0.5rem;
  transition: transform 0.14s ease, box-shadow 0.14s ease;
  box-shadow: 5px 5px 0 rgba(22, 32, 45, 0.1);
}
.stage-card:hover { transform: translate(-3px, -3px); box-shadow: 8px 8px 0 var(--stage); }
.stage-card__no {
  font-family: "IBM Plex Mono", monospace;
  font-size: var(--t-xs); letter-spacing: 0.14em;
  color: var(--stage); font-weight: 600;
}
.stage-card h3 { font-size: var(--t-lg); }
.stage-card__ages { font-size: var(--t-sm); color: var(--ink-soft); margin: 0; }
.stage-card__subjects {
  list-style: none; margin: 0.5rem 0 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 0.35rem;
}
.stage-card__subjects li {
  font-family: "IBM Plex Mono", monospace;
  font-size: var(--t-xs);
  border: 1px solid var(--rule);
  padding: 0.2rem 0.5rem; border-radius: 99px;
}

/* How it works */
.modes { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.mode {
  border: 1px solid #3D4C5C; border-radius: var(--skin-radius);
  padding: 1.5rem; background: var(--chrome-card);
}
.mode h3 { font-size: var(--t-lg); margin-bottom: 0.6rem; color: var(--flag); }
.mode p { margin: 0 0 1rem; color: #C3D0DA; font-size: var(--t-sm); }
.mode ol { margin: 0; padding-left: 1.2rem; font-size: var(--t-sm); color: #C3D0DA; }
.mode li { margin-bottom: 0.4rem; }

/* Read-aloud demo block */
.demo {
  background: var(--card); border: 2px solid var(--ink);
  border-radius: var(--skin-radius); padding: 1.5rem;
  max-width: var(--measure);
}
.speak-btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  background: var(--flag); border: 2px solid var(--ink);
  border-radius: 99px; padding: 0.4rem 0.9rem;
  font-family: "IBM Plex Mono", monospace;
  font-size: var(--t-xs); font-weight: 600;
  cursor: pointer; min-height: 40px; color: var(--ink);
  letter-spacing: 0.06em; text-transform: uppercase;
}
.speak-btn:hover { background: #FFD758; }
.speak-btn[aria-pressed="true"] { background: var(--ks1); color: #fff; }

/* Progress / badges */
.badges { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.badge {
  background: var(--card); border: 2px dashed var(--rule);
  border-radius: var(--skin-radius); padding: 1.1rem;
  text-align: center;
}
.badge--earned { border-style: solid; border-color: var(--stage); }
.badge__ring {
  width: 56px; height: 56px; margin: 0 auto 0.6rem;
  border-radius: 50%; border: 4px solid var(--rule);
  display: grid; place-items: center;
  font-family: "IBM Plex Mono", monospace; font-weight: 600;
  color: var(--ink-faint);
}
.badge--earned .badge__ring { border-color: var(--stage); color: var(--stage); }
.badge__name { font-family: "Poppins", sans-serif; font-weight: 700; font-size: var(--t-sm); }
.badge__sub { font-size: var(--t-xs); color: var(--ink-faint); font-family: "IBM Plex Mono", monospace; }

.empty-note {
  border-left: 4px solid var(--flag);
  padding: 0.75rem 0 0.75rem 1rem;
  color: var(--ink-soft); font-size: var(--t-sm);
  margin-top: 1.5rem;
}

/* Footer */
.foot {
  border-top: 3px solid var(--ink);
  padding-block: 2rem; font-size: var(--t-sm);
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  color: var(--ink-soft);
}
.foot p { margin: 0; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ==========================================================================
   ARTICLE TEMPLATE
   ========================================================================== */

.crumbs {
  font-family: "IBM Plex Mono", monospace;
  font-size: var(--t-xs); color: var(--ink-soft);
  padding-block: 1.25rem 0; display: flex; flex-wrap: wrap; gap: 0.35rem;
}
.crumbs a { color: var(--ink-soft); }
.crumbs span[aria-current] { color: var(--ink); font-weight: 600; }

.article { padding-bottom: 4rem; }
.article__head { padding-block: 1rem 1.5rem; border-bottom: 2px solid var(--ink); }
.article__head h1 { font-size: var(--t-2xl); }
.article__lede { color: var(--ink-soft); max-width: var(--measure); margin: 0.75rem 0 0; }

/* Mode + stage controls ---------------------------------------------------- */

.controls {
  display: flex; flex-wrap: wrap; gap: 1.5rem;
  align-items: flex-end; justify-content: space-between;
  padding-block: 1.25rem; border-bottom: 1px solid var(--rule);
  position: sticky; top: 60px; background: var(--paper); z-index: 20;
}
.control-group { display: flex; flex-direction: column; gap: 0.4rem; }
.control-group > .eyebrow { margin: 0; }

.segmented { display: flex; border: 2px solid var(--ink); border-radius: var(--skin-radius); overflow: hidden; }
.segmented button {
  font-family: "Poppins", sans-serif; font-weight: 600;
  background: var(--card); color: var(--ink); border: 0;
  border-right: 2px solid var(--ink); padding: 0.55rem 1.1rem;
  cursor: pointer; font-size: var(--t-sm); min-height: 44px;
}
.segmented button:last-child { border-right: 0; }
.segmented button[aria-pressed="true"] { background: var(--ink); color: var(--ink-inv); }

.stage-rail { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.stage-pill {
  font-family: "IBM Plex Mono", monospace; font-size: var(--t-xs);
  font-weight: 600; letter-spacing: 0.06em;
  border: 2px solid var(--stage); color: var(--stage);
  background: var(--card); border-radius: 99px;
  padding: 0.45rem 0.9rem; cursor: pointer; min-height: 40px;
}
.stage-pill[aria-pressed="true"] { background: var(--stage); color: #fff; }
.stage-pill[data-your-year]::after { content: " · your year"; font-weight: 400; }

/* Key stage blocks --------------------------------------------------------- */

.ks-block {
  border-left: calc(var(--skin-border) * 3) solid var(--stage);
  padding: 0 0 0 1.25rem; margin: 2.5rem 0;
  scroll-margin-top: 140px;
}
.ks-block__head { display: flex; align-items: baseline; gap: 0.75rem; flex-wrap: wrap; }
.ks-block__head h2 { font-size: var(--t-xl); color: var(--stage); }
.ks-block__age { font-family: "IBM Plex Mono", monospace; font-size: var(--t-xs); color: var(--ink-faint); }

.ks-block[data-collapsed="true"] .ks-block__body { display: none; }
.ks-block__toggle {
  background: none; border: 0; cursor: pointer; padding: 0.3rem 0.5rem;
  font-family: "IBM Plex Mono", monospace; font-size: var(--t-xs);
  color: var(--ink-soft); text-decoration: underline; min-height: 40px;
}

/* Sections ----------------------------------------------------------------- */

.sec { margin: var(--skin-gap) 0; max-width: var(--measure); }
.sec__head { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.sec__head h3 { font-size: var(--t-lg); }
.sec__tools { display: flex; gap: 0.4rem; margin-left: auto; }

.tool-btn {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-family: "IBM Plex Mono", monospace; font-size: var(--t-xs);
  text-transform: uppercase; letter-spacing: 0.06em;
  border: 2px solid var(--ink); background: var(--card); color: var(--ink);
  border-radius: 99px; padding: 0.35rem 0.8rem;
  cursor: pointer; min-height: 40px;
}
.tool-btn:hover { background: var(--ink); color: var(--ink-inv); }
.tool-btn[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }

.sec p { margin: 0 0 0.9rem; }
.sec .term { font-weight: 700; }

/* Figures ------------------------------------------------------------------ */

figure.fig { margin: 1.5rem 0; border: 1px solid var(--rule); background: var(--card); padding: 0.9rem; border-radius: var(--skin-radius); }
figure.fig img { max-width: 100%; height: auto; display: block; margin-inline: auto; }
figure.fig figcaption { font-size: var(--t-sm); color: var(--ink-soft); margin-top: 0.7rem; }
.fig-pair { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

/* Equations ---------------------------------------------------------------- */

.eq { margin: 1rem 0; padding: 0.75rem 1rem; background: var(--card);
      border-left: 3px solid var(--ink-faint); overflow-x: auto; }

/* Quiz --------------------------------------------------------------------- */

.quiz {
  border: 2px solid var(--brand); border-radius: var(--skin-radius);
  background: var(--card); padding: 1.25rem; margin: 1.25rem 0;
  max-width: var(--measure);
}
.quiz[hidden] { display: none; }
.quiz__q { font-family: "Poppins", sans-serif; font-weight: 600; margin: 0 0 0.9rem; }
.quiz__opts { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1rem; }
.quiz__opt {
  display: flex; align-items: flex-start; gap: 0.6rem;
  border: 1px solid var(--rule); border-radius: var(--skin-radius);
  padding: 0.7rem 0.9rem; cursor: pointer; background: var(--paper);
  text-align: left; font: inherit; color: inherit; width: 100%;
  min-height: 46px;
}
.quiz__opt:hover { border-color: var(--ink); }
.quiz__opt[data-state="correct"] { border-color: var(--ks3); background: color-mix(in srgb, var(--ks3) 12%, transparent); }
.quiz__opt[data-state="wrong"]   { border-color: var(--ks1); background: color-mix(in srgb, var(--ks1) 12%, transparent); }
.quiz__text {
  width: 100%; font: inherit; padding: 0.7rem 0.9rem;
  border: 1px solid var(--rule); border-radius: var(--skin-radius); margin-bottom: 0.75rem;
}
.quiz__feedback { font-size: var(--t-sm); margin: 0.75rem 0 0; padding-left: 0.9rem; border-left: 3px solid var(--brand); }
.quiz__progress { font-family: "IBM Plex Mono", monospace; font-size: var(--t-xs); color: var(--ink-faint); }

/* Learn mode gate ---------------------------------------------------------- */

.gate {
  border: 2px dashed var(--stage); border-radius: var(--skin-radius);
  padding: 1.5rem; margin: 1.5rem 0; background: var(--card);
  max-width: var(--measure);
}
.gate h3 { font-size: var(--t-lg); margin-bottom: 0.5rem; }
.gate p { color: var(--ink-soft); margin: 0 0 1rem; }

/* References --------------------------------------------------------------- */

.refs { margin-top: 2rem; }
.refs details { border-top: 1px solid var(--rule); }
.refs summary {
  cursor: pointer; padding: 0.7rem 0; font-family: "IBM Plex Mono", monospace;
  font-size: var(--t-sm); font-weight: 600; min-height: 44px;
}
.refs ul { list-style: none; margin: 0 0 1rem; padding: 0; }
.refs li { font-size: var(--t-sm); margin-bottom: 0.5rem; color: var(--ink-soft); }
.affiliate-note {
  font-size: var(--t-xs); color: var(--ink-faint);
  border-left: 3px solid var(--flag); padding-left: 0.8rem; margin-top: 1rem;
}

/* Completion --------------------------------------------------------------- */

.done {
  border: 2px solid var(--ink); border-radius: var(--skin-radius);
  padding: 1.5rem; margin-top: 2.5rem; background: var(--card);
  display: flex; gap: 1.25rem; align-items: center; flex-wrap: wrap;
}
.done__ring {
  width: 64px; height: 64px; border-radius: 50%;
  border: 5px solid var(--rule); display: grid; place-items: center;
  font-family: "IBM Plex Mono", monospace; font-weight: 600; color: var(--ink-faint);
  flex: none;
}
.done[data-earned="true"] { border-color: var(--brand); }
.done[data-earned="true"] .done__ring { border-color: var(--brand); color: var(--brand); }
.done h3 { font-size: var(--t-lg); margin-bottom: 0.3rem; }
.done p { margin: 0; color: var(--ink-soft); font-size: var(--t-sm); }


/* Equations as real text ---------------------------------------------------- */
.eq { font-family: "Atkinson Hyperlegible", sans-serif; font-size: var(--t-lg); }
.eq .op { color: var(--ink-soft); padding-inline: 0.25em; }
.eq .arrow { color: var(--stage, var(--ink-soft)); font-weight: 700; padding-inline: 0.3em; }

/* Section text hidden while its quiz is open -------------------------------- */
[data-quizzing="true"] > [data-secbody] { display: none; }
.peek {
  font-family: "IBM Plex Mono", monospace; font-size: var(--t-xs);
  background: none; border: 0; color: var(--ink-soft);
  text-decoration: underline; cursor: pointer; min-height: 40px; padding: 0.3rem 0;
}

/* Quiz review --------------------------------------------------------------- */
.review { list-style: none; margin: 1rem 0 0; padding: 0; }
.review li { border-left: 4px solid var(--rule); padding: 0.6rem 0 0.6rem 0.9rem; margin-bottom: 0.7rem; font-size: var(--t-sm); }
.review li[data-ok="true"]  { border-color: var(--ks3); }
.review li[data-ok="false"] { border-color: var(--ks1); }
.review .rq { font-weight: 700; display: block; margin-bottom: 0.25rem; }
.review .ra { color: var(--ink-soft); }
.quiz__actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 1rem; }


/* Skin-specific touches ---------------------------------------------------- */
[data-skin="junior"] .sec__head h3 {
  background: color-mix(in srgb, var(--stage, var(--brand)) 14%, transparent);
  border-radius: 99px; padding: 0.35em 0.9em;
}
[data-skin="junior"] .article__head h1 { letter-spacing: -0.01em; }
[data-skin="junior"] .tool-btn { border-width: 3px; }
[data-skin="senior"] .sec__head h3 {
  border-left: 3px solid var(--stage, var(--ink)); padding-left: 0.6rem;
}
[data-skin="senior"] .crumbs { font-size: calc(0.7rem * var(--z)); }

/* ---- Figure component (replaces layout tables) --------------------------- */

.figure-row {
  display: grid; gap: 1.25rem; margin: var(--skin-gap) 0;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
figure.fig {
  margin: 0; background: var(--card);
  border: 1px solid var(--rule); border-radius: var(--skin-radius);
  padding: 1rem; display: flex; flex-direction: column; gap: 0.75rem;
}
figure.fig img { max-width: 100%; height: auto; display: block; margin-inline: auto; border-radius: calc(var(--skin-radius) / 2); }
figure.fig figcaption { font-size: var(--t-sm); color: var(--ink-soft); margin: 0; }
[data-skin="junior"] figure.fig { border-width: 3px; border-color: var(--stage, var(--rule)); }

/* ---- Worked example ------------------------------------------------------ */

.worked {
  border: var(--skin-border) solid var(--ink);
  border-radius: var(--skin-radius);
  background: var(--card);
  margin: var(--skin-gap) 0; overflow: hidden;
  max-width: var(--measure);
}
.worked__head {
  background: var(--ink); color: var(--ink-inv);
  padding: 0.6rem 1rem;
  font-family: "IBM Plex Mono", monospace; font-size: var(--t-xs);
  letter-spacing: 0.12em; text-transform: uppercase;
}
.worked__q { padding: 1rem 1.25rem 0; font-weight: 700; margin: 0; }
.worked__known {
  display: flex; flex-wrap: wrap; gap: 0.5rem;
  padding: 1rem 1.25rem; margin: 0; list-style: none;
}
.worked__known li {
  font-family: "IBM Plex Mono", monospace; font-size: var(--t-sm);
  background: var(--paper); border: 1px solid var(--rule);
  border-radius: 99px; padding: 0.3rem 0.75rem;
}
.worked__reveal { margin: 0 1.25rem 1.25rem; }
.worked__steps { list-style: none; margin: 0; padding: 0 1.25rem 1.25rem; }
.worked__steps li {
  display: grid; gap: 0.15rem 1rem; padding: 0.7rem 0;
  border-top: 1px dashed var(--rule);
  grid-template-columns: 1fr;
}
@media (min-width: 620px) {
  .worked__steps li { grid-template-columns: 8.5rem 1fr; align-items: baseline; }
}
.worked__label {
  font-family: "IBM Plex Mono", monospace; font-size: var(--t-xs);
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-faint);
}
.worked__do { margin: 0; font-size: var(--t-lg); }
.worked__note { grid-column: 1 / -1; font-size: var(--t-sm); color: var(--ink-soft); margin: 0.3rem 0 0; }
.worked__steps li[data-answer] .worked__do {
  font-weight: 700; color: var(--stage, var(--brand));
}
.worked__steps li[data-answer] { border-top-style: solid; border-top-width: 2px; }
[data-skin="junior"] .worked__head { font-size: var(--t-sm); letter-spacing: 0.06em; }


/* ==========================================================================
   AUDIENCE — presentation shifts with the student's school year.
   Same content, same colours, different density and warmth.
   ========================================================================== */

/* Years 1-6. Larger type, short lines, soft corners, generous spacing. */
[data-audience="young"] {
  --aud: 1.14;
  --lh: 1.85;
  --measure: 42ch;
  --radius: 18px;
  --edge: 3px;
  --shadow: 0 6px 0 rgba(22,32,45,0.10);
}
/* Years 7-9. The midpoint. */
[data-audience="middle"] {
  --aud: 1.05;
  --lh: 1.72;
  --measure: 54ch;
  --radius: 10px;
  --edge: 2px;
}
/* Years 10-13. Denser, quieter, closer to a reference work. */
[data-audience="senior"] {
  --aud: 1;
  --lh: 1.6;
  --measure: 68ch;
  --radius: 3px;
  --edge: 1px;
  --shadow: none;
}

[data-audience] .btn,
[data-audience] .stage-pill,
[data-audience] .tool-btn,
[data-audience] .quiz,
[data-audience] figure.fig,
[data-audience] .worked { border-radius: var(--radius); }

[data-audience="young"] h1,
[data-audience="young"] h2 { letter-spacing: -0.01em; }
[data-audience="young"] .sec { margin-block: 2.5rem; }
[data-audience="young"] .ks-block { border-left-width: 10px; padding-left: 1.5rem; }
[data-audience="young"] .sec__head h3 {
  background: color-mix(in srgb, var(--stage) 14%, transparent);
  padding: 0.3rem 0.85rem; border-radius: 99px;
}
[data-audience="young"] figure.fig { border-width: 3px; border-color: var(--stage); }
[data-audience="young"] .eq { font-size: var(--t-xl); text-align: center; border-left: 0;
  background: color-mix(in srgb, var(--stage) 8%, transparent); border-radius: var(--radius); }

[data-audience="senior"] .ks-block { border-left-width: 3px; }
[data-audience="senior"] figure.fig { border: 0; border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule); border-radius: 0; padding-inline: 0; }
[data-audience="senior"] .article__head { border-bottom-width: 1px; }
[data-audience="senior"] .sec { margin-block: 1.5rem; }

/* ==========================================================================
   WORKED EXAMPLE — replaces the two-column tables.
   A calculation is a sequence, so it is marked up as an ordered list.
   ========================================================================== */

.worked {
  border: var(--edge) solid var(--stage);
  border-radius: var(--radius);
  background: var(--card);
  padding: 1.25rem 1.4rem;
  margin: 1.5rem 0;
  max-width: var(--measure);
}
.worked__q {
  font-family: "Poppins", sans-serif; font-weight: 600;
  font-size: var(--t-base); margin: 0 0 1rem;
  padding-bottom: 0.85rem; border-bottom: 1px dashed var(--rule);
}
.worked__given {
  display: flex; flex-wrap: wrap; gap: 0.4rem 0.5rem;
  margin: 0 0 1.1rem; padding: 0;
}
.worked__given div {
  display: flex; gap: 0.35rem; align-items: baseline;
  background: var(--paper); border-radius: 99px;
  padding: 0.25rem 0.75rem;
  font-family: "IBM Plex Mono", monospace; font-size: var(--t-xs);
}
.worked__given dt { color: var(--ink-soft); margin: 0; }
.worked__given dd { margin: 0; font-weight: 600; }

.worked__steps { list-style: none; counter-reset: step; margin: 0; padding: 0; }
.worked__steps > li {
  counter-increment: step;
  display: grid; grid-template-columns: 1.9rem 1fr;
  gap: 0.5rem 0.85rem; align-items: baseline;
  padding: 0.55rem 0; border-top: 1px solid var(--rule);
}
.worked__steps > li::before {
  content: counter(step);
  font-family: "IBM Plex Mono", monospace; font-size: var(--t-xs);
  font-weight: 600; color: var(--stage);
  border: 1px solid var(--stage); border-radius: 50%;
  width: 1.65rem; height: 1.65rem; display: grid; place-items: center;
}
.worked__do { font-size: var(--t-lg); }
.worked__note {
  grid-column: 2; margin: 0.15rem 0 0;
  font-size: var(--t-sm); color: var(--ink-soft);
}
.worked__ans {
  margin: 1rem 0 0; padding: 0.7rem 1rem;
  background: color-mix(in srgb, var(--stage) 12%, transparent);
  border-radius: var(--radius);
  font-size: var(--t-lg); font-weight: 700;
}
.worked__ans::before {
  content: "Answer"; display: block;
  font-family: "IBM Plex Mono", monospace; font-size: var(--t-xs);
  font-weight: 400; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-soft); margin-bottom: 0.15rem;
}
.worked-set { display: grid; gap: 1.25rem; }
@media (min-width: 880px) { .worked-set { grid-template-columns: 1fr 1fr; } }
[data-audience="young"] .worked-set { grid-template-columns: 1fr; }

/* Data table — real tables only, semantic and responsive */
.datatable-wrap { overflow-x: auto; margin: 1.5rem 0; }
table.data {
  border-collapse: collapse; width: 100%; max-width: var(--measure);
  font-size: var(--t-sm);
}
table.data caption {
  text-align: left; font-family: "IBM Plex Mono", monospace;
  font-size: var(--t-xs); color: var(--ink-soft);
  padding-bottom: 0.5rem; letter-spacing: 0.06em; text-transform: uppercase;
}
table.data th, table.data td {
  text-align: left; padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--rule); vertical-align: top;
}
table.data thead th {
  font-family: "Poppins", sans-serif; border-bottom: 2px solid var(--ink);
  background: color-mix(in srgb, var(--stage) 8%, transparent);
}
table.data tbody tr:hover { background: color-mix(in srgb, var(--stage) 5%, transparent); }

/* ==========================================================================
   PERIODIC TABLE — was 366 images, now a real grid of links
   ========================================================================== */

.ptable {
  display: flex; flex-direction: column; gap: 2px;
  margin: 1.5rem 0; overflow-x: auto; padding-bottom: 0.5rem;
}
.ptable__row { display: flex; gap: 2px; }
.ptable__gap { flex: 0 0 2.15rem; height: 2.15rem; }
.ptable__el {
  flex: 0 0 2.15rem; height: 2.15rem;
  display: grid; place-items: center;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 3px;
  text-decoration: none; color: var(--ink);
  font-family: "IBM Plex Mono", monospace;
  font-size: calc(0.72rem * var(--scale));
  font-weight: 600;
  transition: background 0.1s ease, transform 0.1s ease;
}
.ptable__el:hover,
.ptable__el:focus-visible {
  background: var(--stage, var(--brand));
  color: #fff; transform: scale(1.18); z-index: 2;
  border-color: var(--stage, var(--brand));
}
[data-audience="young"] .ptable__el,
[data-audience="young"] .ptable__gap { flex-basis: 2.6rem; height: 2.6rem; }
[data-audience="young"] .ptable__el { border-radius: 8px; }

/* Video embeds -------------------------------------------------------------- */
.video {
  position: relative; width: 100%; max-width: var(--measure);
  aspect-ratio: 16 / 9; margin: 1.5rem 0;
  border: var(--edge) solid var(--ink); border-radius: var(--radius);
  overflow: hidden; background: #000;
}
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* Single figure ------------------------------------------------------------- */
.fig-single { margin: 1.5rem 0; max-width: var(--measure); }
.fig-single figure.fig { margin: 0; }

/* Extension blocks (Beyond the Curriculum) ---------------------------------- */
.ks-block[data-extra] { border-left-style: dashed; }
.ks-block[data-extra] .ks-block__head h2::after {
  content: "optional";
  font-family: "IBM Plex Mono", monospace;
  font-size: var(--t-xs); font-weight: 400;
  color: var(--ink-faint); margin-left: 0.6rem;
  letter-spacing: 0.1em; text-transform: uppercase;
}

/* Figure captions that carry their own title row */
.fig-title { display: block; margin-bottom: 0.3rem; color: var(--ink); }
.fig-title strong { font-family: "Poppins", sans-serif; }
figure.fig figcaption p:first-child { margin-top: 0; }
figure.fig figcaption ul { margin: 0.4rem 0 0; padding-left: 1.1rem; }
figure.fig figcaption li { margin-bottom: 0.25rem; }

/* ==========================================================================
   COLON LINES — the wiki's ":" prefix means "give this its own line"
   ========================================================================== */

.statements { margin: 1rem 0; max-width: var(--measure); }
.statements .statement {
  margin: 0 0 0.55rem;
  padding-left: 0.9rem;
  border-left: 2px solid var(--rule);
}
.statements .statement[data-depth="2"] { margin-left: 1.4rem; }
[data-audience="young"] .statements .statement {
  border-left-width: 4px;
  border-color: color-mix(in srgb, var(--stage) 45%, transparent);
  margin-bottom: 0.85rem;
}
[data-audience="senior"] .statements .statement {
  border-left: 0; padding-left: 0; margin-bottom: 0.4rem;
}

/* Word forms: Singular Noun / Plural Noun / Verb / Adjective */
.wordforms {
  margin: 1rem 0; padding: 0.9rem 1.1rem;
  background: var(--card); border: 1px solid var(--rule);
  border-radius: var(--radius); max-width: var(--measure);
  display: grid; gap: 0.35rem;
}
.wordforms > div {
  display: grid; grid-template-columns: minmax(7rem, auto) 1fr;
  gap: 0.5rem 1rem; align-items: baseline;
}
.wordforms dt {
  font-family: "IBM Plex Mono", monospace;
  font-size: var(--t-xs); text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--ink-soft);
}
.wordforms dd { margin: 0; }

/* ==========================================================================
   ARTICLE LISTS — including the nested sub-classification levels
   ========================================================================== */

.sec ul, .sec ol { margin: 0.9rem 0; padding-left: 1.4rem; max-width: var(--measure); }
.sec li { margin-bottom: 0.4rem; }
.sec li > ul, .sec li > ol { margin: 0.45rem 0 0.2rem; }

/* Marker changes with depth so the sub-classification is visible at a glance */
.sec ul { list-style: none; }
.sec ul > li { position: relative; padding-left: 0.9rem; }
.sec ul > li::before {
  content: ""; position: absolute; left: 0; top: 0.62em;
  width: 0.42rem; height: 0.42rem; border-radius: 50%;
  background: var(--stage, var(--ink-faint));
}
.sec ul ul > li::before { background: transparent; border: 1.5px solid var(--stage, var(--ink-faint)); }
.sec ul ul ul > li::before { border-radius: 0; width: 0.36rem; height: 0.36rem; }

.sec ol { list-style: decimal; }
.sec ol ol { list-style: lower-alpha; }
.sec ol ol ol { list-style: lower-roman; }
.sec ol > li::marker { font-family: "IBM Plex Mono", monospace; color: var(--stage, var(--ink-soft)); font-weight: 600; }

[data-audience="young"] .sec li { margin-bottom: 0.7rem; }
[data-audience="young"] .sec ul > li::before { width: 0.55rem; height: 0.55rem; top: 0.58em; }
[data-audience="senior"] .sec li { margin-bottom: 0.25rem; }

/* ==========================================================================
   QUIZ — the imported question types
   ========================================================================== */

.q-stimulus { margin-bottom: 1rem; text-align: center; }
.q-stimulus img {
  max-width: min(100%, 340px); height: auto;
  border: 1px solid var(--rule); border-radius: var(--radius); background: #fff;
}

.q-opts { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1rem; }

/* Picture answers */
.q-imggrid {
  display: grid; gap: 0.6rem; margin-bottom: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
}
.q-img {
  border: 2px solid var(--rule); border-radius: var(--radius);
  background: #fff; padding: 0.5rem; cursor: pointer;
  display: flex; flex-direction: column; gap: 0.35rem; align-items: center;
  min-height: 96px;
}
.q-img img { max-width: 100%; height: auto; display: block; }
.q-img__label { font-size: var(--t-xs); color: var(--ink); }
.q-img:hover:not(:disabled) { border-color: var(--ink); }
.q-img[data-state="chosen"]  { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand) inset; }
.q-img[data-state="correct"] { border-color: var(--ks3); background: color-mix(in srgb, var(--ks3) 12%, #fff); }
.q-img[data-state="wrong"]   { border-color: var(--ks1); background: color-mix(in srgb, var(--ks1) 12%, #fff); }

.quiz__opt[data-state="chosen"] { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 10%, transparent); }

/* Fill in the gaps */
.q-blanks { font-size: var(--t-base); line-height: 2.1; margin: 0 0 1rem; }
.q-gap {
  font: inherit; font-size: var(--t-sm);
  border: 0; border-bottom: 2px solid var(--ink);
  background: color-mix(in srgb, var(--brand) 7%, transparent);
  padding: 0.15rem 0.4rem; margin: 0 0.15rem;
  border-radius: 3px 3px 0 0; min-width: 6.5rem; color: var(--ink);
}
.q-gap:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.q-gap[data-state="correct"] { border-color: var(--ks3); background: color-mix(in srgb, var(--ks3) 16%, transparent); }
.q-gap[data-state="wrong"]   { border-color: var(--ks1); background: color-mix(in srgb, var(--ks1) 16%, transparent); }
select.q-gap { border-bottom-width: 2px; }

[data-audience="young"] .q-blanks { line-height: 2.4; }
[data-audience="young"] .q-gap { min-width: 8rem; }

/* Worked example steps: each line of working on its own line */
.worked__do { display: block; margin: 0.15rem 0; }
.worked__note {
  display: block; font-family: "Poppins", sans-serif; font-weight: 600;
  color: var(--ink); font-size: var(--t-sm); margin-bottom: 0.3rem;
}
.worked__steps > li { align-items: start; }
.worked-single { max-width: var(--measure); }

/* Quiz buttons stand out from the Play button */
.tool-btn--quiz {
  border-color: var(--brand); color: var(--brand);
  background: color-mix(in srgb, var(--brand) 8%, transparent);
}
.tool-btn--quiz:hover { background: var(--brand); color: #fff; }

/* Ordered lists inside a caption need room for their numbers */
figure.fig figcaption ol { margin: 0.5rem 0 0; padding-left: 1.9rem; }
figure.fig figcaption ol li { margin-bottom: 0.35rem; }
.sec ol { padding-left: 1.9rem; }
.statements ol, .worked ol { padding-left: 0; }

/* Step content sits in one grid cell, so its lines stack instead of
   spilling into the step-number column */
.worked__body { grid-column: 2; display: block; }
.worked__body .worked__do { display: block; margin: 0.2rem 0; }
.worked__body .worked__do .katex { font-size: 1.05em; }

/* Step number circle: keep the digit centred rather than riding the baseline */
.worked__steps > li { align-items: start; }
.worked__steps > li::before {
  line-height: 1;
  align-self: start;
  margin-top: 0.15rem;
  font-size: calc(0.72rem * var(--scale));
}

/* "Try one yourself" sits directly under its pair of worked examples */
.worked-actions { margin: 0.25rem 0 1.5rem; max-width: var(--measure); }
.tool-btn--try {
  border-color: var(--brand); color: #fff;
  background: var(--brand);
}
.tool-btn--try:hover { background: var(--brand-deep); border-color: var(--brand-deep); }

/* ==========================================================================
   WORKED EXAMPLE CAROUSEL — one at a time, full width
   ========================================================================== */

.worked-set { display: block; }              /* was a 2-up grid */
.worked-set.carousel > .worked[hidden] { display: none; }
.worked-set.carousel > .worked {
  max-width: none;                            /* use the full column */
  margin: 0;
}
.worked-single .worked, .worked-set .worked { max-width: none; }

.carousel__nav {
  display: flex; align-items: center; gap: 0.75rem;
  margin: 0.6rem 0 0.25rem; flex-wrap: wrap;
}
.carousel__btn {
  font-family: "IBM Plex Mono", monospace; font-size: var(--t-xs);
  letter-spacing: 0.06em; text-transform: uppercase;
  border: 2px solid var(--stage, var(--ink)); color: var(--stage, var(--ink));
  background: var(--card); border-radius: 99px;
  padding: 0.4rem 0.9rem; min-height: 42px; cursor: pointer;
}
.carousel__btn:hover:not(:disabled) { background: var(--stage, var(--ink)); color: #fff; }
.carousel__btn:disabled { opacity: 0.35; cursor: default; }
.carousel__count {
  font-family: "IBM Plex Mono", monospace; font-size: var(--t-xs);
  color: var(--ink-soft); margin-inline: auto;
}

/* Give each line of working room to breathe now the column is wider */
.worked { padding: 1.4rem 1.6rem; }
.worked__steps > li { padding: 0.75rem 0; gap: 0.6rem 1rem; }
.worked__body .worked__do { margin: 0.35rem 0; font-size: var(--t-lg); }
.worked__q { font-size: var(--t-base); line-height: 1.5; }

[data-audience="young"] .worked__body .worked__do { font-size: var(--t-xl); }

/* Closing test call to action */
.test-cta { display: inline-flex; margin: 2rem 0 0; }
.test-cta[hidden] { display: none; }

/* Prerequisite check failed: send them back rather than letting them struggle */
.notready {
  margin-top: 1.25rem; padding: 1.1rem 1.25rem;
  border: 2px solid var(--ks1); border-radius: var(--radius);
  background: color-mix(in srgb, var(--ks1) 7%, var(--card));
}
.notready h4 {
  font-family: "Poppins", sans-serif; font-size: var(--t-lg);
  margin: 0 0 0.4rem; color: var(--ink);
}
.notready p { margin: 0 0 0.9rem; color: var(--ink-soft); font-size: var(--t-sm); }
.notready__hint { font-style: italic; }
.notready__actions { display: flex; gap: 0.6rem; flex-wrap: wrap; margin: 0; }
.notready__actions .btn { font-size: var(--t-sm); padding: 0.6rem 1.1rem; }

/* ==========================================================================
   KEYWORD DEFINITION TOOLTIP
   ========================================================================== */

.deftip {
  position: absolute; z-index: 80;
  max-width: min(30rem, calc(100vw - 2rem));
  background: var(--chrome-bg); color: var(--chrome-fg);
  border: 2px solid var(--brand); border-radius: var(--radius);
  padding: 0.7rem 0.9rem;
  font-size: var(--t-sm); line-height: 1.45;
  box-shadow: 0 6px 20px rgba(0,0,0,0.22);
  pointer-events: none;
}
.deftip[hidden] { display: none; }
.deftip__stage {
  display: block; font-family: "IBM Plex Mono", monospace;
  font-size: var(--t-xs); letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--brand); margin-bottom: 0.25rem;
}
.deftip__text { display: block; }

/* The keyword being defined on its own page */
strong.term { font-weight: 700; }

@media (hover: none) { .deftip { display: none; } }
