/* =========================================================================
   AI/ML Landscape — Shared Styles
   Used by index.html and topics/*.html
   ========================================================================= */

:root {
  --bg: #0b0d12;
  --bg-2: #11141c;
  --bg-3: #171b26;
  --panel: #141823;
  --panel-2: #1a1f2e;
  --border: #242a3a;
  --border-light: #2e3549;
  --text: #dbe1ec;
  --text-dim: #8a93a6;
  --text-bright: #ffffff;
  --accent: #7c5cff;
  --accent-2: #22d3ee;
  --accent-3: #f472b6;
  --good: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif;
  --serif: "Charter", "Georgia", "Times New Roman", serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 15px;
  overflow-x: hidden;
}

/* =========================================================================
   Typography
   ========================================================================= */
h1 {
  font-size: 42px;
  line-height: 1.1;
  margin: 0 0 12px;
  color: var(--text-bright);
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #fff 0%, #a78bfa 50%, #22d3ee 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
h2 {
  font-size: 28px;
  margin: 60px 0 18px;
  color: var(--text-bright);
  letter-spacing: -0.01em;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  position: relative;
}
h2 .era {
  float: right;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent-2);
  font-weight: 400;
  padding: 4px 10px;
  background: rgba(34,211,238,0.08);
  border-radius: 4px;
  margin-top: 8px;
}
h2 .deep-dive {
  float: right;
  font-family: var(--mono);
  font-size: 11px;
  margin-top: 10px;
  margin-left: 10px;
  padding: 5px 12px;
  background: linear-gradient(135deg, rgba(124,92,255,0.2), rgba(34,211,238,0.15));
  border: 1px solid var(--accent);
  color: var(--accent-2) !important;
  border-radius: 20px;
  text-decoration: none !important;
  transition: all 0.2s ease;
}
h2 .deep-dive:hover {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff !important;
  transform: translateY(-1px);
}
h3 {
  font-size: 19px;
  margin: 32px 0 12px;
  color: var(--text-bright);
}
h3 .deep-dive {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 400;
  padding: 3px 10px;
  background: rgba(124,92,255,0.12);
  border: 1px solid var(--border-light);
  color: var(--accent-2) !important;
  border-radius: 20px;
  text-decoration: none !important;
  margin-left: 10px;
  vertical-align: middle;
  transition: all 0.2s ease;
}
h3 .deep-dive:hover {
  background: var(--accent);
  color: #fff !important;
  border-color: var(--accent);
}
h4 {
  font-size: 15px;
  margin: 22px 0 8px;
  color: var(--accent-2);
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
p { margin: 12px 0; color: var(--text); }
.lede {
  font-size: 18px;
  color: var(--text-dim);
  margin-bottom: 28px;
  max-width: 680px;
}
code {
  font-family: var(--mono);
  background: var(--bg-3);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
  color: var(--accent-2);
  border: 1px solid var(--border);
}
a {
  color: var(--accent-2);
  text-decoration: none;
  border-bottom: 1px dashed rgba(34,211,238,0.4);
  transition: all 0.15s ease;
}
a:hover { color: var(--accent-3); border-bottom-color: var(--accent-3); }
a.ext::after { content: " ↗"; font-size: 10px; opacity: 0.6; }
a.plain { border-bottom: none; }

/* =========================================================================
   Tooltips
   ========================================================================= */
.term {
  border-bottom: 1px dotted var(--accent);
  cursor: help;
  color: #c5b5ff;
  position: relative;
}
.term:hover { color: var(--accent-2); }
#tooltip {
  position: fixed;
  z-index: 9999;
  background: var(--bg-3);
  border: 1px solid var(--accent);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  max-width: 320px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  box-shadow: 0 12px 30px rgba(0,0,0,0.6);
  line-height: 1.5;
}
#tooltip.show { opacity: 1; }

/* =========================================================================
   Callouts
   ========================================================================= */
.callout {
  border-left: 3px solid var(--accent);
  background: linear-gradient(90deg, rgba(124,92,255,0.08), transparent);
  padding: 14px 18px;
  margin: 20px 0;
  border-radius: 0 6px 6px 0;
}
.callout .label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}
.callout.warn { border-left-color: var(--warn); background: linear-gradient(90deg, rgba(251,191,36,0.08), transparent); }
.callout.warn .label { color: var(--warn); }
.callout.good { border-left-color: var(--good); background: linear-gradient(90deg, rgba(52,211,153,0.08), transparent); }
.callout.good .label { color: var(--good); }
.callout.math { border-left-color: var(--accent-2); background: linear-gradient(90deg, rgba(34,211,238,0.08), transparent); }
.callout.math .label { color: var(--accent-2); }

/* =========================================================================
   Cards / Grids
   ========================================================================= */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  margin: 20px 0;
}
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 16px;
  border-radius: 8px;
  transition: all 0.2s ease;
}
.card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.card h4 { margin-top: 0; }
.card .meta { font-size: 11px; color: var(--text-dim); font-family: var(--mono); }

/* =========================================================================
   Tables
   ========================================================================= */
.rank {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 13px;
  background: var(--panel);
  border-radius: 8px;
  overflow: hidden;
}
.rank th {
  background: var(--bg-3);
  padding: 10px 12px;
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  font-family: var(--mono);
  border-bottom: 1px solid var(--border);
}
.rank td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.rank tr:last-child td { border-bottom: none; }
.rank tr:hover td { background: rgba(124,92,255,0.06); }
.bar {
  display: inline-block;
  height: 6px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 3px;
  vertical-align: middle;
  margin-right: 6px;
}
.tag {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 10px;
  font-family: var(--mono);
  background: var(--bg-3);
  color: var(--accent-2);
  border: 1px solid var(--border);
  margin-right: 4px;
}
.tag.hot { color: var(--accent-3); border-color: var(--accent-3); }
.tag.old { color: var(--text-dim); }

