/* ------------------------------------------------------------------ tokens */
:root {
  --bg: #0a0c11;
  --bg-2: #0f1218;
  --surface: #141823;
  --surface-2: #1a1f2c;
  --border: #252b3a;
  --border-strong: #343c50;
  --text: #e8eaf0;
  --muted: #9aa3b6;
  --faint: #6b7489;

  --r: #5b9cff;
  --python: #ffc94d;
  --web: #c08cff;
  --r-soft: rgba(91, 156, 255, .14);
  --python-soft: rgba(255, 201, 77, .14);
  --web-soft: rgba(192, 140, 255, .14);

  --wip: #ff9f43;
  --restricted: #ff6b81;
  --ok: #3ddc97;

  --code-bg: #0d1017;
  --tok-kw: #ff7b9c;
  --tok-str: #8be9a8;
  --tok-num: #ffc94d;
  --tok-fn: #7cc4ff;
  --tok-com: #6b7489;

  --radius: 14px;
  --shadow: 0 10px 30px -12px rgba(0, 0, 0, .6);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Space Grotesk", var(--font);
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f7f8fb; --bg-2: #eef1f6; --surface: #ffffff; --surface-2: #f3f5f9;
    --border: #e1e5ee; --border-strong: #cbd2df; --text: #161a23; --muted: #535c70; --faint: #7d869a;
    --r: #1f6fe5; --python: #b37800; --web: #8a4fe0;
    --r-soft: rgba(31, 111, 229, .10); --python-soft: rgba(214, 150, 0, .13); --web-soft: rgba(138, 79, 224, .10);
    --wip: #c76a00; --restricted: #d63355; --ok: #12935c;
    --code-bg: #f3f5f9; --tok-kw: #c2185b; --tok-str: #2e7d32; --tok-num: #a35f00; --tok-fn: #1f6fe5; --tok-com: #7d869a;
    --shadow: 0 10px 30px -14px rgba(20, 30, 60, .25);
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #f7f8fb; --bg-2: #eef1f6; --surface: #ffffff; --surface-2: #f3f5f9;
  --border: #e1e5ee; --border-strong: #cbd2df; --text: #161a23; --muted: #535c70; --faint: #7d869a;
  --r: #1f6fe5; --python: #b37800; --web: #8a4fe0;
  --r-soft: rgba(31, 111, 229, .10); --python-soft: rgba(214, 150, 0, .13); --web-soft: rgba(138, 79, 224, .10);
  --wip: #c76a00; --restricted: #d63355; --ok: #12935c;
  --code-bg: #f3f5f9; --tok-kw: #c2185b; --tok-str: #2e7d32; --tok-num: #a35f00; --tok-fn: #1f6fe5; --tok-com: #7d869a;
  --shadow: 0 10px 30px -14px rgba(20, 30, 60, .25);
  color-scheme: light;
}

/* -------------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }   /* components below set `display`, which would otherwise override `hidden` */
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
code { font: .88em var(--font-mono); background: var(--surface-2); padding: .1em .35em; border-radius: 5px; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.1; margin: 0; letter-spacing: -.01em; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--r); outline-offset: 2px; border-radius: 6px; }

