/* Site styles: everything outside a model.
   The palette is named after the compounds the colours come from. Change a
   value here and it changes everywhere. Model colours are set separately at
   the top of model-shell.css. */

:root {
  --paper: #f3f6f8;
  --surface: #ffffff;
  --ink: #16232f;
  --ink-soft: #4b5c6b;
  --rule: #d3dce4;

  --prussian: #123c69;        /* Prussian blue: headings, links, main buttons */
  --prussian-deep: #0a2647;   /* the feedback panel */
  --copper: #1f78b4;          /* copper sulfate: focus rings, hovers */
  --malachite: #1b7a57;       /* live, correct */
  --chromate: #f2b90f;        /* planned, the buttons on dark */
  --cinnabar: #b3261e;        /* errors, hot, over the limit */
  --dichromate: #d9580d;      /* gas molecules */

  --display: "Bricolage Grotesque", "Atkinson Hyperlegible", system-ui, sans-serif;
  --body: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --wrap: 68rem;
  --radius: 10px;
}

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

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 1rem; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.55;
}

img, canvas, svg { max-width: 100%; }

h1, h2, h3 {
  font-family: var(--display);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.015em;
  margin: 0 0 0.5em;
  text-wrap: balance;
}
h1 { font-size: clamp(2rem, 4.5vw, 2.75rem); }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }
p, ul, ol { margin: 0 0 1em; }

a { color: var(--prussian); text-underline-offset: 0.18em; }
a:hover { color: var(--copper); }

:focus-visible {
  outline: 3px solid var(--copper);
  outline-offset: 2px;
  border-radius: 3px;
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: 1.25rem;
}

