/* ---------- tokens ---------- */
:root {
  --bg: #0b0d14; --surface: #12151f; --surface-2: #191d2a; --border: #262b3a;
  --text: #e7e9ef; --muted: #9298a8;
  --c-astro: #f2b33d; --c-ds: #3cc8b4; --c-prod: #f06a9b; --c-hpc: #7d8cff;
  --c: var(--text);
  --maxw: 1120px; --radius: 12px;
  --f-head: "Space Grotesk", system-ui, sans-serif;
  --f-body: "Inter", system-ui, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, monospace;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #fbfaf7; --surface: #ffffff; --surface-2: #f2f1ec; --border: #e3e1da;
    --text: #15171c; --muted: #5d6270;
    --c-astro: #b07506; --c-ds: #0f8a78; --c-prod: #c2346a; --c-hpc: #4655d6;
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #fbfaf7; --surface: #ffffff; --surface-2: #f2f1ec; --border: #e3e1da;
  --text: #15171c; --muted: #5d6270;
  --c-astro: #b07506; --c-ds: #0f8a78; --c-prod: #c2346a; --c-hpc: #4655d6;
  color-scheme: light;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 64px; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.65 var(--f-body); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--f-head); line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; font-weight: 600; }
h1 { font-size: clamp(2rem, 5vw, 2.8rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
h3 { font-size: 1.15rem; margin-top: 2em; }
p { margin: 0 0 1em; }
a { color: var(--c, var(--text)); text-underline-offset: 3px; }
.chapter-body a, .note a { color: var(--c); }
ul, ol { margin: 0; padding: 0; list-style: none; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--c-hpc); outline-offset: 3px; border-radius: 4px; }
.mono { font-family: var(--f-mono); }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 32px; } }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 16px; z-index: 100; background: var(--surface); padding: 8px 12px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.note { color: var(--muted); font-size: .9rem; }