/* --------------------------------------------------------------------- nav */
.nav {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px clamp(16px, 4vw, 48px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font: 600 17px var(--font-display); }
.brand svg { width: 26px; height: 26px; }
.brand .soma { fill: var(--python); }
.brand .neurites { stroke: var(--r); stroke-width: 2.5; stroke-linecap: round; fill: none; }
.brand b { color: var(--muted); font-weight: 500; }
.nav nav { display: flex; align-items: center; gap: clamp(8px, 2vw, 24px); }
.nav-links { display: flex; gap: clamp(8px, 2vw, 24px); }
.nav nav a { text-decoration: none; color: var(--muted); font-size: 15px; transition: color .15s; }
.nav nav a:hover, .nav-links a[aria-current="true"] { color: var(--text); }
.nav-links a[aria-current="true"] { box-shadow: 0 2px 0 var(--text); }
.nav .gh svg, .theme-toggle svg { width: 20px; height: 20px; display: block; }
.theme-toggle { background: none; border: 0; padding: 4px; cursor: pointer; color: var(--muted); }
.theme-toggle:hover { color: var(--text); }
@media (max-width: 640px) {
  /* Section links move to a scrollable second row so they stay discoverable on phones */
  .nav { flex-wrap: wrap; row-gap: 8px; }
  .nav nav { display: contents; }
  .nav .gh { margin-left: auto; }
  .nav-links { order: 3; width: 100%; overflow-x: auto; gap: 16px; padding-bottom: 2px; scrollbar-width: none; }
  .nav-links a { white-space: nowrap; font-size: 14px; }
  html { scroll-padding-top: 104px; }
}

/* -------------------------------------------------------------------- rail */
.rail {
  position: fixed; left: 22px; top: 50%; transform: translate(-10px, -50%); z-index: 15;
  display: none;
  /* hidden over the hero; nav.js adds .shown once the hero is mostly scrolled past */
  opacity: 0; visibility: hidden; transition: opacity .3s, transform .3s, visibility 0s .3s;
}
.rail.shown { opacity: 1; visibility: visible; transform: translate(0, -50%); transition: opacity .3s, transform .3s; }
.rail ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 26px; position: relative; }
.rail a { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--faint); font-size: 13px; font-weight: 500; }
.rail i {
  width: 11px; height: 11px; border-radius: 50%; flex: none; position: relative; z-index: 1;
  background: var(--bg); border: 2px solid var(--border-strong); transition: all .2s;
}
.rail a span {
  padding: 3px 9px; border-radius: 7px; white-space: nowrap;
  background: color-mix(in srgb, var(--surface) 92%, transparent); border: 1px solid var(--border);
  opacity: 0; transform: translateX(-6px); pointer-events: none; transition: opacity .2s, transform .2s, color .2s;
}
.rail a:hover i { border-color: var(--muted); }
.rail a[aria-current="true"] { color: var(--text); }
.rail a[aria-current="true"] i { background: var(--text); border-color: var(--text); transform: scale(1.25); }
.rail:hover a span, .rail a:focus-visible span { opacity: 1; transform: none; pointer-events: auto; }
.rail-track { position: absolute; left: 4.75px; width: 1.5px; background: var(--border); }   /* top/height set by nav.js */
.rail-fill { position: absolute; left: 0; top: 0; width: 100%; height: 0; background: linear-gradient(var(--r), var(--web), var(--python)); }
@media (min-width: 1100px) { .rail { display: block; } }
/* Enough gutter to keep the labels visible permanently */
@media (min-width: 1600px) {
  .rail a span { opacity: 1; transform: none; pointer-events: auto; background: none; border-color: transparent; padding-left: 0; }
}

