:root {
  --bg: #e9f3fb; --ink: #1b2150; --muted: #565d8c; --line: rgba(48, 58, 140, .17);
  --card: rgba(255, 255, 255, .72); --soft: rgba(255, 255, 255, .5); --accent: #00826d; --on-accent: #ffffff;
  --sky: linear-gradient(160deg, #d9e9ff 0%, #e6f6ef 50%, #eee5ff 100%);
  --radius: 8px;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
}
:root[data-theme="dark"] {
  --bg: #0a0a0b; --ink: #ececee; --muted: #8b8b93; --line: #26262b;
  --card: #111113; --soft: #17171a; --accent: #3ef0b5; --on-accent: #04130d; --sky: #0a0a0b;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0a0b; --ink: #ececee; --muted: #8b8b93; --line: #26262b;
    --card: #111113; --soft: #17171a; --accent: #3ef0b5; --on-accent: #04130d; --sky: #0a0a0b;
  }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body { margin: 0; background: var(--sky); background-attachment: fixed; color: var(--ink); font: 16px/1.65 system-ui, -apple-system, "Segoe UI", sans-serif; }
h1, h2, h3 { line-height: 1.12; margin: 0; font-weight: 600; letter-spacing: -0.025em; }
h2 { font-size: clamp(1.7rem, 4vw, 2.4rem); margin-bottom: 1rem; }
a { color: inherit; }
.mono { font-family: var(--mono); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.sr, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.skip:focus { position: fixed; top: 8px; left: 8px; background: var(--ink); color: var(--bg); padding: 8px 12px; z-index: 99; }

.nav { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 24px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { font-family: var(--mono); font-weight: 600; text-decoration: none; font-size: .95rem; }
.brand::before { content: "> "; color: var(--accent); }
.links { display: flex; align-items: center; gap: 18px; font-size: .92rem; }
.links a { text-decoration: none; color: var(--muted); }
.links a:hover { color: var(--ink); }
.theme, .menu-btn { font: inherit; background: none; color: inherit; border: 1px solid var(--line); border-radius: var(--radius); padding: 3px 10px; cursor: pointer; }
.menu-btn { display: none; }

.hero { position: relative; overflow: hidden; min-height: 86vh; display: flex; align-items: center; border-bottom: 1px solid var(--line); }
.net { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-text { position: relative; max-width: 1100px; width: 100%; margin: 0 auto; padding: 72px 24px; pointer-events: none; }
.hero-text a { pointer-events: auto; }
.eyebrow { font-family: var(--mono); font-size: .8rem; margin: 0 0 18px; color: var(--accent); }
h1 { font-size: clamp(2.3rem, 6.2vw, 4.4rem); max-width: 14em; }
.rot { color: var(--accent); font-family: var(--mono); font-weight: 500; }
.rot::after { content: "▌"; margin-left: 2px; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.lead { font-size: 1.1rem; max-width: 36em; color: var(--muted); }
.cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.btn { display: inline-block; font: inherit; font-size: .92rem; font-weight: 500; text-decoration: none; cursor: pointer; padding: 9px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--ink); transition: border-color .15s, transform .15s; }
.btn:hover { border-color: var(--accent); transform: translateY(-1px); }
.btn.solid { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.pill { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }

.wrap { max-width: 1100px; margin: 0 auto; padding: 80px 24px; }
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s, transform .6s; }
.reveal.in { opacity: 1; transform: none; }

.feat { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 32px; }
.feat h3 { font-size: clamp(1.6rem, 3.5vw, 2.2rem); margin: 10px 0 10px; }
.feat p { color: var(--muted); }
.feat .shot { min-height: 200px; border: 1px dashed var(--line); border-radius: var(--radius); display: grid; place-items: center; color: var(--muted); font-family: var(--mono); font-size: .85rem; text-align: center; padding: 12px; background: var(--soft); }
.feat .shot img { width: 100%; border-radius: 6px; }
.badge { display: inline-block; font-family: var(--mono); font-size: .72rem; color: var(--accent); border: 1px solid var(--accent); padding: 2px 9px; border-radius: 999px; }

.lab { display: grid; grid-template-columns: auto 1fr; gap: 28px; margin-top: 28px; align-items: start; }
.playground { display: grid; gap: 14px; }
#nn { width: 360px; max-width: 100%; aspect-ratio: 1; border: 1px solid var(--line); border-radius: var(--radius); cursor: crosshair; touch-action: none; background: var(--card); }
.pg-ctrl { display: grid; gap: 10px; }
.stat { margin: 0; font-size: .8rem; color: var(--muted); }
.term { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); display: flex; flex-direction: column; min-height: 360px; overflow: hidden; }
.term-bar { padding: 8px 14px; font-size: .75rem; color: var(--muted); border-bottom: 1px solid var(--line); background: var(--soft); }
.term-out { flex: 1; max-height: 300px; overflow-y: auto; padding: 14px; font-size: .85rem; line-height: 1.6; }
.term-out p { margin: 0 0 8px; white-space: pre-wrap; }
.term-out .q { color: var(--accent); }
.term .chips { padding: 0 14px 10px; }
.term-form { display: flex; gap: 8px; align-items: center; padding: 10px 14px; border-top: 1px solid var(--line); }
.term-form input { flex: 1; border: 0; background: transparent; padding: 4px 0; border-radius: 0; }
.term-form input:focus-visible { outline: none; }
.term-form:focus-within { border-top-color: var(--accent); }

.about { display: grid; grid-template-columns: 200px 1fr; gap: 32px; align-items: start; }
.avatar { width: 200px; height: 200px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--soft) center/cover; color: var(--accent); display: grid; place-items: center; font: 500 3rem var(--mono); }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 18px; margin: 20px 0 24px; font-size: .92rem; }
.facts dt { font-family: var(--mono); color: var(--muted); font-size: .8rem; padding-top: 2px; } .facts dd { margin: 0; }

.tools { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; margin-bottom: 22px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font: inherit; font-family: var(--mono); font-size: .8rem; cursor: pointer; padding: 5px 13px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--muted); }
.chip:hover { color: var(--ink); border-color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
input, textarea { font: inherit; padding: 9px 13px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--ink); }
input:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; }
.search input { min-width: 220px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.card { text-align: left; font: inherit; color: inherit; cursor: pointer; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 22px; transition: border-color .15s, transform .15s; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card h3 { font-size: 1.2rem; }
.card p { margin: 0; color: var(--muted); font-size: .95rem; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 6px; }
.tag { font-family: var(--mono); font-size: .72rem; padding: 2px 8px; border-radius: 4px; background: var(--soft); color: var(--muted); }
.empty { color: var(--muted); }

.papers { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.paper { border: 1px solid var(--line); border-radius: 12px; padding: 18px 22px; background: var(--card); }
.paper h3 { font-size: 1.15rem; margin: 4px 0; }
.paper p { color: var(--muted); margin: 4px 0 8px; }
.paper .meta { font-family: var(--mono); font-size: .75rem; color: var(--muted); }
.paper a { color: var(--accent); }

.contact { display: grid; grid-template-columns: 1.2fr 1fr; gap: 32px; }
form { display: grid; gap: 14px; }
label { font-size: .85rem; font-family: var(--mono); color: var(--muted); display: grid; gap: 5px; }
.err { color: #c0301a; margin: 0; } :root[data-theme="dark"] .err { color: #ff9a85; }
.ok { margin: 0; color: var(--accent); }
.socials { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; font-family: var(--mono); }
.socials a { color: var(--ink); text-decoration-color: var(--accent); text-underline-offset: 4px; }
.foot { text-align: center; padding: 32px 24px; border-top: 1px solid var(--line); color: var(--muted); font-family: var(--mono); font-size: .8rem; }

dialog { max-width: 640px; width: calc(100% - 32px); border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--ink); padding: 32px; }
dialog::backdrop { background: rgba(0,0,0,.6); }
dialog h3 { font-size: 1.8rem; margin: 10px 0 12px; }
dialog p { color: var(--muted); }
dialog img { width: 100%; border-radius: var(--radius); margin: 8px 0; }
.x { position: absolute; top: 10px; right: 14px; font-size: 1.6rem; background: none; border: 0; color: inherit; cursor: pointer; }
.dlinks { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

@media (max-width: 860px) {
  .feat, .about, .contact, .lab { grid-template-columns: 1fr; }
  .hero { min-height: 70vh; }
  .avatar { width: 120px; height: 120px; font-size: 2rem; }
  .menu-btn { display: block; }
  .links { display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; align-items: flex-start; padding: 16px 24px; background: var(--bg); border-bottom: 1px solid var(--line); }
  .links.open { display: flex; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .reveal { opacity: 1; transform: none; }
}

/* Experience */
.sub { font-size: 1.1rem; margin: 40px 0 12px; }
.exp { display: grid; gap: 10px; }
.job { border: 1px solid var(--line); border-radius: 12px; background: var(--card); padding: 0 22px; }
.job[open] { border-color: var(--muted); }
.job summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 18px 0; align-items: baseline; }
.job summary::-webkit-details-marker { display: none; }
.job summary::before { content: "+"; font-family: var(--mono); color: var(--accent); margin-right: 12px; }
.job[open] summary::before { content: "−"; }
.job-main { flex: 1; display: flex; flex-direction: column; min-width: 220px; }
.job-main strong { font-weight: 600; }
.job-org, .job-date { color: var(--muted); font-size: .85rem; }
.job-blurb { margin: 0 0 8px; color: var(--muted); }
.job ul { margin: 0 0 18px; padding-left: 20px; }
.job li { margin-bottom: 6px; }
.edu { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; font-size: .95rem; }
.edu span { color: var(--muted); }

/* Findings */
.fx { display: grid; gap: 20px; margin-top: 24px; }
.fx-main { display: grid; grid-template-columns: 1.5fr 1fr; gap: 20px; align-items: start; }
.fx-chart, .fx-box, .fx-fig, .fx-extra { border: 1px solid var(--line); border-radius: 12px; background: var(--card); padding: 18px; margin: 0; }
.fx-chart .chips { margin-bottom: 12px; }
.fx-svg { width: 100%; height: auto; display: block; }
.fx-grid { stroke: var(--line); stroke-width: 1; }
.fx-zero { stroke: var(--muted); stroke-width: 1.2; stroke-dasharray: 4 3; }
.fx-tick, .fx-axis { fill: var(--muted); font: 11px var(--mono); }
.fx-lab { fill: var(--ink); font: 13px system-ui, sans-serif; }
.pt { outline: none; cursor: pointer; }
.pt-hit { fill: transparent; }
.pt:hover .pt-hit, .pt:focus-visible .pt-hit { fill: var(--soft); }
.pt-ci { stroke: var(--ink); stroke-width: 2; } .pt-dot { fill: var(--ink); }
.pt-b .pt-ci { stroke: var(--muted); } .pt-b .pt-dot { fill: var(--muted); }
.pt-hl .pt-ci { stroke: var(--accent); stroke-width: 2.6; } .pt-hl .pt-dot { fill: var(--accent); }
.fx-read { min-height: 3em; margin: 10px 0 0; font-size: .78rem; color: var(--muted); }
.fx-side { display: grid; gap: 14px; align-content: start; }
.fx-take { font-size: 1.1rem; margin: 0; }
.fx-note { margin: 0; font-size: .88rem; color: var(--muted); }
.fx-extra { padding: 14px; }
.fx-row2 { display: grid; grid-template-columns: 1.2fr 1fr; gap: 20px; align-items: start; }
.fx-fig img { width: 100%; height: auto; border-radius: 6px; background: #fff; display: block; }
.fx-fig figcaption { font-size: .72rem; color: var(--muted); margin-top: 8px; }
.fx-box h3 { font-size: .95rem; margin-bottom: 10px; font-family: var(--mono); font-weight: 500; color: var(--muted); }
.fx-box ul { margin: 0 0 16px; padding-left: 18px; font-size: .9rem; color: var(--muted); }
.fx-box li { margin-bottom: 6px; }
.brow { display: grid; grid-template-columns: 150px 1fr; gap: 12px; align-items: center; padding: 6px 4px; border-radius: 6px; outline: none; cursor: pointer; }
.brow:hover, .brow:focus-visible { background: var(--soft); }
.brow-l { font-size: .9rem; }
.brow-bars { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; }
.brow-line { display: grid; grid-template-columns: 1fr 52px; gap: 8px; align-items: center; }
.brow-v { font-size: .75rem; color: var(--muted); }
.bar-t { display: block; height: 10px; background: var(--soft); border-radius: 5px; overflow: hidden; }
.bar-f { display: block; height: 100%; border-radius: 5px; transition: width .7s ease-out; }
.bar-f.s0 { background: var(--muted); } .bar-f.s1 { background: var(--accent); }
.bar-legend { display: flex; gap: 16px; font-size: .75rem; color: var(--muted); margin-bottom: 8px; }
.lg i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; background: var(--muted); }
.lg1 i { background: var(--accent); }
.fx-axis-h { font-size: .72rem; color: var(--muted); margin: 8px 0 0; }
@media (max-width: 860px) { .fx-main, .fx-row2 { grid-template-columns: 1fr; } .brow { grid-template-columns: 1fr; gap: 4px; } }

/* Phase 2 */
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .78rem; color: var(--muted); margin: 0 0 6px; }
.link { font: inherit; font-size: .88rem; background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.sk { display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; margin-top: 24px; align-items: start; }
.sk-group { margin-bottom: 20px; }
.sk-group h3 { font-size: .8rem; font-weight: 500; color: var(--muted); margin-bottom: 10px; }
.sk-detail { position: sticky; top: 88px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); padding: 22px; }
.sk-detail h3 { font-size: 1.3rem; margin-bottom: 6px; }
.sk-detail .dlinks { margin-top: 6px; }
.svc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; }
.svc { border: 1px solid var(--line); border-radius: 12px; background: var(--card); padding: 22px; display: flex; flex-direction: column; gap: 10px; }
.svc h3 { font-size: 1.15rem; }
.svc p { margin: 0; }
.svc ul { margin: 0; padding-left: 18px; font-size: .92rem; color: var(--muted); flex: 1; }
.svc li { margin-bottom: 4px; }
.svc-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 8px; }
.quotes { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.quote { margin: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--card); padding: 22px; }
.quote blockquote { margin: 0 0 12px; font-size: 1.05rem; }
.quote figcaption { font-size: .78rem; color: var(--muted); }
.post-card .badge { margin-bottom: 2px; }
.post h4 { font-size: 1.1rem; margin: 22px 0 6px; }
.post p, .post li { color: var(--ink); }
.post ul { padding-left: 20px; }
.post a { color: var(--accent); }
.post code { font-family: var(--mono); font-size: .9em; background: var(--soft); padding: 1px 5px; border-radius: 4px; }
dialog { max-height: 88vh; overflow-y: auto; }
@media (max-width: 860px) { .sk { grid-template-columns: 1fr; } .sk-detail { position: static; } }

/* Cosmos background */
#cosmos { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
main, .foot { position: relative; z-index: 1; }
.hero { border-bottom: 0; }
.hero-text { pointer-events: auto; }

/* Views */
.view-off { display: none !important; }
.subnav { position: sticky; top: 53px; z-index: 9; display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 24px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.subnav[hidden] { display: none; }
.subnav .chip { text-decoration: none; }
.subnav .chip[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.links a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); }
body:not([data-view="home"]) main { min-height: 70vh; }
[data-view] h2:focus { outline: none; }
#highlights .card .link { margin-top: auto; }

.hr-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 24px 0 16px; align-items: start; }
.hr-t { font-size: .8rem; font-weight: 500; color: var(--muted); margin-bottom: 12px; line-height: 1.4; }
@media (max-width: 860px) { .hr-grid { grid-template-columns: 1fr; } }