/* Vertical history list used on track landing pages (not the AI/ML horizontal timeline) */
.history-list {
  list-style: none;
  padding: 0;
  margin: 16px 0 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.history-list li {
  padding: 10px 14px;
  background: var(--bg-2);
  border-left: 3px solid var(--border);
  border-radius: 0 6px 6px 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
}
.history-list li strong { color: var(--accent-2); font-family: var(--mono); }

/* =========================================================================
   Timeline Header (full width, top of page)
   ========================================================================= */
.timeline-header {
  width: 100%;
  background: linear-gradient(180deg, #0d1019 0%, #11141c 100%);
  border-bottom: 1px solid var(--border);
  padding: 12px 0 6px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.timeline-header .timeline-inner {
  padding: 0 20px;
}
.timeline-header h3 {
  margin: 0 0 1px;
  font-size: 10px;
  color: var(--text-bright);
  font-family: var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.timeline-header h3 .highlight {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.timeline-header .sub {
  font-size: 9px;
  color: var(--text-dim);
  margin: 0 0 6px;
  font-family: var(--mono);
}
.timeline-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 4px;
  scrollbar-width: thin;
}
.timeline-scroll::-webkit-scrollbar { height: 5px; }
.timeline-scroll::-webkit-scrollbar-track { background: var(--bg-3); border-radius: 4px; }
.timeline-scroll::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 4px; }
.timeline {
  position: relative;
  height: 172px;
  min-width: 4200px;
  padding-top: 0;
}
.timeline .axis {
  position: absolute;
  left: 0; right: 0;
  top: 82px;
  height: 2px;
  background: linear-gradient(90deg, var(--border), var(--accent), var(--accent-2), var(--accent-3));
  border-radius: 2px;
}
.timeline .year-marks {
  position: absolute;
  left: 0; right: 0;
  top: 87px;
  height: 10px;
  font-family: var(--mono);
  font-size: 8px;
  color: var(--text-dim);
  pointer-events: none;
}
.timeline .year-marks span {
  position: absolute;
  transform: translateX(-50%);
}
.timeline .event {
  position: absolute;
  top: 0;
  width: 0;
  height: 172px;
  cursor: pointer;
}
.timeline .event .dot {
  position: absolute;
  left: 50%;
  top: 78px;
  width: 9px;
  height: 9px;
  background: var(--accent);
  border: 2px solid var(--bg);
  border-radius: 50%;
  transform: translateX(-50%);
  z-index: 3;
  transition: all 0.18s ease;
}
.timeline .event:hover .dot {
  background: var(--accent-3);
  box-shadow: 0 0 0 3px rgba(255,108,61,0.35), 0 0 14px var(--accent-3);
  transform: translateX(-50%) scale(1.35);
}
.timeline .event .label {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  text-align: center;
  font-family: var(--sans);
  padding: 0 5px;
  line-height: 1.1;
  z-index: 2;
  transition: color 0.18s ease;
}
.timeline .event .label .year {
  font-family: var(--mono);
  font-size: 8.5px;
  color: var(--accent-2);
  margin-right: 5px;
}
.timeline .event .label .name {
  font-size: 9.5px;
  color: var(--text);
  font-weight: 600;
}
.timeline .event .label .org { display: none; }
.timeline .event:hover .label .name { color: var(--accent-3); }
/* 6-slot vertical positioning (populated via data-slot by JS) */
.timeline .event[data-slot="-3"] .label { top: 2px; }
.timeline .event[data-slot="-2"] .label { top: 24px; }
.timeline .event[data-slot="-1"] .label { top: 50px; }
.timeline .event[data-slot="1"]  .label { top: 88px; }
.timeline .event[data-slot="2"]  .label { top: 112px; }
.timeline .event[data-slot="3"]  .label { top: 136px; }
/* Connector lines from label to dot (dot center at top: 83px) */
.timeline .event .label::after {
  content: '';
  position: absolute;
  left: 50%;
  width: 1px;
  background: var(--border);
  opacity: 0.55;
}
.timeline .event[data-slot="-3"] .label::after { top: 22px; height: 54px; }
.timeline .event[data-slot="-2"] .label::after { top: 22px; height: 32px; }
.timeline .event[data-slot="-1"] .label::after { top: 22px; height: 8px; }
.timeline .event[data-slot="1"]  .label::after { top: -5px; height: 5px; }
.timeline .event[data-slot="2"]  .label::after { top: -29px; height: 29px; }
.timeline .event[data-slot="3"]  .label::after { top: -53px; height: 53px; }
.timeline .event:hover .label::after { background: var(--accent-3); opacity: 1; }

/* =========================================================================
   Index page layout (sidebar + main)
   ========================================================================= */
/* Offset anchor scroll targets so the sticky topbar doesn't cover headings */
:target,
section[id],
h2[id], h3[id], h4[id] {
  scroll-margin-top: 58px; /* topbar ~42px + 16px breathing room */
}

.layout { display: flex; min-height: 100vh; }
aside.sidebar {
  width: 260px;
  min-width: 260px;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  position: sticky;
  top: 44px; /* sits just below the sticky topbar (~42px tall) */
  align-self: flex-start;
  height: calc(100vh - 44px);
  overflow-y: auto;
  padding: 22px 0;
}
aside .brand {
  padding: 0 22px 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}
aside .brand h2 {
  margin: 0;
  font-size: 15px;
  color: var(--text-bright);
  letter-spacing: 0.02em;
  border: none;
  padding: 0;
}
aside .brand p {
  margin: 4px 0 0;
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--mono);
}
aside nav ul { list-style: none; padding: 0; margin: 0; }

/* --- Collapsible category groups --------------------------------------- */
.cat-group {
  border-left: 3px solid transparent;
  margin: 2px 0;
  position: relative;
}
.cat-group + .cat-group { margin-top: 4px; }

/* The group header button (acts as the disclosure toggle) */
.cat-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 18px 10px 15px;
  background: transparent;
  border: none;
  border-radius: 0;
  color: var(--text-bright);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  position: relative;
}
.cat-toggle:hover { background: rgba(255,255,255,0.03); color: var(--accent-2); }
.cat-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.cat-toggle .cat-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  background: rgba(124,92,255,0.12);
  border: 1px solid rgba(124,92,255,0.35);
  color: var(--accent-2);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0;
  flex-shrink: 0;
}
.cat-toggle .cat-title {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cat-toggle .cat-chev {
  font-size: 10px;
  color: var(--text-dim);
  transition: transform 0.25s ease;
  flex-shrink: 0;
}
.cat-toggle[aria-expanded="false"] .cat-chev { transform: rotate(-90deg); }

/* Body (collapsed / expanded) */
.cat-body {
  overflow: hidden;
  max-height: 2000px;
  transition: max-height 0.3s ease, opacity 0.2s ease;
  opacity: 1;
  padding-bottom: 6px;
}
.cat-toggle[aria-expanded="false"] + .cat-body {
  max-height: 0;
  opacity: 0;
  padding-bottom: 0;
  pointer-events: none;
}

/* Top-level links inside a group */
.cat-body > li > a {
  display: block;
  padding: 6px 18px 6px 45px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  border-left: 2px solid transparent;
  transition: all 0.15s ease;
}
.cat-body > li > a:hover {
  color: var(--text-bright);
  background: var(--bg-3);
}
.cat-body > li > a.active {
  color: var(--accent-2);
  border-left-color: var(--accent);
  background: linear-gradient(90deg, rgba(124,92,255,0.14), transparent);
}

/* Nested sub-links (one extra indent) */
.cat-body ul {
  margin: 2px 0 6px;
}
.cat-body ul li a {
  display: block;
  padding: 4px 18px 4px 62px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 11.5px;
  border-left: 2px solid transparent;
  line-height: 1.5;
}
.cat-body ul li a:hover { color: var(--accent-2); }
.cat-body ul li a.active {
  color: var(--accent-2);
  border-left-color: var(--accent-2);
  background: linear-gradient(90deg, rgba(34,211,238,0.10), transparent);
}

/* --- Active group highlight -------------------------------------------- */
.cat-group.is-active {
  background: linear-gradient(90deg, rgba(124,92,255,0.06), transparent 70%);
  border-left-color: var(--accent);
}
.cat-group.is-active > .cat-toggle { color: var(--accent-2); }

/* --- Category color variants ------------------------------------------- */
/* Default colors by data-group keyword */
.cat-group[data-group="start"]       .cat-icon { background: rgba(34,211,238,0.15); border-color: rgba(34,211,238,0.45); color: #22d3ee; }
.cat-group[data-group="classical"]   .cat-icon { background: rgba(148,163,184,0.15); border-color: rgba(148,163,184,0.45); color: #94a3b8; }
.cat-group[data-group="neural"]      .cat-icon { background: rgba(74,222,128,0.14); border-color: rgba(74,222,128,0.45); color: #4ade80; }
.cat-group[data-group="transformer"] .cat-icon { background: rgba(250,204,21,0.14); border-color: rgba(250,204,21,0.45); color: #facc15; }
.cat-group[data-group="emerging"]    .cat-icon { background: rgba(251,146,60,0.14); border-color: rgba(251,146,60,0.45); color: #fb923c; }
.cat-group[data-group="agi"]         .cat-icon { background: rgba(244,114,182,0.16); border-color: rgba(244,114,182,0.55); color: #f472b6; }
.cat-group[data-group="production"]  .cat-icon { background: rgba(99,179,237,0.14); border-color: rgba(99,179,237,0.45); color: #63b3ed; }
.cat-group[data-group="deep-fund"]   .cat-icon { background: transparent; border-color: transparent; font-size: 13px; }
.cat-group[data-group="deep-front"]  .cat-icon { background: transparent; border-color: transparent; font-size: 13px; }
.cat-group[data-group="deep-spec"]   .cat-icon { background: transparent; border-color: transparent; font-size: 13px; }

/* Group-level background tint (subtle, so sections are easier to tell apart) */
.cat-group--highlight {
  background: linear-gradient(90deg, rgba(244,114,182,0.05), transparent 70%);
  border-top: 1px solid rgba(244,114,182,0.25);
  border-bottom: 1px solid rgba(244,114,182,0.15);
  margin: 10px 0;
}
.cat-group--highlight > .cat-toggle { color: #f9a8d4; }
.cat-group--highlight.is-active {
  background: linear-gradient(90deg, rgba(244,114,182,0.12), transparent 70%);
  border-left-color: #f472b6;
}
.cat-group--highlight .cat-body > li > a.active {
  color: #f9a8d4;
  border-left-color: #f472b6;
  background: linear-gradient(90deg, rgba(244,114,182,0.15), transparent);
}

/* Deep dive groups — visually separated from the topic anchors above */
.cat-group--deep {
  background: rgba(255,255,255,0.015);
}
.cat-group--deep + .cat-group--deep {
  border-top: 1px dashed var(--border);
  margin-top: 0;
}
.cat-group--deep:first-of-type {
  margin-top: 14px;
  border-top: 1px solid var(--border);
  padding-top: 4px;
}
.cat-group--deep > .cat-toggle { color: #b5b5cc; }
.cat-group--deep .cat-body > li > a {
  font-size: 12px;
  padding-left: 42px;
  color: var(--text-dim);
}

/* Speculative (indigo/violet tint) */
.cat-group--speculative {
  background: linear-gradient(90deg, rgba(124,92,255,0.06), transparent 70%);
  border-top: 1px solid rgba(124,92,255,0.25);
}
.cat-group--speculative > .cat-toggle { color: #c4b5fd; }
.cat-group--speculative.is-active {
  background: linear-gradient(90deg, rgba(124,92,255,0.14), transparent 70%);
  border-left-color: var(--accent);
}

/* Legacy `.cat` selector kept as a no-op fallback for non-collapsible places */
aside .cat:not(.cat-toggle) {
  padding: 14px 22px 4px;
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--text-dim);
  text-transform: uppercase;
  font-family: var(--mono);
}

main {
  flex: 1;
  min-width: 0;
}
.container {
  max-width: 920px;
  padding: 60px 56px 120px;
  margin: 0 auto;
}

/* Hero section */
.hero {
  background: radial-gradient(ellipse at top right, rgba(124,92,255,0.15), transparent 60%),
              radial-gradient(ellipse at bottom left, rgba(34,211,238,0.1), transparent 60%);
  padding: 48px 56px 40px;
  border-bottom: 1px solid var(--border);
}
.hero-inner { max-width: 920px; margin: 0 auto; }
.hero-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 28px;
}
.hero-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-decoration: none;
  border: 1px solid transparent;
  transition: filter 0.15s, transform 0.1s;
}
.hero-nav-btn:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
}
/* colour variants reuse the track-banner accent colours */
.hero-nav-btn.tb-math {
  background: rgba(52,211,153,0.12);
  border-color: rgba(52,211,153,0.35);
  color: #34d399;
}
.hero-nav-btn.tb-phys {
  background: rgba(52,211,153,0.12);
  border-color: rgba(52,211,153,0.35);
  color: #34d399;
}
.hero-nav-btn.tb-chem {
  background: rgba(251,191,36,0.12);
  border-color: rgba(251,191,36,0.35);
  color: #fbbf24;
}
.hero-nav-btn.tb-cs {
  background: rgba(124,92,255,0.12);
  border-color: rgba(124,92,255,0.35);
  color: #a78bfa;
}
.hero-nav-btn.tb-ai {
  background: rgba(34,211,238,0.12);
  border-color: rgba(34,211,238,0.35);
  color: #22d3ee;
}
@media (max-width: 600px) {
  .hero-nav { gap: 6px; margin-top: 20px; }
  .hero-nav-btn { font-size: 11px; padding: 7px 14px; }
}
.hero .chip {
  display: inline-block;
  padding: 4px 12px;
  background: rgba(124,92,255,0.15);
  border: 1px solid var(--accent);
  border-radius: 20px;
  font-size: 11px;
  color: var(--accent-2);
  font-family: var(--mono);
  margin-bottom: 16px;
  letter-spacing: 0.04em;
}

/* =========================================================================
   Track banner — the "enter here" full-width card above each section grid.
   Used on index.html to distinguish the track hub from its sub-topic cards.
   ========================================================================= */
.track-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 28px 32px;
  margin: 0 0 22px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
  color: var(--text-bright);
  text-decoration: none;
  box-shadow: 0 6px 30px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
  position: relative;
  overflow: hidden;
}
.track-banner::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.16), rgba(34, 211, 238, 0.08) 55%, transparent 85%);
  transition: opacity 0.15s ease;
}
.track-banner:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.4);
}
.track-banner:hover::before { opacity: 1.25; }

.track-banner .tb-main { position: relative; flex: 1; min-width: 0; }
.track-banner .tb-label {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(10, 13, 18, 0.55);
  margin-bottom: 12px;
}
.track-banner .tb-title {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 600;
  color: var(--text-bright);
  margin: 0 0 8px;
  letter-spacing: -0.01em;
  line-height: 1.15;
}
.track-banner .tb-desc {
  font-family: var(--sans);
  font-size: 15px;
  color: var(--text-dim);
  line-height: 1.55;
  max-width: 680px;
  margin: 0;
}
.track-banner .tb-arrow {
  position: relative;
  font-family: var(--mono);
  font-size: 32px;
  line-height: 1;
  flex-shrink: 0;
  transition: transform 0.15s ease;
}
.track-banner:hover .tb-arrow { transform: translateX(6px); }

/* Per-track accent tinting */
.track-banner.tb-math {
  border-color: rgba(124, 92, 255, 0.45);
}
.track-banner.tb-math::before {
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.22), rgba(124, 92, 255, 0.04) 55%, transparent 90%);
}
.track-banner.tb-math:hover { border-color: var(--accent); }
.track-banner.tb-math .tb-label {
  color: var(--accent);
  border-color: rgba(124, 92, 255, 0.5);
}
.track-banner.tb-math .tb-arrow { color: var(--accent); }