/* -------------------------------------------------------------------- hero */
.hero {
  position: relative;
  min-height: min(88vh, 860px);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  padding: clamp(32px, 6vw, 80px) clamp(16px, 4vw, 48px);
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(60% 70% at 75% 45%, color-mix(in srgb, var(--r) 14%, transparent), transparent 70%),
    radial-gradient(40% 50% at 85% 75%, color-mix(in srgb, var(--python) 9%, transparent), transparent 70%);
}
.hero-canvas { position: absolute; inset: 0 0 0 36%; z-index: -1; cursor: grab; }
.hero-canvas:active { cursor: grabbing; }
.hero-canvas canvas { display: block; width: 100% !important; height: 100% !important; }
.hero-text { max-width: 620px; position: relative; pointer-events: none; }
.hero-text a, .hero-text .btn { pointer-events: auto; }
.eyebrow {
  font: 600 13px var(--font-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 0 0 18px;
}
.hero h1 { font-size: clamp(40px, 6.4vw, 76px); font-weight: 700; margin-bottom: 22px; }
.grad {
  background: linear-gradient(100deg, var(--r) 10%, var(--web) 55%, var(--python) 95%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lede { font-size: clamp(16px, 1.6vw, 19px); color: var(--muted); max-width: 54ch; margin: 0 0 30px; }
.lede a { color: var(--text); }
.cta { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 36px; }
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 12px 20px; border-radius: 999px; text-decoration: none; font-weight: 500;
  border: 1px solid var(--border-strong); background: color-mix(in srgb, var(--surface) 70%, transparent);
  transition: transform .15s, border-color .15s, background .15s;
}
.btn:hover { transform: translateY(-1px); border-color: var(--muted); }
.btn.primary { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn.primary svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.hero-stats { list-style: none; display: flex; flex-wrap: wrap; gap: 10px 28px; padding: 0; margin: 0; }
.hero-stats li { color: var(--muted); font-size: 14px; }
.hero-stats b { display: block; font: 700 26px var(--font-display); color: var(--text); }
.hero-legend {
  position: absolute; right: clamp(16px, 4vw, 48px); bottom: 20px; max-width: 360px;
  font-size: 12px; color: var(--faint); text-align: right;
}
.legend-title { margin: 0 0 8px; }
.hero-legend ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 12px; }
.hero-legend li { cursor: default; display: flex; align-items: center; gap: 6px; font-family: var(--font-mono); transition: color .15s; }
.hero-legend li:hover { color: var(--text); }
.hero-legend li i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
@media (max-width: 860px) {
  .hero { min-height: auto; padding-top: 360px; }
  .hero-canvas { inset: 0 0 auto 0; height: 380px; }
  .hero-legend { position: static; text-align: left; max-width: none; margin-top: 28px; }
  .hero-legend ul { justify-content: flex-start; }
}

/* ---------------------------------------------------------------- sections */
.section { padding: clamp(56px, 8vw, 96px) clamp(16px, 4vw, 48px) 0; max-width: 1320px; margin: 0 auto; }
.section-head { max-width: 760px; margin-bottom: 28px; }
.section-head h2 { font-size: clamp(30px, 4vw, 44px); margin-bottom: 12px; }
.section-head p { color: var(--muted); margin: 0; }
.section-head a { color: var(--text); }

/* ----------------------------------------------------------------- filters */
.filters {
  display: flex; flex-direction: column; gap: 12px;
  padding: 14px; margin-bottom: 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  position: sticky; top: 62px; z-index: 10; box-shadow: var(--shadow);
}
.filter-row { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; }
.search { display: flex; align-items: center; gap: 8px; flex: 1 1 200px; min-width: 0;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; padding: 0 12px; }
.search svg { width: 16px; height: 16px; stroke: var(--faint); stroke-width: 2; fill: none; flex: none; }
.search input { border: 0; background: none; color: var(--text); font: inherit; padding: 8px 0; width: 100%; outline: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--border); background: var(--bg-2); color: var(--muted);
  padding: 5px 12px; border-radius: 999px; font-size: 13.5px; cursor: pointer; transition: all .15s;
}
.chip:hover { color: var(--text); border-color: var(--border-strong); }
.chip.active { color: var(--text); border-color: var(--text); background: var(--surface-2); }
.chip[data-lang="r"].active { border-color: var(--r); background: var(--r-soft); }
.chip[data-lang="python"].active { border-color: var(--python); background: var(--python-soft); }
.chip[data-lang="web"].active { border-color: var(--web); background: var(--web-soft); }
.select { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted); }
.select select {
  font: inherit; color: var(--text); background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 6px 10px; max-width: 180px;
}
.view-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.select { margin-left: auto; }
.view-toggle button { background: var(--bg-2); border: 0; padding: 6px 12px; font-size: 13.5px; color: var(--muted); cursor: pointer; }
.view-toggle button.active { background: var(--surface-2); color: var(--text); box-shadow: inset 0 -2px 0 var(--text); }
@media (max-width: 860px) { .filters { position: static; } .select { margin-left: 0; } }
.result-count { color: var(--faint); font-size: 13.5px; margin: 0 0 14px 4px; }

