@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;600;700&family=IBM+Plex+Sans:wght@400;600;700&family=IBM+Plex+Serif:ital,wght@0,400;0,700;1,400&display=swap');

:root {
  --brand-hue: 260;
  --brand: hsl(var(--brand-hue), 55%, 50%);
  --brand-light: hsl(var(--brand-hue), 55%, 95%);
  --brand-dark: hsl(var(--brand-hue), 55%, 35%);
  --code-bg: hsl(var(--brand-hue), 10%, 96%);
  --text: #111;
  --text-muted: #555;
  --bg: hsl(var(--brand-hue), 15%, 99%);
  --surface: white;
  --border: hsl(var(--brand-hue), 15%, 88%);
  --border-light: hsl(var(--brand-hue), 15%, 90%);
  --shadow: hsl(var(--brand-hue), 15%, 80%);
  --interactive-bg: hsl(var(--brand-hue), 20%, 98%);
  --interactive-border: hsl(var(--brand-hue), 30%, 80%);
  --axis: #666;
  --grid: #e0e0e0;
  --complete: hsl(140, 50%, 40%);
  --locked: hsl(0, 0%, 70%);
}

[data-theme="dark"] {
  --brand: hsl(var(--brand-hue), 65%, 65%);
  --brand-light: hsl(var(--brand-hue), 25%, 15%);
  --brand-dark: hsl(var(--brand-hue), 65%, 75%);
  --code-bg: hsl(var(--brand-hue), 10%, 18%);
  --text: #e0e0e0;
  --text-muted: #999;
  --bg: hsl(var(--brand-hue), 10%, 10%);
  --surface: hsl(var(--brand-hue), 10%, 14%);
  --border: hsl(var(--brand-hue), 10%, 22%);
  --border-light: hsl(var(--brand-hue), 10%, 20%);
  --shadow: hsl(var(--brand-hue), 10%, 5%);
  --interactive-bg: hsl(var(--brand-hue), 10%, 12%);
  --interactive-border: hsl(var(--brand-hue), 20%, 30%);
  --axis: #999;
  --grid: #333;
  --complete: hsl(140, 50%, 55%);
  --locked: hsl(0, 0%, 40%);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

ul, ol { padding-left: 1.5em; margin-bottom: 1rem; }
ul li::marker, ol li::marker { color: var(--brand); }

body {
  font-family: "IBM Plex Serif", serif;
  line-height: 1.6;
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem clamp(1rem, 3vw, 2rem);
  color: var(--text);
  background-color: var(--bg);
}

header {
  border-bottom: 3px solid var(--brand);
  padding-bottom: 1rem;
  margin-bottom: 2rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
}

header div { flex: 1; }

.header-right {
  flex: none;
  display: flex;
  align-items: center;
  gap: 1rem;
}

header h1 {
  font-family: "IBM Plex Sans", sans-serif;
  font-weight: 700;
  font-size: 2rem;
  color: var(--brand-dark);
}

header h1 a { color: inherit; text-decoration: none; }
header h1 a:hover { color: var(--brand); }

header p {
  color: var(--text-muted);
  font-style: italic;
}

nav {
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 1rem;
}

nav a {
  color: var(--brand);
  text-decoration: none;
  margin-left: 1rem;
}

nav a:hover { text-decoration: underline; }

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 1.2rem;
  padding: 0.25rem 0.5rem;
  color: var(--text-muted);
}

.theme-toggle:hover { border-color: var(--brand); color: var(--brand); }

/* Content */

main h1 { font-family: "IBM Plex Sans", sans-serif; font-size: 1.8rem; margin: 0.5rem 0 1rem; color: var(--text); }
main h2 { font-family: "IBM Plex Sans", sans-serif; font-size: 1.4rem; margin: 1.5rem 0 0.75rem; color: var(--brand-dark); }
main h3 { font-family: "IBM Plex Sans", sans-serif; font-size: 1.1rem; margin: 1.25rem 0 0.5rem; }

main p { margin-bottom: 1rem; }

main a { color: var(--brand); text-decoration: underline; text-underline-offset: 2px; }
main a:hover { color: var(--brand-dark); }

main em { font-style: italic; }
main strong { font-weight: 700; }

/* Code */

code {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.9em;
  background: var(--code-bg);
  padding: 0.1em 0.3em;
  border-radius: 3px;
}

pre {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.85rem;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
  margin: 1rem 0;
  overflow-x: auto;
  line-height: 1.5;
}

pre code { background: none; padding: 0; }

/* Tables */

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.95rem;
}

