/* Andrew Rosemberg — personal site.
   Shares its palette and type with the paper websites (e.g. the NeurIPS 2026
   Masked Sobolev site) so that moving between them feels like one site. */

@font-face { font-family: "Instrument Serif"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/InstrumentSerif-Regular-latin.woff2") format("woff2"); }
@font-face { font-family: "Instrument Serif"; font-style: italic; font-weight: 400; font-display: swap; src: url("../fonts/InstrumentSerif-Italic-latin.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400 750; font-display: swap; src: url("../fonts/Inter-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400 750; font-display: swap; src: url("../fonts/Inter-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400 750; font-display: swap; src: url("../fonts/Inter-greek.woff2") format("woff2"); unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF; }

:root {
  --paper: #f8f7f3;
  --paper-2: #f1efe9;
  --card: #fdfcfa;
  --ink: #202a33;
  --ink-2: #3a4550;
  --muted: #5d666e;
  --line: #dddcd5;
  --line-2: #e9e7e1;
  --accent: #7551a7;
  --accent-dark: #5e3b8f;
  --accent-soft: #eee8f5;
  --energy: #2b7a73;
  --energy-soft: #e3f0ee;
  --control: #a2601b;
  --control-soft: #f6ebdd;
  --serif: "Instrument Serif", Georgia, "Times New Roman", serif;
  --sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  --radius: 14px;
  --shadow: 0 1px 2px #20283008, 0 10px 30px -18px #2028304a;
  --wrap: 1180px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--sans); font-size: 16.5px; line-height: 1.65;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
img, svg, video { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration-color: #7551a766; text-underline-offset: 3px; }
a:hover { color: var(--accent-dark); }
p a, li a, .prose a { color: var(--accent-dark); text-decoration: underline; text-decoration-thickness: 1px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
::selection { background: #dcd0ed; color: #302244; }
h1, h2, h3, h4, p, figure, ul, ol { margin: 0; }
strong { font-weight: 650; }
code { font-family: var(--mono); font-size: .88em; }
[hidden] { display: none !important; }

.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: 32px; }
.skip-link { position: fixed; top: -80px; left: 16px; z-index: 100; padding: 10px 18px; background: var(--ink); color: #fff; border-radius: 8px; }
.skip-link:focus { top: 12px; }

/* ---------------------------------------------------------------- header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(140%) blur(10px); -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line-2);
}
.header-inner { max-width: 1280px; margin: auto; padding: 14px 32px; display: flex; align-items: center; gap: 28px; }
.wordmark { display: inline-flex; align-items: center; gap: 11px; font-weight: 650; font-size: 15.5px; letter-spacing: -.2px; text-decoration: none; white-space: nowrap; }
.monogram { width: 32px; height: 32px; border-radius: 9px; background: var(--ink); color: var(--paper); display: grid; place-items: center; font-family: var(--serif); font-size: 17px; letter-spacing: -.5px; }
.site-nav { display: flex; gap: 4px; margin-left: auto; }
.site-nav a { padding: 7px 12px; border-radius: 8px; font-size: 14px; font-weight: 550; color: var(--ink-2); text-decoration: none; transition: background .15s, color .15s; }
.site-nav a:hover { background: var(--accent-soft); color: var(--accent-dark); }
.site-nav a[aria-current="page"] { color: var(--accent-dark); background: var(--accent-soft); }
.header-tools { display: flex; align-items: center; gap: 8px; }
.icon-btn { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); color: var(--ink-2); cursor: pointer; font: inherit; font-size: 12px; }
.icon-btn:hover { border-color: var(--accent); color: var(--accent-dark); }
.icon-btn svg { width: 16px; height: 16px; }
kbd { font-family: var(--sans); font-size: 11px; font-weight: 650; padding: 1px 6px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; background: var(--paper); color: var(--muted); }
.i-sun { display: none; }
:root[data-theme="dark"] .i-sun { display: block; }
:root[data-theme="dark"] .i-moon { display: none; }
.header-cv { font-size: 13.5px; font-weight: 650; padding: 7px 14px; border: 1px solid var(--ink); border-radius: 999px; text-decoration: none; transition: background .15s, color .15s; }
.header-cv:hover { background: var(--ink); color: var(--paper); }

/* ---------------------------------------------------------------- shared type */
.eyebrow { font-size: 12px; font-weight: 650; letter-spacing: .9px; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.eyebrow .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }

.section { padding-block: 88px; }
.section + .section { border-top: 1px solid var(--line-2); }
.section.alt { background: var(--paper-2); border-top: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); }
.section-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 24px 40px; margin-bottom: 40px; }
.section-head .kicker { font-size: 12px; font-weight: 650; letter-spacing: .9px; text-transform: uppercase; color: var(--accent); margin-bottom: 10px; }
.section-head h2, .page-hero h1 { font-family: var(--serif); font-weight: 400; letter-spacing: -.6px; line-height: 1.05; }
.section-head h2 { font-size: clamp(34px, 4.2vw, 50px); text-wrap: balance; }
.section-head .lede { grid-column: 1 / -1; max-width: 760px; color: var(--ink-2); font-size: 17.5px; }
.see-all { font-size: 14.5px; font-weight: 650; text-decoration: none; white-space: nowrap; padding: 9px 16px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); transition: border-color .15s, color .15s; }
.see-all:hover { border-color: var(--accent); }

.prose { max-width: 720px; }
.prose p + p, .prose p + ul, .prose ul + p { margin-top: 1em; }
.prose ul { padding-left: 1.2em; }
.prose li + li { margin-top: .4em; }
.muted { color: var(--muted); }

/* ---------------------------------------------------------------- buttons */
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 10px; font-size: 14.5px; font-weight: 650; text-decoration: none; border: 1px solid var(--line); background: var(--card); color: var(--ink); transition: border-color .15s, background .15s, color .15s; }
.btn:hover { border-color: var(--accent); color: var(--accent-dark); }
.btn svg { width: 17px; height: 17px; flex: none; }
.btn.primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }

/* ---------------------------------------------------------------- home hero */
.hero { padding-block: 72px 64px; }
.hero-cover { position: relative; margin: 0 0 34px; overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: var(--card); box-shadow: var(--shadow); }
.hero-cover img { width: 100%; aspect-ratio: 2.39 / 1; object-fit: cover; }
.hero-cover figcaption { position: absolute; right: 14px; bottom: 12px; padding: 5px 8px; border-radius: 7px; background: color-mix(in srgb, var(--paper) 88%, transparent); color: var(--ink-2); font-size: 12px; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(260px, .8fr); gap: 64px; align-items: center; }
.hero h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(54px, 7.4vw, 92px); line-height: .98; letter-spacing: -1.6px; margin-top: 18px; }
.hero .tagline { font-family: var(--serif); font-size: clamp(24px, 2.6vw, 31px); line-height: 1.25; color: var(--ink-2); margin-top: 22px; max-width: 760px; text-wrap: pretty; }
.hero .tagline em { color: var(--accent-dark); font-style: italic; }
.hero .bio { margin-top: 22px; max-width: 700px; color: var(--ink-2); font-size: 16.5px; }
.hero .bio p + p { margin-top: .8em; }
.hero .btn-row { margin-top: 28px; }
.portrait { position: relative; }
.portrait img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 22px; box-shadow: var(--shadow); }

/* affiliations strip */