/* -------------------------------------------------------------------- grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.card {
  position: relative; display: flex; flex-direction: column; gap: 10px;
  padding: 18px 18px 14px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  transition: transform .18s, border-color .18s, box-shadow .18s;
  --accent: var(--muted); --accent-soft: transparent;
}
.card[data-lang="r"] { --accent: var(--r); --accent-soft: var(--r-soft); }
.card[data-lang="python"] { --accent: var(--python); --accent-soft: var(--python-soft); }
.card[data-lang="web"] { --accent: var(--web); --accent-soft: var(--web-soft); }
.card::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 3px; border-radius: var(--radius) var(--radius) 0 0;
  background: linear-gradient(90deg, var(--accent), transparent 80%); opacity: .8;
}
.card:hover { transform: translateY(-2px); border-color: var(--border-strong); box-shadow: var(--shadow); }
.card.flash { animation: flash 1.6s ease-out; }
@keyframes flash { 0%, 30% { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); } }
.card-head { display: flex; align-items: center; gap: 10px; }
.card-head h3 { font: 600 17px var(--font-mono); letter-spacing: -.01em; word-break: break-word; }
.card-head h3 a { text-decoration: none; }
.card-head h3 a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.tag {
  font: 600 10.5px var(--font-mono); text-transform: uppercase; letter-spacing: .06em;
  padding: 2px 7px; border-radius: 6px; color: var(--accent); background: var(--accent-soft); white-space: nowrap;
}
.status { font: 600 10.5px var(--font-mono); text-transform: uppercase; letter-spacing: .06em; padding: 2px 7px; border-radius: 6px; border: 1px solid; white-space: nowrap; }
.status.wip { color: var(--wip); border-color: color-mix(in srgb, var(--wip) 50%, transparent); }
.status.ext { color: var(--muted); border-color: var(--border-strong); text-transform: none; letter-spacing: 0; }
.status.restricted { color: var(--restricted); border-color: color-mix(in srgb, var(--restricted) 50%, transparent); }
.card-head .spacer { flex: 1; }
.card p { margin: 0; color: var(--muted); font-size: 14.5px; line-height: 1.55; }
.card p a { position: relative; z-index: 1; }
.card .ds { display: flex; flex-wrap: wrap; gap: 4px; }
.card .ds span { font-size: 11.5px; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.card .ds span.generic { border-style: dashed; }
.card-foot { display: flex; align-items: center; gap: 12px; margin-top: auto; padding-top: 6px; font-size: 12.5px; color: var(--faint); }
.card-foot .links { margin-left: auto; display: flex; gap: 10px; position: relative; z-index: 1; }
.card-foot .links a { color: var(--muted); text-decoration: none; }
.card-foot .links a:hover { color: var(--text); }
.card-foot svg { width: 13px; height: 13px; vertical-align: -2px; fill: currentColor; }
.empty { color: var(--muted); padding: 40px; text-align: center; border: 1px dashed var(--border); border-radius: var(--radius); }

/* ------------------------------------------------------------------- pairs */
.pairs { display: flex; flex-direction: column; gap: 14px; }
.pair { display: grid; grid-template-columns: 1fr 150px 1fr; gap: 14px; align-items: stretch; }
.pair-side { display: grid; gap: 10px; align-content: center; }
.pair-side.r { justify-items: stretch; }
.pair-mid { display: flex; align-items: center; justify-content: center; text-align: center; font: 500 14px var(--font-display); color: var(--muted); position: relative; }
.pair-mid::before { content: ""; position: absolute; left: -14px; right: -14px; top: 50%; border-top: 1px dashed var(--border-strong); z-index: -1; }
.pair-mid span { background: var(--bg); padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border); }
.pair .card { padding: 14px 16px 12px; }
.pair-head { display: grid; grid-template-columns: 1fr 150px 1fr; gap: 14px; font: 600 13px var(--font-mono); text-transform: uppercase; letter-spacing: .1em; }
.pair-head .r { color: var(--r); } .pair-head .python { color: var(--python); text-align: right; }
@media (max-width: 760px) {
  .pair, .pair-head { grid-template-columns: 1fr; }
  .pair-mid { justify-content: flex-start; } .pair-mid::before { display: none; }
  .pair-head { display: none; }
  .pair { padding-bottom: 14px; border-bottom: 1px solid var(--border); }
}