.track-banner.tb-cs {
  border-color: rgba(34, 211, 238, 0.45);
}
.track-banner.tb-cs::before {
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.20), rgba(34, 211, 238, 0.04) 55%, transparent 90%);
}
.track-banner.tb-cs:hover { border-color: var(--accent-2); }
.track-banner.tb-cs .tb-label {
  color: var(--accent-2);
  border-color: rgba(34, 211, 238, 0.5);
}
.track-banner.tb-cs .tb-arrow { color: var(--accent-2); }

.track-banner.tb-ai {
  border-color: rgba(244, 114, 182, 0.45);
}
.track-banner.tb-ai::before {
  background: linear-gradient(135deg, rgba(244, 114, 182, 0.20), rgba(244, 114, 182, 0.04) 55%, transparent 90%);
}
.track-banner.tb-ai:hover { border-color: var(--accent-3); }
.track-banner.tb-ai .tb-label {
  color: var(--accent-3);
  border-color: rgba(244, 114, 182, 0.5);
}
.track-banner.tb-ai .tb-arrow { color: var(--accent-3); }

.track-banner.tb-phys {
  border-color: rgba(52, 211, 153, 0.45);
}
.track-banner.tb-phys::before {
  background: linear-gradient(135deg, rgba(52, 211, 153, 0.20), rgba(52, 211, 153, 0.04) 55%, transparent 90%);
}
.track-banner.tb-phys:hover { border-color: var(--good); }
.track-banner.tb-phys .tb-label {
  color: var(--good);
  border-color: rgba(52, 211, 153, 0.5);
}
.track-banner.tb-phys .tb-arrow { color: var(--good); }

.track-banner.tb-chem {
  border-color: rgba(251, 191, 36, 0.45);
}
.track-banner.tb-chem::before {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.20), rgba(251, 191, 36, 0.04) 55%, transparent 90%);
}
.track-banner.tb-chem:hover { border-color: var(--warn); }
.track-banner.tb-chem .tb-label {
  color: var(--warn);
  border-color: rgba(251, 191, 36, 0.5);
}
.track-banner.tb-chem .tb-arrow { color: var(--warn); }