th, td {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

th {
  font-family: "IBM Plex Sans", sans-serif;
  font-weight: 600;
  color: var(--brand-dark);
  border-bottom: 2px solid var(--brand);
}

/* Node cards (homepage) */

.node-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

/* ── Tour cards (homepage) ──────────────────────────────── */

.tours-intro {
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.tour-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.tour-card {
  border: 2px solid var(--brand);
  border-radius: 10px;
  padding: 1.25rem;
  background: var(--surface);
  display: flex;
  flex-direction: column;
}

.tour-card:hover {
  box-shadow: 0 2px 8px var(--shadow);
}

.tour-title {
  font-size: 1.05rem;
  margin-top: 0;
  margin-bottom: 0.4rem;
  color: var(--text);
}

.tour-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  flex: 1;
  margin-bottom: 0.75rem;
  line-height: 1.45;
}

.tour-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tour-count {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.btn-tour {
  display: inline-block;
  padding: 0.3rem 0.9rem;
  background: var(--brand);
  color: white;
  border-radius: 5px;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
}

.btn-tour:hover {
  opacity: 0.9;
  color: white;
}

/* ── Tour progress bar (node pages) ────────────────────── */

.tour-bar {
  display: none;
  background: var(--surface);
  border: 1px solid var(--brand);
  border-radius: 8px;
  padding: 0.6rem 1rem;
  margin-bottom: 1rem;
}

.tour-bar-inner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.tour-bar-title {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--brand);
  white-space: nowrap;
}

.tour-bar-dots {
  display: flex;
  gap: 0.35rem;
  align-items: center;
}

.tour-dot {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--surface);
  text-decoration: none;
  font-size: 0.7rem;
  font-family: "IBM Plex Mono", monospace;
  color: var(--text-muted);
  transition: all 0.15s;
}

.tour-dot.is-complete {
  border-color: var(--complete);
  background: var(--complete);
  color: white;
}

.tour-dot.is-current {
  border-color: var(--brand);
  background: var(--brand);
  color: white;
  transform: scale(1.15);
}

.tour-dot-num { line-height: 1; }

.tour-bar-next {
  margin-left: auto;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--brand);
  text-decoration: none;
}

.tour-bar-next:hover { text-decoration: underline; }

.tour-bar-done {
  margin-left: auto;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--complete);
}

.tour-bar-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0 0.3rem;
}

.tour-bar-close:hover { color: var(--text); }

/* ── Tour footer (bottom of node page) ─────────────────── */

.tour-footer {
  border: 2px solid var(--brand);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  background: var(--surface);
}

.tour-footer-inner {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.6rem;
}

.tour-footer-inner .tour-bar-dots {
  margin-bottom: 0.25rem;
}

.btn-tour-next {
  display: inline-block;
  padding: 0.45rem 1.1rem;
  background: var(--brand);
  color: white;
  border-radius: 6px;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
}

.btn-tour-next:hover {
  opacity: 0.9;
  color: white;
}

/* ── Inline content links: completion state ─────────────── */

.node-content a.is-node-complete {
  color: var(--complete);
}

.inline-check {
  font-weight: 700;
  color: var(--complete);
}

/* ── Active tour banner (homepage) ─────────────────────── */

.active-tour-banner {
  border: 2px solid var(--brand);
  border-radius: 10px;
  padding: 1.25rem;
  background: var(--surface);
  margin-bottom: 1.5rem;
}

.active-tour-inner {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.active-tour-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.active-tour-label {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--brand);
  font-weight: 600;
}

.active-tour-title {
  margin: 0;
  font-size: 1.1rem;
}

.active-tour-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0.25rem;
}

.active-tour-progress {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ── Node cards ──────────────────────────────────────────── */

.node-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
  position: relative;
}

.node-card:hover {
  border-color: var(--brand);
  box-shadow: 0 2px 8px var(--shadow);
}

.node-card a {
  text-decoration: none;
  color: inherit;
  display: block;
}

.node-card h3 {
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 1.1rem;
  margin: 0 0 0.5rem;
  color: var(--text);
}

.node-card-prereqs {
  color: var(--text-muted);
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 0.8rem;
}

.node-card-upcoming {
  opacity: 0.5;
  border-style: dashed;
}

.node-card-placeholder {
  opacity: 0.4;
  border-style: dashed;
  border-color: var(--locked);
}

.node-card-placeholder h3 { color: var(--text-muted); }

/* Node card meta row (level badge + learn button) */

.node-card-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

/* Level badges */

.level-badge {
  display: inline-block;
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.1rem 0.5rem;
  border-radius: 3px;
}