/* ------------------------------------------------------------------ matrix */
.matrix-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.matrix { border-collapse: separate; border-spacing: 0; font-size: 13.5px; min-width: 100%; }
.matrix th, .matrix td { padding: 0; text-align: center; border-bottom: 1px solid var(--border); }
.matrix thead th { position: sticky; top: 0; background: var(--surface); vertical-align: bottom; height: 160px; z-index: 1; }
.matrix thead th.col { width: 34px; min-width: 34px; }
.matrix thead th.col a {
  writing-mode: vertical-rl; transform: rotate(180deg); text-decoration: none;
  font: 500 12.5px var(--font-mono); padding: 10px 0; display: inline-block; white-space: nowrap; color: var(--muted);
}
.matrix thead th.col a:hover { color: var(--text); }
.matrix thead th.col.r { box-shadow: inset 0 -3px 0 var(--r); }
.matrix thead th.col.python { box-shadow: inset 0 -3px 0 var(--python); }
.matrix thead th.col.web { box-shadow: inset 0 -3px 0 var(--web); }
.matrix thead th.group-gap, .matrix td.group-gap { width: 10px; min-width: 10px; border-bottom-color: transparent; }
.matrix tbody th {
  position: sticky; left: 0; background: var(--surface); text-align: left; font-weight: 500; z-index: 1;
  padding: 8px 16px; white-space: nowrap; min-width: 220px; cursor: pointer;
}
@media (max-width: 640px) { .matrix tbody th { min-width: 150px; padding: 8px 10px; white-space: normal; } }
.matrix tbody th small { display: block; color: var(--faint); font-weight: 400; font-size: 12px; }
.matrix tbody th .lock { color: var(--restricted); font-size: 11px; margin-left: 4px; }
.matrix tbody tr { transition: background .12s; }
.matrix tbody tr:hover, .matrix tbody tr:hover th { background: var(--surface-2); }
.matrix tbody tr.selected th { box-shadow: inset 3px 0 0 var(--text); }
.matrix td.hl, .matrix th.hl { background: color-mix(in srgb, var(--surface-2) 80%, transparent); }
.dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; vertical-align: -1px; }
.dot.dedicated { background: var(--text); }
.dot.generic { border: 1.5px solid var(--muted); }
.matrix td .dot.dedicated { background: var(--c, var(--text)); }
.matrix td .dot.generic { border-color: var(--c, var(--muted)); }
.matrix td.r { --c: var(--r); } .matrix td.python { --c: var(--python); } .matrix td.web { --c: var(--web); }
.matrix tbody tr:last-child > * { border-bottom: 0; }

