/* ── Design tokens ─────────────────────────────────────────────── */

:root {
  --bg: #f7f4ef;
  --bg-alt: #eee9e0;
  --surface: #ffffff;
  --surface-warm: #fdf9f5;
  --line: #e3ddd4;
  --line-strong: #cec7bc;
  --text: #201c16;
  --muted: #6b6157;
  --muted-strong: #3d3730;
  --accent: #c94d22;
  --accent-strong: #a83d18;
  --accent-soft: #fdf0ea;
  --teal: #1a7d6e;
  --teal-soft: #e6f5f3;
  --violet: #5e44a0;
  --violet-soft: #f0ecfa;
  --gold: #9e6e00;
  --gold-soft: #fdf4e0;
  --shadow: 0 2px 12px rgba(30, 22, 12, 0.07), 0 1px 3px rgba(30, 22, 12, 0.05);
  --shadow-md: 0 6px 24px rgba(30, 22, 12, 0.10), 0 2px 6px rgba(30, 22, 12, 0.06);
  --radius-xl: 20px;
  --radius-lg: 14px;
  --radius-md: 10px;
  --content: 1180px;
  --nav-bg: rgba(247, 244, 239, 0.94);
}

/* ── Temperature-reactive theming ──────────────────────────────────
   Each topic page sets data-topic on <body>. The paper warms or cools
   a few degrees and the accent shifts so the whole page *feels* like
   its physics. Components downstream just read the tokens. */

body[data-topic="heat"] {
  --bg: #f8f1e9;
  --bg-alt: #f1e5d8;
  --surface-warm: #fdf3ea;
  --accent: #c94d22;
  --accent-strong: #a83d18;
  --accent-soft: #fdeee5;
  --nav-bg: rgba(248, 241, 233, 0.94);
}

body[data-topic="cold"] {
  --bg: #eef3f4;
  --bg-alt: #e0eaec;
  --surface-warm: #f0f7f7;
  --accent: #1a7d6e;
  --accent-strong: #14625a;
  --accent-soft: #e3f3f1;
  --nav-bg: rgba(238, 243, 244, 0.94);
}

body[data-topic="light"] {
  --bg: #f8f3e7;
  --bg-alt: #f0e7d2;
  --surface-warm: #fdf7e9;
  --accent: #b97f10;
  --accent-strong: #8a5d00;
  --accent-soft: #faf1d9;
  --nav-bg: rgba(248, 243, 231, 0.94);
}

body[data-topic="sound"] {
  --bg: #f3f1f8;
  --bg-alt: #e8e4f2;
  --surface-warm: #f7f4fc;
  --accent: #5e44a0;
  --accent-strong: #49348a;
  --accent-soft: #efeafa;
  --nav-bg: rgba(243, 241, 248, 0.94);
}

body[data-topic="flow"] {
  --bg: #eef2f5;
  --bg-alt: #dfe8ee;
  --surface-warm: #f1f6f9;
  --accent: #2f7db0;
  --accent-strong: #24628c;
  --accent-soft: #e4f0f8;
  --nav-bg: rgba(238, 242, 245, 0.94);
}

body[data-topic="materials"] {
  --bg: #f4f2ed;
  --bg-alt: #e8e3da;
  --surface-warm: #f8f5ef;
  --accent: #9e6e00;
  --accent-strong: #7d5700;
  --accent-soft: #f5edda;
  --nav-bg: rgba(244, 242, 237, 0.94);
}

/* ── Reset ─────────────────────────────────────────────────────── */

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--text);
  background-color: var(--bg);
  font-family: "Georgia", "Times New Roman", serif;
  font-size: 1rem;
  line-height: 1.7;
}

img { display: block; max-width: 100%; }

a { color: inherit; }

button, input { font: inherit; }

/* ── Shell ─────────────────────────────────────────────────────── */

.site-shell { position: relative; }

/* ── Navigation ────────────────────────────────────────────────── */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 3.5rem;
  padding: 0 max(1.25rem, calc((100% - var(--content)) / 2 + 1.25rem));
  background: var(--nav-bg);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.brand {
  color: var(--text);
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-decoration: none;
  text-transform: uppercase;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem;
}

.nav-links a {
  color: var(--muted);
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 0.35rem 0.7rem;
  border-radius: 6px;
  text-decoration: none;
  text-transform: uppercase;
  transition: color 140ms ease, background 140ms ease;
}

.nav-links a:hover,
.nav-links a:focus-visible {
  color: var(--text);
  background: var(--line);
}

.site-nav a[aria-current="page"],
.footer-nav a[aria-current="page"] {
  color: var(--accent-strong);
  font-weight: 700;
}

/* ── Hero section ──────────────────────────────────────────────── */

.hero {
  width: min(calc(100% - 2.5rem), var(--content));
  margin: 0 auto;
  padding: 3.5rem 0 3rem;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 3rem;
  align-items: center;
}

.hero-copy {
  padding: 2.5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 0.75rem;
  color: var(--accent-strong);
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1, h2, h3 {
  margin: 0;
  font-family: "Georgia", serif;
  line-height: 1.15;
  font-weight: 700;
  color: var(--text);
  text-wrap: balance;
}

h1 { font-size: clamp(1.8rem, 3.2vw, 2.75rem); }
h2 { font-size: clamp(1.35rem, 2.1vw, 1.85rem); }
h3 { font-size: clamp(0.95rem, 1.2vw, 1.12rem); }

.hero-lead {
  margin: 1.1rem 0 0;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.75;
}

.hero-actions, .quiz-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1.75rem 0 0;
}

/* hero image panel */
.hero-panel, .path-media, .visual-card {
  overflow: hidden;
  border-radius: var(--radius-xl);
  border: 1px solid var(--line);
  background: var(--surface-warm);
  box-shadow: var(--shadow);
}

.hero-panel img, .path-media img, .visual-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-panel img[src$=".svg"],
.path-media img[src$=".svg"],
.visual-card img[src$=".svg"],
.phenomenon-card img[src$=".svg"],
.detail-panel img[src$=".svg"],
.story-slide img[src$=".svg"] {
  object-fit: contain;
  padding: 1.2rem;
  background: var(--surface-warm);
}