.level-0 { background: var(--border-light); color: var(--text-muted); }
.level-1 { background: hsl(40, 70%, 90%); color: hsl(40, 70%, 30%); }
.level-2 { background: hsl(200, 60%, 90%); color: hsl(200, 60%, 30%); }
.level-3 { background: hsl(140, 50%, 90%); color: hsl(140, 50%, 30%); }

[data-theme="dark"] .level-1 { background: hsl(40, 30%, 20%); color: hsl(40, 60%, 70%); }
[data-theme="dark"] .level-2 { background: hsl(200, 25%, 20%); color: hsl(200, 50%, 70%); }
[data-theme="dark"] .level-3 { background: hsl(140, 25%, 20%); color: hsl(140, 50%, 70%); }

/* Maturity notice on node pages */

.maturity-notice {
  background: hsl(40, 70%, 95%);
  border-left: 4px solid hsl(40, 70%, 50%);
  padding: 0.5rem 1rem;
  border-radius: 0 6px 6px 0;
  margin-bottom: 1rem;
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 0.85rem;
  color: hsl(40, 50%, 30%);
}

[data-theme="dark"] .maturity-notice {
  background: hsl(40, 20%, 15%);
  border-color: hsl(40, 50%, 40%);
  color: hsl(40, 40%, 70%);
}

.node-card-status {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  font-size: 0.85rem;
}

/* Node card states (set by JS) */
.node-card.is-complete { border-left: 4px solid var(--complete); }
.node-card.is-complete .node-card-status::after { content: "✓"; color: var(--complete); }
.node-card.is-locked { opacity: 0.5; }
.node-card.is-locked .node-card-status::after { content: "🔒"; }

/* Node page: header */

.node-header {
  margin-bottom: 0.5rem;
}

.prereq-label, .next-label {
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}

.prereq-chip, .next-chip {
  display: inline-block;
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 0.8rem;
  color: var(--brand);
  background: var(--brand-light);
  padding: 0.15rem 0.6rem;
  border-radius: 4px;
  text-decoration: none;
  margin-left: 0.25rem;
}

.prereq-chip:hover, .next-chip:hover {
  background: var(--brand);
  color: white;
}

.prereq-chip.is-complete { border-left: 3px solid var(--complete); }

/* Node page: footer */

.node-footer {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-light);
}

.node-actions {
  margin-bottom: 1rem;
}

.btn {
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 0.9rem;
  padding: 0.5rem 1.25rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn:hover { opacity: 0.9; }

.btn-complete {
  background: var(--brand);
  color: white;
}

.btn-complete.is-complete {
  background: var(--complete);
}

.node-next {
  margin-top: 0.75rem;
}

/* Learn button on cards */

.node-card-actions {
  margin-top: 0.5rem;
}

.btn-learn {
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 0.8rem;
  padding: 0.25rem 0.75rem;
  background: none;
  color: var(--brand);
  border: 1px solid var(--brand);
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.btn-learn:hover {
  background: var(--brand);
  color: white;
}

.node-card.is-complete .btn-learn { display: none; }

/* Path panel */

.path-panel {
  background: var(--surface);
  border: 2px solid var(--brand);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  animation: pathSlideIn 0.2s ease-out;
}

@keyframes pathSlideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.path-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.path-header h3 {
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 1.1rem;
  color: var(--brand-dark);
  margin: 0;
  flex: 1;
}

.path-count {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--brand-light);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

.path-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
}

.path-close:hover { color: var(--text); }

.path-steps {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
}

.path-step {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border-light);
}

.path-step:last-child { border-bottom: none; }

.path-step-num {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--brand);
  min-width: 1.5rem;
  text-align: centre;
}

.path-step a {
  color: var(--text);
  text-decoration: none;
  font-size: 0.95rem;
}

.path-step a:hover { color: var(--brand); }

.path-step.is-complete a { color: var(--text-muted); text-decoration: line-through; }
.path-step.is-goal a { font-weight: 600; color: var(--brand-dark); }
.path-step.is-placeholder { opacity: 0.5; }
.path-step-title { color: var(--text-muted); font-size: 0.95rem; }
.path-placeholder-tag {
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  background: var(--border-light);
  color: var(--text-muted);
  padding: 0.05rem 0.4rem;
  border-radius: 3px;
  margin-left: 0.25rem;
}
.path-warning {
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 0.85rem;
  color: hsl(40, 70%, 40%);
  margin: 0 0 0.5rem;
}

.path-check {
  color: var(--complete);
  font-size: 0.85rem;
}

.path-complete-msg {
  color: var(--complete);
  font-family: "IBM Plex Sans", sans-serif;
  font-weight: 600;
  margin: 0;
}