/* Blockchain track — orange #f97316 */
.track-banner.tb-chain {
  border-color: rgba(249, 115, 22, 0.45);
}
.track-banner.tb-chain::before {
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.20), rgba(249, 115, 22, 0.04) 55%, transparent 90%);
}
.track-banner.tb-chain:hover { border-color: #f97316; }
.track-banner.tb-chain .tb-label {
  color: #f97316;
  border-color: rgba(249, 115, 22, 0.5);
}
.track-banner.tb-chain .tb-arrow { color: #f97316; }

/* Quantum Computing track — violet #a855f7 */
.track-banner.tb-qc {
  border-color: rgba(168, 85, 247, 0.45);
}
.track-banner.tb-qc::before {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.20), rgba(168, 85, 247, 0.04) 55%, transparent 90%);
}
.track-banner.tb-qc:hover { border-color: #a855f7; }
.track-banner.tb-qc .tb-label {
  color: #a855f7;
  border-color: rgba(168, 85, 247, 0.5);
}
.track-banner.tb-qc .tb-arrow { color: #a855f7; }

.hero-nav-btn.tb-chain {
  background: rgba(249,115,22,0.12);
  border-color: rgba(249,115,22,0.35);
  color: #f97316;
}
.hero-nav-btn.tb-qc {
  background: rgba(168,85,247,0.12);
  border-color: rgba(168,85,247,0.35);
  color: #a855f7;
}
/* Astronomy track — cyan #22d3ee */
.hero-nav-btn.tb-astro {
  background: rgba(34,211,238,0.12);
  border-color: rgba(34,211,238,0.35);
  color: #22d3ee;
}
.track-banner.tb-astro {
  border-color: rgba(34,211,238,0.45);
}
.track-banner.tb-astro::before {
  background: linear-gradient(135deg, rgba(34,211,238,0.20), rgba(34,211,238,0.04) 55%, transparent 90%);
}
.track-banner.tb-astro:hover { border-color: #22d3ee; }
.track-banner.tb-astro .tb-label {
  color: #22d3ee;
  border-color: rgba(34,211,238,0.5);
}
.track-banner.tb-astro .tb-arrow { color: #22d3ee; }

@media (max-width: 700px) {
  .track-banner {
    padding: 20px 18px;
    gap: 14px;
    border-radius: 12px;
  }
  .track-banner .tb-title { font-size: 22px; }
  .track-banner .tb-desc { font-size: 13px; }
  .track-banner .tb-arrow { font-size: 26px; }
}

/* =========================================================================
   Site footer — AI-generated disclaimer + repo link on the landing page.
   ========================================================================= */
.site-footer {
  margin-top: 60px;
  padding: 32px 24px 48px;
  border-top: 1px solid var(--border);
  background: rgba(10, 13, 18, 0.45);
}
.site-footer .sf-inner {
  max-width: 920px;
  margin: 0 auto;
  font-family: var(--sans);
  color: var(--text-dim);
}
.site-footer .sf-disclaimer {
  font-size: 13px;
  line-height: 1.65;
  margin: 0 0 12px;
}
.site-footer .sf-disclaimer strong {
  color: var(--text-bright);
  font-weight: 600;
}
.site-footer .sf-disclaimer a,
.site-footer .sf-meta a {
  color: var(--accent-2);
  text-decoration: none;
  border-bottom: 1px solid rgba(34, 211, 238, 0.35);
  transition: border-color 0.15s ease, color 0.15s ease;
}
.site-footer .sf-disclaimer a:hover,
.site-footer .sf-meta a:hover {
  color: var(--text-bright);
  border-color: var(--accent-2);
}
.site-footer .sf-meta {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  margin: 0;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  color: var(--text-dim);
}
@media (max-width: 700px) {
  .site-footer { padding: 24px 18px 40px; margin-top: 40px; }
  .site-footer .sf-disclaimer { font-size: 12px; }
}

/* =========================================================================
   Interactive Diagrams (index page demos)
   ========================================================================= */
.demo {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 22px;
  margin: 24px 0;
}
.demo-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.demo-header .title {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent-2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.demo-header .step-indicator {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-dim);
  padding: 3px 10px;
  background: var(--bg-3);
  border-radius: 10px;
  border: 1px solid var(--border);
}
.demo-body {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 20px;
  align-items: start;
}
.demo-visual {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  min-height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.demo-visual svg { max-width: 100%; height: auto; }
.demo-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.demo-params {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
}
.demo-params h5 {
  margin: 0 0 8px;
  font-size: 10px;
  font-family: var(--mono);
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.demo-params .param-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
  font-family: var(--mono);
  font-size: 12px;
}
.demo-params label {
  color: var(--text-dim);
  min-width: 30px;
}
.demo-params input[type="number"] {
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 4px 6px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 12px;
  width: 64px;
  text-align: right;
  transition: border-color 0.15s ease;
}
.demo-params input[type="number"]:focus {
  outline: none;
  border-color: var(--accent-2);
}
.demo-params .preset {
  display: inline-block;
  margin-top: 8px;
  padding: 3px 8px;
  font-size: 10px;
  font-family: var(--mono);
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 10px;
  cursor: pointer;
}
.demo-params .preset:hover {
  border-color: var(--accent-2);
  color: var(--accent-2);
}
.demo-calc {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  min-height: 120px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.7;
}
.demo-calc .step-title {
  color: var(--accent-3);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
  font-weight: 700;
}
.demo-calc .math {
  color: var(--text);
  margin: 4px 0;
  font-family: var(--mono);
  font-size: 13px;
}
.demo-calc .math .var { color: var(--accent-2); }
.demo-calc .math .num { color: var(--text-bright); }
.demo-calc .math .op { color: var(--text-dim); }
.demo-calc .math .result { color: var(--accent-3); font-weight: 700; }
.demo-calc .note {
  color: var(--text-dim);
  font-size: 11px;
  font-style: italic;
  margin-top: 6px;
}
.demo-controls {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
  margin-top: 14px;
}
button.btn {
  background: var(--bg-3);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: all 0.15s ease;
}
button.btn:hover {
  border-color: var(--accent-2);
  color: var(--accent-2);
}
button.btn.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
button.btn.primary:hover {
  background: var(--accent-3);
  border-color: var(--accent-3);
  transform: translateY(-1px);
}
button.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Diagram highlighting */
.node-base { fill: var(--bg-3); stroke: var(--border-light); stroke-width: 2; transition: all 0.3s ease; }
.node-active { fill: var(--accent)!important; stroke: var(--accent-3)!important; filter: drop-shadow(0 0 6px var(--accent)); }
.node-used { fill: rgba(124,92,255,0.3); stroke: var(--accent); }
.conn-base { stroke: var(--text-dim); stroke-width: 1.5; fill: none; opacity: 0.4; transition: all 0.3s ease; }
.conn-active { stroke: var(--accent-2)!important; stroke-width: 2.5!important; opacity: 1!important; filter: drop-shadow(0 0 4px var(--accent-2)); }
.conn-used { stroke: var(--accent); opacity: 0.8; }
.cell-base { fill: var(--bg-3); stroke: var(--border); stroke-width: 1; transition: fill 0.3s ease, stroke 0.3s ease; }
.cell-highlight { stroke: var(--accent-3)!important; stroke-width: 2.5!important; }

/* Mini-tables for CNN / attention */
.mini-grid { display: grid; gap: 4px; font-family: var(--mono); font-size: 11px; }
.mini-grid .cell {
  background: var(--bg-3);
  border: 1px solid var(--border);
  padding: 6px 4px;
  text-align: center;
  border-radius: 3px;
  transition: all 0.2s ease;
  min-width: 28px;
}
.mini-grid .cell.highlight {
  border-color: var(--accent-3);
  background: rgba(244,114,182,0.15);
  color: var(--accent-3);
}
.mini-grid .cell.done {
  background: rgba(34,211,238,0.1);
  border-color: var(--accent-2);
  color: var(--accent-2);
}
.mini-grid input[type="number"] {
  background: transparent;
  border: none;
  color: inherit;
  font-family: var(--mono);
  font-size: 11px;
  width: 100%;
  text-align: center;
  padding: 0;
}
.mini-grid input[type="number"]:focus { outline: 1px solid var(--accent-2); }

/* =========================================================================
   Lists
   ========================================================================= */
ul.clean { padding-left: 20px; }
ul.clean li { margin: 6px 0; }
ul.checked { list-style: none; padding-left: 0; }
ul.checked li {
  padding-left: 24px;
  position: relative;
  margin: 6px 0;
}
ul.checked li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--accent-2);
  font-family: var(--mono);
}

/* =========================================================================
   Topic page layout
   ========================================================================= */
.topic-page {
  max-width: 100%;
}
.topic-nav {
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  padding: 14px 30px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
}
.topic-nav .back {
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 12px;
  text-decoration: none;
  border-bottom: none;
  white-space: nowrap;
  transition: color 0.15s ease;
}
.topic-nav .back:hover { color: var(--accent-2); }
.topic-nav .crumb {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  flex: 1;
  text-align: center;
}
.topic-nav .crumb .topic-name {
  color: var(--accent-2);
}

.topic-layout {
  display: flex;
  max-width: 1400px;
  margin: 0 auto;
  padding: 40px 24px;
  gap: 40px;
}
.topic-toc {
  width: 240px;
  min-width: 240px;
  position: sticky;
  top: 80px;
  align-self: flex-start;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  font-size: 12px;
}
.topic-toc h4 {
  font-size: 10px;
  color: var(--text-dim);
  margin: 0 0 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.topic-toc ul { list-style: none; padding: 0; margin: 0; }
.topic-toc ul li { margin: 0; }
.topic-toc ul li a {
  display: block;
  padding: 6px 10px 6px 14px;
  color: var(--text-dim);
  text-decoration: none;
  border-left: 2px solid transparent;
  border-bottom: none;
  font-size: 12px;
  line-height: 1.4;
  transition: all 0.15s ease;
}
.topic-toc ul li a:hover {
  color: var(--accent-2);
  background: rgba(124,92,255,0.05);
}
.topic-toc ul li a.active {
  color: var(--accent-2);
  border-left-color: var(--accent-2);
  background: linear-gradient(90deg, rgba(34,211,238,0.08), transparent);
}
.topic-toc ul ul li a {
  padding-left: 30px;
  font-size: 11px;
}
.topic-content {
  flex: 1;
  min-width: 0;
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.75;
}
.topic-content h1 {
  font-family: var(--sans);
  font-size: 40px;
  margin-bottom: 10px;
}
.topic-content h2 {
  font-family: var(--sans);
  font-size: 26px;
  margin-top: 50px;
}
.topic-content h3 {
  font-family: var(--sans);
  font-size: 19px;
  margin-top: 32px;
}
.topic-content p, .topic-content li { color: var(--text); }
.topic-content .subtitle {
  font-size: 17px;
  color: var(--text-dim);
  margin: 10px 0 30px;
  font-family: var(--sans);
  font-style: italic;
}
.topic-content .meta-tags {
  margin: 20px 0 30px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
}
.topic-content .meta-tags span {
  display: inline-block;
  padding: 3px 10px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 20px;
  margin-right: 6px;
}
.topic-content code {
  font-family: var(--mono);
}
.topic-content figure {
  margin: 30px 0;
}
.topic-content figcaption {
  font-size: 13px;
  color: var(--text-dim);
  text-align: center;
  margin-top: 10px;
  font-style: italic;
  font-family: var(--sans);
}

/* Theorem / definition / proof boxes */
.theorem, .defn, .proof, .example {
  background: var(--panel);
  border-left: 3px solid var(--accent);
  padding: 16px 22px;
  margin: 24px 0;
  border-radius: 0 6px 6px 0;
  font-family: var(--sans);
  font-size: 15px;
}
.theorem { border-left-color: var(--accent-3); }
.defn { border-left-color: var(--accent-2); }
.proof { border-left-color: var(--good); }
.example { border-left-color: var(--warn); }
.theorem .label, .defn .label, .proof .label, .example .label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 8px;
  display: block;
  font-weight: 700;
}
.theorem .label { color: var(--accent-3); }
.defn .label { color: var(--accent-2); }
.proof .label { color: var(--good); }
.example .label { color: var(--warn); }
.proof::after {
  content: "∎";
  display: block;
  text-align: right;
  color: var(--good);
  font-size: 18px;
  margin-top: 8px;
}

/* Math display */
.math-display {
  background: var(--bg-2);
  border: 1px solid var(--border);
  padding: 18px 20px;
  border-radius: 6px;
  margin: 20px 0;
  overflow-x: auto;
  text-align: center;
}
.math-display.no-center { text-align: left; }

/* Step-through interactive figure (topic pages) */
.step-figure {
  background: var(--panel);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 24px;
  margin: 30px 0;
  font-family: var(--sans);
}
.step-figure .sf-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.step-figure .sf-title {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent-2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.step-figure .sf-progress {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-dim);
}
.step-figure .sf-body {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 20px;
}
.step-figure .sf-visual {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  min-height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.step-figure .sf-explain {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 18px;
  font-size: 14px;
  line-height: 1.7;
  max-height: 260px;
  overflow-y: auto;
}
.step-figure .sf-explain h5 {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--accent-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 8px;
}
.step-figure .sf-math {
  font-family: var(--mono);
  font-size: 13px;
  background: var(--bg-3);
  padding: 10px 12px;
  border-radius: 4px;
  margin: 10px 0;
  border-left: 2px solid var(--accent-2);
}
.step-figure .sf-controls {
  margin-top: 16px;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  align-items: center;
}
.step-figure .sf-controls .spacer { flex: 1; }
.step-figure .sf-params {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
}
.step-figure .sf-params label {
  display: flex;
  align-items: center;
  gap: 6px;
}
.step-figure .sf-params input[type="number"] {
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 3px 6px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 11px;
  width: 58px;
  text-align: right;
}
.step-figure .sf-params input[type="number"]:focus {
  outline: none;
  border-color: var(--accent-2);
}
.step-figure .sf-params input[type="range"] {
  width: 100px;
}

/* KaTeX overrides for dark theme */
.katex { font-size: 1.05em !important; }
.katex-display { margin: 1em 0 !important; }
.katex .mathnormal, .katex * { color: var(--text); }

/* =========================================================================
   Math glossary — per-variable explanations beneath an equation
   ========================================================================= */
.math-glossary {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-2);
  border-radius: 6px;
  padding: 14px 18px;
  margin: -10px 0 24px;
  font-size: 13.5px;
}
.math-glossary .mg-title {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--accent-2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.math-glossary .mg-title::before {
  content: "∇";
  color: var(--accent-3);
  font-size: 14px;
}
.math-glossary dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 16px;
  margin: 0;
}
.math-glossary dt {
  font-family: var(--mono);
  color: var(--accent-3);
  font-weight: 600;
  white-space: nowrap;
  padding-top: 2px;
}
.math-glossary dd {
  margin: 0;
  color: var(--text);
  line-height: 1.55;
}
.math-glossary dd .mg-why {
  display: block;
  color: var(--text-dim);
  font-size: 12px;
  font-style: italic;
  margin-top: 2px;
}
.math-glossary .mg-analogy {
  margin: 12px 0 0;
  padding: 10px 12px;
  background: var(--bg-3);
  border-radius: 4px;
  border-left: 2px solid var(--accent-3);
  font-size: 13px;
  color: var(--text);
}
.math-glossary .mg-analogy strong {
  color: var(--accent-3);
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: block;
  margin-bottom: 4px;
}

/* =========================================================================
   Code tabs — same algorithm in multiple languages
   ========================================================================= */
.code-tabs {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin: 24px 0;
  overflow: hidden;
}
.code-tabs .ct-header {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 6px 0;
  background: var(--bg-3);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.code-tabs .ct-tab {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 11px;
  padding: 8px 14px 9px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  border-radius: 4px 4px 0 0;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.code-tabs .ct-tab:hover {
  color: var(--text);
  background: rgba(124, 92, 255, 0.06);
}
.code-tabs .ct-tab.active {
  color: var(--accent-2);
  border-bottom-color: var(--accent-2);
  background: var(--bg-2);
}
.code-tabs .ct-label {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 8px 10px;
}
.code-tabs .ct-panel {
  display: none;
  padding: 0;
}
.code-tabs .ct-panel.active { display: block; }
.code-tabs .ct-panel pre {
  margin: 0;
  padding: 16px 20px;
  background: transparent;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text);
  overflow-x: auto;
  max-height: 420px;
  overflow-y: auto;
}
.code-tabs .ct-panel code .kw  { color: #c792ea; }
.code-tabs .ct-panel code .fn  { color: #82aaff; }
.code-tabs .ct-panel code .str { color: #c3e88d; }
.code-tabs .ct-panel code .num { color: #f78c6c; }
.code-tabs .ct-panel code .cmt { color: #546e7a; font-style: italic; }
.code-tabs .ct-panel code .op  { color: #89ddff; }

/* =========================================================================
   Per-section collapsible code block — wraps a .code-tabs
   Usage: <details class="algo-code"><summary>Source — Title</summary>…</details>
   ========================================================================= */
details.algo-code {
  margin: 20px 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-2);
  overflow: hidden;
}
details.algo-code > summary {
  cursor: pointer;
  padding: 9px 16px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-3);
  transition: color 0.15s;
}
details.algo-code > summary::-webkit-details-marker { display: none; }
details.algo-code > summary::before {
  content: '▶';
  font-size: 10px;
  color: var(--accent);
  display: inline-block;
  transition: transform 0.15s;
  flex-shrink: 0;
}
details.algo-code[open] > summary::before {
  transform: rotate(90deg);
}
details.algo-code[open] > summary {
  border-bottom: 1px solid var(--border);
  color: var(--accent-2);
}
details.algo-code > summary:hover {
  color: var(--text);
}
details.algo-code .code-tabs {
  margin: 0;
  border: none;
  border-radius: 0;
}

/* =========================================================================
   3D visualization frame — for isometric SVG renders
   ========================================================================= */
.viz-3d {
  background: radial-gradient(ellipse at center, #141a2a 0%, #0b0d12 75%);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin: 24px 0;
  position: relative;
  overflow: hidden;
}
.viz-3d::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(124,92,255,0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(124,92,255,0.06) 1px, transparent 1px);
  background-size: 24px 24px;
  pointer-events: none;
  mask-image: radial-gradient(ellipse at center, #000 30%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse at center, #000 30%, transparent 80%);
}
.viz-3d .viz-title {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-2);
  margin: 0 0 10px;
  position: relative;
  z-index: 1;
}
.viz-3d svg {
  display: block;
  width: 100%;
  height: auto;
  position: relative;
  z-index: 1;
}
.viz-3d .viz-caption {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--text-dim);
  text-align: center;
  font-style: italic;
  position: relative;
  z-index: 1;
}
.viz-3d .viz-controls {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 12px;
  position: relative;
  z-index: 1;
}
.viz-3d .viz-controls button {
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--mono);
  font-size: 10px;
  padding: 5px 12px;
  border-radius: 4px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.viz-3d .viz-controls button:hover {
  border-color: var(--accent-2);
  color: var(--accent-2);
}

/* =========================================================================
   Mobile menu toggle (hidden on desktop)
   ========================================================================= */
.mobile-menu-toggle {
  display: none;
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 200;
  background: var(--bg-3);
  border: 1px solid var(--accent);
  color: var(--accent-2);
  width: 42px;
  height: 42px;
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

/* =========================================================================
   Responsiveness
   ========================================================================= */
@media (max-width: 1100px) {
  .topic-toc { display: none; }
  .topic-layout { padding: 30px 20px; }
  .demo-body { grid-template-columns: 1fr; }
  .step-figure .sf-body { grid-template-columns: 1fr; }
  .container { padding: 50px 40px 100px; }
  aside.sidebar { width: 220px; min-width: 220px; }
}

@media (max-width: 900px) {
  body { font-size: 14px; }

  h1 { font-size: 28px; }
  h2 { font-size: 22px; margin: 40px 0 14px; }
  h3 { font-size: 17px; }
  h2 .era { display: none; }
  h2 .deep-dive, h3 .deep-dive {
    float: none;
    display: inline-block;
    margin: 6px 0 0 0;
    font-size: 10px;
  }

  /* Layout */
  .layout { flex-direction: column; }

  /* Sidebar becomes a slide-out drawer */
  aside.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    min-width: 280px;
    height: 100vh;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 150;
    box-shadow: 6px 0 30px rgba(0,0,0,0.7);
    border-right: 1px solid var(--accent);
  }
  aside.sidebar.open {
    transform: translateX(0);
  }

  .mobile-menu-toggle { display: block; }

  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 140;
  }
  .sidebar-backdrop.show { display: block; }

  main { width: 100%; }

  /* Hero */
  .hero { padding: 32px 20px 24px; }
  .hero .chip { font-size: 10px; padding: 3px 10px; }
  .lede { font-size: 15px; margin-bottom: 18px; }

  /* Container */
  .container { max-width: 100%; padding: 28px 18px 80px; }

  /* Timeline header */
  .timeline-header { padding: 10px 0 4px; }
  .timeline-header .timeline-inner { padding: 0 14px; }
  .timeline-header h3 { font-size: 9px; }
  .timeline-header .sub { font-size: 8px; margin-bottom: 4px; }
  .timeline { height: 150px; min-width: 3200px; }
  .timeline .event .label .name { font-size: 9px; }

  /* Demos */
  .demo { padding: 14px; margin: 18px 0; }
  .demo-body { grid-template-columns: 1fr; gap: 12px; }
  .demo-visual { min-height: 200px; padding: 10px; }
  .demo-visual svg { max-width: 100%; width: 100%; height: auto; }
  .demo-panel { gap: 10px; }
  .demo-params { padding: 10px; }
  .demo-params .param-row { gap: 6px; font-size: 11px; }
  .demo-params input[type="number"] {
    width: 68px;
    font-size: 15px;
    padding: 8px 6px;
    min-height: 34px;
  }
  .demo-calc { font-size: 11px; padding: 10px; min-height: 90px; }
  .demo-calc .math { font-size: 11px; }
  .demo-controls { flex-wrap: wrap; gap: 6px; }
  button.btn {
    flex: 1 1 auto;
    font-size: 10px;
    padding: 11px 8px;
    min-width: 70px;
    min-height: 40px;
  }
  .demo-header { flex-direction: column; align-items: flex-start; gap: 6px; padding-bottom: 8px; margin-bottom: 10px; }
  .demo-header .title { font-size: 10px; }
  .demo-header .step-indicator { font-size: 9px; }

  /* Cards */
  .grid { grid-template-columns: 1fr; gap: 10px; }
  .card { padding: 14px; }
  .card h4 { font-size: 13px; }

  /* Tables */
  .rank { font-size: 11px; }
  .rank th, .rank td { padding: 6px 8px; }
  .rank th { font-size: 9px; }
  .bar { height: 4px; }

  /* Callouts */
  .callout { padding: 12px 14px; margin: 14px 0; }

  /* Topic pages */
  .topic-nav { padding: 10px 14px; flex-wrap: wrap; gap: 8px; }
  .topic-nav .crumb { font-size: 10px; }
  .topic-layout { padding: 20px 16px; flex-direction: column; gap: 20px; }
  .topic-content { font-size: 15px; max-width: 100%; }
  .topic-content h1 { font-size: 26px; }
  .topic-content h2 { font-size: 20px; margin-top: 36px; }
  .topic-content h3 { font-size: 16px; }
  .step-figure { padding: 14px; margin: 20px 0; }
  .step-figure .sf-body { grid-template-columns: 1fr; gap: 12px; }
  .step-figure .sf-visual { min-height: 180px; padding: 12px; }
  .step-figure .sf-explain { max-height: none; font-size: 13px; padding: 12px; }
  .step-figure .sf-controls { flex-wrap: wrap; gap: 6px; }
  .step-figure .sf-params { font-size: 10px; gap: 8px; }
  .step-figure .sf-params input[type="number"] {
    min-height: 34px;
    font-size: 14px;
    width: 60px;
  }

  /* Math display */
  .math-display { padding: 12px; font-size: 13px; }

  /* Math glossary */
  .math-glossary { padding: 12px 14px; font-size: 12.5px; }
  .math-glossary dl { grid-template-columns: 1fr; gap: 2px 0; }
  .math-glossary dt { padding-top: 8px; }

  /* Code tabs */
  .code-tabs .ct-tab { font-size: 10px; padding: 7px 10px; }
  .code-tabs .ct-panel pre { font-size: 11.5px; padding: 12px 14px; }

  /* 3D viz */
  .viz-3d { padding: 14px; }

  /* KaTeX smaller on mobile */
  .katex { font-size: 0.92em !important; }
  .katex-display {
    overflow-x: auto;
    overflow-y: hidden;
    padding: 4px 0;
  }
}

@media (max-width: 500px) {
  h1 { font-size: 24px; }
  .hero { padding: 24px 16px 20px; }
  .container { padding: 22px 14px 70px; }
  .demo { padding: 12px; }
  .demo-params .param-row { flex-wrap: wrap; }
  .demo-visual { min-height: 180px; padding: 8px; }
  .timeline { min-width: 2200px; }
  .topic-content h1 { font-size: 22px; }
  .topic-content h2 { font-size: 18px; }
  aside.sidebar { width: 250px; min-width: 250px; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* =========================================================================
   Top bar — slim "back to hub" bar shown on track pages
   ========================================================================= */
.topbar {
  position: sticky;
  top: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 24px;
  background: rgba(11,13,18,0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 12px;
}
.topbar-back {
  color: var(--accent-2);
  text-decoration: none;
  font-weight: 600;
  padding: 4px 10px;
  border: 1px solid rgba(34,211,238,0.3);
  border-radius: 6px;
  transition: all 0.15s ease;
}
.topbar-back:hover {
  background: rgba(34,211,238,0.1);
  border-color: var(--accent-2);
}
.topbar-crumb {
  color: var(--text-dim);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 11px;
}
.topbar-tracks {
  margin-left: auto;
  display: flex;
  gap: 14px;
}
.topbar-tracks a {
  color: var(--text-dim);
  text-decoration: none;
  padding: 3px 10px;
  border-radius: 5px;
  transition: all 0.15s ease;
}
.topbar-tracks a:hover {
  color: var(--text-bright);
  background: var(--bg-3);
}

/* =========================================================================
   Landing / Hub page
   ========================================================================= */
.hub-hero {
  padding: 80px 40px 50px;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(124,92,255,0.18), transparent 55%),
    radial-gradient(ellipse at 80% 10%, rgba(34,211,238,0.14), transparent 55%),
    radial-gradient(ellipse at 50% 100%, rgba(244,114,182,0.08), transparent 60%);
  border-bottom: 1px solid var(--border);
  text-align: center;
}
.hub-hero-inner {
  max-width: 960px;
  margin: 0 auto;
}
.hub-hero .chip {
  display: inline-block;
  padding: 5px 14px;
  background: rgba(124,92,255,0.15);
  border: 1px solid var(--accent);
  border-radius: 20px;
  font-size: 11px;
  font-family: var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-2);
  margin-bottom: 22px;
}
.hub-hero h1 {
  font-size: 56px;
  line-height: 1.02;
  margin: 0 0 18px;
  letter-spacing: -0.025em;
}
.hub-hero .hub-sub {
  font-size: 19px;
  line-height: 1.55;
  color: var(--text-dim);
  max-width: 760px;
  margin: 0 auto 28px;
}
.hub-hero .hub-sub strong { color: var(--text); font-weight: 600; }
.hub-hero .hub-tagline {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 14px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
}
.hub-hero .hub-tagline span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.hub-hero .hub-tagline span::before {
  content: "▸";
  color: var(--accent);
}

/* Track grid: the three big cards */
.track-grid {
  max-width: 1200px;
  margin: 0 auto;
  padding: 60px 40px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
}
.track-card {
  background: linear-gradient(180deg, var(--bg-2), var(--bg));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 32px 28px;
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  position: relative;
  transition: all 0.25s ease;
  overflow: hidden;
}
.track-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 50%, rgba(124,92,255,0.04));
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}
.track-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 20px 50px rgba(0,0,0,0.4), 0 0 0 1px rgba(124,92,255,0.2);
}
.track-card:hover::before { opacity: 1; }

.track-card .track-num {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 0.18em;
  margin-bottom: 8px;
}
.track-card h2 {
  margin: 0 0 6px;
  font-size: 28px;
  color: var(--text-bright);
  border: none;
  padding: 0;
  background: linear-gradient(135deg, #fff, #a78bfa 60%, #22d3ee);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.01em;
}
.track-card .track-lede {
  font-size: 14px;
  color: var(--text-dim);
  margin: 4px 0 18px;
  line-height: 1.55;
  flex: 0 0 auto;
}
.track-card ul {
  list-style: none;
  padding: 0;
  margin: 0 0 22px;
  flex: 1 1 auto;
}
.track-card ul li {
  font-size: 13px;
  padding: 4px 0;
  color: var(--text);
  border-bottom: 1px dashed var(--border);
  font-family: var(--mono);
}
.track-card ul li:last-child { border: none; }
.track-card ul li::before {
  content: "·";
  color: var(--accent);
  margin-right: 8px;
  font-weight: bold;
}
.track-card .track-cta {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent-2);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.track-card .track-cta::after {
  content: " →";
  transition: transform 0.2s ease;
  display: inline-block;
}
.track-card:hover .track-cta::after { transform: translateX(4px); }

/* Modifier colors per track */
.track-card[data-track="ai-ml"]::after,
.track-card[data-track="math"]::after,
.track-card[data-track="cs"]::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--accent);
}
.track-card[data-track="ai-ml"]::after  { background: linear-gradient(90deg, #7c5cff, #22d3ee); }
.track-card[data-track="math"]::after   { background: linear-gradient(90deg, #22d3ee, #34d399); }
.track-card[data-track="cs"]::after     { background: linear-gradient(90deg, #fb923c, #f472b6); }

/* Design philosophy panel */
.hub-philosophy {
  max-width: 1100px;
  margin: 40px auto;
  padding: 0 40px 80px;
}
.hub-philosophy h3 {
  text-align: center;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 0 0 30px;
}
.philosophy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
}
.philosophy-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 22px 20px;
}
.philosophy-card h4 {
  margin: 0 0 8px;
  font-size: 15px;
  color: var(--text-bright);
}
.philosophy-card h4 .icon {
  display: inline-block;
  width: 24px;
  height: 24px;
  line-height: 24px;
  text-align: center;
  background: rgba(124,92,255,0.15);
  border: 1px solid rgba(124,92,255,0.4);
  border-radius: 6px;
  font-size: 13px;
  margin-right: 8px;
  color: var(--accent-2);
}
.philosophy-card p {
  margin: 0;
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.55;
}

/* Hub footer */
.hub-footer {
  border-top: 1px solid var(--border);
  padding: 30px 40px;
  text-align: center;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.08em;
}
.hub-footer a {
  color: var(--accent-2);
  text-decoration: none;
  margin: 0 6px;
}
.hub-footer a:hover { text-decoration: underline; }

/* =========================================================================
   Track hub pages (math/index.html and cs/index.html)
   ========================================================================= */
.track-hub {
  max-width: 1100px;
  margin: 0 auto;
  padding: 50px 40px 80px;
}
.track-hub .track-intro {
  margin-bottom: 40px;
}
.track-hub .track-intro h1 {
  font-size: 44px;
  margin: 0 0 14px;
  letter-spacing: -0.02em;
}
.track-hub .track-intro .lede {
  font-size: 17px;
  max-width: 780px;
  color: var(--text-dim);
  line-height: 1.6;
}
.subject-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin: 30px 0;
}
.subject-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px 22px;
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  position: relative;
  transition: all 0.2s ease;
}
.subject-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}
.subject-card .subj-num {
  position: absolute;
  top: 18px;
  right: 20px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.1em;
}
.subject-card h3 {
  margin: 0 0 6px;
  font-size: 19px;
  color: var(--text-bright);
  padding: 0;
  border: none;
}
.subject-card .subj-lede {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.55;
  margin: 4px 0 14px;
  flex: 1 1 auto;
}
.subject-card .subj-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-family: var(--mono);
  font-size: 10px;
}
.subject-card .subj-tags span {
  padding: 2px 8px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-dim);
  letter-spacing: 0.04em;
}
.subject-card .subj-tags .hot {
  color: var(--accent-2);
  border-color: rgba(34,211,238,0.4);
  background: rgba(34,211,238,0.08);
}
.subject-card .subj-tags .core {
  color: var(--accent);
  border-color: rgba(124,92,255,0.4);
  background: rgba(124,92,255,0.08);
}

/* Link bar: horizontal row of related subjects */
.see-also {
  margin: 40px 0 30px;
  padding: 20px 22px;
  background: linear-gradient(90deg, rgba(124,92,255,0.06), transparent 70%);
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
}
.see-also h4 {
  margin: 0 0 10px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--accent-2);
  text-transform: uppercase;
}
.see-also ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
}
.see-also ul li a {
  display: inline-block;
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
  padding: 4px 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  transition: all 0.15s ease;
}
.see-also ul li a:hover {
  border-color: var(--accent-2);
  color: var(--accent-2);
}