/* news */
.news-wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 56px; align-items: start; }
.news { list-style: none; padding: 0; }
.news li { display: grid; grid-template-columns: 92px 1fr; gap: 16px; padding: 13px 0; border-bottom: 1px solid var(--line-2); font-size: 15.5px; }
.news li:first-child { padding-top: 0; }
.news time { font-size: 13px; font-weight: 650; color: var(--accent-dark); padding-top: 2px; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- thesis map */
.thesis-block { display: grid; grid-template-columns: minmax(0, .72fr) minmax(0, 1.28fr); gap: 48px; align-items: center; margin-bottom: 56px; }
.thesis-block .prose p { font-size: 16px; }

.flow { stroke-dasharray: 5 6; animation: flow 1.8s linear infinite; }
.flow.back { animation-direction: reverse; }
@keyframes flow { to { stroke-dashoffset: -22; } }

/* ---------------------------------------------------------------- project cards */
.project-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.project-card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; transition: border-color .18s, box-shadow .18s, transform .18s; }
.project-card:hover { border-color: #c9b9e0; box-shadow: var(--shadow); transform: translateY(-2px); }
.card-link { display: flex; flex-direction: column; height: 100%; text-decoration: none; color: inherit; }
.card-link:hover { color: inherit; }
.card-media { aspect-ratio: 16 / 10; background: #fff; border-bottom: 1px solid var(--line-2); overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.card-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-venue { font-size: 11.5px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--accent); }
.card-body h3 { font-family: var(--serif); font-weight: 400; font-size: 25px; line-height: 1.12; letter-spacing: -.2px; }
.card-summary { font-size: 14.5px; color: var(--ink-2); line-height: 1.55; }
.tags { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.tags li { font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--paper-2); color: var(--ink-2); border: 1px solid var(--line-2); }
.card-go { margin-top: auto; padding-top: 8px; font-size: 13.5px; font-weight: 650; color: var(--accent-dark); }
.project-card.featured { grid-column: span 2; }
.project-card.featured .card-link { flex-direction: row; }
.project-card.featured .card-media { aspect-ratio: auto; flex: 1.25; border-bottom: 0; border-right: 1px solid var(--line-2); min-height: 300px; display: grid; place-items: center; padding: 10px; }
.project-card.featured .card-media { background: #fff; padding: 18px; }
.project-card.featured .card-media picture, .project-card.featured .card-media img { width: 100%; height: 100%; object-fit: contain; }
.project-card.featured .card-body { flex: 1; padding: 26px 28px; }
.project-card.featured h3 { font-size: 31px; }

/* ---------------------------------------------------------------- publications */
.pub-list { list-style: none; padding: 0; display: grid; gap: 14px; }
.pub { display: grid; grid-template-columns: 1fr; gap: 20px; padding: 18px 20px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.pub.has-thumb { grid-template-columns: 168px minmax(0, 1fr); }
.pub-thumb { display: block; border-radius: 9px; overflow: hidden; border: 1px solid var(--line-2); background: #fff; align-self: start; aspect-ratio: 16 / 10; }
.pub-thumb img { width: 100%; height: 100%; object-fit: cover; }
.pub-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; font-size: 13px; color: var(--muted); font-weight: 550; }
.venue-badge { font-size: 11px; font-weight: 750; letter-spacing: .6px; text-transform: uppercase; padding: 2px 8px; border-radius: 6px; background: var(--accent-soft); color: var(--accent-dark); }
.venue-badge.journal { background: var(--energy-soft); color: var(--energy); }
.venue-badge.preprint, .venue-badge.workshop { background: var(--paper-2); color: var(--ink-2); border: 1px solid var(--line); }
.venue-badge.software, .venue-badge.thesis { background: var(--control-soft); color: var(--control); }
.pub-title { font-size: 17.5px; line-height: 1.35; font-weight: 650; margin-top: 6px; letter-spacing: -.1px; }
.pub-title a { text-decoration: none; color: var(--ink); }
.pub-title a:hover { color: var(--accent-dark); }
.pub-title a:hover { text-decoration: underline; }
.pub-authors { font-size: 14.5px; color: var(--ink-2); margin-top: 4px; }
.pub-authors .me { color: var(--ink); }
.pub-note { font-size: 13.5px; color: var(--muted); margin-top: 6px; }
.pub-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; align-items: flex-start; }
.pub-link { display: inline-block; font-size: 12.5px; font-weight: 650; padding: 4px 11px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; background: var(--paper); cursor: pointer; list-style: none; }
.pub-link::-webkit-details-marker { display: none; }
.pub-link:hover { border-color: var(--accent); color: var(--accent-dark); }
.pub-link.primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.pub-link.primary:hover { background: var(--accent-dark); color: #fff; }
details.bib { order: 99; }
details.bib[open] { flex-basis: 100%; }
details.bib > summary { display: inline-block; }
details.bib[open] > summary { border-color: var(--accent); color: var(--accent-dark); }
.bib-box { position: relative; margin-top: 10px; }
.bib-box pre { margin: 0; padding: 14px 16px; background: #22293a; color: #e8e6f0; border-radius: 10px; font-size: 12.5px; line-height: 1.55; overflow-x: auto; }
.copy-bib { position: absolute; top: 8px; right: 8px; font-size: 11.5px; font-weight: 650; padding: 4px 10px; border-radius: 6px; border: 1px solid #ffffff30; background: #ffffff14; color: #fff; cursor: pointer; }
.copy-bib:hover { background: #ffffff2a; }
.pub-list.compact .pub { padding: 14px 16px; }
.pub-year + .pub-year { margin-top: 44px; }
.year-label { font-family: var(--serif); font-weight: 400; font-size: 34px; margin-bottom: 14px; color: var(--ink-2); }
.pub-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 32px; }
.pub-filters button { font: inherit; font-size: 13.5px; font-weight: 650; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--ink-2); cursor: pointer; }
.pub-filters button[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.pub-filters .count { opacity: .65; margin-left: 4px; font-weight: 550; }

/* ---------------------------------------------------------------- software */

/* ---------------------------------------------------------------- timeline */
.timeline { list-style: none; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 118px; top: 8px; bottom: 8px; width: 1px; background: var(--line); }
.tl { display: grid; grid-template-columns: 100px minmax(0, 1fr); gap: 37px; padding: 0 0 26px; position: relative; }
.tl::before { content: ""; position: absolute; left: 113px; top: 7px; width: 11px; height: 11px; border-radius: 50%; background: var(--paper); border: 2px solid var(--accent); }
.tl.industry::before { border-color: var(--energy); }
.tl.edu::before { border-color: var(--control); }
.tl time { font-size: 13.5px; font-weight: 650; color: var(--ink-2); text-align: right; font-variant-numeric: tabular-nums; line-height: 1.5; }
.tl h3 { font-size: 16.5px; font-weight: 700; line-height: 1.4; }
.tl .org { font-size: 14.5px; color: var(--muted); }
.tl p, .tl ul { font-size: 15px; color: var(--ink-2); margin-top: 6px; }
.tl ul { padding-left: 1.1em; }
.tl li + li { margin-top: 3px; }

/* The recent entries deliberately read as concurrent branches, not a chronology
   in which one appointment succeeds another. */

.legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-bottom: 26px; }
.legend span::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--accent); margin-right: 7px; vertical-align: -1px; }
.legend .l-ind::before { border-color: var(--energy); }
.legend .l-edu::before { border-color: var(--control); }

/* ---------------------------------------------------------------- page hero (inner pages) */
.page-hero { padding-block: 64px 36px; }
.page-hero h1 { font-size: clamp(44px, 6vw, 72px); margin-top: 14px; text-wrap: balance; }
.page-hero .lede { margin-top: 18px; max-width: 760px; font-size: 18px; color: var(--ink-2); }

.breadcrumb { font-size: 13.5px; color: var(--muted); }
.breadcrumb a { color: var(--muted); }

/* ---------------------------------------------------------------- project pages */
.proj-hero { padding-block: 56px 28px; }
.proj-hero h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(40px, 5.2vw, 64px); line-height: 1.04; letter-spacing: -1px; margin-top: 16px; max-width: 980px; text-wrap: balance; }
.proj-hero .lede { margin-top: 18px; max-width: 780px; font-size: 18.5px; color: var(--ink-2); }
.proj-hero .authors { margin-top: 18px; font-size: 14.5px; color: var(--ink-2); }
.proj-hero .authors .me { color: var(--ink); }
.proj-hero .btn-row { margin-top: 22px; }
.proj-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 56px; align-items: start; padding-bottom: 72px; }
.toc { position: sticky; top: 92px; font-size: 13.5px; }
.toc p { font-size: 11.5px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.toc ol { list-style: none; padding: 0; border-left: 1px solid var(--line); }
.toc a { display: block; padding: 5px 0 5px 14px; margin-left: -1px; border-left: 2px solid transparent; color: var(--ink-2); text-decoration: none; }
.toc a:hover, .toc a.active { color: var(--accent-dark); border-left-color: var(--accent); }
.proj-body { min-width: 0; }
.proj-body > section + section { margin-top: 64px; }
.proj-body h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(30px, 3.4vw, 40px); letter-spacing: -.4px; line-height: 1.1; margin-bottom: 18px; }
.proj-body h2 .num { font-family: var(--sans); font-size: 13px; font-weight: 700; color: var(--accent); letter-spacing: .6px; display: block; margin-bottom: 8px; text-transform: uppercase; }
.proj-body h3 { font-size: 18px; font-weight: 700; margin: 28px 0 8px; }
.proj-body p, .proj-body li { font-size: 16.5px; color: var(--ink-2); max-width: 760px; }
.proj-body p + p { margin-top: 1em; }
.proj-body ul { padding-left: 1.2em; margin-top: .8em; }
.proj-body li + li { margin-top: .45em; }
.plain { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--energy); border-radius: 12px; padding: 20px 24px; max-width: 800px; }
.plain .label { font-size: 11.5px; font-weight: 750; letter-spacing: .8px; text-transform: uppercase; color: var(--energy); margin-bottom: 6px; }
.plain p { font-size: 16.5px; }
.callout { background: var(--accent-soft); border-radius: 12px; padding: 18px 22px; max-width: 800px; margin-top: 22px; }
.callout p { color: #3c2a58; }
.fig { margin-top: 28px; }
.fig .frame { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px; overflow: hidden; }
.fig .frame.flush { padding: 0; }
.fig figcaption { font-size: 13.5px; color: var(--muted); margin-top: 10px; max-width: 820px; line-height: 1.55; }
.fig figcaption b { color: var(--ink-2); }
.method-figure { max-width: 1000px; }
.method-figure > .method-diagram { border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
.method-figure .frame { background: #fff; }
.method-wide-only > .method-diagram, .method-compact-only > .method-diagram { border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
.method-compact-only { display: none; }
@media (max-width: 640px) { .method-wide-only { display: none !important; } .method-compact-only { display: block !important; } }
.fig-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 28px; }
.fig-row .fig { margin-top: 0; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 26px; }
.stat { padding: 18px 20px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.stat .v { font-family: var(--serif); font-size: 42px; line-height: 1; letter-spacing: -.5px; color: var(--accent-dark); }
.stat .v small { font-size: 24px; }
.stat .k { font-size: 14px; font-weight: 650; margin-top: 8px; }
.stat .d { font-size: 13px; color: var(--muted); margin-top: 3px; line-height: 1.45; }
.eq { margin: 20px 0; padding: 12px 14px; background: var(--card); border: 1px solid var(--line-2); border-radius: 10px; overflow-x: auto; }
.eq .katex-display > .katex { font-size: 1.1em; }
.code { margin-top: 18px; max-width: 820px; }
.code pre { margin: 0; padding: 18px 20px; background: #22293a; color: #e8e6f0; border-radius: 12px; font-size: 13px; line-height: 1.6; overflow-x: auto; }
.code .c { color: #8e95a8; }
.code .k { color: #c9a8ff; }
.code .s { color: #9fd8b5; }
table.data { border-collapse: collapse; width: 100%; max-width: 820px; font-size: 14.5px; margin-top: 18px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
table.data th, table.data td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line-2); }
table.data th { font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); background: var(--paper-2); font-weight: 700; }
table.data td.n { text-align: right; font-variant-numeric: tabular-nums; }
table.data tr.hl td { background: var(--accent-soft); font-weight: 650; }
table.data caption { caption-side: bottom; text-align: left; font-size: 13px; color: var(--muted); padding: 10px 14px; }
.table-scroll { overflow-x: auto; max-width: 820px; }
.research-compass { margin-top: 72px; padding-top: 28px; border-top: 1px solid var(--line); }
.research-compass > p { font-size: 11.5px; font-weight: 750; letter-spacing: .9px; text-transform: uppercase; color: var(--muted); }
.research-compass-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.research-compass-grid a { min-height: 96px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink); text-decoration: none; display: flex; flex-direction: column; gap: 5px; }
.research-compass-grid a:hover { border-color: var(--accent); color: var(--accent-dark); }
.research-compass-grid small { font-size: 11.5px; font-weight: 700; letter-spacing: .65px; text-transform: uppercase; color: var(--muted); }
.research-compass-grid span { font-size: 14px; font-weight: 650; line-height: 1.35; }
.research-compass-grid b { color: var(--accent-dark); font-weight: 650; white-space: nowrap; }
.research-compass-all { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 16px; }
.research-compass-all a { color: var(--accent-dark); font-size: 13.5px; font-weight: 650; text-decoration: none; border-bottom: 1px solid #7551a766; }
.research-compass-all a:hover { color: var(--ink); border-color: var(--ink); }
.topic-map { margin: -18px auto 44px; }
.topic-map > p { margin: 0; font-size: 11.5px; font-weight: 750; letter-spacing: .9px; text-transform: uppercase; color: var(--muted); }
.topic-map ol { list-style: none; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin: 12px 0 0; padding: 0; }
.topic-map a { display: flex; flex-direction: column; min-height: 96px; gap: 7px; padding: 14px 15px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink); text-decoration: none; }
.topic-map a:hover { border-color: var(--accent); color: var(--accent-dark); }
.topic-map small { font-size: 10.5px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.topic-map span { font-size: 13px; font-weight: 650; line-height: 1.35; }
@media (max-width: 860px) {
  .research-compass-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topic-map ol { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .research-compass-grid { grid-template-columns: minmax(0, 1fr); }
  .research-compass-grid a { min-height: 0; }
  .topic-map ol { grid-template-columns: minmax(0, 1fr); }
  .topic-map a { min-height: 0; }
}

/* chart helpers (inline SVG) */
.chart text { font-family: var(--sans); }

/* ---------------------------------------------------------------- teaching */
.course { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 40px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 32px; }
.course h3 { font-family: var(--serif); font-weight: 400; font-size: 34px; line-height: 1.1; }
.course .meta { font-size: 13.5px; color: var(--muted); margin-top: 6px; }
.course p { margin-top: 14px; color: var(--ink-2); }
.course .btn-row { margin-top: 20px; }
.course img { border-radius: 12px; border: 1px solid var(--line-2); background: #fff; }

/* ---------------------------------------------------------------- footer */
.site-footer { background: var(--paper-2); border-top: 1px solid var(--line-2); }
.footer-inner { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, .8fr) minmax(0, .9fr); gap: 32px; padding-block: 48px 32px; font-size: 14.5px; }
.footer-name { font-family: var(--serif); font-size: 26px; line-height: 1.1; margin-bottom: 8px; color: var(--ink); }
.footer-id { color: var(--ink-2); }
.footer-id p + p { margin-top: 8px; }
.footer-label { font-size: 11.5px; font-weight: 750; letter-spacing: .8px; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.footer-col { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.footer-col a:not(.sponsor-btn) { text-decoration: none; color: var(--ink-2); }
.footer-col a:not(.sponsor-btn):hover { color: var(--accent-dark); }

.sponsor-btn { display: inline-flex; align-items: center; gap: 8px; padding: 7px 13px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); font-weight: 650; font-size: 13.5px; text-decoration: none; }
.sponsor-btn svg { width: 14px; height: 14px; fill: #bf3989; }
.sponsor-btn:hover { border-color: #bf3989; color: #9e2a6f; }
.footer-bottom { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; color: var(--muted); padding-block: 16px 28px; border-top: 1px solid var(--line); }
@media (max-width: 860px) { .footer-inner { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .footer-id { grid-column: 1 / -1; } }

/* sponsor block on software page */
.sponsor-panel { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 28px; align-items: center; padding: 26px 28px; border: 1px solid #ecd2e2; background: #fcf4f8; border-radius: 16px; margin-top: 40px; }
.sponsor-panel h3 { font-family: var(--serif); font-weight: 400; font-size: 28px; }
.sponsor-panel p { color: var(--ink-2); margin-top: 6px; max-width: 640px; }
.sponsor-panel iframe { border: 0; border-radius: 6px; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1080px) {
  .project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .proj-layout { grid-template-columns: minmax(0, 1fr); }
  .toc { display: none; }
  .thesis-block { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .header-inner { flex-wrap: wrap; row-gap: 8px; padding: 12px 20px; }
  .site-nav { order: 3; width: 100%; margin-left: -12px; overflow-x: auto; scrollbar-width: none; }
  .site-nav::-webkit-scrollbar { display: none; }
  .header-tools { margin-left: auto; gap: 6px; }
  .wordmark { gap: 9px; }
  .wrap { padding-inline: 20px; }
  .hero-grid, .news-wrap, .course, .sponsor-panel { grid-template-columns: minmax(0, 1fr); }
  .portrait { max-width: 420px; display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 14px; align-items: start; }
  .portrait img { border-radius: 16px; }

  

  .section { padding-block: 64px; }
  .section-head { grid-template-columns: minmax(0, 1fr); }
  .project-card.featured { grid-column: auto; }
  .project-card.featured .card-link { flex-direction: column; }
  .project-card.featured .card-media { min-height: 0; aspect-ratio: 16 / 10; border-right: 0; border-bottom: 1px solid var(--line-2); }

  .fig-row, .stats { grid-template-columns: minmax(0, 1fr); }
  .footer-inner { grid-template-columns: minmax(0, 1fr); }
  .project-pager { grid-template-columns: minmax(0, 1fr); }
  .project-pager .next { text-align: left; }
}
@media (max-width: 640px) {
  html, body { overflow-x: clip; }
  body { font-size: 16px; }
  .hero h1 { font-size: clamp(40px, 10.5vw, 46px); letter-spacing: -.8px; }
  .hero .tagline { font-size: 24px; }
  .hero .eyebrow { flex-wrap: wrap; gap: 7px; }
  .hero-cover figcaption { right: 8px; bottom: 8px; max-width: calc(100% - 16px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .wordmark > span:last-child { display: none; }

  

  
  .portrait { grid-template-columns: minmax(0, 1fr); max-width: 300px; }
  .project-grid { grid-template-columns: minmax(0, 1fr); }
  .pub.has-thumb { grid-template-columns: minmax(0, 1fr); }
  .pub-thumb { max-width: 260px; }
  .timeline::before { left: 7px; }
  .tl { grid-template-columns: minmax(0, 1fr); gap: 2px; padding-left: 30px; }
  .tl::before { left: 2px; }
  .tl time { text-align: left; }
  .news li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .flow { animation: none; }
  .project-card, .project-card:hover { transition: none; transform: none; }
}
@media print {
  .site-header, .site-footer, .toc, .project-pager { display: none; }
  body { background: #fff; }
}

/* ---------------------------------------------------------------- clickable thesis map */

/* compact software list (home) */
.mini-soft { list-style: none; padding: 0; display: grid; gap: 10px; }
.mini-soft a { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); text-decoration: none; transition: border-color .15s; }
.mini-soft a:hover { border-color: var(--accent); color: inherit; }
.mini-soft b { font-size: 15.5px; color: var(--ink); }
.mini-soft span { font-size: 14px; color: var(--ink-2); }

/* home: conceptual research map below portrait */

.app-energy { --area: var(--energy); }.app-markets { --area: var(--accent); }.app-robotics { --area: var(--control); }
.app-energy img { object-position: center; }.app-markets img { object-position: right center; }.app-robotics img { object-position: left center; }

/* interactive dispatch explorer */
.explorer { margin-top: 26px; padding: 22px 24px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; max-width: 820px; }
.explorer label { display: flex; justify-content: space-between; font-weight: 650; font-size: 14.5px; }
.explorer input[type=range] { width: 100%; margin: 12px 0 18px; accent-color: var(--accent); }
.explorer .rows { display: grid; gap: 9px; }
.explorer .row { display: grid; grid-template-columns: 150px minmax(0, 1fr) 110px; gap: 12px; align-items: center; font-size: 14px; }
.explorer .track { height: 12px; background: var(--paper-2); border-radius: 6px; overflow: hidden; }
.explorer .fill { height: 100%; border-radius: 6px; transition: width .08s linear; }
.explorer .val { text-align: right; font-variant-numeric: tabular-nums; font-weight: 650; }
.explorer .sub { font-size: 13px; font-weight: 700; color: var(--muted); margin: 16px 0 4px; }
.explorer .regime { margin-top: 14px; font-size: 14.5px; color: var(--accent-dark); min-height: 2.6em; }
@media (max-width: 640px) { .explorer .row { grid-template-columns: 100px minmax(0, 1fr) 70px; } }

/* research directions */
.directions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.direction { display: flex; flex-direction: column; gap: 16px; padding: 22px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; }
.direction-media { border-radius: 10px; border: 1px solid var(--line-2); background: #fff; aspect-ratio: 16 / 10; display: grid; place-items: center; padding: 10px; overflow: hidden; }
.direction-media img { width: 100%; height: 100%; object-fit: contain; }
.direction.wide { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); align-items: center; gap: 24px; }
.direction.wide .direction-media { aspect-ratio: 3.4 / 1; }
@media (max-width: 860px) { .direction.wide { grid-template-columns: minmax(0, 1fr); } }
.direction h3 { font-family: var(--serif); font-weight: 400; font-size: 26px; line-height: 1.15; }
.direction p { font-size: 15px; color: var(--ink-2); margin-top: 8px; }
@media (max-width: 860px) { .directions { grid-template-columns: minmax(0, 1fr); } }

/* talks */
.talks { margin-top: 56px; }
.talk-list { list-style: none; padding: 0; }
.talk-list li { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line-2); font-size: 15.5px; }
.talk-list span { font-weight: 650; color: var(--accent-dark); font-variant-numeric: tabular-nums; }
.talk-list b { font-weight: 650; }

/* key insight / contribution / evidence */
.insight { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; margin-top: 26px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--card); max-width: 900px; }
.insight > div { padding: 18px 20px; }
.insight > div + div { border-left: 1px solid var(--line-2); }
.insight .label { font-size: 11.5px; font-weight: 750; letter-spacing: .8px; text-transform: uppercase; color: var(--accent); margin-bottom: 6px; }
.insight > div:nth-child(2) .label { color: var(--energy); }
.insight > div:nth-child(3) .label { color: var(--control); }
.insight p { font-size: 14.5px !important; line-height: 1.55; }
@media (max-width: 860px) { .insight { grid-template-columns: minmax(0, 1fr); } .insight > div + div { border-left: 0; border-top: 1px solid var(--line-2); } }

.pipeline { list-style: none; padding: 0 !important; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin: 22px 0 6px !important; max-width: 900px; counter-reset: step; }
.pipeline li { position: relative; margin: 0 !important; padding: 14px 14px 16px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; display: flex; flex-direction: column; gap: 4px; }
.pipeline li::before { counter-increment: step; content: counter(step); font-size: 11px; font-weight: 750; color: var(--accent); }
.pipeline li:not(:last-child)::after { content: "→"; position: absolute; right: -10px; top: 50%; transform: translateY(-50%); color: var(--accent); font-weight: 700; background: var(--paper); line-height: 1; }
.pipeline b { font-size: 14.5px; color: var(--ink); }
.pipeline span { font-size: 12.5px; color: var(--ink-2); line-height: 1.45; }
@media (max-width: 860px) { .pipeline { grid-template-columns: minmax(0, 1fr); } .pipeline li:not(:last-child)::after { content: "↓"; right: 50%; top: auto; bottom: -12px; transform: none; } }

.quote { margin: 40px 0 0; padding: 26px 30px; border-left: 4px solid var(--accent); background: var(--card); border-radius: 0 14px 14px 0; max-width: 860px; }
.quote p { font-family: var(--serif); font-size: 26px; line-height: 1.3; color: var(--ink); }
.quote cite { display: block; margin-top: 12px; font-style: normal; font-size: 13.5px; color: var(--muted); }

.skills { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.skills > div { padding: 20px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
.skills h3 { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.skills p { font-size: 14.5px; color: var(--ink-2); }
.tl time small { font-weight: 500; color: var(--muted); font-size: 12px; }
@media (max-width: 1080px) { .skills { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .skills { grid-template-columns: minmax(0, 1fr); } }

/* ---------------------------------------------------------------- search palette */
.palette { padding: 0; border: 0; background: transparent; width: min(640px, calc(100vw - 32px)); margin-top: 12vh; max-height: 76vh; }
.palette::backdrop { background: #1a1f2659; backdrop-filter: blur(3px); }
.palette-box { background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 30px 80px -20px #10141a66; overflow: hidden; display: flex; flex-direction: column; max-height: 76vh; }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line-2); color: var(--muted); }
.palette-input svg { width: 18px; height: 18px; flex: none; }
.palette-input input { flex: 1; border: 0; outline: 0; background: transparent; font: inherit; font-size: 17px; color: var(--ink); min-width: 0; }
.palette-input input::-webkit-search-cancel-button { display: none; }
.palette-results { list-style: none; margin: 0; padding: 6px; overflow-y: auto; }
.palette-results li a { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 12px; align-items: baseline; padding: 9px 12px; border-radius: 10px; text-decoration: none; color: var(--ink); }
.palette-results li a small { font-size: 11px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--accent); }
.palette-results li a span { font-size: 14.5px; font-weight: 600; line-height: 1.4; }
.palette-results li a em { display: block; font-style: normal; font-weight: 450; font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.palette-results li[aria-selected="true"] a { background: var(--accent-soft); }
.palette-results .empty { padding: 18px 14px; color: var(--muted); font-size: 14px; }
.palette-hint { display: flex; gap: 16px; justify-content: flex-end; padding: 9px 14px; border-top: 1px solid var(--line-2); font-size: 12px; color: var(--muted); }
.palette-hint kbd { margin-right: 3px; }
@media (max-width: 860px) { .search-btn kbd { display: none; } }

/* ---------------------------------------------------------------- dark theme */
:root[data-theme="dark"] {
  --paper: #14181d; --paper-2: #191e24; --card: #1d232a; --ink: #ebe8e2; --ink-2: #c3c8cd; --muted: #98a0a8;
  --line: #313941; --line-2: #262d34; --accent: #b496e6; --accent-dark: #cdb4f4; --accent-soft: #2b2540;
  --energy: #63bdb2; --energy-soft: #1c2f2c; --control: #e2a560; --control-soft: #33291c;
  --shadow: 0 1px 2px #0006, 0 10px 30px -18px #000c;
  color-scheme: dark;
}
:root[data-theme="dark"] .monogram { background: var(--accent-soft); color: var(--accent-dark); }
:root[data-theme="dark"] .btn.primary, :root[data-theme="dark"] .pub-link.primary { background: var(--accent-dark); border-color: var(--accent-dark); color: #1a1530; }
:root[data-theme="dark"] .header-cv { border-color: var(--line); }

:root[data-theme="dark"] .direction-media, :root[data-theme="dark"] .course img { background: #fbfaf7; border-radius: 10px; }
:root[data-theme="dark"] .callout p { color: var(--ink); }
:root[data-theme="dark"] .sponsor-panel { background: #2a1f27; border-color: #4a3343; }
:root[data-theme="dark"] .portrait img { filter: brightness(.94); }
:root[data-theme="dark"] .project-card:hover { border-color: #5b4a7a; }

/* hand-drawn inline diagrams (theme-aware) */
svg.diagram { width: 100%; height: auto; color: var(--ink-2); font-family: var(--sans); }
svg.diagram .d-box { fill: var(--card); stroke: var(--line); stroke-width: 1.5; }
svg.diagram .d-acc { fill: var(--accent-soft); stroke: var(--accent); }
svg.diagram .d-mute { fill: var(--muted); }
svg.diagram .d-acc-t { fill: var(--accent-dark); font-weight: 650; }

:root[data-theme="dark"] .fig .frame:has(svg.diagram) { background: var(--card); }
.approach-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 18px; max-width: 900px; }
.approach { padding: 16px 18px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.approach .label { font-size: 11.5px; font-weight: 750; letter-spacing: .7px; text-transform: uppercase; color: var(--accent); margin-bottom: 6px; }
.approach p { font-size: 14.5px !important; line-height: 1.55; }
.approach:last-child { border-color: var(--accent); }
@media (max-width: 860px) { .approach-grid { grid-template-columns: minmax(0, 1fr); } }

table.method-map td:first-child { white-space: nowrap; }
@media (max-width: 640px) { table.method-map td:first-child { white-space: normal; } }

/* page icons (one family, theme-aware) */
.hero-mark { display: flex; align-items: center; gap: 14px; }
.page-icon { width: 52px; height: 52px; flex: none; display: grid; place-items: center; border-radius: 14px; background: var(--accent-soft); color: var(--accent-dark); }
.page-icon svg { width: 34px; height: 34px; }

/* software: threads and lineage */
.thread { padding-block: 28px 44px; }
.thread + .thread { border-top: 1px solid var(--line-2); padding-top: 52px; }
.thread-head { max-width: 780px; margin-bottom: 22px; }
.thread-num { font-size: 12px; font-weight: 750; letter-spacing: .9px; text-transform: uppercase; color: var(--accent); }
.thread-head h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(30px, 3.4vw, 40px); line-height: 1.1; margin: 6px 0 10px; }
.thread-head p:last-child { color: var(--ink-2); font-size: 16px; }
.lineage { display: grid; grid-template-columns: minmax(0, 1fr) 132px minmax(0, 1fr); align-items: stretch; }
.lineage.three { grid-template-columns: minmax(0, 1fr) 112px minmax(0, 1fr) 112px minmax(0, 1fr); }
.tool { display: flex; flex-direction: column; gap: 8px; padding: 18px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; min-width: 0; }
.tool.key { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tool-media { aspect-ratio: 16 / 10; border-radius: 10px; border: 1px solid var(--line-2); background: #fff; overflow: hidden; display: grid; place-items: center; padding: 8px; margin-bottom: 6px; }
.tool-media img { width: 100%; height: 100%; object-fit: contain; }
.tool-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.tool-head h3 { font-size: 18px; font-weight: 700; letter-spacing: -.2px; }
.tool-head h3 a { text-decoration: none; color: var(--ink); }
.tool-head h3 a:hover { color: var(--accent-dark); }

.tool .role { font-size: 12px; font-weight: 650; color: var(--accent-dark); text-transform: uppercase; letter-spacing: .6px; }
.tool p { font-size: 14.5px; color: var(--ink-2); line-height: 1.55; }
.tool .soft-links { margin-top: auto; padding-top: 6px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.tool .stars { height: 20px; width: auto; margin-left: auto; }
.software-relations { display: grid; grid-template-columns: minmax(0, 1fr) 116px minmax(0, 1fr); grid-template-rows: auto 106px auto; align-items: stretch; max-width: 1040px; margin-inline: auto; }
.relation-portfolio { grid-column: 1; grid-row: 1; }
.relation-bids { grid-column: 3; grid-row: 1; }
.relation-diff { grid-column: 1 / -1; grid-row: 3; width: calc((100% - 116px) / 2); justify-self: center; align-self: start; padding: 13px; }
.relation-diff .tool-media { aspect-ratio: 2.5 / 1; padding: 4px; margin-bottom: 2px; }
.relation-diff .tool-head { display: block; }
.relation-diff .tool-head .stars { margin: 5px 0 0; }
.relation-diff .role { margin-top: 3px; }
.relation-diff p { font-size: 13px; }
.relation-diff .soft-links { padding-top: 0; }
.relation-arrow { position: relative; display: flex; align-items: center; justify-content: center; padding: 0 10px; }
.relation-right { grid-column: 2; grid-row: 1; }
.relation-right::before { content: ""; position: absolute; left: 8px; right: 14px; top: 50%; border-top: 1.5px dashed var(--accent); opacity: .7; }
.relation-right::after { content: ""; position: absolute; right: 8px; top: calc(50% - 5px); border-left: 9px solid var(--accent); border-top: 5px solid transparent; border-bottom: 5px solid transparent; }
.relation-up::before { content: ""; position: absolute; top: 14px; bottom: 8px; left: 50%; border-left: 1.5px dashed var(--accent); opacity: .7; }
.relation-up::after { content: ""; position: absolute; top: 6px; left: calc(50% - 5px); border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 9px solid var(--accent); }
.relation-diff-portfolio { grid-column: 1; grid-row: 2; }
.relation-diff-bids { grid-column: 3; grid-row: 2; }
.relation-arrow span { position: relative; z-index: 1; background: var(--paper); padding: 3px 6px; font-size: 11px; line-height: 1.35; color: var(--accent-dark); text-align: center; font-weight: 600; }
.relation-up span { align-self: center; margin: 26px 0 0; max-width: 22ch; }
.link-arrow { position: relative; display: flex; align-items: center; justify-content: center; padding: 0 10px; }
.link-arrow::before { content: ""; position: absolute; left: 8px; right: 14px; top: 50%; border-top: 1.5px dashed var(--accent); opacity: .7; }
.link-arrow::after { content: ""; position: absolute; right: 8px; top: calc(50% - 5px); border-left: 9px solid var(--accent); border-top: 5px solid transparent; border-bottom: 5px solid transparent; }
.link-arrow span { position: relative; background: var(--paper); padding: 4px 6px; font-size: 12px; line-height: 1.35; color: var(--accent-dark); text-align: center; font-weight: 600; margin-bottom: 44px; }
.tool.org { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 26px; }
.org-media { display: grid; gap: 12px; }
.org-media figure { margin: 0; }
.org-media figcaption { font-size: 12.5px; color: var(--muted); margin-top: -2px; }
.org-list { list-style: none; padding: 0; margin: 6px 0 0; display: grid; gap: 6px; font-size: 14.5px; color: var(--ink-2); }
.org-list li { padding-left: 14px; position: relative; }
.org-list li::before { content: ""; position: absolute; left: 0; top: .6em; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.also { color: var(--muted); font-size: 14.5px; }
:root[data-theme="dark"] .tool-media { background: #fbfaf7; }
@media (max-width: 960px) {
  .lineage, .lineage.three { grid-template-columns: minmax(0, 1fr); }
  .link-arrow { min-height: 64px; }
  .link-arrow::before { left: 50%; right: auto; top: 6px; bottom: 14px; border-top: 0; border-left: 1.5px dashed var(--accent); }
  .link-arrow::after { left: calc(50% - 4px); right: auto; top: auto; bottom: 6px; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 9px solid var(--accent); border-bottom: 0; }
  .link-arrow span { margin: 0 0 0 0; background: var(--paper); }
  .tool.org { grid-template-columns: minmax(0, 1fr); }
  .software-relations { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; max-width: 640px; }
  .relation-portfolio, .relation-bids, .relation-diff, .relation-right, .relation-diff-portfolio, .relation-diff-bids { grid-column: auto; grid-row: auto; }
  .relation-diff { width: auto; padding: 18px; }
  .relation-diff .tool-media { width: 100%; max-width: none; aspect-ratio: 2.5 / 1; }
  .relation-arrow { min-height: 64px; }
  .relation-arrow::before { left: 50%; right: auto; top: 6px; bottom: 14px; border-top: 0; border-left: 1.5px dashed var(--accent); }
  .relation-arrow::after { left: calc(50% - 4px); right: auto; top: auto; bottom: 6px; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 9px solid var(--accent); border-bottom: 0; }
  .relation-arrow span, .relation-up span { align-self: center; margin: 0; background: var(--paper); }
}

/* thesis diagram ↔ text highlighting (subtle) */
.thesis-block [data-key]:not(.hot) { border-radius: 4px; transition: background-color .15s, box-shadow .15s; }
.thesis-block strong[data-key].is-lit, .thesis span[data-key].is-lit { background: var(--accent-soft); box-shadow: 0 0 0 3px var(--accent-soft); color: var(--accent-dark); }
.thesis-block li[data-key] { padding: 4px 8px; margin-left: -8px; }
.thesis-block li[data-key].is-lit { background: var(--accent-soft); }

.talk-list li.plain-row { grid-template-columns: minmax(0, 1fr); }
/* italic overhang: keep italics from touching the next upright glyph */
em, i { padding-right: .06em; }
.hero .tagline em, .proj-hero em, .quote em { padding-right: .1em; }

/* project groups */

.group-label { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; font-size: 12px; font-weight: 750; letter-spacing: .9px; text-transform: uppercase; color: var(--ink-2); margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.group-label span { text-transform: none; letter-spacing: 0; font-weight: 500; font-size: 14px; color: var(--muted); }
.project-card.featured { grid-column: 1 / -1; }
.project-card.featured .card-media { flex: 1.35; }
.project-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.project-grid.four .card-body h3 { font-size: 22px; }
.project-grid.four .card-summary { font-size: 14px; }
.card-role { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 650; color: var(--accent-dark); }
.card-role::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--accent); }

@media (max-width: 1080px) { .project-grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .project-grid.four { grid-template-columns: minmax(0, 1fr); } }

/* ---- QA fixes ---- */
/* software lineage: label above the arrow, nothing covering the line */
.link-arrow span { position: absolute; left: 4px; right: 4px; bottom: calc(50% + 8px); margin: 0; background: none; padding: 0; font-size: 12px; }
.tool .stars { margin-left: 0; height: 20px; flex: none; }
.tool-head { align-items: center; }
.tool.org { display: flex; flex-direction: column; gap: 14px; }
.tool.org .org-media { order: 2; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 960px) {
  .link-arrow span { position: relative; left: auto; right: auto; bottom: auto; background: var(--paper); padding: 2px 6px; }
  .tool.org .org-media { grid-template-columns: minmax(0, 1fr); }
}
/* spacing after figures, lists and tables before body text */
.proj-body figure + p, .proj-body .fig-row + p, .proj-body ol + p, .proj-body .table-scroll + p, .proj-body .stats + p, .proj-body .approach-grid + p { margin-top: 1.1em; }
.proj-body > section > figure.fig + p { margin-top: 1.4em; }
/* mobile: nav hint, equations, tables */
@media (max-width: 860px) {
  .site-nav { -webkit-mask-image: linear-gradient(to right, #000 85%, transparent); mask-image: linear-gradient(to right, #000 85%, transparent); padding-right: 28px; }
  .eq { font-size: 13px; padding: 12px 12px; }
  .eq .katex-display { margin: 0; overflow-x: auto; overflow-y: hidden; padding-bottom: 4px; }
}
.table-note { font-size: 13px; color: var(--muted); margin-top: 8px !important; max-width: 820px; }
/* dark mode: dim the white panels behind figures */
:root[data-theme="dark"] .fig .frame, :root[data-theme="dark"] .card-media, :root[data-theme="dark"] .project-card.featured .card-media, :root[data-theme="dark"] .pub-thumb, :root[data-theme="dark"] .tool-media, :root[data-theme="dark"] .direction-media { background: #e9e7e1; }
:root[data-theme="dark"] .fig .frame:has(svg.diagram) { background: var(--card); }
/* wide images in direction cards */
.direction-media.wide { aspect-ratio: auto; padding: 10px; }

/* lightbox */
.zoomable { cursor: zoom-in; }
dialog.lightbox { border: 0; padding: 0; background: transparent; max-width: 96vw; max-height: 94vh; }
dialog.lightbox::backdrop { background: #10141ae6; }
dialog.lightbox img { max-width: 94vw; max-height: 86vh; width: auto; height: auto; background: #fff; border-radius: 10px; padding: 14px; display: block; cursor: zoom-out; }
dialog.lightbox p { color: #e8e6f0; font-size: 13.5px; max-width: 900px; margin: 10px auto 0; text-align: center; }
/* publication thumbnail placeholder */
.pub-thumb.placeholder { display: grid; place-items: center; background: var(--paper-2); color: var(--muted); }
.pub-thumb.placeholder svg { width: 40px; height: 40px; }
.fig-row.single { grid-template-columns: minmax(0, 1fr); max-width: 640px; }
.map-split { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 18px; margin-top: 28px; align-items: start; }
.map-split .fig { margin-top: 0; }
@media (max-width: 860px) { .map-split { grid-template-columns: minmax(0, 1fr); } }
.teaching-photo .frame img { aspect-ratio: 16 / 9; object-fit: cover; object-position: center 40%; width: 100%; }
/* home: research text in two columns above a full-width diagram */

/* card thumbnails: show the whole figure */
.card-media { background: #fff; display: grid; place-items: center; padding: 10px; }
.card-media img, .card-media picture { width: 100%; height: 100%; object-fit: contain; }
.hero .tagline em { padding-right: .03em; }

/* ================= typographic system (consolidated; overrides above) ================= */
/* five serif steps */
.hero h1 { font-size: clamp(56px, 7vw, 88px); }
.page-hero h1, .proj-hero h1 { font-size: clamp(40px, 5vw, 64px); line-height: 1.04; }
.section-head h2, .proj-body h2, .thread-head h2, #map-title { font-family: var(--serif); font-weight: 400; font-size: clamp(32px, 3.4vw, 44px); line-height: 1.08; letter-spacing: -.5px; }
#map-title { margin-bottom: 16px; }
.year-label, .course h3, .sponsor-panel h3, .project-card.featured h3 { font-size: 32px; line-height: 1.1; }
.card-body h3, .direction h3, .footer-name, .quote p { font-size: 24px; line-height: 1.15; }
.project-grid.four .card-body h3 { font-size: 21px; }
/* one label style, one kicker style */
.eyebrow, .insight .label, .approach .label, .plain .label, .card-venue, .toc p, .footer-label, table.data th, .group-label, .sub, .explorer .sub { font-size: 11.5px !important; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.section-head .kicker, .proj-body h2 .num, .thread-num { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.explorer .sub { text-transform: none; letter-spacing: 0; font-size: 13px !important; }
/* ledes */
.section-head .lede, .page-hero .lede, .proj-hero .lede { font-size: 18px; line-height: 1.6; }
/* balanced headings, no orphans */
h1, h2, h3, .pub-title, .card-body h3 { text-wrap: balance; }
p, li { text-wrap: pretty; }
.eyebrow { flex-wrap: nowrap; align-items: baseline; }
.eyebrow .dot { flex: none; align-self: center; }

/* one measure for prose, full column for every box */
.proj-body p, .proj-body li { max-width: 72ch; }
.proj-body .plain, .proj-body .callout, .proj-body .eq, .proj-body .code, .proj-body table.data, .proj-body .table-scroll, .proj-body .explorer, .proj-body .insight, .proj-body .approach-grid, .proj-body .pipeline, .proj-body .stats, .quote { max-width: none; }
.proj-body .plain p, .proj-body .callout p, .proj-body .insight p, .proj-body .approach p, .proj-body .stat p { max-width: none; }

/* paper cards inside project pages keep their own sizes */
.proj-body .pub-list :is(p, li, h3) { font-size: revert; max-width: none; margin-top: revert; }
.proj-body .pub-list .pub-meta { font-size: 13px; }
.proj-body .pub-list .pub-title { font-size: 17.5px; margin-top: 6px; }
.proj-body .pub-list .pub-authors { font-size: 14.5px; margin-top: 4px; }
.proj-body .pub-list .pub-note { font-size: 13.5px; margin-top: 6px; }
.proj-body p + .pub-list, .proj-body h2 + .pub-list { margin-top: 20px; }
.pub-links .pub-link:not(.primary) { color: var(--ink-2); text-decoration: none; }

/* project hero separated from body */
.proj-hero { padding-block: 56px 40px; border-bottom: 1px solid var(--line-2); margin-bottom: 48px; }
.proj-layout { padding-top: 0; }

/* four-column related cards: tidy */
.project-grid.four .tags { display: none; }

/* figures side by side share a height */
.fig-row { align-items: stretch; }
.fig-row .fig { display: flex; flex-direction: column; }
.fig-row .fig .frame { flex: 1; display: grid; place-items: center; }
.fig-row .fig .frame img { max-height: 520px; width: auto; max-width: 100%; }
.fig.inset { max-width: 600px; }

.fig figcaption, .org-media figcaption { margin-top: 10px; }
.direction-media { aspect-ratio: 16 / 9; }

/* research overview split only on wide screens */
.thesis-block.split { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1081px) { .thesis-block.split { grid-template-columns: minmax(0, .62fr) minmax(0, 1.38fr); } }

/* tables */
table.data { border-collapse: separate; border-spacing: 0; }
table.data tr:last-child td { border-bottom: 0; }
table.data th.n { text-align: right; }
table.data.blocks td:first-child { width: 22%; white-space: nowrap; font-weight: 650; }

/* experience timeline measure */
.tl p, .tl ul { max-width: 72ch; }

/* sponsor panel: neutral, accent rule */
.sponsor-panel { background: var(--paper-2); border: 1px solid var(--line); border-left: 4px solid var(--accent); }
:root[data-theme="dark"] .sponsor-panel { background: var(--card); border-color: var(--line); border-left-color: var(--accent); }

/* thread separators and footer rule align with content */
.thread + .thread { border-top: 0; }
.thread + .thread::before { content: ""; display: block; border-top: 1px solid var(--line-2); margin-bottom: 52px; }
.footer-bottom { border-top: 0; }
.footer-bottom-inner { display: flex; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); padding-top: 16px; width: 100%; }

/* home news / software balance */
.news-wrap { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
@media (max-width: 860px) { .news-wrap { grid-template-columns: minmax(0, 1fr); } }

/* software lineage stacks earlier */
@media (max-width: 1180px) {
  .lineage, .lineage.three { grid-template-columns: minmax(0, 1fr); max-width: 640px; }
  .link-arrow { min-height: 64px; }
  .link-arrow::before { left: 50%; right: auto; top: 6px; bottom: 14px; border-top: 0; border-left: 1.5px dashed var(--accent); }
  .link-arrow::after { left: calc(50% - 4px); right: auto; top: auto; bottom: 6px; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 9px solid var(--accent); border-bottom: 0; }
  .link-arrow span { position: relative; left: auto; right: auto; bottom: auto; background: var(--paper); padding: 2px 8px; text-align: center; }
}

/* mobile: buttons in two columns, small portrait beside the name */
@media (max-width: 640px) {
  .btn-row .btn { flex: 1 1 calc(50% - 5px); justify-content: center; }
  .hero-grid .portrait { order: -1; grid-template-columns: 96px minmax(0, 1fr); max-width: none; display: grid; gap: 14px; }
  .hero-grid .portrait img { border-radius: 14px; }

}
.fig-row.stacked-pair { grid-template-columns: minmax(0, 1fr); max-width: 760px; }
table.data.method-map { max-width: none; } .course p { max-width: 70ch; }
.proj-body .table-note { font-size: 13px; color: var(--muted); }

/* project groups v2 */
.project-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }

@media (max-width: 640px) { .project-grid.two { grid-template-columns: minmax(0, 1fr); } }

/* the arc: a numbered sequence of short steps */

.subline { font-size: 17px; color: var(--ink-2); margin-top: 12px; max-width: 700px; }
.overview-section { padding-block: 56px; border-top: 1px solid var(--line-2); }
.overview-section .prose p { font-size: 16.5px; color: var(--ink-2); }

.applications { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin-top: 10px; }
.applications li { font-size: 13.5px; padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); color: var(--ink-2); }
.program-note, .proj-body p.program-note { font-size: 15px; color: var(--muted); border-left: 3px solid var(--accent); padding: 2px 0 2px 14px; margin-bottom: 18px !important; max-width: 72ch; }

/* ---------------------------------------------------------------- research areas */
:root { --sky: #3a6aa0; --sky-soft: #e4ecf5; }
:root[data-theme="dark"] { --sky: #8db3df; --sky-soft: #1d2834; }
.area-optimize { --area: var(--accent); }
.area-diff { --area: var(--energy); }
.area-policy { --area: var(--control); }
.area-uncertainty { --area: var(--sky); }

.area { padding: 26px 32px 28px 0; border-bottom: 1px solid var(--line-2); display: flex; flex-direction: column; }
.area:nth-child(2n) { padding: 26px 0 28px 32px; border-left: 1px solid var(--line-2); }
.area h3 { font-family: var(--serif); font-weight: 400; font-size: 30px; line-height: 1.1; display: flex; align-items: center; gap: 12px; }
.area h3::before { content: ""; flex: none; width: 10px; height: 10px; border-radius: 3px; background: var(--area); }
.area p { font-size: 15.5px; line-height: 1.62; color: var(--ink-2); margin-top: 10px; }

@media (max-width: 860px) {

  .area, .area:nth-child(2n) { padding: 22px 0; border-left: 0; }
}
.area-kicker { display: inline-flex; align-items: center; gap: 8px; color: var(--area) !important; }
.area-kicker::before { content: ""; width: 9px; height: 9px; border-radius: 3px; background: var(--area); }

.card-role.area-optimize, .card-role.area-diff, .card-role.area-policy, .card-role.area-uncertainty, .card-role.area-value { color: var(--area); }
.card-role.area-optimize::before, .card-role.area-diff::before, .card-role.area-policy::before, .card-role.area-uncertainty::before, .card-role.area-value::before { background: var(--area); border-radius: 2px; }
.project-grid.more { margin-top: 22px; }

.research-focus { padding-block: 82px; }
.research-focus-grid { display: grid; grid-template-columns: minmax(0, .94fr) minmax(390px, 1.06fr); gap: clamp(32px, 5vw, 68px); align-items: center; }
.research-focus-grid .prose { max-width: none; }
.research-focus-grid .prose p { font-size: 16.5px; color: var(--ink-2); }

/* The research-page figures are deliberately diagrams, not cards: the quiet
   background preserves the shared structure while the coloured computation is
   readable at a glance in either theme. */

@media (max-width: 960px) { .research-focus-grid { grid-template-columns: minmax(0, 1fr); } }

.subline p + p { margin-top: 10px; }

/* ================= decision-process diagrams (src/_partials/diagrams, tools/make_diagrams.js) =================
   One structure everywhere; a section highlights its computation by listing parts in
   {{diagram:stage focus=...}}. Faded parts stay legible: opacity only, never blur, and the
   rules below select SVG classes only, so they cannot reach KaTeX markup in the page. */
:root { --rose: #a14c62; --rose-soft: #f6e8ec; }
:root[data-theme="dark"] { --rose: #e49aab; --rose-soft: #35232a; }
.dg-figure { margin: 0; }
.dg-wrap { padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); }
.section.alt .dg-wrap { background: var(--card); }
.dg { display: block; width: 100%; height: auto; font-family: var(--sans); overflow: visible; }
.dg-wrap .dg-stack { display: none; }
@media (max-width: 600px) {
  .dg-wrap { padding: 8px; }
  .dg-wrap .dg-grid { display: none; }
  .dg-wrap .dg-stack { display: block; max-width: 420px; margin-inline: auto; }
}
.dg-box > rect:first-child { fill: var(--card); stroke: var(--c, var(--line)); stroke-width: 1.3; }
.section.alt .dg-box > rect:first-child { fill: var(--paper); }

.dg-box[data-part="info"] { --c: var(--sky); }
.dg-box[data-part="value"] { --c: var(--rose); }
.dg-box[data-part="state"], .dg-box[data-part="map"] { --c: var(--control); }
.dg-box[data-part="recourse"], .dg-box[data-part="opt"] { --c: var(--accent); }
.dg-box[data-part="duals"], .dg-box[data-part="sens"] { --c: var(--energy); }
.dg-box[data-part="evals"] { --c: var(--ink-2); }
.dg-title { font-size: 14px; font-weight: 650; fill: var(--ink); letter-spacing: -.01em; }
.dg-cap { font-size: 11.5px; fill: var(--muted); }
.dg-math { color: var(--ink); }
.dg-chip { fill: var(--paper-2); stroke: var(--line); stroke-width: 1; }
.section.alt .dg-chip { fill: var(--card); }
.dg-chip-t { font-size: 12px; fill: var(--ink-2); }
.dg-line { fill: none; stroke: var(--muted); stroke-width: 1.4; stroke-linejoin: round; }
.dg-edge.dashed .dg-line { stroke-dasharray: 5 4; }
.dg-head { fill: var(--muted); }
.dg-math.dg-lab { color: var(--ink-2); }
.dg-elab { font-size: 12px; fill: var(--ink-2); }
/* highlighting */
.dg-wrap.has-focus [data-part] { opacity: .36; }
:root[data-theme="dark"] .dg-wrap.has-focus [data-part] { opacity: .4; }
.dg-focus-info [data-part~="info"], .dg-focus-value [data-part~="value"], .dg-focus-state [data-part~="state"], .dg-focus-recourse [data-part~="recourse"], .dg-focus-duals [data-part~="duals"], .dg-focus-sens [data-part~="sens"], .dg-focus-map [data-part~="map"], .dg-focus-opt [data-part~="opt"], .dg-focus-evals [data-part~="evals"] { opacity: 1 !important; }
.dg-focus-info .dg-box[data-part="info"] > rect:first-child, .dg-focus-value .dg-box[data-part="value"] > rect:first-child, .dg-focus-state .dg-box[data-part="state"] > rect:first-child, .dg-focus-recourse .dg-box[data-part="recourse"] > rect:first-child, .dg-focus-duals .dg-box[data-part="duals"] > rect:first-child, .dg-focus-sens .dg-box[data-part="sens"] > rect:first-child, .dg-focus-map .dg-box[data-part="map"] > rect:first-child, .dg-focus-opt .dg-box[data-part="opt"] > rect:first-child, .dg-focus-evals .dg-box[data-part="evals"] > rect:first-child { fill: color-mix(in srgb, var(--c) 9%, var(--card)); stroke-width: 2; }
.dg-focus-info .dg-edge[data-part~="info"] .dg-line, .dg-focus-value .dg-edge[data-part~="value"] .dg-line, .dg-focus-state .dg-edge[data-part~="state"] .dg-line, .dg-focus-recourse .dg-edge[data-part~="recourse"] .dg-line, .dg-focus-duals .dg-edge[data-part~="duals"] .dg-line, .dg-focus-sens .dg-edge[data-part~="sens"] .dg-line, .dg-focus-map .dg-edge[data-part~="map"] .dg-line, .dg-focus-opt .dg-edge[data-part~="opt"] .dg-line, .dg-focus-evals .dg-edge[data-part~="evals"] .dg-line { stroke: var(--ink-2); stroke-width: 1.6; }
.dg-focus-info .dg-edge[data-part~="info"] .dg-head, .dg-focus-value .dg-edge[data-part~="value"] .dg-head, .dg-focus-state .dg-edge[data-part~="state"] .dg-head, .dg-focus-recourse .dg-edge[data-part~="recourse"] .dg-head, .dg-focus-duals .dg-edge[data-part~="duals"] .dg-head, .dg-focus-sens .dg-edge[data-part~="sens"] .dg-head, .dg-focus-map .dg-edge[data-part~="map"] .dg-head, .dg-focus-opt .dg-edge[data-part~="opt"] .dg-head, .dg-focus-evals .dg-edge[data-part~="evals"] .dg-head { fill: var(--ink-2); }
.dg-figure figcaption { max-width: 70ch; margin-top: 11px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.dg-figure figcaption b { color: var(--ink-2); }
.dg-tab { fill: none; stroke: var(--c, var(--line)); stroke-width: 3.5; stroke-linecap: round; }

/* ================= research overview (framework page) ================= */
.area-value { --area: var(--rose); }
.research-framing { border-top: 0; padding-block: 24px 80px; }
.framing-grid { display: grid; grid-template-columns: minmax(0, .58fr) minmax(0, 1.42fr); gap: 24px 56px; align-items: start; }
.framing-grid h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(32px, 3.4vw, 44px); line-height: 1.08; letter-spacing: -.5px; text-wrap: balance; }
.framing-grid .prose { max-width: 760px; }
.research-focus-grid { grid-template-columns: minmax(0, 1fr) minmax(400px, 560px); align-items: start; }
.research-focus-grid > .dg-figure { position: sticky; top: 96px; }
.research-focus-grid .prose .eq { margin: 16px 0; }
.diagram-progression { display: grid; gap: 14px; }
.diagram-progression-arrow { display: grid; justify-items: center; gap: 2px; color: var(--muted); }
.diagram-progression-arrow span { color: var(--accent-dark); font-size: 28px; line-height: .9; }
.diagram-progression-arrow small { font-size: 11.5px; font-weight: 650; letter-spacing: .2px; text-align: center; }
.through-figure { max-width: 940px; margin: 48px auto 0; }
.through-figure figcaption { margin-inline: auto; }
.terms { margin: 1.1em 0 1.2em; display: grid; gap: 0; border-bottom: 1px solid var(--line-2); }
.terms > div { display: grid; grid-template-columns: 148px minmax(0, 1fr); gap: 16px; padding: 11px 0; border-top: 1px solid var(--line-2); }
.terms dt { font-weight: 650; color: var(--ink); font-size: 15px; line-height: 1.5; }
.terms dd { margin: 0; color: var(--ink-2); font-size: 15.5px; line-height: 1.6; }
@media (max-width: 1080px) {
  .research-focus-grid { grid-template-columns: minmax(0, 1fr); }
  .research-focus-grid > .dg-figure { position: static; width: 100%; max-width: 600px; margin-inline: auto; }
}
@media (max-width: 960px) { .framing-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) { .terms > div { grid-template-columns: minmax(0, 1fr); gap: 2px; } }

/* ================= home: research objects × settings graph ================= */
.ro-graph { width: min(1120px, 100%); margin: 48px auto 0; padding: 22px 26px 18px; border: 1px solid var(--line); border-radius: 18px; background: var(--card); box-shadow: var(--shadow); }
.ro-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; padding-bottom: 14px; border-bottom: 1px solid var(--line-2); }
.ro-title { font-family: var(--serif); font-size: 24px; line-height: 1.15; color: var(--ink-2); }
.ro-title a { color: var(--ink); text-decoration: none; }
.ro-title a:hover { color: var(--accent-dark); text-decoration: underline; text-decoration-thickness: 1px; }
.ro-legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--muted); }
.ro-key { display: inline-flex; align-items: center; gap: 7px; }
.ro-key::before { content: ""; width: 11px; height: 11px; border-radius: 50%; box-sizing: border-box; background: var(--ink-2); }
.ro-key.ongoing::before { background: transparent; border: 2px solid var(--ink-2); }
.ro-grid { display: grid; grid-template-columns: 196px repeat(3, minmax(0, 1fr)); margin-top: 18px; }
.ro-grid .ro-app { margin: 0 9px 4px; }
.ro-app { display: block; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); color: var(--ink); text-decoration: none; transition: border-color .15s, box-shadow .15s; }
.ro-app:hover { border-color: var(--accent); box-shadow: var(--shadow); color: var(--ink); }
.ro-app img { display: block; width: 100%; height: 132px; object-fit: cover; }
.app-markets img { object-position: 62% center; } .app-robotics img { object-position: 30% center; }
.ro-app span { display: block; padding: 8px 12px 10px; font-family: var(--serif); font-size: 21px; line-height: 1.1; }
.ro-obj { position: relative; z-index: 1; align-self: start; display: flex; flex-direction: column; gap: 2px; margin: 13px 12px 0 0; padding: 2px 0 2px 13px; border-left: 3px solid var(--area); color: var(--ink); text-decoration: none; }
.ro-obj b { font-size: 14.5px; font-weight: 650; line-height: 1.3; }
.ro-obj span { font-size: 12.5px; color: var(--muted); line-height: 1.35; }
.ro-obj:hover b { color: var(--accent-dark); }
.ro-cell { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; min-height: 78px; padding: 19px 8px 12px; }
.ro-cell::before { content: ""; position: absolute; left: 0; right: 0; top: 26px; height: 2px; background: var(--area); opacity: .5; }
.ro-cell::after { content: ""; position: absolute; z-index: 0; top: 0; bottom: 0; left: 50%; width: 1px; background: var(--line); }
.ro-grid > .ro-cell:nth-child(4n) { margin-right: 0; }
.ro-node { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; max-width: 220px; color: var(--ink-2); text-align: center; text-decoration: none; }
.ro-node::before { content: ""; flex: none; box-sizing: border-box; width: 16px; height: 16px; border-radius: 50%; background: var(--area); border: 3px solid var(--card); box-shadow: 0 0 0 1.5px var(--area); }
.ro-node.ongoing::before { background: var(--card); border: 2.5px solid var(--area); box-shadow: 0 0 0 2px var(--card); }
.ro-node span { padding: 1px 6px; border-radius: 6px; background: var(--card); font-size: 13px; line-height: 1.32; text-wrap: balance; }
.ro-node:hover span { color: var(--accent-dark); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.ro-node + .ro-node { margin-top: 2px; }
.ro-graph figcaption { margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--line-2); color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.ro-list { display: none; }
@media (max-width: 760px) {
  .ro-graph { padding: 16px; margin-top: 36px; }
  .ro-grid { display: none; }
  .ro-list { display: grid; gap: 14px; margin-top: 14px; }
  .ro-app-card { border: 1px solid var(--line-2); border-radius: 14px; padding: 8px; background: var(--paper); }
  .ro-app-card .ro-app img { height: 150px; }
  .ro-app-card ul { list-style: none; margin: 10px 4px 4px; padding: 0; display: grid; gap: 8px; }
  .ro-app-card .ro-node { flex-direction: row; align-items: flex-start; gap: 10px; max-width: none; text-align: left; }
  .ro-app-card .ro-node::before { margin-top: 3px; }
  .ro-app-card .ro-node b { display: block; font-size: 12px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--area); }
  .ro-app-card .ro-node span { padding: 0; background: none; font-size: 14.5px; color: var(--ink-2); }
  .ro-app-card .ro-node > :is(b, span) { display: block; }
  .ro-app-card li > a { display: grid; grid-template-columns: 16px minmax(0, 1fr); column-gap: 10px; }
  .ro-app-card li > a::before { grid-row: 1 / span 2; }
}

/* ================= home: research overview rows ================= */
.areas-list { border-top: 1px solid var(--line); margin-bottom: 52px; }
.area-row { display: grid; grid-template-columns: minmax(0, .38fr) minmax(0, 1fr); gap: 12px 48px; padding: 28px 0 30px; border-bottom: 1px solid var(--line-2); }
.area-row h3 { font-family: var(--serif); font-weight: 400; font-size: 29px; line-height: 1.12; display: flex; align-items: baseline; gap: 12px; }
.area-row h3::before { content: ""; flex: none; width: 10px; height: 10px; border-radius: 3px; background: var(--area); transform: translateY(-3px); }
.area-row h3 a { color: var(--ink); text-decoration: none; }
.area-row h3 a:hover { color: var(--accent-dark); }
.area-row p { font-size: 16px; line-height: 1.65; color: var(--ink-2); max-width: 74ch; }
.area-row p strong { color: var(--ink); }
@media (max-width: 860px) { .area-row { grid-template-columns: minmax(0, 1fr); padding: 22px 0 24px; } .area-row h3 { font-size: 26px; } }
@media (max-width: 640px) {
  .hero-cover figcaption { position: static; max-width: none; padding: 8px 12px 9px; border-radius: 0; background: var(--card); white-space: normal; overflow: visible; text-overflow: clip; border-top: 1px solid var(--line-2); }
}

/* ================= experience: concurrent appointments as a branch graph ================= */

/* ================= software: thread labels and the DiffOpt card ================= */
.thread-num a { color: inherit; text-decoration: none; }
.thread-num a:hover { text-decoration: underline; text-decoration-thickness: 1px; }
.relation-stacked { display: none; }
@media (min-width: 961px) {
  .software-relations { max-width: 1060px; grid-template-columns: minmax(0, 1fr) 140px minmax(0, 1fr); grid-template-rows: auto 96px auto; }
  .relation-diff { grid-column: 1 / -1; width: auto; justify-self: stretch; padding: 18px; }
}
@media (max-width: 960px) {
  .relation-diff-portfolio, .relation-diff-bids { display: none; }
  .relation-stacked { display: flex; }
  .relation-diff { padding: 18px; }
}
.relation-diff-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 24px; align-items: center; }
.relation-diff .dg-wrap { padding: 10px; }
.relation-diff p { font-size: 14.5px; }
.relation-diff .soft-links { padding-top: 10px; }
.relation-diff .tool-head { display: flex; }
.relation-diff .tool-head .stars { margin: 0; }
.relation-right span { max-width: 15ch; margin-bottom: 44px; }
.relation-right::before { right: 16px; }
@media (max-width: 1080px) { .relation-diff-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 960px) { .relation-right span { margin-bottom: 0; max-width: none; } }
.relation-diff-grid { grid-template-columns: minmax(0, 1fr); justify-items: center; gap: 16px; }
.relation-diff-grid > .dg-figure { width: 100%; max-width: 780px; }
.relation-diff-grid > div { width: 100%; max-width: 780px; }
.relation-right span { position: absolute; left: 6px; right: 6px; bottom: calc(50% + 10px); max-width: none; margin: 0; padding: 0; background: none; }
@media (max-width: 960px) { .relation-right span { position: relative; left: auto; right: auto; bottom: auto; background: var(--paper); padding: 2px 6px; } }
.relation-stacked span { max-width: 44ch; }

/* ================= project pages: shared adjustments ================= */
:root[data-theme="dark"] .fig .frame img { mix-blend-mode: multiply; }
.proj-body ul + p { margin-top: 1.1em; }
.proj-body .dg-figure { max-width: 660px; }
.proj-body .dg-figure.wide { max-width: 940px; }
.proj-body .fig.dg-figure { margin-top: 28px; }
.proj-body p + .plain { margin-top: 22px; }
.proj-body table.data td { vertical-align: top; }
.proj-body .insight + p { margin-top: 1.1em; }
/* tables that become labelled rows on phones */
@media (max-width: 640px) {
  table.stack-table, table.stack-table tbody, table.stack-table tr, table.stack-table td { display: block; width: 100% !important; }
  table.stack-table thead, table.stack-table colgroup { display: none; }
  table.stack-table tr { padding: 12px 14px; border-bottom: 1px solid var(--line-2); }
  table.stack-table tr:last-child { border-bottom: 0; }
  table.stack-table td { padding: 3px 0; border: 0; }
  table.stack-table td:first-child { font-size: 15.5px; padding-bottom: 6px; }
  table.stack-table td[data-label]:not(:first-child)::before { content: attr(data-label); display: block; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-top: 6px; }
}
@media (max-width: 640px) { table.stack-table tr.hl { background: var(--accent-soft); } }
.proj-body .dg-figure:has(.dg-through-wrap) { max-width: 900px; }
.page-icon .ic-fill { fill: var(--card); }
:root[data-theme="dark"] :is(.card-media, .tool-media, .pub-thumb) img { mix-blend-mode: multiply; }
.section-head .see-all { justify-self: start; }
@media (min-width: 861px) { .section-head .see-all { justify-self: end; } }
/* figure legends written in captions */
.data .cell-note { display: block; margin-top: 4px; color: var(--muted); }
.lg { white-space: nowrap; color: var(--ink-2); }
.lg::before { content: ""; display: inline-block; width: 14px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; background: var(--lgc); }
.lg-green { --lgc: #3d9a4a; } .lg-orange { --lgc: #d0643a; } .lg-blue { --lgc: #2f8fd8; }
.lg-slate { --lgc: #34404b; } .lg-purple { --lgc: #7551a7; } .lg-amber { --lgc: #c2631c; }
:root[data-theme="dark"] .lg-slate { --lgc: #98a0a8; }

/* home: graph title, settings line, shorter cover */
.ro-graph > .ro-title { padding-bottom: 14px; border-bottom: 1px solid var(--line-2); }
.area-row .area-settings { margin-top: 10px; font-size: 13px; color: var(--muted); }
.area-row .area-settings::first-letter { text-transform: uppercase; }
.hero-cover img { aspect-ratio: 3.4 / 1; object-position: center 46%; }
@media (max-width: 640px) { .hero-cover img { aspect-ratio: 2.4 / 1; } }
.ro-app.app-markets img { object-position: 40% center; }
table.data th[colspan] { text-align: center; }
/* graph nodes: problem + what is learned */
.ro-grid .ro-node span b { display: block; font-weight: 650; color: var(--ink); font-size: 13.5px; }
.ro-grid .ro-node span i { display: block; font-style: normal; color: var(--muted); font-size: 12px; line-height: 1.35; margin-top: 1px; }
.ro-grid .ro-node span { max-width: 210px; }
.ro-app-card .ro-node b { letter-spacing: 0; text-transform: none; font-size: 14.5px; color: var(--ink); }
.ro-app-card .ro-node span { font-size: 13.5px; color: var(--muted); }
.ro-app-card li > a::before { background: var(--area); }
/* home: thread figures, topic line, slimmer cover */
.area-row .area-fig { margin: 18px 0 0; max-width: 680px; }
.area-row .area-fig .frame { border: 1px solid var(--line); border-radius: 12px; background: #fff; padding: 10px; overflow: hidden; }
.area-row .area-fig .frame.flush { padding: 0; }
.area-row .area-fig img { display: block; width: 100%; height: auto; }
.area-row .area-fig-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.area-row .area-fig figcaption { margin-top: 8px; font-size: 13px; line-height: 1.5; color: var(--muted); max-width: 70ch; }
:root[data-theme="dark"] .area-row .area-fig .frame { background: #e9e7e1; }
:root[data-theme="dark"] .area-row .area-fig img { mix-blend-mode: multiply; }
.hero-topics { margin-top: 16px; max-width: 700px; font-size: 13.5px; line-height: 1.6; color: var(--muted); letter-spacing: .01em; }
.hero-cover img { aspect-ratio: 4 / 1; object-position: center 48%; }
@media (max-width: 640px) { .hero-cover img { aspect-ratio: 2.6 / 1; } .area-row .area-fig-pair { grid-template-columns: minmax(0, 1fr); } }
ul.hero-topics { list-style: none; padding: 0; display: flex; flex-wrap: wrap; row-gap: 2px; }
ul.hero-topics li { white-space: nowrap; }
ul.hero-topics li:not(:last-child)::after { content: "·"; margin: 0 .55em; color: var(--muted); }
@media (max-width: 640px) { ul.hero-topics li { white-space: normal; } }
.subline p.plain-line { color: var(--ink); }
ul.hero-facts { list-style: none; padding: 0; margin: 22px 0 0; max-width: 760px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
ul.hero-facts li { padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; display: grid; gap: 3px; }
ul.hero-facts b { font-size: 14px; font-weight: 700; color: var(--ink); line-height: 1.25; }
ul.hero-facts span { font-size: 12.5px; line-height: 1.4; color: var(--muted); }
@media (max-width: 760px) { ul.hero-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.area-row p.area-use { margin-top: .9em; padding-left: 11px; border-left: 2px solid var(--accent); font-size: 14.5px; line-height: 1.5; color: var(--ink-2); }
.area-row p.area-use b { font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-dark); margin-right: 6px; }

/* home: hero with affiliations under the portrait; claims; ongoing tags; software roles */
.hero-grid { grid-template-columns: minmax(0, 1fr) 280px; gap: 56px; align-items: start; }
.hero-grid .portrait { margin-top: 10px; }
.hero-grid .portrait img { width: 100%; max-width: 280px; border-radius: 18px; }
.affil { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 11px; font-size: 13.5px; line-height: 1.45; color: var(--ink-2); }
.affil li { padding-left: 11px; border-left: 2px solid var(--line); }
.affil b { display: block; font-size: 13px; font-weight: 650; color: var(--ink); }
.affil a { color: inherit; text-decoration-color: var(--line); text-underline-offset: 2px; }
.affil a:hover { color: var(--accent-dark); }
.area-row p.area-claim { font-family: var(--serif); font-size: 22px; line-height: 1.3; color: var(--ink); margin-bottom: 12px; max-width: 46ch; text-wrap: pretty; }
.area-row p + p:not(.area-claim):not(.area-settings) { margin-top: .75em; }
.area-row .area-fig.narrow { max-width: 440px; }
.topic-link { display: inline-flex; align-items: center; gap: 5px; margin: 16px 12px 0 0; padding: 5px 0; color: var(--accent-dark); font-size: 13.5px; font-weight: 650; line-height: 1.35; text-decoration: none; border-bottom: 1px solid #7551a766; }
.topic-link:hover { color: var(--ink); border-color: var(--ink); }
.ro-node b em, .ro-app-card .ro-node b em { display: inline-block; margin-left: 4px; padding: 0 5px; border: 1px solid var(--line); border-radius: 4px; font-size: 10.5px; font-style: normal; font-weight: 600; letter-spacing: .03em; color: var(--muted); vertical-align: 1px; }
.ro-grid .ro-app img { height: 96px; }
.mini-soft small { font-size: 12px; font-weight: 600; letter-spacing: .02em; color: var(--muted); }
@media (max-width: 960px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .hero-grid .portrait { margin-top: 0; display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 18px; max-width: 640px; align-items: start; }
  .hero-grid .portrait img { border-radius: 14px; }
  .affil { margin-top: 0; }
}
@media (max-width: 640px) {
  .hero-grid .portrait { order: 0; grid-template-columns: 88px minmax(0, 1fr); gap: 14px; }
  .area-row p.area-claim { font-size: 20px; }
}

/* Opening photograph of a project page ({{scene:<slug>}} in build.py). */
.scene { margin-top: 4px; margin-bottom: 44px; }
.scene picture, .scene img { display: block; width: 100%; }
.scene img { height: auto; aspect-ratio: 21 / 9; object-fit: cover; border: 1px solid var(--line); border-radius: 18px; background: var(--card); }
:root[data-theme="dark"] .scene img { filter: brightness(.9); }
@media (max-width: 640px) {
  .scene { margin-bottom: 32px; }
  .scene img { aspect-ratio: 4 / 3; border-radius: 12px; }
}

/* References list on project pages: <section id="references"><ol class="refs"><li id="ref-key">…  */
.proj-body .refs { padding-left: 1.4em; margin-top: .6em; }
.proj-body .refs li { font-size: 14px; line-height: 1.5; color: var(--ink-2); }
.proj-body .refs li + li { margin-top: .45em; }
.proj-body .refs li:target { background: var(--accent-soft); border-radius: 4px; }
.proj-body .research-compass + section { margin-top: 48px; }

/* Argument row: balance the grid for 6–8 sections on wide screens. */
@media (min-width: 861px) {
  .topic-map ol:has(> li:nth-child(6):last-child) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .topic-map ol:has(> li:nth-child(7)):not(:has(> li:nth-child(9))) { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.frame .fig-row { margin-top: 0; }

/* Software behind a project ({{software:project=<slug>}}): thumbnail cards linking to package pages. */
.soft-features { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; margin-top: 22px; }
.soft-feature { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 16px; align-items: start; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
.soft-feature-media { display: grid; place-items: center; aspect-ratio: 4 / 3; border-radius: 9px; border: 1px solid var(--line-2); background: #fff; overflow: hidden; padding: 6px; }
.soft-feature-media img { width: 100%; height: 100%; object-fit: contain; }
.soft-feature h3 { font-size: 16.5px; font-weight: 700; margin: 2px 0 4px; }
.soft-feature h3 a { color: var(--ink); text-decoration: none; }
.soft-feature h3 a:hover { color: var(--accent-dark); }
.soft-feature p { font-size: 14px; line-height: 1.5; color: var(--ink-2); margin: 0; }
.soft-feature .soft-feature-links { display: flex; gap: 16px; margin-top: 8px; font-size: 13.5px; font-weight: 650; }
@media (max-width: 520px) { .soft-feature { grid-template-columns: 96px minmax(0, 1fr); gap: 12px; } }
/* Scene pair: one energy setting and one physical-AI setting of the same problem. */
.scene-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.scene-pair img { aspect-ratio: 4 / 3; }
@media (max-width: 640px) { .scene-pair { grid-template-columns: minmax(0, 1fr); gap: 10px; } }
/* Research overview: links to project pages, then the packages that implement them. */
.topic-links { margin-top: 4px; }
.topic-link.soft { color: var(--ink-2); font-weight: 600; }
.topic-link.soft::before { content: "</>"; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; color: var(--muted); margin-right: 2px; }
.proj-body .code + p, .proj-body .bib-box + p { margin-top: 18px; }

/* draw.io method diagrams (src/assets/img/diagrams): paper figures on a white card in both themes.
   build.py sets each image's true aspect ratio and a legible max-width. */
.fig .frame img[src*="/diagrams/"] { display: block; width: 100%; height: auto; margin: 0 auto; background: #fff; }
:root[data-theme="dark"] .fig .frame:has(img[src*="/diagrams/"]) { box-shadow: 0 0 0 1px rgba(255,255,255,.08); }

/* Responsive equations: <div class="eq-r"><div class="eq eq-wide">\[…\]</div><div class="eq eq-narrow">\[…\]</div></div>.
   The wide form is the full, annotated statement; the narrow form is the same mathematics laid out for a phone. */
.eq-r { container-type: inline-size; }
.eq-r > .eq-narrow, .eq-r > .eq-mid { display: none; }
@container (max-width: 600px) {
  .eq-r > .eq-wide { display: none; }
  .eq-r > .eq-narrow { display: block; }
}

/* Home page: preview mosaic of the opening scenes under each research topic ({{scenes:mosaic=...}}).
   Every mosaic is the same box (full heading-column width, 2:1); its tiles crop to fill it. */
.scene-mosaic { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: minmax(0, 1fr); gap: 3px; margin-top: 8px; width: 100%; aspect-ratio: 2 / 1; border-radius: 9px; overflow: hidden; }
.scene-mosaic:has(> a:nth-child(2):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.scene-mosaic a { display: block; min-height: 0; line-height: 0; }
.scene-mosaic img { width: 100%; height: 100%; object-fit: cover; transition: filter .15s; }
.scene-mosaic a:hover img { filter: brightness(1.08) saturate(1.1); }
@media (max-width: 860px) {
  .area-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  .scene-mosaic, .scene-mosaic:has(> a:nth-child(2):last-child) { width: 70px; aspect-ratio: auto; grid-template-columns: repeat(2, 34px); grid-auto-rows: 26px; margin-top: 0; flex: none; border-radius: 5px; gap: 2px; }
  .scene-mosaic > a:nth-child(n+3) { display: none; }
}
/* Home page keywords: accent color and weight, no change of wording. */
strong.kw { color: var(--accent-dark); font-weight: 650; }
.tagline strong.kw { font-weight: 500; }
.area-row p strong.kw { color: var(--accent-dark); }
@media (max-width: 600px) { .scene-mosaic { display: none; } }


.soft-feature-media:has(img[src*="/scenes/"]) { padding: 0; }
.soft-feature-media img[src*="/scenes/"] { object-fit: cover; }
/* Diagrams inside software cards: natural aspect ratio, never cropped. */
.tool-media:has(img[src*="/diagrams/"]) { aspect-ratio: auto; padding: 10px; }
.tool-media img[src*="/diagrams/"] { height: auto; max-height: none; object-fit: initial; }

/* Equations side by side under column headings (<div class="eq-table"><div><p class="eq-table-head">…</p><div class="eq">\[…\]</div></div>…</div>);
   on phones the columns stack, each heading above its equation. */
.eq-table { display: grid; grid-template-columns: repeat(3, auto); grid-template-rows: auto auto; margin: 16px 0; background: var(--card); border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; }
.eq-table > div { display: grid; grid-row: span 2; grid-template-rows: subgrid; }  /* headings share one row, so their rules line up */
.eq-table > div + div { border-left: 1px solid var(--line-2); }
.eq-table-head { margin: 0 !important; padding: 9px 12px; font-size: 11.5px !important; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; line-height: 1.35; color: var(--muted) !important; background: var(--paper-2); border-bottom: 1px solid var(--line-2); contain: inline-size; }  /* columns are sized by their equations, not by the headings */
.research-focus-grid .prose .eq-table .eq, .eq-table .eq { margin: 0; padding: 6px 4px; border: 0; border-radius: 0; background: none; display: flex; align-items: center; justify-content: center; }
.eq-table .eq .katex-display { margin: .6em 0; }
.eq-table .eq .katex-display > .katex { font-size: 1em; }
@media (max-width: 640px) {
  .eq-table { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; }
  .eq-table > div { grid-row: auto; grid-template-rows: auto auto; }
  .eq-table > div + div { border-left: 0; border-top: 1px solid var(--line-2); }
}

/* Opening-scene captions: a one-line key to the painted overlays under each image of the pair. */
.scene-item { min-width: 0; }
.scene-cap { margin: 8px 2px 0; font-size: 13px; line-height: 1.45; color: var(--muted); }


/* Experience and education trees ({{experience}} page): one row per entry, ordered by start date.
   Lanes are neutral grey; the earliest ongoing entry keeps lane 0 and overlapping entries branch to lanes 1–2.
   Every entry has the same hollow node, coloured by category (research, industry, education). */
.tree { list-style: none; padding: 0; margin: 0 0 26px; --lane: color-mix(in srgb, var(--muted) 55%, transparent); }
.tr { display: grid; grid-template-columns: 100px 84px minmax(0, 1fr); column-gap: 18px; }
.tr time { padding-top: 1px; font-size: 13.5px; font-weight: 650; line-height: 1.5; color: var(--ink-2); text-align: right; font-variant-numeric: tabular-nums; }
.tr time small { font-weight: 500; color: var(--muted); font-size: 12px; }
.tb { padding-bottom: 28px; min-width: 0; }
.tb h3 { font-size: 16.5px; font-weight: 700; line-height: 1.4; }
.tb .org { font-size: 14.5px; color: var(--muted); }
.tb p, .tb ul { font-size: 15px; color: var(--ink-2); margin-top: 6px; max-width: 72ch; }
.tb .org { margin-top: 0; }
.tb ul { padding-left: 1.1em; } .tb li + li { margin-top: 3px; }
.tg { position: relative; min-height: 100%; }
.tg .s { position: absolute; width: 2px; margin-left: -1px; background: var(--lane); }
.tg .x0 { left: 13px; } .tg .x1 { left: 41px; } .tg .x2 { left: 69px; }
.tg .s.full { top: 0; bottom: 0; } .tg .s.up { top: 0; height: 13px; } .tg .s.down { top: 13px; bottom: 0; }
.tg .s.downfork { top: 13px; bottom: 28px; } .tg .s.fullfork { top: 0; bottom: 28px; }
.tg .s.fade { background: linear-gradient(to bottom, transparent, var(--lane) 22px); }
.tg .n { position: absolute; top: 6px; width: 14px; height: 14px; margin-left: -7px; box-sizing: border-box; border-radius: 50%; background: var(--paper); border: 2.5px solid var(--accent); box-shadow: 0 0 0 3px var(--paper); z-index: 1; }
.tg .n.ind { border-color: var(--energy); } .tg .n.edu { border-color: var(--control); }
.tg .c { position: absolute; bottom: 0; left: 13px; height: 28px; overflow: visible; }
.tg .c.w1 { width: 28px; } .tg .c.w2 { width: 56px; }
.tg .c path { fill: none; stroke: var(--lane); stroke-width: 2; stroke-linecap: round; vector-effect: non-scaling-stroke; }
@media (max-width: 640px) {
  .tr { grid-template-columns: 84px minmax(0, 1fr); column-gap: 12px; }
  .tr time { grid-column: 2; grid-row: 1; text-align: left; }
  .tg { grid-column: 1; grid-row: 1 / span 2; }
  .tb { grid-column: 2; grid-row: 2; }
}