.skip-link {
  position: absolute;
  left: 0.5rem;
  top: -4rem;
  padding: 0.5rem 0.8rem;
  background: var(--prussian);
  color: #fff;
  border-radius: 6px;
  z-index: 10;
}
.skip-link:focus { top: 0.5rem; color: #fff; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-block;
  padding: 0.6rem 1.1rem;
  font: inherit;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  color: #fff;
  background: var(--prussian);
  border: 2px solid var(--prussian);
  border-radius: 8px;
  cursor: pointer;
}
.btn:hover { background: var(--prussian-deep); border-color: var(--prussian-deep); color: #fff; }
.btn--quiet { background: transparent; color: var(--prussian); }
.btn--quiet:hover { background: var(--prussian); color: #fff; }
.btn--light { background: var(--chromate); border-color: var(--chromate); color: var(--ink); }
.btn--light:hover { background: #ffd24a; border-color: #ffd24a; color: var(--ink); }
.btn:disabled { opacity: 0.6; cursor: default; }

.link-btn {
  padding: 0;
  font: inherit;
  color: var(--prussian);
  background: none;
  border: 0;
  text-decoration: underline;
  text-underline-offset: 0.18em;
  cursor: pointer;
}
.link-btn:hover { color: var(--copper); }

/* ----------------------------------------------------------------- header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--rule); }
.site-header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem 1.5rem;
  padding-block: 0.8rem;
}
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
}
.wordmark:hover { color: var(--prussian); }
/* The logo: an open book with a benzene ring rising from it (Paul, 23 November 2026).
   Fixed colours for the pages; the ring takes the text colour. */
.wordmark-mark { flex: none; }
.wordmark-mark .bk-left { fill: #2c6fbe; }
.wordmark-mark .bk-right { fill: #5fd3c6; }
.wordmark-mark .bk-ring { fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linejoin: round; }
.wordmark-mark .bk-inner { fill: none; stroke: #e8a33d; stroke-width: 2; }

.site-nav { display: flex; flex-wrap: wrap; gap: 0.2rem 1.3rem; list-style: none; margin: 0; padding: 0; }
.site-nav a { display: block; padding: 0.3rem 0; color: var(--ink); text-decoration: none; border-bottom: 3px solid transparent; }
.site-nav a:hover { border-bottom-color: var(--rule); }
.site-nav a[aria-current="page"] { border-bottom-color: var(--prussian); font-weight: 700; }

/* ------------------------------------------------------------------- hero */
.hero { padding-block: clamp(2.5rem, 7vw, 5rem); }
.hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: clamp(1.5rem, 5vw, 4rem);
  align-items: center;
}
.hero h1 {
  font-size: clamp(2.4rem, 6.2vw, 4.2rem);
  line-height: 1.02;
  letter-spacing: -0.03em;
  color: var(--prussian-deep);
}
.hero-sub { font-size: 1.2rem; max-width: 34rem; color: var(--ink-soft); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 1.5rem 0 0; }

.hero-feature {
  display: block;
  background: var(--surface);
  border: 2px solid var(--ink);
  border-radius: 16px;
  overflow: hidden;
  color: inherit;
  text-decoration: none;
}
.hero-feature-set { max-width: 34rem; } /* no wider than the words beside it, on a tablet too */
.hero-feature[hidden] { display: none; }
.hero-feature img { display: block; width: 100%; height: auto; }
/* the animation (or picture) fills the card; the link to the lesson sits underneath */
.hero-feature-view { display: block; color: inherit; }
.hero-feature-view img, .hero-feature-view .hero-anim { display: block; width: 100%; height: auto; }
.hero-feature-go { display: flex; align-items: center; justify-content: center; min-height: 52px; padding: 0.4rem 1rem; border-top: 2px solid var(--ink); font-weight: 700; font-size: 1.05rem; color: var(--prussian); text-decoration: none; }
.hero-feature-go:hover { text-decoration: underline; }
.hero-feature-go:focus-visible { outline: 3px solid var(--prussian); outline-offset: -3px; }
.hero-feature:focus-visible { outline: 3px solid var(--prussian); outline-offset: 3px; }

/* --------------------------------------------------------------- sections */
.section { padding-block: 1.5rem 2.5rem; }
.section-lead { color: var(--ink-soft); max-width: 44rem; }
.page { padding-block: 2rem 3.5rem; }
.prose { max-width: 42rem; }
.prose h2 { margin-top: 1.8em; }
.prose code { background: var(--surface); border: 1px solid var(--rule); border-radius: 4px; padding: 0.05em 0.3em; font-size: 0.92em; }

.crumbs { margin-bottom: 0.9rem; font-size: 0.95rem; color: var(--ink-soft); }
.crumbs a { color: var(--ink-soft); }

.missing h2 { border-top: 1px solid var(--rule); padding-top: 2.2rem; }
.missing p { max-width: 42rem; }
.missing p:last-child { display: flex; flex-wrap: wrap; gap: 0.6rem; }

/* ------------------------------------------------------------- topic grid */
/* Image-led tiles. Every image slot is 16:10; object-fit crops anything else. */
.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 1.1rem;
  list-style: none;
  margin: 1.2rem 0 0;
  padding: 0;
}
.topic-grid a {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
  color: var(--ink);
  text-decoration: none;
}
.topic-grid a:hover { border-color: var(--ink); }
.topic-grid img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; }
.topic-tile-text { display: grid; gap: 0.25rem; padding: 0.8rem 1rem 1rem; }
.topic-name { font-family: var(--display); font-weight: 700; font-size: 1.15rem; line-height: 1.2; }
.topic-grid a:hover .topic-name { text-decoration: underline; text-underline-offset: 0.18em; }
.topic-blurb { color: var(--ink-soft); font-size: 0.95rem; }
.topic-count { font-size: 0.88rem; font-weight: 700; color: var(--malachite); }
.topic-soon { margin: 1.4rem 0 0; color: var(--ink-soft); max-width: 60rem; }
.topic-soon strong { color: var(--ink); }
.topic-soon a { display: inline-block; margin-right: 0.9rem; color: var(--ink-soft); }

/* ------------------------------------------------------------ model cards */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: 1.1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.model-card-link a {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
  color: var(--ink);
  text-decoration: none;
}
.model-card-link a:hover { border-color: var(--ink); }
.model-card-link img, .model-card-link .card-anim { display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; border-bottom: 1px solid var(--rule); }
.model-card-link .card-anim { transition: opacity 0.35s ease; }
.model-card-text { display: flex; flex-direction: column; align-items: flex-start; gap: 0.4rem; padding: 0.9rem 1rem 1.1rem; }
.model-card-link strong { font-family: var(--display); font-size: 1.2rem; line-height: 1.2; }
.model-card-link a:hover strong { text-decoration: underline; text-underline-offset: 0.18em; }
.model-card-summary { color: var(--ink-soft); font-size: 0.97rem; }

.tag {
  display: inline-block;
  padding: 0.1rem 0.55rem;
  font-size: 0.82rem;
  font-weight: 700;
  border: 1.5px solid currentColor;
  border-radius: 999px;
  color: var(--ink-soft);
}
.tag--interactive, .tag--learn { color: var(--prussian); }
.tag--practice { color: var(--malachite); }
/* "Test yourself": filled, so that a bench stands out from the models that lead to it. */
.tag--test { color: #fff; background: var(--malachite); border-color: var(--malachite); }
.model-card-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
/* Progress, kept in the student's own browser and added by site.js. */
.progress-badge { font-size: 0.82rem; font-weight: 700; color: var(--ink-soft); }
.progress-badge.is-done { color: var(--malachite); }
.model-card-link.is-done a { border-color: var(--malachite); }
.progress-note { margin-top: 1.5rem; font-size: 0.95rem; color: var(--ink-soft); }
[data-progress-count] { font-weight: 400; color: var(--ink-soft); }
/* The five parts on the topics page. */
.part { margin-top: 2rem; }
.part-title { margin: 0; font-size: 1.25rem; }
.part-title span { display: inline-block; margin-right: 0.5rem; padding: 0.05rem 0.55rem; font-family: var(--body); font-size: 0.8rem; letter-spacing: 0.03em; text-transform: uppercase; color: var(--ink-soft); border: 1.5px solid var(--rule); border-radius: 999px; vertical-align: 0.15em; }
.part .topic-grid { margin-top: 0.8rem; }
.part .topic-grid:empty { display: none; }
.part .topic-soon { margin-top: 0.7rem; }
/* "Carry on where you left off", on the landing page. */
.carry-on { padding-block: 0 0.5rem; }
.carry-on p { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1rem; margin: 0; padding: 0.9rem 1.1rem; background: var(--surface); border: 2px solid var(--prussian); border-radius: var(--radius); }
.carry-on span { font-weight: 700; }

.topic-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 24rem); gap: 1.5rem 2.5rem; align-items: center; margin-bottom: 1rem; }
.topic-head img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--rule); }
.topic-head .topic-pic { overflow: hidden; border-radius: var(--radius); border: 1px solid var(--rule); }
.topic-head .topic-pic svg { display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; }