.btn-start {
  display: inline-block;
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 0.9rem;
  padding: 0.5rem 1.25rem;
  background: var(--brand);
  color: white;
  border: none;
  border-radius: 6px;
  text-decoration: none;
  cursor: pointer;
}

.btn-start:hover { opacity: 0.9; color: white; }

/* Related nodes (cross-references, compare/contrast) */

.node-related {
  margin-top: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.related-label {
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.related-chip {
  display: inline-block;
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 0.85rem;
  color: hsl(30, 60%, 45%);
  background: hsl(30, 50%, 95%);
  border: 1px solid hsl(30, 40%, 80%);
  padding: 0.2rem 0.6rem;
  border-radius: 5px;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.related-chip:hover {
  background: hsl(30, 50%, 88%);
  color: hsl(30, 60%, 35%);
}

[data-theme="dark"] .related-chip {
  color: hsl(30, 50%, 70%);
  background: hsl(30, 20%, 18%);
  border-color: hsl(30, 20%, 30%);
}

[data-theme="dark"] .related-chip:hover {
  background: hsl(30, 25%, 25%);
}

/* Expansions (optional deeper-dive nodes) */

.expansion-banner {
  background: var(--brand-light);
  border-left: 4px solid var(--brand);
  padding: 0.5rem 1rem;
  border-radius: 0 6px 6px 0;
  margin-bottom: 0.75rem;
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.expansion-banner a { margin-left: 0.25rem; }
.expansion-icon { margin-right: 0.25rem; }

.expansions {
  background: var(--interactive-bg);
  border: 1px dashed var(--interactive-border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
}

.expansions-title {
  font-family: "IBM Plex Sans", sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--brand-dark);
  margin-bottom: 0.25rem;
}

.expansions p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.expansion-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.expansion-chip {
  display: inline-block;
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 0.85rem;
  color: var(--brand);
  background: var(--surface);
  border: 1px solid var(--brand);
  padding: 0.3rem 0.75rem;
  border-radius: 6px;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.expansion-chip:hover {
  background: var(--brand);
  color: white;
}

/* Depth sections */

.depth-section {
  border-left: 3px solid var(--brand-light);
  padding: 0.5rem 1rem;
  margin: 1rem 0;
  border-radius: 0 6px 6px 0;
  transition: all 0.2s;
}

.depth-section::before {
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  display: block;
  margin-bottom: 0.25rem;
}

.depth-section[data-depth="conceptual"]::before { content: "💡 Conceptual"; }
.depth-section[data-depth="working"]::before { content: "🔧 Working detail"; }
.depth-section[data-depth="rigorous"]::before { content: "📐 Rigorous"; }

.depth-section[data-depth="conceptual"] { border-left-color: hsl(145, 40%, 55%); }
.depth-section[data-depth="working"] { border-left-color: var(--brand); }
.depth-section[data-depth="rigorous"] { border-left-color: hsl(280, 40%, 55%); }

.depth-section.depth-shown {
  background: var(--interactive-bg);
}

.depth-section.depth-collapsed {
  opacity: 0.5;
  max-height: 2.2rem;
  overflow: hidden;
  cursor: pointer;
  position: relative;
}

.depth-section.depth-collapsed::after {
  content: "click to expand";
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 0.75rem;
  color: var(--text-muted);
  position: absolute;
  right: 0.75rem;
  top: 0.6rem;
}

.depth-section.depth-collapsed > *:not(:first-child) { display: none; }

/* Depth picker (inside preferences modal) */

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

.depth-option {
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 0.9rem;
  padding: 0.5rem 0.8rem;
  border: 2px solid var(--border-light);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
}

.depth-option:hover {
  border-color: var(--brand-light);
}

.depth-option.is-active {
  border-color: var(--brand);
  background: var(--brand-light);
  color: var(--brand-dark);
}

.depth-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.depth-option.is-active .depth-desc {
  color: var(--brand);
}

/* Depth-tagged prerequisite chips */

.prereq-chip.depth-working::after,
.prereq-chip.depth-rigorous::after {
  font-size: 0.65rem;
  margin-left: 0.3rem;
  vertical-align: super;
}

.prereq-chip.depth-working::after { content: "🔧"; }
.prereq-chip.depth-rigorous::after { content: "📐"; }

/* Domain examples */

.domain-example {
  border-left: 3px solid var(--brand-light);
  padding: 0.5rem 1rem;
  margin: 1rem 0;
  border-radius: 0 6px 6px 0;
  transition: all 0.2s;
}

.domain-example::before {
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  display: block;
  margin-bottom: 0.25rem;
}

.domain-example[data-domain="linguistics"]::before { content: "📝 Linguistics example"; }
.domain-example[data-domain="medicine"]::before { content: "🏥 Medicine example"; }
.domain-example[data-domain="ecology"]::before { content: "🌿 Ecology example"; }
.domain-example[data-domain="music"]::before { content: "🎵 Music example"; }
.domain-example[data-domain="physics"]::before { content: "⚛️ Physics example"; }
.domain-example[data-domain="economics"]::before { content: "📊 Economics example"; }
.domain-example[data-domain="astronomy"]::before { content: "🔭 Astronomy example"; }

.domain-example.domain-shown {
  border-left-color: var(--brand);
  background: var(--interactive-bg);
}

.domain-example.domain-collapsed {
  border-left-color: var(--border-light);
  opacity: 0.5;
  max-height: 2.2rem;
  overflow: hidden;
  cursor: pointer;
  position: relative;
}

.domain-example.domain-collapsed::after {
  content: "click to expand";
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 0.75rem;
  color: var(--text-muted);
  position: absolute;
  right: 0.75rem;
  top: 0.6rem;
}

.domain-example.domain-collapsed > *:not(:first-child) { display: none; }

/* Domain picker modal */

.domain-picker-modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.15s;
}

.domain-picker {
  background: var(--surface);
  border-radius: 12px;
  padding: 1.5rem 2rem;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.domain-picker h3 {
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 1.1rem;
  margin: 0 0 0.25rem;
}

.domain-picker p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0 0 1rem;
}

.domain-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.domain-option {
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 0.9rem;
  padding: 0.4rem 0.8rem;
  border: 2px solid var(--border-light);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s;
}

.domain-option:hover {
  border-color: var(--brand-light);
}

.domain-option.is-active {
  border-color: var(--brand);
  background: var(--brand-light);
  color: var(--brand-dark);
  font-weight: 600;
}

.domain-icon { margin-right: 0.15rem; }

.domain-picker-footer {
  text-align: right;
}

/* Domain picker trigger button */

.btn-domains {
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 0.85rem;
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--brand-light);
  border-radius: 6px;
  background: var(--surface);
  color: var(--brand);
  cursor: pointer;
  transition: background 0.15s;
}

.btn-domains:hover {
  background: var(--brand-light);
}

/* Interactives */

.interactive {
  background: var(--interactive-bg);
  border: 1px solid var(--interactive-border);
  border-radius: 8px;
  padding: 1.25rem;
  margin: 1.5rem 0;
}

.interactive-title {
  font-family: "IBM Plex Sans", sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}

.interactive textarea {
  width: 100%;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.85rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  resize: vertical;
  min-height: 100px;
}

.interactive button {
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 0.9rem;
  padding: 0.5rem 1rem;
  margin-top: 0.5rem;
  background: var(--brand);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.interactive button:hover { opacity: 0.9; }

/* Euler product prime toggle buttons */
.euler-prime-btn {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8rem;
  padding: 0.3rem 0.6rem;
  margin: 0;
  background: var(--surface);
  color: var(--text-muted);
  border: 1.5px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}
.euler-prime-btn.is-active {
  background: var(--brand);
  color: white;
  border-color: var(--brand);
}
.euler-prime-btn:hover { opacity: 0.85; }

.interactive select {
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 0.9rem;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
}

.interactive .controls {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.interactive .chart {
  width: 100%;
  min-height: 300px;
}

.interactive .stats {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* Math */

.MathJax { font-size: 1.05em; }

/* Blockquote */

blockquote {
  border-left: 4px solid var(--brand);
  padding: 0.5rem 1rem;
  margin: 1rem 0;
  color: var(--text-muted);
  font-style: italic;
}

/* Sidebar link callout */

.sidebar-link {
  background: var(--interactive-bg);
  border-left: 3px solid var(--brand);
  padding: 0.75rem 1rem;
  margin: 1.5rem 0;
  border-radius: 0 6px 6px 0;
}

/* Footer */

footer {
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.85rem;
}

footer a { color: var(--brand); }

.footer-tech { font-size: 0.75rem; margin-top: 0.25rem; }

/* ── Graph Map ─────────────────────────────────────────── */

#graph-map {
  width: 100%;
  background: var(--bg);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

#graph-map svg {
  display: block;
}

.graph-node:hover circle {
  stroke-width: 4;
  filter: drop-shadow(0 0 4px rgba(0,0,0,0.3));
}

.graph-node:hover text {
  font-weight: 600;
}