/* Prereq chip inside meta-tags */
.topic-content .meta-tags a {
  color: var(--accent-2);
  text-decoration: none;
  border-bottom: 1px dotted var(--accent-2);
}
.topic-content .meta-tags a:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* Figure caption style for pages using <figure> */
.topic-content figure {
  margin: 20px 0;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
}
.topic-content figure img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}
.topic-content figcaption {
  font-size: 12px;
  color: var(--text-dim);
  font-family: var(--mono);
  margin-top: 10px;
  line-height: 1.5;
}
.topic-content figcaption a {
  color: var(--text-dim);
  border-bottom: 1px dotted var(--text-dim);
  text-decoration: none;
}

/* Mobile tweaks for hub */
@media (max-width: 700px) {
  .hub-hero { padding: 50px 22px 34px; }
  .hub-hero h1 { font-size: 38px; }
  .hub-hero .hub-sub { font-size: 15px; }
  .track-grid { padding: 30px 18px; gap: 18px; }
  .track-card { padding: 24px 20px; }
  .track-card h2 { font-size: 22px; }
  .hub-philosophy { padding: 0 18px 50px; }
  .topbar { padding: 8px 14px; gap: 10px; font-size: 11px; }
  .topbar-tracks { gap: 6px; }
  .track-hub { padding: 30px 18px 60px; }
  .track-hub .track-intro h1 { font-size: 30px; }
}