/* ------------------------------------------------- topic and coverage pages */
/* A section: an ordered path of models ending in a practice set. */
.path { margin-top: 2.4rem; }
.path h2 { margin-bottom: 0.2rem; }
.path-lead { color: var(--ink-soft); }
.card-grid--steps { counter-reset: step; }
.card-grid--steps > li { counter-increment: step; position: relative; }
.card-grid--steps > li::before {
  content: counter(step);
  position: absolute;
  top: 0.6rem;
  left: 0.6rem;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  font-family: var(--display);
  font-weight: 700;
  color: #fff;
  background: var(--prussian);
  border: 2px solid #fff;
  border-radius: 50%;
}
.model-card-soon {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 0.4rem;
  min-height: 9rem;
  padding: 3.2rem 1rem 1.1rem;
  border: 2px dashed var(--rule);
  border-radius: var(--radius);
  color: var(--ink-soft);
}
.model-card-soon strong { font-family: var(--display); font-size: 1.15rem; line-height: 1.2; color: var(--ink); }
.later-list { padding-left: 1.2rem; }
.later-list li { margin: 0.3rem 0; }
.later-list .link-btn { margin-left: 0.5rem; font-size: 0.95rem; }
.coverage-kind { color: var(--ink-soft); font-size: 0.95rem; }