.btn { display: inline-flex; align-items: center; padding: 10px 18px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); text-decoration: none; font-weight: 500; font-size: .95rem; transition: border-color .2s; }
.btn:hover { border-color: var(--muted); }
.btn-primary { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn-sm { padding: 5px 12px; font-size: .88rem; }

/* ---------- nav ---------- */
.nav { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
@media (min-width: 720px) { .nav { padding: 10px 32px; } }
.brand { font-family: var(--f-head); font-weight: 600; color: var(--text); text-decoration: none; }
.nav-links { display: none; gap: 4px; }
.nav-links a { color: var(--muted); text-decoration: none; padding: 6px 12px; border-radius: 6px; font-size: .92rem; border-bottom: 2px solid transparent; }
.nav-links a:hover, .nav-links a.active { color: var(--text); border-bottom-color: var(--c); border-radius: 0; }
@media (min-width: 820px) { .nav-links { display: flex; } }
.nav-actions { display: flex; gap: 8px; align-items: center; }
.theme-toggle { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--border); background: transparent; display: grid; place-items: center; }
.theme-toggle svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.i-moon { display: none; }
[data-theme="light"] .i-sun { display: none; }
[data-theme="light"] .i-moon { display: block; }

/* ---------- intro ---------- */
.intro { padding-top: 64px; padding-bottom: 56px; display: grid; gap: 40px; }
@media (min-width: 960px) { .intro { grid-template-columns: 1.15fr 1fr; align-items: start; padding-top: 88px; } }
.photo { width: 112px; height: 112px; border-radius: 50%; object-fit: cover; display: block; margin-bottom: 20px; border: 1px solid var(--border); }
.lede { font-size: 1.1rem; color: var(--muted); max-width: 58ch; }
.meta { font-size: .8rem; color: var(--muted); }
.intro-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.map { display: grid; gap: 10px; }
.map a { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 16px 18px; border: 1px solid var(--border); border-left: 4px solid var(--c); border-radius: 10px; background: var(--surface); text-decoration: none; color: var(--text); transition: transform .2s; }
.map a:hover { transform: translateX(4px); }
.map b { font-family: var(--f-head); font-size: 1.15rem; font-weight: 600; grid-row: 1; }
.map .yrs { grid-column: 2; grid-row: 1; color: var(--c); font-size: .78rem; align-self: center; }
.map span:last-child { grid-column: 1 / -1; color: var(--muted); font-size: .9rem; }

/* ---------- chapters ---------- */
.chapter { padding: 72px 0; border-top: 1px solid var(--border); }
.chapter-grid { display: grid; gap: 32px; }
@media (min-width: 960px) {
  .chapter-grid { grid-template-columns: 320px 1fr; gap: 56px; }
  .chapter-head { position: sticky; top: 88px; align-self: start; }
}
.label { color: var(--c); font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; margin-bottom: 12px; }
.label::before { content: ""; display: inline-block; width: 24px; height: 3px; background: var(--c); vertical-align: middle; margin-right: 10px; border-radius: 2px; }
.where { color: var(--muted); font-size: .9rem; }
.facts { display: grid; gap: 8px; margin-top: 20px; }
.facts li { border-left: 2px solid var(--c); padding-left: 12px; color: var(--muted); font-size: .92rem; }
.facts b { color: var(--text); font-family: var(--f-mono); font-weight: 600; margin-right: 4px; }
.chapter-body > p:first-child { font-size: 1.05rem; }
.chapter-body h3:first-child, .item:first-child h3 { margin-top: 0; }

.item { padding: 4px 0 8px; }
.item + .item { border-top: 1px solid var(--border); padding-top: 4px; }
.item h3 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.org { font: 400 .78rem var(--f-mono); color: var(--muted); }
.item p { color: var(--muted); }
.kv { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.kv li { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 8px 14px; display: flex; flex-direction: column; }
.kv b { font-family: var(--f-mono); color: var(--c); font-size: 1.1rem; }
.kv span { color: var(--muted); font-size: .8rem; }

.list li { padding: 10px 0; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; }
.list a { color: var(--text); font-weight: 500; text-decoration-color: var(--c); }
.list span { color: var(--muted); font-size: .78rem; }
.timeline li { position: relative; padding: 8px 0 8px 92px; color: var(--muted); }
.timeline span { position: absolute; left: 0; top: 10px; color: var(--c); font-size: .82rem; }

.products { display: grid; gap: 12px; margin: 16px 0 8px; }
@media (min-width: 720px) { .products { grid-template-columns: 1fr 1fr; } }
.product { border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; background: var(--surface); }
.product b { font-family: var(--f-head); }
.product p { font-size: .9rem; margin: 4px 0 8px; }
.product a { font-size: .85rem; }
.quote { margin: 32px 0 0; padding: 20px 24px; border-left: 4px solid var(--c); background: var(--surface); border-radius: 0 10px 10px 0; }
.quote p { font: 500 1.3rem/1.35 var(--f-head); color: var(--text); margin-bottom: 8px; }
.quote cite { font-style: normal; color: var(--muted); font-size: .88rem; }

/* ---------- black-hole diagram ---------- */
.bh { overflow: hidden; margin: 24px 0 8px; }
.bh-svg { width: 100%; height: auto; display: block; background: #07080f; }
.bh-svg .L { opacity: 0; transition: opacity .5s ease, transform .8s ease; }
.bh-svg .L.on { opacity: 1; }
.bh-svg text { fill: #a3a9b8; font: 12px var(--f-body); text-anchor: middle; }
.bh-svg .t-big { fill: #eef0f5; font: 600 17px var(--f-head); }
.bh-svg .strong { fill: #eef0f5; font-weight: 600; }
.bh-svg .acc { fill: #f2b33d; }
.bh-svg .dm { fill: none; stroke: #5d6475; stroke-dasharray: 4 6; }
.bh-svg .wave { fill: none; stroke: #f2b33d; stroke-width: 1.8; }
.bh-svg .h2x path { stroke: #f06a9b; stroke-width: 2.5; }
.bh-svg .h2x text { fill: #eef0f5; }
.bh-svg .merge { fill: none; stroke: #f2b33d; stroke-width: 1.5; stroke-dasharray: 5 5; }
.bh-svg .star { fill: #fff; }
.bh-svg[data-step="5"] .nb { transform: translateX(-80px); }
.bh-controls { padding: 16px 20px 20px; }
.bh-steps { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.bh-steps button { border: 1px solid var(--border); background: transparent; border-radius: 6px; padding: 5px 10px; font-size: .82rem; color: var(--muted); }
.bh-steps button[aria-selected="true"] { color: var(--text); border-color: var(--c); background: var(--surface-2); }
.bh-text { min-height: 96px; }
.bh-text p { color: var(--muted); margin: 0; }
.bh-text b, .bh-text em { color: var(--text); }
.cite { display: block; margin-top: 6px; font-size: .78rem; }
.bh-nav { display: flex; gap: 6px; margin-top: 12px; }

/* ---------- HPC ---------- */
.explorer { overflow: hidden; margin: 8px 0 24px; }
.tabs { display: flex; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tabs button { flex: 1; background: none; border: 0; padding: 12px; color: var(--muted); font: .88rem var(--f-mono); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--c); }
.explorer-body { display: grid; gap: 20px; padding: 20px; }
@media (min-width: 1100px) { .explorer-body { grid-template-columns: 1fr 1fr; } }
.node-fig { margin: 0; }
.node-svg { width: 100%; height: auto; }
.node-svg .node-outline { fill: none; stroke: var(--border); stroke-width: 1.5; stroke-dasharray: 5 5; }
.node-svg .cpu { fill: var(--surface-2); stroke: var(--muted); }
.node-svg .gpu-b { fill: color-mix(in srgb, var(--c) 14%, transparent); stroke: var(--c); }
.node-svg .link { stroke: var(--c); stroke-width: 1.5; fill: none; opacity: .7; }
.node-svg .ib { stroke: var(--muted); stroke-width: 1.5; fill: none; stroke-dasharray: 3 4; }
.node-svg text { fill: var(--text); font: 11px var(--f-mono); text-anchor: middle; }
.node-svg text.lbl { fill: var(--muted); font-size: 10px; }
.sys-caption { color: var(--muted); font-size: .75rem; margin-top: 6px; }
.specs { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0 0 16px; font-size: .9rem; }
.specs dt { color: var(--muted); font: .78rem var(--f-mono); padding-top: 2px; }
.specs dd { margin: 0; }
.small-label { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 6px; }
.did li { padding-left: 16px; position: relative; font-size: .92rem; margin-bottom: 6px; }
.did li::before { content: "–"; position: absolute; left: 0; color: var(--c); }

.pipeline { display: grid; gap: 8px; counter-reset: s; margin-bottom: 20px; }
@media (min-width: 900px) { .pipeline { grid-template-columns: repeat(4, 1fr); } }
.pipeline li { counter-increment: s; border: 1px solid var(--border); border-top: 3px solid var(--c); border-radius: 8px; padding: 12px; background: var(--surface); display: flex; flex-direction: column; gap: 4px; }
.pipeline b::before { content: counter(s) ". "; color: var(--c); font-family: var(--f-mono); }
.pipeline span { color: var(--muted); font-size: .84rem; line-height: 1.5; }
.compare { display: grid; gap: 16px; margin-bottom: 8px; }
.compare > div { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; font-size: .88rem; }
.compare > div > span { grid-column: 1 / -1; color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; }
.compare b { font-family: var(--f-mono); font-weight: 500; font-size: .85rem; }
.bar { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.bar i { display: block; height: 100%; width: var(--w); min-width: 3px; background: var(--muted); border-radius: 4px; }
.bar i.after { background: var(--c); }

/* ---------- closing ---------- */
.closing { padding-top: 72px; padding-bottom: 56px; border-top: 1px solid var(--border); display: grid; gap: 32px; }
@media (min-width: 960px) { .closing { grid-template-columns: 1.4fr 1fr; } .closing h2 { grid-column: 1 / -1; margin: 0; } }
.skills { display: grid; grid-template-columns: auto 1fr; gap: 10px 20px; margin: 0; font-size: .92rem; }
.skills dt { font: 600 .8rem var(--f-mono); color: var(--muted); padding-top: 2px; }
.skills dd { margin: 0; }
.contact p { color: var(--muted); }
.footer { padding-top: 24px; padding-bottom: 32px; color: var(--muted); font-size: .8rem; border-top: 1px solid var(--border); }

/* gentle fade-in */
.reveal { opacity: 0; transform: translateY(12px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }
.chapter-body, .chapter-head { min-width: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}

/* ---------- v3: flows, figures, charts ---------- */
.flow { display: grid; gap: 8px; counter-reset: f; margin: 16px 0 18px; }
@media (min-width: 720px) { .flow { grid-template-columns: repeat(3, 1fr); } }
.flow li { counter-increment: f; position: relative; border: 1px solid var(--border); border-top: 3px solid var(--c); border-radius: 8px; padding: 10px 12px; background: var(--surface); display: flex; flex-direction: column; gap: 2px; }
.flow li b::before { content: counter(f) " "; font-family: var(--f-mono); color: var(--c); font-size: .8rem; }
.flow li span { color: var(--muted); font-size: .82rem; line-height: 1.45; }
.flow li.wip { border-style: dashed; border-top-style: dashed; }
.split { display: grid; gap: 20px; margin: 16px 0 18px; align-items: start; }
@media (min-width: 720px) { .split { grid-template-columns: 1fr 1fr; } }
.fig { margin: 0; }
.fig figcaption { color: var(--muted); font-size: .72rem; margin-top: 6px; }
.fig-title { font-weight: 600; font-size: .9rem; margin-bottom: 10px; color: var(--text) !important; }
.muted { color: var(--muted); font-weight: 400; }
.h3-svg, .cld, .dp-svg { width: 100%; height: auto; display: block; }
.h3-svg polygon { stroke: var(--bg); stroke-width: 1.2; }
.h3-svg .parent { fill: none; stroke: var(--text); stroke-width: 1.2; stroke-dasharray: 3 3; }
.h3-svg text { fill: var(--muted); font: 10px var(--f-mono); text-anchor: middle; }
.hbars { display: grid; gap: 12px; }
.hb { display: grid; grid-template-columns: 56px 1fr 48px; gap: 3px 8px; align-items: center; font-size: .82rem; }
.hb span { grid-row: span 2; color: var(--muted); }
.hb i { display: block; height: 9px; width: var(--w); background: var(--c); border-radius: 3px; }
.hb i.ref { background: var(--muted); opacity: .55; }
.hb b { font: 500 .78rem var(--f-mono); text-align: right; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; background: var(--c); margin-right: 5px; vertical-align: -1px; }
.legend .sw.ref { background: var(--muted); opacity: .55; }
.legend > span:first-child { flex-basis: 100%; }
.cld text { fill: var(--text); font: 600 11px var(--f-body); text-anchor: middle; }
.cld path { fill: none; stroke: var(--c); stroke-width: 1.6; }
.cld .ah { fill: var(--c); stroke: none; }
.cld .pol { fill: var(--c); font: 700 15px var(--f-mono); }
.cld .loop { fill: var(--muted); font: 700 22px var(--f-head); }
.cld .loop-sub { fill: var(--muted); font: 400 10px var(--f-mono); }
.dp-svg rect { fill: color-mix(in srgb, var(--c) 14%, transparent); stroke: var(--c); }
.dp-svg .dp-ar { fill: var(--surface-2); stroke: var(--muted); }
.dp-svg .dp-l { fill: none; stroke: var(--c); stroke-width: 1.4; }
.dp-svg text { fill: var(--text); font: 10px var(--f-mono); text-anchor: middle; }
.dp-svg .dp-s { fill: var(--muted); font-size: 9.5px; }
.steps { display: flex; flex-wrap: wrap; gap: 0; margin: 0 0 28px; counter-reset: st; }
.steps li { counter-increment: st; flex: 1 1 130px; padding: 18px 12px 0 0; border-top: 2px solid var(--c); position: relative; font-size: .85rem; display: flex; flex-direction: column; }
.steps li::before { content: counter(st); position: absolute; top: -12px; left: 0; width: 22px; height: 22px; border-radius: 50%; background: var(--c); color: var(--bg); font: 600 .72rem/22px var(--f-mono); text-align: center; }
.steps span { color: var(--muted); font-size: .8rem; line-height: 1.4; }
.two-col { display: grid; gap: 24px; margin-top: 20px; }
@media (min-width: 900px) { .two-col { grid-template-columns: 1fr 1fr; } }
.did b { color: var(--text); }
#astrophysics .bh-svg { max-height: 260px; }
#astrophysics .bh-text { min-height: 72px; font-size: .92rem; }
.kv li { flex: 1 1 150px; max-width: 260px; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); row-gap: 28px; }
@media (min-width: 900px) { .steps { grid-template-columns: repeat(6, 1fr); } }

/* ---------- v4: clearer delineation ---------- */
.chapter { background: color-mix(in srgb, var(--c) 5%, var(--bg)); border-top: 4px solid var(--c); margin-top: 48px; padding: 56px 0 72px; }
.chapter-head h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); }
.label { font-size: .9rem; font-weight: 600; }
.item { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--c); border-radius: 12px; padding: 20px 22px 8px; }
.item + .item { margin-top: 20px; border-top: 1px solid var(--border); padding-top: 20px; }
.item h3 { margin-top: 0; padding-bottom: 10px; border-bottom: 1px dashed var(--border); margin-bottom: 14px; }
.item .kv li, .item .product, .item .flow li, .item .pipeline li { background: var(--surface-2); }
.chapter-body > .item:first-child, .chapter-body > .steps + .item { margin-top: 0; }
.chapter-body > p:first-child { margin-bottom: 20px; }
.explorer { margin-bottom: 20px; }

.phases { display: grid; gap: 8px; margin: 4px 0 18px; }
@media (min-width: 720px) { .phases { grid-template-columns: repeat(4, 1fr); gap: 14px; } }
.phases li { position: relative; padding: 10px 12px; border-radius: 8px; background: var(--surface-2); display: flex; flex-direction: column; font-size: .88rem; }
.phases li > .mono { color: var(--c); font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; }
.phases li > span:last-child { color: var(--muted); font-size: .8rem; }
.phases li:nth-child(n+3) { background: color-mix(in srgb, var(--c) 14%, var(--surface-2)); }
@media (min-width: 720px) { .phases li:not(:last-child)::after { content: "→"; position: absolute; right: -12px; top: 50%; transform: translateY(-50%); color: var(--c); font-size: .9rem; } }

.dag { width: 100%; height: auto; display: block; }
.dag rect { fill: var(--surface-2); stroke: var(--muted); }
.dag .core rect { fill: color-mix(in srgb, var(--c) 18%, transparent); stroke: var(--c); }
.dag text { fill: var(--text); font: 9.5px var(--f-mono); text-anchor: middle; }
.dag path { fill: none; stroke: var(--c); stroke-width: 1.4; }
.dag .ah { fill: var(--c); }
.dag .frame { fill: none; stroke: var(--border); stroke-dasharray: 4 4; }
.dag .mods rect { fill: var(--surface-2); stroke: var(--muted); }
.dag .cl rect.on { fill: color-mix(in srgb, var(--c) 30%, transparent); stroke: var(--c); }
.dag .hd { fill: var(--muted); font-size: 9px; }
.dag .hd2 { fill: var(--text); font-size: 9.5px; font-weight: 600; }
.dag .sm { fill: var(--muted); font-size: 8.5px; }
.flow.one { grid-template-columns: 1fr !important; margin-top: 0; }
.dumbbell { display: grid; gap: 14px; }
.db { display: grid; grid-template-columns: 64px 1fr 92px; gap: 10px; align-items: center; font-size: .8rem; }
.db span { color: var(--muted); }
.db b { font: 500 .76rem var(--f-mono); text-align: right; }
.db .track { position: relative; height: 2px; background: var(--border); }
.db .track i { position: absolute; top: 50%; left: var(--x); width: 12px; height: 12px; border-radius: 50%; transform: translate(-50%, -50%); }
.db .track i.hi { background: var(--c); }
.db .track i.lo { background: var(--muted); opacity: .6; }
.split-svg { width: 100%; height: auto; display: block; }
.split-svg .tr { fill: color-mix(in srgb, var(--c) 22%, transparent); stroke: var(--c); }
.split-svg .te { fill: var(--surface-2); stroke: var(--muted); }
.split-svg .lomo rect { fill: var(--c); }
.split-svg text { fill: var(--text); font: 9.5px var(--f-mono); text-anchor: middle; }
.split-svg .sm { fill: var(--muted); font-size: 9px; }
.split.ml { margin-top: 24px; }

/* ---------- v5: intro, intersection, highlights, lead ---------- */
h1, h2 { font-family: "Fraunces", Georgia, serif; font-weight: 600; letter-spacing: -.015em; }
.hero2 { display: grid; gap: 28px 48px; padding-top: 64px; padding-bottom: 40px; }
@media (min-width: 900px) { .hero2 { grid-template-columns: 1fr 260px; padding-top: 96px; } }
.hero2 h1 { font-size: clamp(2.4rem, 6vw, 4.2rem); line-height: 1.05; margin: 8px 0 18px; }
.hero2 h1 em { font-style: italic; color: var(--muted); font-weight: 500; }
.eyebrow { color: var(--muted); font-size: .82rem; letter-spacing: .04em; margin: 0; }
.hero2-photo { margin: 0; justify-self: start; }
@media (min-width: 900px) { .hero2-photo { justify-self: end; align-self: center; } }
.hero2-photo img { width: 200px; height: 200px; border-radius: 24px; object-fit: cover; display: block; border: 1px solid var(--border); transform: rotate(2deg); box-shadow: 0 18px 40px rgba(0,0,0,.18); }
@media (min-width: 900px) { .hero2-photo img { width: 260px; height: 260px; } }
.story { grid-column: 1 / -1; border-top: 1px solid var(--border); padding-top: 28px; display: grid; gap: 20px; }
@media (min-width: 900px) { .story { grid-template-columns: 1fr 1.1fr; gap: 48px; align-items: start; } }
.story > p:first-child { font-size: 1.05rem; color: var(--text); margin: 0; }
.route { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px 0; }
.route li { position: relative; padding: 16px 10px 0 0; border-top: 2px dashed var(--border); display: flex; flex-direction: column; font-size: .85rem; }
.route li::before { content: ""; position: absolute; top: -6px; left: 0; width: 10px; height: 10px; border-radius: 50%; background: var(--bg); border: 2px solid var(--muted); }
.route li.home::before { background: var(--c-prod); border-color: var(--c-prod); box-shadow: 0 0 0 5px color-mix(in srgb, var(--c-prod) 25%, transparent); }
.route li.home { border-top-style: solid; border-top-color: var(--c-prod); }
.route b { font-family: "Fraunces", Georgia, serif; font-size: 1.05rem; font-weight: 600; }
.route span { color: var(--muted); font-size: .76rem; }
.route-note { grid-column: 2; color: var(--muted); font-size: .75rem; margin: -6px 0 0; }
@media (max-width: 899px) { .route-note { grid-column: 1; } }

.intersect { padding-top: 56px; padding-bottom: 24px; }
.int-head { max-width: 640px; margin-bottom: 20px; }
.int-head h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
.int-body { display: grid; gap: 24px; align-items: center; }
@media (min-width: 900px) { .int-body { grid-template-columns: 380px 1fr; gap: 48px; } }
.venn { width: 100%; max-width: 380px; height: auto; display: block; margin: 0 auto; }
.venn .vc { cursor: pointer; outline: none; }
.venn circle { fill: var(--c); fill-opacity: .1; stroke: var(--c); stroke-width: 1.5; transition: fill-opacity .25s, stroke-width .25s; mix-blend-mode: normal; }
.venn .vc:hover circle, .venn .vc:focus-visible circle, .venn .vc.on circle { fill-opacity: .28; stroke-width: 3; }
.venn text { fill: var(--text); font: 600 14px "Fraunces", Georgia, serif; text-anchor: middle; pointer-events: none; }
.venn .me { font: 600 11px var(--f-mono); fill: var(--muted); }
.chips2 { display: flex; flex-wrap: wrap; gap: 8px; }
.chips2 a { display: inline-block; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); text-decoration: none; font-size: .88rem; transition: opacity .25s, border-color .25s, transform .25s; }
.chips2 a:hover, .chips2 a.on { border-color: var(--text); transform: translateY(-2px); }
.chips2.filtering a:not(.on) { opacity: .3; }

.highlights { display: grid; gap: 12px; padding-top: 32px; padding-bottom: 24px; }
@media (min-width: 720px) { .highlights { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1060px) { .highlights { grid-template-columns: repeat(4, 1fr); } }
.hl { display: flex; flex-direction: column; gap: 6px; padding: 20px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); border-top: 4px solid var(--c); color: var(--text); text-decoration: none; transition: transform .2s; }
.hl:hover { transform: translateY(-3px); }
.hl b { font: 600 1.7rem "Fraunces", Georgia, serif; color: var(--c); }
.hl span { color: var(--muted); font-size: .88rem; }

.lead { padding-top: 48px; padding-bottom: 24px; }
.lead h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
.lead-grid { display: grid; gap: 24px; margin-top: 12px; }
@media (min-width: 720px) { .lead-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1060px) { .lead-grid { grid-template-columns: repeat(4, 1fr); } }
.lead-grid article { border-top: 1px solid var(--text); padding-top: 14px; }
.lead-grid .n { color: var(--muted); font-size: .75rem; }
.lead-grid h3 { font-family: "Fraunces", Georgia, serif; font-size: 1.3rem; margin: 4px 0 8px; }
.lead-grid p { color: var(--muted); font-size: .92rem; }
.item.soon { border-style: dashed; border-left-style: solid; }
.route-note { margin: 18px 0 0 !important; }
@media (min-width: 900px) { .flow.five { grid-template-columns: repeat(5, 1fr); } }
.fed { width: 100%; height: auto; display: block; }
.fed .hub rect:first-child { fill: var(--surface-2); stroke: var(--border); }
.fed ellipse, .fed .hub path { fill: color-mix(in srgb, var(--c) 18%, transparent); stroke: var(--c); }
.fed .pkg { fill: var(--surface); stroke: var(--c); }
.fed .agg { fill: color-mix(in srgb, var(--c) 18%, transparent); stroke: var(--c); }
.fed .up { fill: none; stroke: var(--c); stroke-width: 1.4; stroke-dasharray: 4 3; }
.fed .ah { fill: var(--c); }
.fed text { fill: var(--text); font: 9.5px var(--f-mono); text-anchor: middle; }
.fed .hd2 { font-weight: 600; }
.fed .sm { fill: var(--muted); font-size: 8.5px; }

/* ---------- v6: formatting fixes ---------- */
.item h3 { display: block; }
.org { display: block; margin-top: 4px; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.kv li { max-width: none; }
.flow { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)) !important; }
.flow.one { grid-template-columns: 1fr !important; }
.split.ml { grid-template-columns: 1fr !important; }
.split .kv { grid-template-columns: repeat(2, 1fr); }
.split.ml .kv { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.h3-svg text.h3l { fill: var(--text); font-weight: 600; }
.chapter-body .item > p { color: var(--muted); }
.item p b { color: var(--text); }
.chapter-body .flow { grid-template-columns: 1fr !important; }
@media (min-width: 600px) { .chapter-body .flow { grid-template-columns: repeat(3, 1fr) !important; } .chapter-body .flow.five { grid-template-columns: repeat(5, 1fr) !important; } }
.chapter-body .flow.one { grid-template-columns: 1fr !important; }
.flow.five li b { font-size: .9rem; }
@media (max-width: 819px) {
  .nav { flex-wrap: wrap; row-gap: 6px; }
  .nav nav { order: 3; width: 100%; }
  .nav-links { display: flex; overflow-x: auto; gap: 2px; margin: 0 -8px; }
  .nav-links a { font-size: .85rem; padding: 4px 8px; white-space: nowrap; }
}
.lead-grid ul { display: grid; gap: 6px; }
.lead-grid li { position: relative; padding-left: 14px; color: var(--muted); font-size: .9rem; line-height: 1.45; }
.lead-grid li::before { content: ""; position: absolute; left: 0; top: .6em; width: 6px; height: 1.5px; background: var(--text); }
.story > p:first-child { max-width: 52ch; }

/* ---------- v7: product portfolio ---------- */
.portfolio { overflow-x: auto; margin-bottom: 24px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.portfolio table { width: 100%; border-collapse: collapse; font-size: .86rem; min-width: 640px; }
.portfolio caption { text-align: left; padding: 14px 16px 6px; font: 600 .78rem var(--f-mono); text-transform: uppercase; letter-spacing: .08em; color: var(--c); }
.portfolio th { text-align: left; font: 500 .72rem var(--f-mono); color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding: 8px 16px; border-bottom: 1px solid var(--border); }
.portfolio td { padding: 10px 16px; border-bottom: 1px solid var(--border); vertical-align: top; color: var(--muted); }
.portfolio tr:last-child td { border-bottom: 0; }
.portfolio td:first-child b { display: block; color: var(--text); font-weight: 600; }
.portfolio td:first-child span { font-size: .75rem; }
.st { font-style: normal; font: 600 .7rem var(--f-mono); padding: 2px 8px; border-radius: 99px; white-space: nowrap; }
.st.live { background: color-mix(in srgb, var(--c-ds) 18%, transparent); color: var(--c-ds); }
.st.demo { background: color-mix(in srgb, var(--c-hpc) 18%, transparent); color: var(--c-hpc); }
.st.rd { background: var(--surface-2); color: var(--muted); }
.roles { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.roles li { font: .74rem var(--f-mono); padding: 3px 10px; border-radius: 99px; border: 1px solid var(--c); color: var(--c); }
.bullets { display: grid; gap: 8px; margin: 0 0 14px; }
.bullets li { position: relative; padding-left: 16px; color: var(--muted); font-size: .94rem; }
.bullets li::before { content: ""; position: absolute; left: 0; top: .7em; width: 7px; height: 1.5px; background: var(--c); }
.bullets b { color: var(--text); }
.item .compare { margin: 6px 0 16px; }

/* ---------- v8: header band layout ---------- */
.chapter-grid { grid-template-columns: 1fr !important; gap: 28px; }
.chapter-head { position: static !important; display: grid; gap: 10px 32px; grid-template-columns: 1fr; padding-bottom: 8px; }
@media (min-width: 960px) { .chapter-head { grid-template-columns: 1.1fr 1fr; align-items: end; } .chapter-head .label, .chapter-head h2, .chapter-head .tags { grid-column: 1; } .chapter-head .facts { grid-column: 2; grid-row: 1 / span 3; align-self: end; } }
.chapter-head h2 { font-size: clamp(1.8rem, 3.6vw, 2.6rem); margin: 0; }
.chapter-head .label { margin: 0; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tags li { font: .76rem var(--f-mono); padding: 4px 10px; border-radius: 6px; background: var(--surface); border: 1px solid var(--border); color: var(--text); }
.facts { display: grid !important; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px !important; margin: 0 !important; }
.facts li { border: 1px solid var(--border) !important; border-top: 3px solid var(--c) !important; border-left: 1px solid var(--border) !important; border-radius: 8px; background: var(--surface); padding: 10px 12px !important; font-size: .78rem !important; line-height: 1.35; }
.facts b { display: block; font-size: 1.05rem; margin: 0 0 2px !important; color: var(--c) !important; }
.chapter-body { max-width: none; }
.facts { grid-template-columns: repeat(2, 1fr) !important; }
@media (min-width: 720px) { .facts { grid-template-columns: none !important; grid-auto-flow: column; grid-auto-columns: 1fr; } }
.h3-svg { max-width: 420px; }

/* ---------- v9: sticky section bar ---------- */
.secbar { position: fixed; left: 0; right: 0; top: 54px; z-index: 45; background: color-mix(in srgb, var(--c, var(--bg)) 7%, var(--bg)); border-bottom: 2px solid var(--c, var(--border)); transform: translateY(-110%); opacity: 0; pointer-events: none; transition: transform .25s ease, opacity .25s ease; }
.secbar.on { transform: none; opacity: 1; }
.secbar-in { display: flex; align-items: center; gap: 14px; padding-top: 8px; padding-bottom: 8px; overflow: hidden; }
.sb-label { color: var(--c); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; white-space: nowrap; }
.sb-title { font: 600 1rem "Fraunces", Georgia, serif; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-tags { flex-wrap: nowrap; overflow: hidden; margin-left: auto; }
.sb-tags li { font-size: .68rem; padding: 2px 8px; white-space: nowrap; }
@media (max-width: 720px) { .sb-tags { display: none; } }
html { scroll-padding-top: 110px; }

/* ---------- v10: job group headers ---------- */
.job { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 14px; margin: 36px 0 14px; padding-bottom: 8px; border-bottom: 2px solid var(--c); }
.chapter-body > .job:first-child, .chapter-body > .portfolio + .job { margin-top: 8px; }
.job b { font: 600 1.35rem "Fraunces", Georgia, serif; }
.job span { color: var(--muted); font: .8rem var(--f-mono); }
.job + .item { margin-top: 0; }

/* ---------- v11: chips, results, teaching, embed ---------- */
.chips2 button { font: inherit; font-size: .86rem; padding: 7px 13px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; transition: opacity .25s, border-color .25s, transform .25s; }
.chips2 button:hover, .chips2 button.on { border-color: var(--text); transform: translateY(-2px); }
.chips2.filtering button:not(.on) { opacity: .25; }
.mini-h { font-size: clamp(1.4rem, 2.6vw, 1.8rem); margin: 0 0 14px; }
.highlights-wrap { padding-top: 40px; }
.highlights-wrap .highlights { padding: 0; }
.hl em { font: 600 .7rem var(--f-mono); font-style: normal; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.teaching { padding-top: 40px; padding-bottom: 24px; }
.teach-grid { display: grid; gap: 12px; }
@media (min-width: 720px) { .teach-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1060px) { .teach-grid { grid-template-columns: repeat(4, 1fr); } }
.teach-grid li { display: flex; flex-direction: column; gap: 2px; padding: 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.teach-grid .lvl { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--c-ds); }
.teach-grid b { font: 600 1.05rem "Fraunces", Georgia, serif; }
.teach-grid span:last-child { color: var(--muted); font-size: .86rem; }
.embed { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; min-height: 120px; justify-content: center; border: 1px dashed var(--border); border-radius: 10px; background: var(--surface-2); margin-bottom: 16px; }
.embed.loaded { display: block; border: 0; background: none; }
.embed iframe { width: 100%; height: 560px; border: 1px solid var(--border); border-radius: 10px; display: block; }
.teaching .note { margin-top: 12px; }

/* ---------- v12: network background, publications ---------- */
.hero2 { position: relative; isolation: isolate; }
.hero2::before { content: ""; position: absolute; z-index: -1; top: -40px; right: calc(50% - 50vw); width: min(1100px, 80vw); height: 620px; background: url("../img/network.jpg") right top / cover no-repeat; opacity: .55; mix-blend-mode: multiply; -webkit-mask-image: linear-gradient(to left, #000 25%, transparent 85%), linear-gradient(to bottom, #000 55%, transparent); mask-image: linear-gradient(to left, #000 25%, transparent 85%); pointer-events: none; }
:root[data-theme="dark"] .hero2::before { filter: invert(1) hue-rotate(180deg); mix-blend-mode: screen; opacity: .35; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .hero2::before { filter: invert(1) hue-rotate(180deg); mix-blend-mode: screen; opacity: .35; } }
@media (max-width: 899px) { .hero2::before { width: 100vw; height: 420px; opacity: .3; } }
.pubs { padding-top: 40px; padding-bottom: 24px; }
.pubs-grid { display: grid; gap: 24px; }
@media (min-width: 900px) { .pubs-grid { grid-template-columns: 1fr 1fr; gap: 40px; } }
.pubs .list a { text-decoration-color: var(--c-ds); }
.hero2::before { -webkit-mask-image: linear-gradient(to left, #000 25%, transparent 85%), linear-gradient(to bottom, #000 50%, transparent 95%); mask-image: linear-gradient(to left, #000 25%, transparent 85%), linear-gradient(to bottom, #000 50%, transparent 95%); -webkit-mask-composite: source-in; mask-composite: intersect; }
:root[data-theme="dark"] .hero2::before { opacity: .55; filter: invert(1) hue-rotate(180deg) saturate(1.6) brightness(1.3); }
.hero2 .subtitle { font: 500 clamp(1.05rem, 2vw, 1.35rem) "Fraunces", Georgia, serif; color: var(--muted); margin: -6px 0 16px; }
.ladder { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 6px; }
.ladder i { font: normal .74rem var(--f-mono); padding: 2px 8px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); }
.ladder i:not(:last-child)::after { content: " →"; color: var(--c); }
.ladder i:last-child { border-color: var(--c); color: var(--c); }
.node-svg .fw { fill: var(--surface); stroke: var(--c); }
.node-svg text.fwt { fill: var(--c); font-size: 10px; font-weight: 600; }