/* homepage copy — no card box, open layout */
.hero-copy-home {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 1rem 0;
  border-radius: 0;
  align-self: center;
}

/* homepage hero grid overrides */
.hero-grid-home {
  grid-template-columns: 1fr 1fr;
  align-items: stretch;
  gap: 1.5rem;
}

/* homepage hero collage */
.hero-collage {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 0.75rem;
  min-height: 360px;
}

.hero-collage > .hero-panel-large {
  grid-row: span 2;
}

.hero-collage > :nth-child(4) {
  display: none;
}

/* Ensure hero panels have visible height for SVG content */
.hero-grid > .hero-panel,
.hero-grid > .hero-panel-large {
  min-height: 280px;
  align-self: stretch;
}

/* ── Buttons ───────────────────────────────────────────────────── */

.button,
.ghost-button,
.control-pill,
.filter-chip,
.story-dot,
.quiz-option,
.inline-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 2.6rem;
  padding: 0.55rem 1.1rem;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--muted-strong);
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-decoration: none;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    border-color 150ms ease,
    background 150ms ease,
    color 150ms ease,
    box-shadow 150ms ease,
    transform 150ms ease;
}

.button-primary {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent-strong);
  box-shadow: 0 3px 10px rgba(201, 77, 34, 0.28);
}

.button-primary:hover,
.button-primary:focus-visible {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  transform: translateY(-1px);
  box-shadow: 0 5px 16px rgba(201, 77, 34, 0.34);
}

.button-secondary {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.button-secondary:hover,
.button-secondary:focus-visible {
  background: #fce8de;
  transform: translateY(-1px);
}

.ghost-button:hover,
.ghost-button:focus-visible,
.control-pill:hover,
.control-pill:focus-visible,
.filter-chip:hover,
.filter-chip:focus-visible,
.inline-link:hover,
.inline-link:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-1px);
}

.inline-link {
  min-height: 0;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  border-radius: 0;
  font-size: 0.78rem;
}

.inline-link:hover,
.inline-link:focus-visible {
  color: var(--accent-strong);
  background: transparent;
  border-color: transparent;
  transform: none;
}

.filter-chip.is-active,
.control-pill.is-active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent-strong);
}

.story-dot {
  min-height: 0.75rem;
  width: 0.75rem;
  padding: 0;
  border-radius: 50%;
}

.story-dot.is-active {
  background: var(--accent);
  border-color: var(--accent-strong);
}

/* ── Section wrapper ───────────────────────────────────────────── */

.section {
  width: min(calc(100% - 2.5rem), var(--content));
  margin: 0 auto;
  padding: 3.5rem 0;
}

.section-header {
  max-width: 48rem;
  margin-bottom: 2rem;
}

.section-header h2 {
  margin-top: 0.5rem;
}

.section-header-wide {
  max-width: none;
  display: grid;
  grid-template-columns: 1fr 0.75fr;
  gap: 2rem;
  align-items: end;
}

.section-copy {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.75;
  margin: 0;
}

/* ── Pillar cards (home + teach) ───────────────────────────────── */