/* The section a model belongs to, shown under the model. */
.section-path { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--rule); max-width: 46rem; }
.section-path h2 { font-size: 1.3rem; }
.section-path ol { margin: 0; padding-left: 1.5rem; }
.section-path li { margin: 0.5rem 0; padding-left: 0.3rem; }
.section-path li.is-here { font-weight: 700; }
.section-path .tag { margin-right: 0.4rem; }
.section-path-note { margin-left: 0.4rem; font-size: 0.9rem; font-weight: 400; color: var(--ink-soft); }

.legend { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; list-style: none; padding: 0; margin: 1.2rem 0 0; font-size: 0.95rem; color: var(--ink-soft); }

.status {
  display: inline-block;
  min-width: 4.6rem;
  padding: 0.08rem 0.55rem;
  font-size: 0.82rem;
  font-weight: 700;
  text-align: center;
  border-radius: 999px;
  border: 1.5px solid transparent;
}
.status--live { background: var(--malachite); color: #fff; }
.status--planned { background: var(--chromate); color: var(--ink); }
.status--none { border-color: var(--rule); color: var(--ink-soft); background: var(--surface); }

.coverage-topic { margin-top: 2.2rem; }
.coverage-topic h2 { font-size: 1.3rem; margin-bottom: 0.3rem; }
.coverage-topic h2 a { color: var(--ink); }
.coverage-list { list-style: none; margin: 0; padding: 0; max-width: 52rem; }
.coverage-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 14rem);
  gap: 0.3rem 1rem;
  align-items: baseline;
  padding: 0.5rem 0;
  border-top: 1px solid var(--rule);
}
.coverage-list .link-btn { text-align: left; }