/* ==========================================================================
   SITE SEARCH
   Floating trigger button + modal overlay with live results.
   Activated by ⌘K / Ctrl-K / "/". Styles paired with search.js.
   ========================================================================== */

/* --- floating trigger (default — used when no topbar is present) --------- */
.search-trigger {
  position: fixed;
  right: 22px;
  top: 14px;
  z-index: 500;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: linear-gradient(180deg, rgba(124,92,255,.18), rgba(34,211,238,.12));
  border: 1px solid rgba(124,92,255,.45);
  color: var(--text-bright);
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(0,0,0,.45), 0 0 0 1px rgba(255,255,255,.02) inset;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: transform .12s ease, border-color .12s ease, background .12s ease;
}
.search-trigger:hover {
  transform: translateY(-1px);
  border-color: var(--accent-2);
  background: linear-gradient(180deg, rgba(124,92,255,.28), rgba(34,211,238,.22));
}
.search-trigger svg { color: var(--accent-2); flex-shrink: 0; }
.search-trigger .st-label { letter-spacing: .2px; }
.search-trigger .st-kbd {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 5px;
  background: rgba(10,13,18,.7);
  border: 1px solid rgba(255,255,255,.12);
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 10.5px;
  line-height: 1.2;
}

/* --- topbar-embedded trigger (overrides fixed positioning) --------------- */
.topbar .search-trigger {
  position: static;
  right: auto;
  top: auto;
  z-index: auto;
  padding: 5px 12px;
  font-size: 11px;
  box-shadow: none;
  background: rgba(124,92,255,.14);
  border-color: rgba(124,92,255,.35);
  margin-left: auto;       /* push it to the right, before .topbar-tracks */
  margin-right: 0;
}
.topbar .search-trigger:hover {
  transform: none;
  background: rgba(124,92,255,.26);
  border-color: var(--accent);
}
/* .topbar-tracks already has margin-left:auto — remove it when trigger is present */
.topbar:has(.search-trigger) .topbar-tracks {
  margin-left: 0;
}