.pillars {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.pillar-card {
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  display: grid;
  gap: 0.6rem;
  align-content: start;
}

.pillar-card p {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.65;
  margin: 0;
}

.pillar-index,
.path-label,
.story-step,
.studio-label,
.experiment-tag,
.detail-kicker,
.quiz-kicker,
.chapter-chip {
  margin: 0 0 0.5rem;
  color: var(--accent-strong);
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ── Path cards (learn, index quick-starts) ────────────────────── */

.path-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.1rem;
}

.path-card {
  display: grid;
  grid-template-columns: 1fr 0.8fr;
  gap: 0;
  border-radius: var(--radius-xl);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.path-card-cool {
  grid-template-columns: 0.8fr 1fr;
}

.path-copy {
  padding: 2rem 2rem;
  display: grid;
  align-content: center;
  gap: 0.75rem;
}

.path-copy p {
  color: var(--muted);
  font-size: 0.97rem;
  line-height: 1.7;
  margin: 0;
}

.path-media {
  border-radius: 0;
  border: none;
  border-left: 1px solid var(--line);
  min-height: 200px;
}

.path-card-cool .path-media {
  border-left: none;
  border-right: 1px solid var(--line);
}

/* ── Hero stats ─────────────────────────────────────────────────── */

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin: 2rem 0 0;
}

.hero-stats div {
  padding-top: 0.9rem;
  border-top: 2px solid var(--line);
}

.hero-stats dt {
  color: var(--text);
  font-family: "Segoe UI", sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
}

.hero-stats dd {
  margin: 0.3rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* ── Atlas (explore) ───────────────────────────────────────────── */

.atlas-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.2rem;
}

.chip-row, .control-row, .story-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.atlas-layout {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 1.5rem;
  align-items: start;
}

.phenomena-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.phenomenon-card {
  display: grid;
  gap: 0.7rem;
  padding: 1rem;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.phenomenon-card:hover,
.phenomenon-card:focus-visible {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.phenomenon-card[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.phenomenon-card img {
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: calc(var(--radius-lg) - 4px);
  object-fit: cover;
  background: var(--bg-alt);
}

.phenomenon-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.6;
}

.chapter-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chapter-chip {
  display: inline-flex;
  align-items: center;
  min-height: 1.6rem;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.detail-panel {
  position: sticky;
  top: 4.5rem;
  padding: 1.4rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
}

.detail-panel p {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.7;
  margin: 0;
}

.detail-panel img {
  width: 100%;
  aspect-ratio: 16 / 10;
  margin: 1rem 0;
  border-radius: var(--radius-md);
  object-fit: cover;
  background: var(--bg-alt);
}

.detail-list {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
}

.detail-list div {
  padding-top: 0.8rem;
  border-top: 1px solid var(--line);
}

.detail-list dt {
  margin-bottom: 0.28rem;
  color: var(--muted-strong);
  font-weight: 700;
  font-size: 0.9rem;
}

.detail-list dd {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.6;
}

/* ── Studio (try demos) ────────────────────────────────────────── */

.studio-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.studio-card-wide { grid-column: 1 / -1; }

.studio-card {
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.studio-card p {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.68;
  margin: 0.5rem 0 0;
}

.range-wrap {
  display: grid;
  gap: 0.6rem;
  margin-top: 1rem;
}

.range-wrap span {
  color: var(--muted-strong);
  font-family: "Segoe UI", sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.meter, .phase-visual {
  position: relative;
  overflow: hidden;
  height: 0.85rem;
  margin-top: 1rem;
  border-radius: 999px;
  background: var(--bg-alt);
  border: 1px solid var(--line);
}

.meter-fill {
  width: 20%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  transition: width 340ms cubic-bezier(0.34, 1.4, 0.64, 1);
}

.meter-fill-sound {
  background: linear-gradient(90deg, var(--teal), var(--violet));
}

.light-swatch {
  height: 5rem;
  margin-top: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
}

.phase-visual {
  height: 5rem;
}

.phase-state {
  width: 100%;
  height: 100%;
  border-radius: inherit;
}

.demo-readout {
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: 0.93rem;
  line-height: 1.6;
}

/* ── Experiments (try) ─────────────────────────────────────────── */

.experiment-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.experiment-card {
  padding: 1.4rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.experiment-card p {
  color: var(--muted);
  font-size: 0.93rem;
  line-height: 1.65;
  margin: 0.4rem 0 0;
}

/* ── Quiz ──────────────────────────────────────────────────────── */

.quiz-shell { display: grid; gap: 1rem; }

.quiz-progress {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.quiz-card {
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.quiz-card p { color: var(--muted); margin: 0; line-height: 1.7; }

.quiz-options {
  display: grid;
  gap: 0.65rem;
  margin-top: 1rem;
}

.quiz-option {
  justify-content: flex-start;
  min-height: 3rem;
  padding-inline: 1rem;
  text-align: left;
  text-transform: none;
  font-size: 0.88rem;
  letter-spacing: 0;
  border-radius: var(--radius-md);
}

.quiz-option.is-correct {
  color: #fff;
  background: var(--teal);
  border-color: var(--teal);
}

.quiz-option.is-wrong {
  color: #fff;
  background: #c0392b;
  border-color: #a93226;
}

.quiz-feedback {
  margin: 0.8rem 0 0;
  color: var(--muted-strong);
  font-size: 0.93rem;
  line-height: 1.65;
}

/* ── Visual grid ───────────────────────────────────────────────── */

.visual-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.visual-card figcaption {
  padding: 0.85rem 1rem 1rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.65;
}

/* ── Glossary ──────────────────────────────────────────────────── */

.glossary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.glossary-card {
  padding: 1.4rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.glossary-card p {
  color: var(--muted);
  font-size: 0.93rem;
  line-height: 1.65;
  margin: 0.4rem 0 0;
}

/* ── Story viewer (learn) ──────────────────────────────────────── */

.story-viewer {
  padding: 1.4rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
}

.story-track { position: relative; overflow: hidden; }

.story-slide {
  display: none;
  grid-template-columns: 0.92fr 1.08fr;
  gap: 1.5rem;
  align-items: center;
}

.story-slide.is-active { display: grid; }

.story-slide img {
  width: 100%;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
}

.story-copy { padding: 0.6rem 0.4rem; }

.story-copy p {
  color: var(--muted);
  font-size: 0.97rem;
  line-height: 1.7;
  margin: 0.5rem 0 0;
}

.story-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

/* ── About / CTA strip ─────────────────────────────────────────── */

.about-section { padding-bottom: 5rem; }

.about-layout {
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: 2rem;
  padding: 2rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  align-items: center;
}

.about-copy p {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.75;
  margin: 0;
}

.about-copy a {
  color: var(--accent-strong);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.about-copy a:hover { color: var(--text); }

/* ── Footer ────────────────────────────────────────────────────── */

.site-footer {
  margin-top: 4rem;
  padding: 2rem 0;
  border-top: 1px solid var(--line);
  background: var(--surface-warm);
}

.footer-inner {
  width: min(calc(100% - 2.5rem), var(--content));
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 2rem;
}

.footer-inner .brand { flex-shrink: 0; }

/* Discreet company attribution + contact (Seailles Limited). */
.footer-meta {
  width: min(calc(100% - 2.5rem), var(--content));
  margin: 1.6rem auto 0;
  padding-top: 1.3rem;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 0.55rem 1rem;
  flex-wrap: wrap;
}

.footer-meta img { height: 22px; width: auto; display: block; opacity: 0.92; }

.footer-meta p {
  margin: 0;
  color: var(--muted);
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  font-size: 0.82rem;
  line-height: 1.5;
}

.footer-meta a { color: var(--muted-strong); text-decoration: none; font-weight: 600; }
.footer-meta a:hover,
.footer-meta a:focus-visible { color: var(--accent-strong); text-decoration: underline; }

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  flex: 1;
}

.footer-nav a {
  color: var(--muted);
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  padding: 0.25rem 0.55rem;
  border-radius: 5px;
  text-decoration: none;
  text-transform: uppercase;
  transition: color 140ms ease, background 140ms ease;
}

.footer-nav a:hover,
.footer-nav a:focus-visible {
  color: var(--text);
  background: var(--line);
}

.footer-tagline {
  width: 100%;
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1fr;
  gap: 2rem;
  align-items: start;
}

.footer-brand-block .footer-tagline {
  margin-top: 0.7rem;
  line-height: 1.6;
}

.footer-col {
  display: grid;
  gap: 0.1rem;
  justify-items: start;
}

.footer-col .footer-col-title {
  margin: 0 0 0.4rem;
  color: var(--accent-strong);
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.footer-grid .footer-nav a {
  padding: 0.18rem 0;
  border-radius: 3px;
  text-transform: none;
  letter-spacing: 0.01em;
  font-size: 0.85rem;
  font-weight: 400;
}

@media (max-width: 780px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-brand-block { grid-column: 1 / -1; }
}

/* ── Design signature ──────────────────────────────────────────── */

::selection {
  background: var(--accent);
  color: #fff;
}

body {
  background-image: radial-gradient(1100px 480px at 88% -8%, rgba(201, 77, 34, 0.06), rgba(201, 77, 34, 0));
  background-repeat: no-repeat;
}

.brand::before {
  content: "";
  display: inline-block;
  width: 1.55em;
  height: 1.55em;
  margin-right: 0.55em;
  vertical-align: -0.48em;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Crect width='64' height='64' rx='14' fill='%23c94d22'/%3E%3Cpath d='M22 10c0 4-5 5-5 9s5 5 5 9' fill='none' stroke='%23f7f4ef' stroke-width='4' stroke-linecap='round'/%3E%3Cpath d='M40 10c0 4-5 5-5 9s5 5 5 9' fill='none' stroke='%23f7f4ef' stroke-width='4' stroke-linecap='round'/%3E%3Cpath d='M14 36h36l-4 16a4 4 0 0 1-4 3H22a4 4 0 0 1-4-3z' fill='%23f7f4ef'/%3E%3C/svg%3E") center / contain no-repeat;
}

.section-header h2::after {
  content: "";
  display: block;
  width: 3.4rem;
  height: 3px;
  margin-top: 0.65rem;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--gold));
}

/* ── Scroll-progress bar ───────────────────────────────────────── */

.lesson-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  z-index: 100;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  transition: width 80ms linear;
  pointer-events: none;
}

/* ── Lesson page wrapper ───────────────────────────────────────── */

.page {
  width: min(calc(100% - 2.5rem), var(--content));
  margin: 0 auto;
  padding: 2rem 0 5rem;
}

.page > .section {
  width: auto;
  padding: 3rem 0 0;
}

/* ── Lesson ToC ────────────────────────────────────────────────── */

.lesson-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0 0 2.5rem;
}

.lesson-toc a {
  display: inline-flex;
  align-items: center;
  min-height: 2.1rem;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--muted-strong);
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  font-size: 0.69rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  transition: border-color 140ms ease, color 140ms ease, background 140ms ease;
}

.lesson-toc a:hover,
.lesson-toc a:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

/* ── Lesson content grids ──────────────────────────────────────── */

.grid-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.grid-three, .cards, .teacher-grid, .print-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

/* ── Lesson content cards ──────────────────────────────────────── */

.panel,
.diagram-card,
.sequence-card,
.question-card,
.activity-card,
.teacher-card,
.sim-card {
  padding: 1.4rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.panel p,
.diagram-card p,
.sequence-card p,
.question-card p,
.activity-card p,
.teacher-card p,
.sim-card p {
  color: var(--muted);
  font-size: 0.97rem;
  line-height: 1.72;
  margin: 0.5rem 0 0;
}

.diagram-card img {
  width: 100%;
  border-radius: calc(var(--radius-lg) - 4px);
  margin-top: 1rem;
  border: 1px solid var(--line);
  background: var(--surface-warm);
}

.diagram-card img[src$=".svg"] {
  object-fit: contain;
  padding: 1rem;
  background: var(--surface-warm);
}

/* In multi-column grids a narrow track can fail to resolve the image's
   intrinsic ratio, leaving the figure stretched tall with a big gap above
   it. Pin the true 4:3 ratio, and let the image card size to its content so
   the diagram sits directly under its text. (Full-width explainer cards are
   not in these grids and are unaffected.) */
.grid-two .diagram-card img,
.grid-three .diagram-card img,
.cards .diagram-card img {
  aspect-ratio: 1200 / 900;
  height: auto;
}

.grid-two > .diagram-card,
.grid-three > .diagram-card,
.cards > .diagram-card {
  align-self: start;
}

.kicker {
  margin: 0 0 0.6rem;
  color: var(--accent-strong);
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  font-size: 0.71rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.callout {
  margin-top: 1rem;
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  color: var(--muted-strong);
  font-size: 0.97rem;
  line-height: 1.72;
}

ul {
  margin: 0.75rem 0 0;
  padding-left: 1.2rem;
  color: var(--muted);
  font-size: 0.97rem;
  line-height: 1.72;
}

/* ── Lesson simulation components ──────────────────────────────── */

.sim-shell { display: grid; gap: 0.9rem; }

.sim-meter {
  position: relative;
  overflow: hidden;
  height: 0.85rem;
  margin-top: 0.5rem;
  border-radius: 999px;
  background: var(--bg-alt);
  border: 1px solid var(--line);
}

.sim-fill {
  width: 30%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--gold), var(--violet));
  transition: width 380ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.sim-stage {
  position: relative;
  overflow: hidden;
  height: 7rem;
  margin-top: 0.5rem;
  border-radius: var(--radius-md);
  background: var(--bg-alt);
  border: 1px solid var(--line);
}

.sim-state {
  width: 100%;
  height: 100%;
  border-radius: inherit;
}

.sim-readout {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.7;
  margin: 0;
}

.sim-canvas {
  display: block;
  width: 100%;
  height: auto;
  margin-top: 0.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-warm);
}

.sim-canvas-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.6rem;
}

/* ── Print card (ruled) ────────────────────────────────────────── */

.print-card {
  padding: 1.4rem;
  border-radius: var(--radius-lg);
  background:
    repeating-linear-gradient(
      180deg,
      transparent,
      transparent 27px,
      rgba(30, 22, 12, 0.04) 28px
    ),
    var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.print-card p {
  color: var(--muted);
  font-size: 0.97rem;
  line-height: 1.72;
}

/* ── Footer note ───────────────────────────────────────────────── */

.footer-note {
  margin-top: 3rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.72;
}

/* ── Responsive: 1080px ────────────────────────────────────────── */

@media (max-width: 1080px) {
  .hero-grid,
  .section-header-wide,
  .atlas-layout,
  .story-slide,
  .path-card,
  .path-card-cool,
  .about-layout {
    grid-template-columns: 1fr;
  }

  .path-media {
    border-left: none;
    border-top: 1px solid var(--line);
    min-height: 220px;
  }

  .path-card-cool .path-media {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .detail-panel { position: static; }

  .pillars,
  .studio-grid,
  .experiment-grid,
  .visual-grid,
  .glossary-grid,
  .phenomena-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ── Responsive: 780px ─────────────────────────────────────────── */

@media (max-width: 780px) {
  .hero,
  .section,
  .page {
    width: min(calc(100% - 1.25rem), var(--content));
  }

  .site-nav {
    height: auto;
    flex-wrap: wrap;
    padding: 0.75rem 1rem;
    gap: 0.5rem;
  }

  .nav-links { width: 100%; gap: 0.1rem; }

  .nav-links a { font-size: 0.7rem; padding: 0.3rem 0.55rem; }

  .hero { padding: 1.5rem 0 2rem; }

  .hero-copy { padding: 1.5rem; }

  .hero-collage,
  .hero-stats,
  .pillars,
  .studio-grid,
  .experiment-grid,
  .visual-grid,
  .glossary-grid,
  .phenomena-grid {
    grid-template-columns: 1fr;
  }

  .hero-panel-large { grid-row: span 1; }

  .story-controls,
  .quiz-progress {
    justify-content: flex-start;
    align-items: flex-start;
  }
}

/* ── Responsive: lesson grids ──────────────────────────────────── */

@media (max-width: 980px) {
  .grid-two,
  .grid-three,
  .cards,
  .teacher-grid,
  .print-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Print ─────────────────────────────────────────────────────── */

@media print {
  body { color: #111; background: #fff; background-image: none; }

  .site-nav,
  .lesson-progress-bar,
  .lesson-toc,
  .hero-actions,
  .site-footer { display: none; }

  .section-header h2::after,
  .brand::before { display: none; }

  .page, .section { width: 100%; }

  .hero-copy,
  .panel,
  .diagram-card,
  .question-card,
  .sequence-card,
  .activity-card,
  .teacher-card,
  .print-card,
  .sim-card {
    color: #111;
    background: #fff;
    box-shadow: none;
    border: 1px solid #ccc;
  }

  .kicker, .eyebrow { color: #555; }

  .panel p,
  .diagram-card p,
  .sequence-card p,
  .question-card p,
  .activity-card p,
  .teacher-card p,
  .print-card p,
  .sim-readout { color: #333; }

  .breadcrumb,
  .next-lesson-band,
  .quiz-history,
  .atlas-count { display: none; }
}

/* ── Skip link ──────────────────────────────────────────────────── */

.skip-link {
  position: fixed;
  top: -100%;
  left: 1rem;
  z-index: 9999;
  padding: 0.5rem 1.25rem;
  background: var(--accent);
  color: #fff;
  font-family: "Segoe UI", "Inter", "Helvetica Neue", sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: 1rem;
  outline: 3px solid var(--accent-strong);
  outline-offset: 2px;
}

/* ── Breadcrumb ─────────────────────────────────────────────────── */

.breadcrumb {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.82rem;
  color: var(--muted);
  padding: 1rem 2rem 0;
  max-width: var(--content);
  margin: 0 auto;
  font-family: "Segoe UI", "Inter", "Helvetica Neue", sans-serif;
}

.breadcrumb a {
  color: var(--muted);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.breadcrumb-sep {
  color: var(--line-strong);
}

.breadcrumb [aria-current="page"] {
  color: var(--text);
  font-weight: 500;
}

/* ── Next-lesson band ───────────────────────────────────────────── */

.next-lesson-band {
  background: var(--accent-soft);
  border-top: 1px solid var(--line);
  padding: 2rem;
}

.next-lesson-inner {
  max-width: var(--content);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
}

.next-lesson-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin: 0 0 0.2rem;
  font-family: "Segoe UI", "Inter", "Helvetica Neue", sans-serif;
}

.next-lesson-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
  font-family: "Segoe UI", "Inter", "Helvetica Neue", sans-serif;
}

/* ── Atlas count + quiz history ─────────────────────────────────── */

.atlas-count {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0.25rem 0 0;
  font-family: "Segoe UI", "Inter", "Helvetica Neue", sans-serif;
}

.quiz-history {
  font-size: 0.88rem;
  color: var(--muted);
  margin: 0 0 1.5rem;
  font-family: "Segoe UI", "Inter", "Helvetica Neue", sans-serif;
}

/* ── Glossary ───────────────────────────────────────────────────── */

.glossary-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.5rem;
}

.glossary-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.1rem;
  min-height: 2.1rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted-strong);
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
}

.glossary-nav a:hover,
.glossary-nav a:focus-visible {
  border-color: var(--accent);
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.glossary-letter {
  margin: 2.2rem 0 0.4rem;
  color: var(--accent-strong);
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.glossary-list {
  margin: 0;
  padding: 1.1rem 1.4rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.glossary-list dt {
  font-weight: 700;
  scroll-margin-top: 5rem;
}

.glossary-list dt + dd,
.glossary-list dd + dt {
  margin-top: 0.25rem;
}

.glossary-list dd + dt {
  margin-top: 1rem;
}

.glossary-list dd {
  margin-left: 0;
  color: var(--muted);
  line-height: 1.7;
}

/* ── 3D kitchen (kitchen3d.html) ────────────────────────────────── */

.k3d-body {
  overflow: hidden;
  height: 100vh;
}

.k3d-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 3.5rem;
  padding: 0 1.25rem;
  background: rgba(247, 244, 239, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.k3d-topbar-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.k3d-stage {
  position: fixed;
  inset: 0;
  background: linear-gradient(180deg, #efe9df 0%, #e4dccd 100%);
}

.k3d-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.k3d-label {
  position: absolute;
  z-index: 10;
  margin: 0;
  padding: 0.3rem 0.7rem;
  transform: translate(-50%, -130%);
  border-radius: 999px;
  background: rgba(32, 28, 22, 0.85);
  color: #f7f4ef;
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none;
}

.k3d-index {
  position: fixed;
  z-index: 20;
  top: 4.5rem;
  left: 1rem;
  width: 250px;
  max-height: calc(100vh - 6rem);
  overflow-y: auto;
  padding: 1rem 1.1rem;
  background: rgba(255, 255, 255, 0.93);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(8px);
}

.k3d-index h2 {
  margin: 0 0 0.3rem;
  font-size: 1.05rem;
}

.k3d-index-copy {
  margin: 0 0 0.8rem;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.55;
}

.k3d-index-list {
  display: grid;
  gap: 0.4rem;
}

.k3d-index-list button {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.86rem;
  text-align: left;
  cursor: pointer;
}

.k3d-index-list button:hover,
.k3d-index-list button:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.k3d-index-list button.is-active {
  border-color: var(--accent-strong);
  background: var(--accent-soft);
  font-weight: 700;
}

.k3d-index-dot {
  flex: 0 0 auto;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 999px;
  background: var(--accent);
}

/* A visited phenomenon: filled teal dot with a small check. */
.k3d-index-list button.is-visited .k3d-index-dot {
  background: var(--teal);
  position: relative;
}

.k3d-index-list button.is-visited .k3d-index-dot::after {
  content: "";
  position: absolute;
  left: 0.16rem;
  top: 0.06rem;
  width: 0.14rem;
  height: 0.26rem;
  border: solid #fff;
  border-width: 0 0.07rem 0.07rem 0;
  transform: rotate(40deg);
}

.k3d-index-list button.is-visited:not(.is-active) { color: var(--muted-strong); }

.k3d-progress {
  margin: 0.75rem 0 0;
  padding-top: 0.6rem;
  border-top: 1px solid var(--line);
  color: var(--teal);
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.k3d-panel {
  position: fixed;
  z-index: 25;
  top: 4.5rem;
  right: 1rem;
  width: min(370px, calc(100vw - 2rem));
  max-height: calc(100vh - 6rem);
  overflow-y: auto;
  padding: 1.3rem 1.4rem;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(8px);
}

.k3d-panel-title {
  margin: 0 0 0.6rem;
  font-size: 1.35rem;
  line-height: 1.25;
}

.k3d-panel-body {
  margin: 0 0 0.8rem;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.65;
}

.k3d-panel-question {
  margin: 0 0 1rem;
  padding: 0.7rem 0.9rem;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  color: var(--muted-strong);
  font-size: 0.9rem;
  line-height: 1.6;
}

.k3d-panel-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.k3d-panel-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  border-top: 1px solid var(--line);
  padding-top: 0.9rem;
}

.k3d-hint {
  position: fixed;
  z-index: 15;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%);
  margin: 0;
  padding: 0.45rem 1rem;
  border-radius: 999px;
  background: rgba(32, 28, 22, 0.78);
  color: #f7f4ef;
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  font-size: 0.8rem;
  pointer-events: none;
}

.k3d-fallback {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: var(--bg);
}

.k3d-fallback[hidden] { display: none; }

.k3d-fallback-card {
  max-width: 34rem;
  padding: 2rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
}

@media (max-width: 780px) {
  .k3d-index {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: auto;
    max-height: 38vh;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  }

  .k3d-panel {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: auto;
    max-height: 62vh;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  }

  .k3d-hint { display: none; }
}

/* ── Ambient physics field ─────────────────────────────────────────
   A full-viewport canvas behind all content. ambient bootstrap in
   nav.js paints a topic-keyed field (rising heat, falling cold,
   drifting light, sound rings, flow streamlines, a material lattice).
   Kept very faint so body text stays readable on top. */

#ambient-field {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.5;
}

.site-shell {
  position: relative;
  z-index: 1;
}

/* ── The dial (single-scrubber lesson story) ───────────────────────── */

.dial-card {
  padding: 1.4rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.dial-canvas {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-warm);
}

.dial-state-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.6rem 0.9rem;
  margin-top: 1rem;
}

.dial-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid var(--line);
  color: var(--accent-strong);
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.dial-badge::before {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 999px;
  background: var(--accent);
}

.dial-temp {
  font-family: "Consolas", "SFMono-Regular", "Menlo", monospace;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.dial-temp span {
  font-size: 0.9rem;
  color: var(--muted);
}

.dial-range-wrap {
  display: grid;
  gap: 0.45rem;
  margin-top: 1.1rem;
}

.dial-range-label {
  display: flex;
  justify-content: space-between;
  color: var(--muted-strong);
  font-family: "Segoe UI", sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
}

.dial-range-label .dial-energy-pct {
  font-family: "Consolas", "SFMono-Regular", "Menlo", monospace;
  color: var(--accent-strong);
  font-variant-numeric: tabular-nums;
}

.dial-card input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.dial-readout {
  margin: 0.9rem 0 0;
  color: var(--muted);
  font-size: 0.97rem;
  line-height: 1.72;
  min-height: 3.4em;
}

.dial-audio-btn {
  margin-left: auto;
}

/* ── Language switcher & landing chooser ───────────────────────────── */

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-left: 0.4rem;
}

.lang-switch-float {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 8000;
  padding: 0.3rem 0.6rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow);
}

.lang-globe { font-size: 0.95rem; line-height: 1; }

.lang-select {
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 0.28rem 0.4rem;
  cursor: pointer;
}

.lang-select:hover { color: var(--text); }

.lang-modal {
  position: fixed;
  inset: 0;
  z-index: 9500;
  display: grid;
  place-items: center;
  padding: 5vmin;
  background: rgba(24, 18, 10, 0.55);
}

.lang-modal-card {
  width: 100%;
  max-width: 460px;
  padding: 1.7rem 1.8rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
}

.lang-modal-card h2 {
  font-family: "Georgia", serif;
  font-size: 1.4rem;
  margin: 0 0 0.3rem;
}

.lang-modal-card > p {
  margin: 0 0 1.1rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.lang-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
}

.lang-grid button {
  padding: 0.65rem 0.85rem;
  background: var(--surface-warm);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--text);
  font-size: 1rem;
  text-align: left;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease;
}

.lang-grid button:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.lang-modal-skip {
  margin-top: 1rem;
  padding: 0;
  background: none;
  border: none;
  color: var(--accent-strong);
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}

/* ── History & equation block ──────────────────────────────────────
   A compact "who, when, and the governing equation" note attached to a
   phenomenon. The equation is shown in serif italics in its own framed row. */

.milestone {
  margin-top: 1.2rem;
  padding: 1.2rem 1.4rem;
  background: var(--surface-warm);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-md);
}

.milestone-label {
  margin: 0 0 0.4rem;
  color: var(--accent-strong);
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.milestone p {
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.7;
}

.milestone p strong { color: var(--muted-strong); }

.equation {
  margin: 0.9rem 0 0.2rem;
  padding: 0.85rem 1rem;
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  text-align: center;
}

.equation + .equation { margin-top: 0.6rem; }

.equation-math {
  display: block;
  font-family: "Cambria Math", "Georgia", serif;
  font-style: italic;
  font-size: 1.3rem;
  line-height: 1.4;
  color: var(--text);
}

.equation-name {
  display: block;
  margin-top: 0.3rem;
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  font-style: normal;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.milestone sub { font-size: 0.7em; vertical-align: -0.25em; }
.milestone sup { font-size: 0.7em; vertical-align: 0.4em; }

/* Expandable derivation for technical readers. Native <details>/<summary>. */
.derivation {
  margin-top: 1rem;
  border-top: 1px dashed var(--line-strong);
}

.derivation > summary {
  cursor: pointer;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 0 0.3rem;
  color: var(--accent-strong);
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.derivation > summary::-webkit-details-marker { display: none; }

.derivation > summary::before {
  content: "▸";
  display: inline-block;
  font-size: 0.85em;
  transition: transform 140ms ease;
}

.derivation[open] > summary::before { transform: rotate(90deg); }

.derivation-body { padding: 0.3rem 0 0.2rem; }

.derivation-body p {
  margin: 0.6rem 0 0;
  color: var(--muted);
  font-size: 0.93rem;
  line-height: 1.78;
}

.derivation-need {
  padding: 0.6rem 0.85rem;
  background: var(--accent-soft);
  border-radius: 8px;
  color: var(--muted-strong) !important;
}

.derivation-body .equation { background: var(--surface-warm); }
.derivation-body .equation-math { font-size: 1.12rem; }
.derivation-step {
  color: var(--accent-strong) !important;
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  font-size: 0.72rem !important;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ── Curriculum alignment (for teachers) ───────────────────────────── */

.curriculum {
  margin-top: 1.5rem;
  padding: 1.2rem 1.4rem;
  background: var(--teal-soft);
  border: 1px solid #cfe7e2;
  border-left: 4px solid var(--teal);
  border-radius: var(--radius-md);
}

.curriculum-label {
  margin: 0;
  color: #13564b;
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.curriculum-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.7rem 0 0.2rem;
}

.curriculum-tag {
  padding: 0.4rem 0.75rem;
  background: var(--surface);
  border: 1px solid #cfe7e2;
  border-radius: 999px;
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  font-size: 0.82rem;
  color: var(--muted-strong);
}

.curriculum-tag strong { color: #13564b; font-weight: 800; }

.curriculum p {
  margin: 0.6rem 0 0;
  color: var(--muted);
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  font-size: 0.9rem;
  line-height: 1.65;
}

/* ── Present mode (fullscreen dial for projection) ─────────────────── */

.dial-present { padding: 0.3rem 0.7rem; font-size: 0.72rem; }
.dial-share { margin-left: auto; padding: 0.3rem 0.7rem; font-size: 0.72rem; }
.dial-hear { padding: 0.3rem 0.7rem; font-size: 0.72rem; }

.dial-card:fullscreen {
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: var(--bg);
  padding: 3vmin 4vmin;
}

.dial-card:fullscreen .dial-canvas { max-width: min(94vw, 1500px); margin: 0 auto; }
.dial-card:fullscreen .dial-readout { font-size: 1.15rem; max-width: 70ch; margin-inline: auto; }
.dial-card:fullscreen .dial-state-row,
.dial-card:fullscreen .dial-range-wrap { max-width: min(94vw, 1500px); margin-inline: auto; width: 100%; }

/* ── Hover-to-enlarge figures ──────────────────────────────────────
   Small diagrams in collages and cards are hard to read; zoom.js pops a
   large centred copy on hover (tap to pin on touch). These selectors mark
   the figures as zoomable; the overlay holds the enlarged image. */

.hero-panel img,
.path-media img,
.diagram-card img,
.detail-panel img,
.visual-card img {
  cursor: zoom-in;
}

.zoom-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: grid;
  place-items: center;
  padding: 4vmin;
  background: rgba(24, 18, 10, 0.5);
  opacity: 0;
  transition: opacity 160ms ease;
}

.zoom-overlay.is-on { opacity: 1; }
.zoom-overlay[hidden] { display: none; }

.zoom-overlay img {
  max-width: 92vw;
  max-height: 92vh;
  width: auto;
  height: auto;
  border-radius: 16px;
  background: var(--surface-warm);
  padding: 0.6rem;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.45);
  transform: scale(0.96);
  transition: transform 160ms ease;
}

.zoom-overlay.is-on img { transform: scale(1); }

/* ── Reduced motion ─────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .zoom-overlay, .zoom-overlay img { transition: none; }

  html { scroll-behavior: auto; }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── Kitchen Lab (lab.html) ─────────────────────────────────────────── */

.lab-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 1.2rem;
  align-items: start;
  margin-top: 0.9rem;
}

.lab-canvas {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
  background: #0a1028;
  cursor: crosshair;
  touch-action: manipulation;
}

.lab-side { display: flex; flex-direction: column; gap: 0.9rem; }

.lab-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.lab-probe canvas {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.55);
}

.lab-challenge-block { margin-top: 1.2rem; }

.lab-challenge-list {
  list-style: none;
  margin: 0.6rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.5rem;
}

.lab-challenge {
  display: flex;
  gap: 0.55rem;
  align-items: baseline;
  padding: 0.55rem 0.75rem;
  border: 1px solid rgba(107, 97, 87, 0.25);
  border-radius: 10px;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.45);
}

.lab-challenge.is-done {
  border-color: rgba(26, 125, 110, 0.5);
  background: rgba(26, 125, 110, 0.08);
  color: var(--ink);
}

.lab-challenge-check {
  flex: 0 0 1.1rem;
  color: #1a7d6e;
  font-weight: 700;
}

.lab-challenge-note { font-size: 0.82rem; color: var(--muted); margin-top: 0.6rem; }

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

@media (max-width: 860px) {
  .lab-layout { grid-template-columns: 1fr; }
}

/* Badges on the progress page */
.prog-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.9rem;
}

.prog-badge {
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  border: 1px dashed rgba(107, 97, 87, 0.4);
  font-size: 0.85rem;
  color: var(--muted);
}

.prog-badge.is-on {
  border-style: solid;
  border-color: rgba(201, 77, 34, 0.55);
  background: rgba(201, 77, 34, 0.08);
  color: var(--ink);
  font-weight: 600;
}

/* ── Cross-page view transitions (progressive enhancement) ──────────── */

@media not (prefers-reduced-motion: reduce) {
  @view-transition { navigation: auto; }
  ::view-transition-old(root) { animation-duration: 0.18s; }
  ::view-transition-new(root) { animation-duration: 0.22s; }
}

/* ── Physics Lens ───────────────────────────────────────────────────── */

.kpa-lens {
  position: absolute;
  z-index: 30;
  display: none;
  pointer-events: none;
  filter: drop-shadow(0 6px 14px rgba(40, 32, 24, 0.28));
}

.kpa-lens canvas { display: block; border-radius: 50%; }

.kpa-lens-caption {
  display: block;
  margin: 6px auto 0;
  width: max-content;
  max-width: 220px;
  padding: 0.25rem 0.6rem;
  background: rgba(58, 53, 49, 0.92);
  color: #f7f4ef;
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  font-size: 0.72rem;
  border-radius: 999px;
  text-align: center;
}

@media print { .kpa-lens { display: none !important; } }

/* Lab goal editor */
.lab-goal-editor { margin-top: 1rem; font-size: 0.9rem; }
.lab-goal-editor summary { cursor: pointer; color: var(--muted); font-weight: 600; }
.lab-goal-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  align-items: end;
  margin-top: 0.8rem;
}
.lab-goal-form label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.8rem; color: var(--muted); }
.lab-goal-form select, .lab-goal-form input {
  padding: 0.35rem 0.5rem;
  border: 1px solid rgba(107, 97, 87, 0.35);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
  font: inherit;
  font-size: 0.85rem;
  max-width: 9rem;
}
.lab-goal { margin-bottom: 0.6rem; }

/* ── Worksheet number generator ─────────────────────────────────────── */

.ws-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.1rem;
}
.ws-note { font-size: 0.78rem; color: var(--muted); max-width: 46ch; }
.ws-answer {
  display: none;
  margin-left: 0.4rem;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: rgba(26, 125, 110, 0.12);
  color: #14604f;
  font-weight: 700;
  font-size: 0.85em;
}
body.ws-show-answers .ws-answer { display: inline-block; }
@media print { .ws-controls { display: none; } }

/* ── Exam & certificate ─────────────────────────────────────────────── */

.exam-intro { display: flex; flex-wrap: wrap; align-items: end; gap: 1rem; margin-bottom: 1rem; }
.exam-intro label { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.85rem; color: var(--muted); font-weight: 600; }
.exam-intro input {
  padding: 0.55rem 0.8rem;
  border: 1px solid rgba(107, 97, 87, 0.35);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.75);
  font: inherit;
  min-width: 18rem;
}
.exam-result { text-align: center; }
.exam-certificate {
  display: block;
  width: min(100%, 760px);
  margin: 1.2rem auto;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(40, 32, 24, 0.18);
}
.exam-result .ghost-button { margin-top: 0.9rem; }

/* ── Scrollytelling story ───────────────────────────────────────────── */

.scrolly { position: relative; }

.scrolly-stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
}

.scrolly-stage canvas { display: block; width: 100%; height: 100%; }

.scrolly-caption {
  position: absolute;
  left: 50%;
  bottom: 1.4rem;
  transform: translateX(-50%);
  margin: 0;
  padding: 0.4rem 1rem;
  background: rgba(58, 53, 49, 0.85);
  color: #f7f4ef;
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  font-size: 0.85rem;
  border-radius: 999px;
  max-width: min(90vw, 46ch);
  text-align: center;
}

.scrolly-steps {
  position: relative;
  margin-top: -100vh;
  pointer-events: none;
}

.scrolly-step {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0 clamp(1rem, 5vw, 4rem);
}

.scrolly-card {
  pointer-events: auto;
  max-width: 380px;
  background: rgba(247, 244, 239, 0.94);
  border: 1px solid rgba(107, 97, 87, 0.25);
  border-radius: 16px;
  padding: 1.3rem 1.5rem;
  box-shadow: 0 12px 30px rgba(40, 32, 24, 0.16);
  opacity: 0.45;
  transition: opacity 0.3s ease;
}

.scrolly-step.is-active .scrolly-card { opacity: 1; }

.scrolly-card h3 { margin: 0.3rem 0 0.6rem; font-size: 1.25rem; }
.scrolly-card p { margin: 0 0 0.6rem; font-size: 0.95rem; line-height: 1.6; }

@media (max-width: 700px) {
  .scrolly-step { align-items: flex-end; padding-bottom: 4.4rem; }
  .scrolly-card { max-width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .scrolly-card { transition: none; }
}

/* ── 3D kitchen hunt overlay ────────────────────────────────────────── */

.k3d-hunt {
  position: fixed;
  top: 68px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  max-width: min(92vw, 560px);
  background: rgba(58, 53, 49, 0.94);
  color: #f7f4ef;
  border-radius: 16px;
  padding: 0.9rem 1.2rem;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  text-align: center;
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
}
.k3d-hunt-text { margin: 0 0 0.35rem; font-size: 1.02rem; font-weight: 600; line-height: 1.5; }
.k3d-hunt-meta { margin: 0 0 0.55rem; font-size: 0.85rem; opacity: 0.85; }
.k3d-hunt-meta a { color: #ffd9a0; }
.k3d-hunt .ghost-button { font-size: 0.78rem; }

/* ── Phone layout fixes ─────────────────────────────────────────────── */

/* 3D kitchen topbar: one compact row that scrolls sideways instead of
   stacking a column of buttons over the scene. */
@media (max-width: 920px) {
  .k3d-topbar {
    gap: 0.5rem;
    height: auto;
    min-height: 3rem;
    padding: 0.35rem 0.6rem;
  }
  .k3d-topbar .brand { font-size: 0.8rem; flex: 0 0 auto; white-space: nowrap; }
  .k3d-topbar-actions {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    max-width: 100%;
  }
  .k3d-topbar-actions::-webkit-scrollbar { display: none; }
  .k3d-topbar-actions .ghost-button,
  .k3d-topbar-actions select {
    flex: 0 0 auto;
    white-space: nowrap;
    font-size: 0.62rem;
    padding: 0.35rem 0.55rem;
  }
  .k3d-hunt { top: 3.4rem; }
}

/* Story: keep the caption clear of the text cards, which sit at the bottom
   of the screen on phones. */
@media (max-width: 700px) {
  .scrolly-caption { bottom: auto; top: 0.9rem; }
}