/* Hero scene */
.hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--line); background: radial-gradient(ellipse 60% 70% at 78% 50%, color-mix(in srgb, var(--accent) 7%, transparent), transparent 70%); }
.hero-sky { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
.hero-text { position: relative; z-index: 1; }

@media (max-width: 860px) { .hero-text { padding-bottom: 270px; } .hero { min-height: 0; } }

/* Hero layout from the sketch: brain top left, headline below it, galaxy right */
.hero { align-items: flex-end; }
.hero-text { padding-top: 298px; }
@media (max-width: 860px) { .hero-text { padding-top: 215px; } }

/* Light mode: aurora sky. Glass cards and soft colour, drawn only in light mode. */
:root[data-theme="light"] .card, :root[data-theme="light"] .svc, :root[data-theme="light"] .job,
:root[data-theme="light"] .paper, :root[data-theme="light"] .fx-chart, :root[data-theme="light"] .fx-box,
:root[data-theme="light"] .fx-fig, :root[data-theme="light"] .fx-extra, :root[data-theme="light"] .feat,
:root[data-theme="light"] .term, :root[data-theme="light"] .sk-detail, :root[data-theme="light"] .quote {
  backdrop-filter: blur(10px); box-shadow: 0 1px 0 rgba(255, 255, 255, .6) inset, 0 8px 28px rgba(60, 70, 160, .08);
}
:root[data-theme="light"] .btn.solid { background: linear-gradient(135deg, #2a3190, #1b2150); }
:root[data-theme="light"] .chip[aria-pressed="true"], :root[data-theme="light"] .btn.pill { background: linear-gradient(135deg, #00a389, #00826d); }
:root[data-theme="light"] .hero { background: radial-gradient(ellipse 60% 70% at 76% 50%, rgba(255, 190, 220, .28), transparent 70%), radial-gradient(ellipse 50% 60% at 10% 20%, rgba(150, 190, 255, .25), transparent 70%); }