/* ----------------------------------------------------------------- recipes */
.recipes { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 18px; align-items: start; }
.recipe-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.recipe-list button {
  width: 100%; text-align: left; background: none; border: 1px solid transparent; border-radius: 10px;
  padding: 10px 14px; cursor: pointer; color: var(--muted); font-weight: 500; transition: all .15s;
}
.recipe-list button:hover { color: var(--text); background: var(--surface); }
.recipe-list button[aria-selected="true"] { color: var(--text); background: var(--surface); border-color: var(--border-strong); }
.recipe-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; min-width: 0; }
.recipe-panel .blurb { padding: 16px 18px 0; margin: 0; color: var(--muted); font-size: 14.5px; }
.recipe-panel .blurb a { color: var(--text); }
.code-tabs { display: flex; gap: 4px; padding: 14px 18px 0; border-bottom: 1px solid var(--border); }
.code-tabs button {
  background: none; border: 0; padding: 8px 14px; cursor: pointer; color: var(--muted);
  font: 600 13px var(--font-mono); border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.code-tabs button[data-lang="r"][aria-selected="true"] { color: var(--r); border-color: var(--r); }
.code-tabs button[data-lang="python"][aria-selected="true"] { color: var(--python); border-color: var(--python); }
.code-tabs .copy { margin-left: auto; font-weight: 500; }
.code-tabs .copy:hover { color: var(--text); }
.recipe-panel pre { margin: 0; padding: 18px; background: var(--code-bg); overflow-x: auto; font: 13.5px/1.65 var(--font-mono); }
.recipe-panel pre code { background: none; padding: 0; font: inherit; }
.recipe-panel .uses { padding: 12px 18px 16px; font-size: 13px; color: var(--faint); border-top: 1px solid var(--border); background: var(--code-bg); }
.recipe-panel .uses a { color: var(--muted); }
@media (max-width: 760px) {
  .recipes { grid-template-columns: 1fr; }
  .recipe-list { flex-direction: row; overflow-x: auto; padding-bottom: 4px; }
  .recipe-list button { white-space: nowrap; }
}
.hljs-keyword, .hljs-built_in, .hljs-literal { color: var(--tok-kw); }
.hljs-string { color: var(--tok-str); }
.hljs-number { color: var(--tok-num); }
.hljs-title, .hljs-title.function_, .hljs-params { color: var(--tok-fn); }
.hljs-comment { color: var(--tok-com); font-style: italic; }
.hljs-operator, .hljs-punctuation { color: var(--muted); }

/* ------------------------------------------------------------------- graph */
.graph {
  position: relative; height: min(78vh, 760px); min-height: 480px;
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  background:
    radial-gradient(circle at 25% 50%, var(--r-soft), transparent 45%),
    radial-gradient(circle at 75% 50%, var(--python-soft), transparent 45%),
    var(--surface);
}
.graph svg { display: block; width: 100%; height: 100%; }
.graph .link { stroke: var(--border-strong); stroke-opacity: .9; fill: none; }
.graph .link.pair { stroke: var(--muted); stroke-dasharray: 4 4; stroke-opacity: .55; }
.graph .node circle { stroke: var(--bg); stroke-width: 2; cursor: pointer; }
.graph .node text { font: 500 11px var(--font-mono); fill: var(--text); pointer-events: none; paint-order: stroke; stroke: var(--surface); stroke-width: 3px; }
.graph .node.r circle { fill: var(--r); } .graph .node.python circle { fill: var(--python); } .graph .node.web circle { fill: var(--web); }
.graph .node.ext circle { fill-opacity: .25; stroke: var(--python); stroke-width: 1.5; stroke-dasharray: 3 2; }
.graph.focus .node, .graph.focus .link { opacity: .12; transition: opacity .15s; }
.graph.focus .node.on, .graph.focus .link.on { opacity: 1; }
.graph-legend { position: absolute; left: 14px; bottom: 12px; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--muted); pointer-events: none; }
.graph-legend span { display: flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.sw.ext { border: 1.5px dashed var(--muted); }
.sw.r { background: var(--r); } .sw.python { background: var(--python); } .sw.web { background: var(--web); }
.ln { width: 22px; border-top: 1.5px solid var(--border-strong); display: inline-block; }
.ln.dashed { border-top: 1.5px dashed var(--muted); }
.graph-labels { position: absolute; top: 14px; left: 18px; right: 18px; display: flex; justify-content: space-between; pointer-events: none;
  font: 600 13px var(--font-mono); letter-spacing: .12em; text-transform: uppercase; }
.graph-labels .r { color: var(--r); } .graph-labels .python { color: var(--python); }

/* ------------------------------------------------------------ tooltip/foot */
.tooltip {
  position: fixed; z-index: 50; pointer-events: none; max-width: 300px;
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 10px;
  padding: 10px 12px; font-size: 13px; color: var(--muted); box-shadow: var(--shadow);
}
.tooltip b { color: var(--text); font-family: var(--font-mono); }
.footer { max-width: 1320px; margin: clamp(64px, 9vw, 120px) auto 0; padding: 28px clamp(16px, 4vw, 48px) 48px; border-top: 1px solid var(--border); color: var(--muted); font-size: 14.5px; }
.footer p { margin: 0 0 8px; }
.footer .small { font-size: 12.5px; color: var(--faint); }

/* ------------------------------------------------------------------ people */
.people-page h1 { font-size: clamp(36px, 5vw, 56px); margin-bottom: 16px; }
.people-group { font-size: 22px; margin: 40px 0 16px; color: var(--muted); font-weight: 500; }
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.people-grid.core { grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); }
.person {
  display: flex; gap: 16px; align-items: flex-start; padding: 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.avatar {
  flex: none; width: 64px; height: 64px; border-radius: 50%; overflow: hidden;
  background: var(--surface-2); border: 1px solid var(--border);
  display: grid; place-items: center; font: 600 20px var(--font-display); color: var(--muted);
}
.person.core .avatar { width: 84px; height: 84px; font-size: 26px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.person-body { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.person h3 { font: 600 18px var(--font-display); }
.person.core h3 { font-size: 21px; }
.handle { font: 13px var(--font-mono); color: var(--faint); text-decoration: none; }
.handle:hover { color: var(--text); }
.affil { margin: 6px 0 0; font-size: 14.5px; color: var(--muted); }
.prev { margin: 0; font-size: 13px; color: var(--faint); }
.pkgs { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.pkg {
  font: 12px var(--font-mono); padding: 2px 8px; border-radius: 999px; text-decoration: none; white-space: nowrap;
  color: var(--muted); background: var(--surface-2); border: 1px solid var(--border);
}
.pkg[data-lang="r"] { border-color: color-mix(in srgb, var(--r) 45%, transparent); }
.pkg[data-lang="python"] { border-color: color-mix(in srgb, var(--python) 45%, transparent); }
.pkg[data-lang="web"] { border-color: color-mix(in srgb, var(--web) 45%, transparent); }
.pkg:hover { color: var(--text); }
.pkgs .more {
  font: 12px var(--font-mono); padding: 2px 8px; border-radius: 999px; cursor: pointer;
  color: var(--faint); background: none; border: 1px dashed var(--border-strong);
}
.pkgs .more:hover { color: var(--text); border-color: var(--muted); }
.people-more { color: var(--muted); margin-top: 32px; max-width: 760px; }
.people-more a, .people-page .section-head a { color: var(--text); }

/* ----------------------------------------------------------------- contact */
.contact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.contact-card {
  display: flex; flex-direction: column; gap: 8px; padding: 22px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.contact-card h3 { font-size: 19px; }
.contact-card p { margin: 0; color: var(--muted); font-size: 15px; }
.contact-card a { color: var(--text); }
.contact-card .hint { font-size: 13.5px; color: var(--faint); margin-top: auto; padding-top: 6px; }
.contact-icon {
  width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--muted);
}
.contact-icon svg { width: 18px; height: 18px; fill: currentColor; }

.recipe-panel .tutorials {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px;
  padding: 14px 18px; border-top: 1px solid var(--border); background: var(--code-bg); font-size: 13.5px;
}
.recipe-panel .tutorials > span { font: 600 11.5px var(--font-mono); text-transform: uppercase; letter-spacing: .08em; color: var(--faint); margin-right: 4px; }
.recipe-panel .tutorials a {
  display: inline-flex; align-items: center; gap: 6px; text-decoration: none; color: var(--text);
  padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface);
}
.recipe-panel .tutorials a:hover { border-color: var(--muted); }
.recipe-panel .tutorials svg { width: 12px; height: 12px; fill: var(--faint); }

/* ------------------------------------------------------------ publications */
.pubs-page h1 { font-size: clamp(36px, 5vw, 56px); margin-bottom: 16px; }
.pubs-heading { font-size: clamp(26px, 3vw, 34px); margin: 48px 0 16px; }
.pubs-sub { font-size: 18px; margin: 28px 0 12px; color: var(--muted); font-weight: 500; }
.pubs-sub span { font: 400 13.5px var(--font); color: var(--faint); }
.pubs-intro { color: var(--muted); max-width: 760px; margin: 0 0 8px; }
.pubs-intro a, .pubs-page .section-head a { color: var(--text); }
.cite-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.cite-filter .select { margin-left: 0; }
.cite-filter .hint { margin: 0; color: var(--faint); font-size: 14px; }
.cite-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.cite {
  display: flex; gap: 16px; align-items: flex-start; justify-content: space-between;
  padding: 16px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.cite-main { min-width: 0; }
.cite-ref { margin: 0; line-height: 1.5; }
.cite-ref a { color: var(--text); font-weight: 500; }
.cite-authors { color: var(--muted); margin-right: 4px; }
.cite-for { margin: 8px 0 0; font-size: 13.5px; color: var(--faint); display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.cite-for .note { color: var(--faint); }
.cite-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex: none; }
.doi { font: 12.5px var(--font-mono); color: var(--muted); text-decoration: none; white-space: nowrap; }
.doi:hover { color: var(--text); }
.copy-cite {
  font: 12px var(--font-mono); padding: 3px 10px; border-radius: 999px; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--muted);
}
.copy-cite:hover { color: var(--text); }
.software-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.software {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; min-width: 0;
  padding: 10px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
}
.year-group { display: grid; grid-template-columns: 80px minmax(0, 1fr); gap: 16px; margin-top: 18px; }
.year { font: 700 22px var(--font-display); color: var(--faint); margin: 10px 0 0; }
.pub-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.pub { padding: 12px 0; border-bottom: 1px solid var(--border); }
.pub:last-child { border-bottom: 0; }
.pub-title { color: var(--text); font-weight: 500; text-decoration: none; }
.pub-title:hover { text-decoration: underline; }
.pub-meta { margin: 2px 0 6px; color: var(--muted); font-size: 14px; }
.pub-uses { margin: 0; display: flex; flex-wrap: wrap; gap: 5px; }
.pubs-page .empty { padding: 16px; }
@media (max-width: 640px) {
  .cite { flex-direction: column; }
  .cite-actions { flex-direction: row; align-items: center; }
  .year-group { grid-template-columns: 1fr; gap: 0; }
}

.callout {
  display: flex; gap: 14px; align-items: flex-start; margin: 0 0 20px; padding: 16px 18px; border-radius: var(--radius);
  background: var(--python-soft); border: 1px solid color-mix(in srgb, var(--python) 45%, transparent);
}
.callout > svg { width: 20px; height: 20px; flex: none; margin-top: 2px; fill: var(--python); }
.callout p { margin: 0 0 10px; }
.callout a { color: var(--text); }