/* --- topic-nav-embedded trigger (deep-dive pages) ----------------------- */
.topic-nav .search-trigger {
  position: static;
  right: auto;
  top: auto;
  z-index: auto;
  flex-shrink: 0;
  padding: 4px 10px 4px 8px;
  font-size: 11px;
  height: 28px;
  background: rgba(124,92,255,.12);
  border-color: rgba(124,92,255,.3);
}
.topic-nav .search-trigger:hover {
  transform: none;
  background: rgba(124,92,255,.22);
  border-color: var(--accent);
}

/* --- modal scaffold ------------------------------------------------------ */
.search-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 10vh 20px 20px;
  background: rgba(4,6,10,.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: searchFadeIn .14s ease;
}
.search-modal[hidden] { display: none; }
@keyframes searchFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
body.search-open { overflow: hidden; }

.search-panel {
  width: 100%;
  max-width: 720px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #11151e, #0c1018);
  border: 1px solid rgba(124,92,255,.35);
  border-radius: 14px;
  box-shadow:
    0 30px 90px rgba(0,0,0,.6),
    0 0 0 1px rgba(255,255,255,.03) inset,
    0 0 60px rgba(124,92,255,.15);
  overflow: hidden;
  animation: searchSlideIn .18s ease;
}
@keyframes searchSlideIn {
  from { transform: translateY(-14px); opacity: .2; }
  to   { transform: translateY(0);     opacity: 1; }
}

/* --- input row ----------------------------------------------------------- */
.search-input-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.search-input-row .search-icon { color: var(--accent-2); flex-shrink: 0; }
.search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-bright);
  font-family: var(--sans);
  font-size: 17px;
  font-weight: 400;
  padding: 2px 0;
}
.search-input::placeholder { color: var(--text-dim); }
.search-close {
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.12);
  color: var(--text-dim);
  padding: 4px 10px;
  font-family: var(--mono);
  font-size: 11px;
  border-radius: 5px;
  cursor: pointer;
  letter-spacing: .5px;
}
.search-close:hover { color: var(--text-bright); border-color: var(--accent-2); }