.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); }
.data-table th, .data-table td { padding: 0.6rem 0.8rem; text-align: left; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.data-table thead th { font-size: 0.9rem; color: var(--ink-soft); }
.data-table tbody tr:last-child > * { border-bottom: 0; }

/* -------------------------------------------------------------- model page */
.model-page { padding-block: 1.5rem 3rem; }
.model-actions { display: flex; flex-wrap: wrap; gap: 0.4rem 1.5rem; margin: 1rem 0 0; font-size: 0.97rem; }
.before-this { margin: 0 0 0.9rem; padding: 0.5rem 0.8rem; background: var(--surface); border-left: 5px solid var(--prussian); }
.next-step { margin: 1.6rem 0 0; }
.next-step-btn { display: inline-flex; flex-direction: column; gap: 0.15rem; padding: 0.8rem 1.4rem; text-align: left; }
.next-step-lead { font-size: 0.9rem; font-weight: 400; }
.next-step-title { font-family: var(--display); font-size: 1.3rem; }
body:has(.viz-container.focus-mode) .next-step { display: none; }
.embed-only { display: none; }

/* --------------------------------------------------------- feedback panel */
.fb { background: var(--prussian-deep); color: #fff; padding-block: 2.8rem 3rem; }
.fb-inner { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: 1.5rem 3.5rem; }
.fb h2 { font-size: 1.9rem; }
.fb-lead p { color: #c9d6e4; max-width: 22rem; }
.fb :focus-visible { outline-color: var(--chromate); }

.fb-tabs { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1.2rem; }
html:not(.js) .fb-tabs { display: none; }
html:not(.js) .fb-panel + .fb-panel { margin-top: 2.5rem; }
.fb-tabs button {
  padding: 0.45rem 0.95rem;
  font: inherit;
  font-weight: 700;
  color: #fff;
  background: transparent;
  border: 2px solid #5f7da0;
  border-radius: 999px;
  cursor: pointer;
}
.fb-tabs button:hover { border-color: #fff; }
.fb-tabs button[aria-selected="true"] { background: #fff; border-color: #fff; color: var(--prussian-deep); }

.fb-panel[hidden] { display: none; }
.fb form { display: grid; gap: 0.4rem; max-width: 36rem; }
.fb label, .fb legend { font-weight: 700; margin-top: 0.6rem; padding: 0; }
.fb textarea, .fb select {
  width: 100%;
  padding: 0.55rem 0.65rem;
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 2px solid #fff;
  border-radius: 8px;
}
.fb textarea { resize: vertical; }
.fb .btn { justify-self: start; margin-top: 0.9rem; }
.fb-small { margin: 0.6rem 0 0; font-size: 0.9rem; color: #c9d6e4; }
.fb-status { min-height: 1.6em; margin: 0.4rem 0 0; font-weight: 700; }
.fb-hp { position: absolute; left: -200vw; }
/* Folded to one line until someone asks for it (scripts on only). */
.fb-opener { display: none; }
html.js .fb.is-folded { padding-block: 1.1rem; }
html.js .fb.is-folded .fb-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.6rem 2rem; }
html.js .fb.is-folded .fb-lead { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1.5rem; }
html.js .fb.is-folded h2 { margin: 0; font-size: 1.2rem; }
html.js .fb.is-folded .fb-lead p, html.js .fb.is-folded .fb-main { display: none; }
html.js .fb.is-folded .fb-opener { display: inline-block; margin: 0; }

.fb-rating { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0; padding: 0; border: 0; }
.fb-rating legend { width: 100%; margin: 0 0 0.4rem; }
.fb-rating label { margin: 0; font-weight: 400; }
.fb-rating input { position: absolute; opacity: 0; }
.fb-rating span {
  display: block;
  min-width: 5.5rem;
  padding: 0.45rem 0.9rem;
  text-align: center;
  border: 2px solid #5f7da0;
  border-radius: 8px;
  cursor: pointer;
}
.fb-rating span:hover { border-color: #fff; }
.fb-rating input:checked + span { background: #fff; border-color: #fff; color: var(--prussian-deep); font-weight: 700; }
.fb-rating input:focus-visible + span { outline: 3px solid var(--chromate); outline-offset: 2px; }

/* ----------------------------------------------------------------- footer */
.site-footer { background: var(--prussian-deep); color: #c9d6e4; border-top: 1px solid #2b476b; font-size: 0.95rem; }
.site-footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 2rem; padding-block: 1.2rem 1.6rem; }
.site-footer p { margin: 0; }
.site-footer .footer-copy { display: block; margin-top: 0.4rem; }   /* the copyright line, under the site's name and description (19 November 2026: the site's name, not a person's) */
.site-footer ul { display: flex; flex-wrap: wrap; gap: 0.3rem 1.3rem; list-style: none; margin: 0; padding: 0; }
.site-footer a { color: #fff; }

/* ------------------------------------------------------------- embed mode */
html.embed .hide-in-embed { display: none !important; }
html.embed .embed-only { display: block; margin: 0.8rem 0 0; font-size: 0.9rem; }
html.embed .model-page { padding-block: 0.8rem; }

/* Focus mode is switched on inside a model, but it should quieten the whole page. */
body:has(.viz-container.focus-mode) .site-header,
body:has(.viz-container.focus-mode) .crumbs,
body:has(.viz-container.focus-mode) .model-actions,
body:has(.viz-container.focus-mode) .section-path,
body:has(.viz-container.focus-mode) .fb,
body:has(.viz-container.focus-mode) .site-footer { display: none; }

/* ------------------------------------------------------------ small screens */
@media (max-width: 800px) {
  .hero-inner, .fb-inner, .topic-head { grid-template-columns: minmax(0, 1fr); }
  .coverage-list li { grid-template-columns: minmax(0, 1fr) auto; }
  .coverage-list li > :nth-child(3) { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

/* the Ko-fi box (teacher-facing pages only; a placeholder until site.donate.url is set) */
.donate { margin-top: 2rem; padding: 1.1rem 1.2rem; border: 1px dashed var(--rule-strong, #b9bccc); border-radius: 14px; }
.donate h2 { margin: 0 0 0.4rem; }
.donate p:last-child { margin-bottom: 0; }
.donate-kick { display: block; margin-bottom: 0.5rem; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--prussian); }
.donate-btn, .donate-soon { display: flex; align-items: center; justify-content: center; min-height: 48px; border-radius: 10px; text-align: center; }
.donate-soon { border: 1px dashed var(--rule-strong, #b9bccc); color: var(--muted, #646887); font-weight: 600; }
.tp .donate { margin-top: 0; background: #131824; border-color: #5a6378; }
.tp .donate h2 { font-family: var(--display); font-weight: 500; font-size: 1.4rem; color: var(--ink); }