/* --- results list -------------------------------------------------------- */
.search-results {
  flex: 1;
  overflow-y: auto;
  padding: 6px 6px 8px;
  scrollbar-width: thin;
  scrollbar-color: #2a3040 transparent;
}
.search-results::-webkit-scrollbar { width: 8px; }
.search-results::-webkit-scrollbar-thumb { background: #2a3040; border-radius: 4px; }

.search-result {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  margin: 2px 4px;
  text-decoration: none;
  color: var(--text);
  border-radius: 8px;
  border: 1px solid transparent;
  transition: background .1s ease, border-color .1s ease;
}
.search-result.sr-active {
  background: rgba(124,92,255,.10);
  border-color: rgba(124,92,255,.4);
}
.search-result.sr-active .sr-title { color: #ffffff; }
.search-result.sr-active .sr-track { filter: brightness(1.15); }

.sr-track {
  flex-shrink: 0;
  padding: 3px 7px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .7px;
  margin-top: 2px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.1);
  color: var(--text-dim);
  line-height: 1.4;
}
.sr-track-ai-ml { background: rgba(244,114,182,.15); color: #f9a8d4; border-color: rgba(244,114,182,.35); }
.sr-track-math  { background: rgba(34,211,238,.15);  color: #67e8f9; border-color: rgba(34,211,238,.35);  }
.sr-track-cs    { background: rgba(124,92,255,.15);  color: #a78bfa; border-color: rgba(124,92,255,.35);  }
.sr-track-hub   { background: rgba(255,255,255,.08); color: var(--text-dim); }

.sr-main { flex: 1; min-width: 0; }
.sr-title {
  color: var(--text-bright);
  font-family: var(--sans);
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 2px;
}
.sr-heading {
  color: var(--accent-2);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  margin: 1px 0 3px;
  opacity: .85;
}
.sr-snippet {
  color: var(--text-dim);
  font-family: var(--sans);
  font-size: 12.5px;
  line-height: 1.5;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.search-result mark {
  background: rgba(34,211,238,.22);
  color: #67e8f9;
  padding: 0 1px;
  border-radius: 2px;
}
.search-result.sr-active mark { background: rgba(34,211,238,.35); color: #ffffff; }

/* --- empty / no-results states ------------------------------------------ */
.search-empty {
  padding: 40px 24px 34px;
  text-align: center;
}
.search-empty .se-title {
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 500;
  margin: 0 0 4px;
}
.search-empty .se-sub {
  color: var(--text-dim);
  font-family: var(--sans);
  font-size: 13px;
  margin: 0 0 20px;
}
.search-empty .se-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
}
.search-empty .se-chips > span {
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .5px;
  margin-right: 2px;
}
.search-empty .se-chips button {
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.1);
  color: var(--text);
  padding: 5px 11px;
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 12px;
  cursor: pointer;
  transition: background .1s ease, border-color .1s ease;
}
.search-empty .se-chips button:hover {
  background: rgba(124,92,255,.15);
  border-color: var(--accent);
  color: var(--text-bright);
}

.search-no-results {
  padding: 40px 24px;
  text-align: center;
  color: var(--text-dim);
  font-family: var(--sans);
}
.search-no-results p { margin: 4px 0; }
.search-no-results strong { color: var(--text-bright); }
.search-no-results .snr-sub { font-size: 12.5px; }

/* --- footer -------------------------------------------------------------- */
.search-footer {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 18px;
  border-top: 1px solid rgba(255,255,255,.06);
  background: rgba(0,0,0,.2);
  font-family: var(--sans);
  font-size: 11.5px;
  color: var(--text-dim);
}
.search-footer kbd {
  display: inline-block;
  padding: 1px 6px;
  margin-right: 4px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text);
}
.search-footer .sf-count {
  margin-left: auto;
  color: var(--accent-2);
  font-family: var(--mono);
}

/* --- mobile -------------------------------------------------------------- */
@media (max-width: 700px) {
  .search-trigger {
    right: 14px;
    top: 10px;
    padding: 9px 12px;
    font-size: 12px;
  }
  .search-trigger .st-kbd { display: none; }
  .search-modal { padding: 6vh 10px 10px; }
  .search-panel { max-height: 85vh; border-radius: 12px; }
  .search-input { font-size: 16px; }
  .search-footer { gap: 10px; font-size: 10.5px; padding: 8px 12px; }
  .search-footer .sf-count { display: none; }
  .sr-snippet { -webkit-line-clamp: 3; }
}

/* =========================================================================
   Problem Sets — practice blocks rendered by problem-set.js
   ========================================================================= */
.problem-set {
  margin: 36px 0 40px;
  background: linear-gradient(180deg, var(--panel) 0%, var(--bg-2) 100%);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  font-family: var(--sans);
  position: relative;
}
.problem-set::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(124,92,255,0.06) 0%, rgba(34,211,238,0.04) 100%);
  pointer-events: none;
}
.problem-set > * { position: relative; }

/* --- header -------------------------------------------------------------- */
.ps-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,0.25);
  flex-wrap: wrap;
}
.ps-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-2);
  padding: 4px 10px;
  background: rgba(34,211,238,0.1);
  border: 1px solid rgba(34,211,238,0.25);
  border-radius: 4px;
  white-space: nowrap;
}
.ps-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-bright);
  flex: 1;
  min-width: 180px;
}
.ps-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ps-seed {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  padding: 5px 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}
.ps-seed:hover {
  color: var(--accent-2);
  border-color: var(--accent-2);
  background: rgba(34,211,238,0.06);
}
.ps-btn {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--text-bright);
  padding: 6px 12px;
  background: linear-gradient(135deg, rgba(124,92,255,0.25), rgba(124,92,255,0.15));
  border: 1px solid var(--accent);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.ps-btn:hover {
  background: linear-gradient(135deg, var(--accent), rgba(124,92,255,0.8));
  transform: translateY(-1px);
}
.ps-btn:active { transform: translateY(0); }

.ps-description {
  padding: 12px 20px;
  font-size: 13.5px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  font-style: italic;
}

/* --- tabs ---------------------------------------------------------------- */
.ps-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,0.15);
}
.ps-tab {
  flex: 1;
  padding: 13px 16px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-dim);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.ps-tab:hover {
  color: var(--text);
  background: rgba(255,255,255,0.02);
}
.ps-tab.active {
  color: var(--text-bright);
  border-bottom-color: var(--accent);
  background: rgba(124,92,255,0.06);
}
.ps-tab-count {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10px;
  padding: 1px 7px;
  background: rgba(255,255,255,0.06);
  border-radius: 999px;
  color: var(--text-dim);
}
.ps-tab.active .ps-tab-count {
  background: rgba(124,92,255,0.25);
  color: var(--text-bright);
}

/* --- tier panels --------------------------------------------------------- */
.ps-body {
  padding: 8px 0;
}
.ps-tier {
  display: none;
  padding: 8px 20px 16px;
}
.ps-tier.active { display: block; }

.ps-empty {
  padding: 30px 20px;
  text-align: center;
  color: var(--text-dim);
  font-style: italic;
  font-size: 13px;
}
.ps-loading {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 12px;
}

/* --- individual problem -------------------------------------------------- */
.ps-problem {
  padding: 16px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.ps-problem:last-child { border-bottom: none; }

.ps-prompt {
  display: flex;
  gap: 10px;
  align-items: baseline;
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.65;
}
.ps-num {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent-2);
  flex-shrink: 0;
  min-width: 22px;
  padding-top: 1px;
}
.ps-prompt-text { flex: 1; }

.ps-hint {
  margin: 8px 0 0 32px;
  padding: 8px 12px;
  background: rgba(251,191,36,0.06);
  border-left: 2px solid var(--warn);
  border-radius: 0 4px 4px 0;
  font-size: 13px;
  color: var(--text-dim);
}
.ps-hint-label {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--warn);
  margin-right: 8px;
}

/* --- solution disclosure ------------------------------------------------- */
.ps-solution {
  margin: 10px 0 0 32px;
}
.ps-solution > summary {
  display: inline-block;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  padding: 5px 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 4px;
  list-style: none;
  transition: all 0.15s ease;
  user-select: none;
}
.ps-solution > summary::-webkit-details-marker { display: none; }
.ps-solution > summary::before {
  content: "▸ ";
  color: var(--accent-2);
  transition: transform 0.15s ease;
  display: inline-block;
}
.ps-solution[open] > summary::before {
  content: "▾ ";
}
.ps-solution > summary:hover {
  color: var(--text);
  border-color: var(--accent);
  background: rgba(124,92,255,0.08);
}
.ps-solution[open] > summary {
  color: var(--text-bright);
  border-color: var(--accent);
  background: rgba(124,92,255,0.1);
}

.ps-solution-body {
  margin-top: 10px;
  padding: 14px 16px;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.ps-answer {
  font-size: 14px;
  color: var(--text-bright);
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.ps-answer-label {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--good);
  margin-right: 8px;
}
.ps-steps {
  margin: 0;
  padding-left: 22px;
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.7;
}
.ps-steps li {
  margin: 6px 0;
  padding-left: 4px;
}
.ps-steps li::marker {
  color: var(--accent-2);
  font-family: var(--mono);
  font-size: 11px;
}

/* --- footer -------------------------------------------------------------- */
.ps-footer {
  padding: 10px 20px;
  border-top: 1px solid var(--border);
  background: rgba(0,0,0,0.2);
  font-size: 11.5px;
  color: var(--text-dim);
  font-style: italic;
  text-align: center;
}

/* --- mobile -------------------------------------------------------------- */
@media (max-width: 700px) {
  .problem-set { margin: 28px -10px 32px; border-radius: 8px; }
  .ps-header { padding: 12px 14px; gap: 10px; }
  .ps-title { font-size: 14px; min-width: 100%; order: -1; }
  .ps-tab { padding: 11px 8px; font-size: 12px; flex-direction: column; gap: 3px; }
  .ps-tier { padding: 6px 14px 14px; }
  .ps-problem { padding: 14px 0; }
  .ps-prompt { font-size: 14px; }
  .ps-hint, .ps-solution { margin-left: 0; }
  .ps-solution-body { padding: 12px; }
  .ps-footer { padding: 9px 14px; font-size: 11px; }
}

/* =========================================================================
   Physicist photo cards
   ========================================================================= */
.physicist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
  margin: 1.6rem 0;
}
.physicist-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
  display: flex;
  flex-direction: column;
}
.physicist-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4), 0 0 0 1px rgba(124,92,255,0.2);
}
.physicist-card .pc-photo {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  object-position: top center;
  background: var(--bg-3);
  display: block;
  filter: grayscale(20%) contrast(1.05);
  transition: filter 0.22s ease;
}
.physicist-card:hover .pc-photo {
  filter: grayscale(0%) contrast(1.08);
}
/* Fallback avatar shown when photo fails to load */
.physicist-card .pc-avatar {
  width: 100%;
  aspect-ratio: 3/4;
  background: linear-gradient(135deg, var(--bg-3), var(--panel));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 40px;
  font-weight: 700;
  color: var(--accent);
  opacity: 0.6;
  letter-spacing: -2px;
}
.physicist-card .pc-body {
  padding: 14px 14px 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.physicist-card .pc-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-bright);
  margin: 0;
  line-height: 1.2;
}
.physicist-card .pc-dates {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--accent-2);
  letter-spacing: 0.06em;
}
.physicist-card .pc-field {
  font-size: 11px;
  color: var(--accent);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.physicist-card .pc-bio {
  font-size: 12.5px;
  color: var(--text-dim);
  line-height: 1.55;
  margin: 4px 0 0;
  flex: 1;
}
.physicist-card .pc-nobel {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  padding: 3px 8px;
  background: rgba(251,191,36,0.12);
  border: 1px solid rgba(251,191,36,0.3);
  border-radius: 5px;
  font-size: 10.5px;
  color: var(--warn);
  font-family: var(--mono);
}
@media (max-width: 600px) {
  .physicist-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
  .physicist-card .pc-bio { display: none; }
}
