/* A restrained engineering-document look: one type family, one accent, hairline rules, a strict grid.
   Light only, so the schematics and the simulation canvas stay on a single ground. */
:root {
  --bg: #ffffff;
  --ink: #14181d;
  --muted: #56606b;
  --rule: #dde1e6;
  --surface: #f4f6f8;
  --accent: #17497f;
  --accent-deep: #0f3560;
  --sans: "IBM Plex Sans", -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --math: "STIX Two Text", "Times New Roman", serif;
  --gutter: clamp(20px, 4vw, 40px);
  --label: 200px;
  --gap: 48px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  /* The footer sits at the bottom of short pages. */
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
body > main { flex: 1 0 auto; width: 100%; }
body > header, body > footer { width: 100%; }
.wrap {
  max-width: calc(1120px + var(--gutter) * 2);
  margin-inline: auto;
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent); }
a:hover { color: var(--accent-deep); text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 8px; background: var(--bg); padding: 6px 10px; z-index: 10; }

h1, h2, h3, h4 { font-weight: 500; line-height: 1.2; letter-spacing: -0.012em; text-wrap: balance; margin: 0; }
h1 { font-size: clamp(2.1rem, 4.4vw, 3.1rem); line-height: 1.12; letter-spacing: -0.02em; }
.lede { font-size: clamp(1.15rem, 1.8vw, 1.3rem); line-height: 1.5; margin: 18px 0 0; max-width: 40em; color: var(--ink); text-wrap: pretty; }

/* Head and foot */
.site-head { border-bottom: 1px solid var(--rule); }
.head-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 32px; padding-block: 18px; }
.home { font-weight: 600; color: var(--ink); text-decoration: none; }
.home:hover { color: var(--ink); }
.site-head nav { display: flex; flex-wrap: wrap; gap: 2px 24px; font-size: 0.95rem; }
.site-head nav a { color: var(--muted); text-decoration: none; padding-block: 3px; border-bottom: 1px solid transparent; }
.site-head nav a:hover { color: var(--ink); }
.site-head nav a[aria-current] { color: var(--ink); border-bottom-color: var(--ink); }
.site-foot { margin-top: 96px; border-top: 1px solid var(--rule); font-size: 0.95rem; color: var(--muted); }
.foot-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 32px; padding-block: 26px 36px; }
.site-foot p { margin: 0; }
.foot-links { display: flex; flex-wrap: wrap; gap: 4px 20px; }

/* Shared */
.section { margin-top: 80px; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 24px; padding-bottom: 12px; margin-bottom: 32px; border-bottom: 1px solid var(--ink); }
.section-head h2 { font-size: 1.4rem; }
.section-head a { font-size: 0.95rem; }
.page-top { padding-block: 56px 48px; }
.page-top p:not(.lede) { max-width: 42rem; margin: 16px 0 0; }
.page-top + .section { margin-top: 0; }
.btn { display: inline-block; padding: 9px 18px; background: var(--accent); border: 1px solid var(--accent); color: #fff; font-weight: 500; font-size: 0.975rem; text-decoration: none; border-radius: 2px; }
.btn:hover { background: var(--accent-deep); border-color: var(--accent-deep); color: #fff; }
.btn-quiet { background: transparent; border-color: var(--rule); color: var(--ink); }
.btn-quiet:hover { background: var(--surface); border-color: var(--muted); color: var(--ink); }
.spec { margin: 0; font-size: 0.95rem; line-height: 1.5; }
.spec div { padding-block: 11px; border-top: 1px solid var(--rule); }
.spec div:last-child { border-bottom: 1px solid var(--rule); }
.spec dt { color: var(--muted); font-size: 0.85rem; }
.spec dd { margin: 2px 0 0; }

/* Home */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 40px 72px; align-items: start; padding-block: 72px 0; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 30px 0 0; }
.me { margin: 0 0 20px; }
.me img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }

.kind-intro { margin: -14px 0 32px; max-width: 42rem; color: var(--muted); }
.card :is(h3, h4) { font-size: 1.15rem; line-height: 1.3; margin: 0; }
.card :is(h3, h4) a { color: var(--ink); text-decoration: none; }
.card :is(h3, h4) a:hover { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; }
.card-meta { margin: 0 0 6px; color: var(--muted); font-size: 0.875rem; line-height: 1.4; }
.card-text > p:not(.card-meta) { margin: 8px 0 0; }
.card-pic { display: block; margin-bottom: 16px; border: 1px solid var(--rule); background: var(--surface); }
.card-pic:hover { border-color: var(--accent); }
.card-pic { background: #fff; }
/* Contain, not cover: these are engineering figures, so axes and labels must never be cropped. */
.card-pic img, .card-pic svg { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; }
.card-text > .view-row, .view-row { margin: 10px 0 0; }
.view { font-size: 0.95rem; font-weight: 500; white-space: nowrap; }
.card-row { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 20px var(--gap); align-items: start; }
.card-row .card-pic { margin: 0; }
.card-row :is(h3, h4) { font-size: 1.5rem; line-height: 1.25; }
.card-row .results { margin-top: 22px; }
.cards { display: grid; gap: 44px 32px; }
.cards-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.featured { margin-top: 44px; padding-top: 32px; border-top: 1px solid var(--rule); }
.list { display: grid; gap: 32px; }
.list .card + .card { padding-top: 32px; border-top: 1px solid var(--rule); }
.briefs { border-bottom: 1px solid var(--rule); }
.brief { display: grid; grid-template-columns: var(--label) minmax(0, 1fr); gap: 4px var(--gap); padding-block: 18px; border-top: 1px solid var(--rule); }
.brief:first-child { border-top: 0; padding-top: 0; }
.brief .card-meta { margin: 3px 0 0; }
.brief :is(h3, h4) { font-size: 1.15rem; line-height: 1.3; }
.brief :is(h3, h4) a { color: var(--ink); text-decoration: none; }
.brief :is(h3, h4) a:hover { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; }
.brief p:not(.card-meta) { margin: 6px 0 0; max-width: 42rem; }
.list .card-row { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }

.results { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px 32px; margin: 0; }
.results div { border-top: 1px solid var(--rule); padding-top: 10px; }
.results dt { font-size: 1.6rem; font-weight: 500; line-height: 1.2; letter-spacing: -0.015em; color: var(--accent); font-variant-numeric: tabular-nums; }
.results dd { margin: 4px 0 0; font-size: 0.95rem; line-height: 1.45; color: var(--muted); max-width: 42rem; }
.wide-result dt { font-size: 1.25rem; line-height: 1.3; }
.summary { margin-bottom: 32px; border-top-color: var(--rule); }
.summary > div { padding-block: 12px; }
.summary dd { font-size: 1rem; line-height: 1.55; }

.rows { list-style: none; margin: 0; padding: 0; }
.rows > li { display: grid; grid-template-columns: var(--label) minmax(0, 1fr); gap: 2px var(--gap); padding-block: 14px; border-bottom: 1px solid var(--rule); }
.rows > li:first-child { padding-top: 0; }
.rows-when { color: var(--muted); font-size: 0.95rem; font-variant-numeric: tabular-nums; }
.rows-what { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 24px; }
.rows-what span { color: var(--muted); }

/* Project page */
.project-head { padding-block: 40px 32px; }
.crumbs { font-size: 0.9rem; color: var(--muted); margin-bottom: 18px; }
.crumbs a { color: var(--muted); }
.project-head h1 { max-width: 24em; }
.project-head .lede { max-width: 42em; }
.project .results { padding-bottom: 40px; }
.project-body { display: grid; grid-template-columns: var(--label) minmax(0, 1fr); gap: 32px var(--gap); align-items: start; border-top: 1px solid var(--ink); padding-top: 32px; }
.project-side { align-self: stretch; }
.toc { position: sticky; top: 20px; margin-top: 22px; max-height: calc(100vh - 40px); overflow-y: auto; font-size: 0.9rem; line-height: 1.35; }
.toc summary { color: var(--muted); font-size: 0.85rem; cursor: pointer; padding-bottom: 6px; }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--rule); }
.toc li { margin: 0; }
.toc a { display: block; padding: 5px 0 5px 11px; margin-left: -1px; border-left: 2px solid transparent; color: var(--muted); text-decoration: none; }
.toc a:hover { color: var(--ink); }
.toc a[aria-current] { color: var(--accent); border-left-color: var(--accent); font-weight: 500; }
.prose h2 { scroll-margin-top: 18px; }
.video-figure { margin: 18px 0 28px; }
.video-figure video { display: block; max-width: 100%; max-height: min(78vh, 640px); background: #000; border: 1px solid var(--rule); }
.prose { min-width: 0; counter-reset: fig; }
.prose > :first-child { margin-top: 0; }
.prose > p:not(.math), .prose > ul, .prose > h2, .prose > blockquote, .more > p:not(.math), .more > ul { max-width: 42rem; }
.ledger { margin: 20px 0; border-top: 1px solid var(--rule); max-width: 46rem; }
.ledger > div { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 2px 24px; padding-block: 11px; border-bottom: 1px solid var(--rule); }
.ledger dt { color: var(--accent); font-size: 0.925rem; font-weight: 500; padding-top: 2px; }
.ledger dd { margin: 0; font-size: 1rem; line-height: 1.55; }
.table-wrap { overflow-x: auto; margin: 20px 0; max-width: 46rem; }
table { border-collapse: collapse; width: 100%; font-size: 0.975rem; line-height: 1.45; font-variant-numeric: tabular-nums; }
th { font-weight: 500; text-align: left; color: var(--muted); font-size: 0.9rem; border-bottom: 1px solid var(--ink); padding: 6px 16px 8px 0; }
td { border-bottom: 1px solid var(--rule); padding: 8px 16px 8px 0; }
.more { margin: 18px 0; max-width: 46rem; border-block: 1px solid var(--rule); padding-block: 10px; }
.more summary { cursor: pointer; font-weight: 500; color: var(--accent); }
.more[open] summary { margin-bottom: 8px; }
.prose h2 { font-size: 1.4rem; margin: 44px 0 10px; clear: both; }
.prose > h2:first-child { margin-top: 0; }
.prose p { margin: 14px 0; }
.prose ul { margin: 14px 0; padding-left: 1.15em; }
.prose li { margin: 8px 0; }
.prose li::marker { color: var(--muted); }
.prose code { font-family: var(--mono); font-size: 0.88em; background: var(--surface); padding: 1px 5px; border-radius: 2px; }
.small { font-size: 0.9rem; color: var(--muted); }
.pull { margin: 26px 0; padding-left: 20px; border-left: 2px solid var(--accent); font-size: 1.25rem; line-height: 1.4; }
.math { font-family: var(--math); font-style: italic; font-size: 1.2rem; background: var(--surface); padding: 12px 18px; overflow-x: auto; }
.math sub { font-size: 0.7em; }
.shot { margin: 0; }
.shot img { width: 100%; border: 1px solid var(--rule); }
.zoom { display: block; cursor: zoom-in; }
.zoom:hover img { border-color: var(--accent); }
.shot figcaption, .cad figcaption { font-size: 0.925rem; line-height: 1.45; color: var(--muted); margin-top: 10px; max-width: 42rem; }
/* Figures number themselves, in reading order, like a report. */
.shot figcaption::before, .cad figcaption::before { counter-increment: fig; content: "Fig. " counter(fig) ". "; color: var(--ink); font-weight: 500; }
.lead { margin: 0 0 32px; }
.lead img, .lead svg { width: 100%; border: 1px solid var(--rule); }
.lead svg { aspect-ratio: 16 / 9; background: var(--surface); }
.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; margin: 28px 0; }
.pair .shot img { aspect-ratio: 4 / 3; object-fit: contain; background: var(--surface); }
.wide { margin: 28px 0; }
.float-r { float: right; width: 300px; margin: 6px 0 16px 32px; }
.flow { list-style: none; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 18px 0; padding: 0; font-size: 0.95rem; }
.flow li { display: flex; align-items: center; gap: 10px; margin: 0; }
.flow span { border: 1px solid var(--rule); background: var(--surface); padding: 5px 12px; border-radius: 2px; }
.flow li:not(:last-child)::after { content: "→"; color: var(--muted); }
.art-figure { margin: 28px 0; max-width: 46rem; }
.art-figure svg { width: 100%; border: 1px solid var(--rule); }
.table-wrap caption { text-align: left; caption-side: bottom; color: var(--muted); font-size: 0.9rem; padding-top: 8px; }
.legend { list-style: none; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); gap: 8px 28px; font-size: 0.95rem; line-height: 1.45; max-width: 60rem; }
.prose .legend li { display: flex; gap: 10px; margin: 0; }
.key { flex: none; width: 1.55em; height: 1.55em; border-radius: 50%; background: var(--accent); color: #fff; font-size: 0.82rem; font-weight: 500; display: inline-flex; align-items: center; justify-content: center; margin-top: 1px; }
.annotated .shot img { max-height: min(85vh, 760px); width: auto; max-width: 100%; }
.excerpt { margin: 18px 0; max-width: 42rem; }
.excerpt blockquote { margin: 0; padding-left: 16px; border-left: 2px solid var(--rule); font-size: 1rem; }
.excerpt blockquote p { margin: 0 0 10px; }
.excerpt figcaption { margin-top: 8px; font-size: 0.9rem; color: var(--muted); }
.downloads { list-style: none; margin: 14px 0; padding: 0; border-top: 1px solid var(--rule); max-width: 46rem; }
.prose .downloads { padding-left: 0; }
.prose .downloads li { margin: 0; padding-block: 11px; border-bottom: 1px solid var(--rule); }
.downloads a { font-weight: 500; }
.prose .downloads p { margin: 3px 0 0; font-size: 0.95rem; color: var(--muted); }
.file-meta { color: var(--muted); font-size: 0.85rem; white-space: nowrap; }
.lightbox { padding: 0; border: 0; width: 100vw; height: 100dvh; max-width: none; max-height: none; background: #fff; }
.lightbox[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.lightbox::backdrop { background: rgb(20 24 29 / 0.6); }
.lb-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; padding: 10px var(--gutter); border-bottom: 1px solid var(--rule); }
.lb-count { margin-right: auto; color: var(--muted); font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.lb-stage { overflow: auto; display: flex; background: var(--surface); }
.lb-stage img { margin: auto; max-width: 100%; max-height: 100%; width: auto; height: auto; background: #fff; }
.lb-stage.actual img { max-width: none; max-height: none; }
.lb-caption { margin: 0; padding: 10px var(--gutter) 14px; font-size: 0.95rem; line-height: 1.45; color: var(--muted); border-top: 1px solid var(--rule); max-height: 28vh; overflow: auto; }
.cad { margin: 18px 0 30px; }
model-viewer { display: block; width: 100%; height: clamp(320px, 46vw, 480px); background: var(--surface); --poster-color: transparent; --progress-bar-height: 0px; }
.next { margin-top: 64px; padding-top: 18px; border-top: 1px solid var(--rule); display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px 24px; }
.next span { color: var(--muted); font-size: 0.95rem; margin-right: 6px; }
.next a { font-size: 1.05rem; font-weight: 500; }

/* Flutter */
.sim { margin: 0 0 24px; border: 1px solid var(--rule); }
.sim-stage { background: #fff; border-bottom: 1px solid var(--rule); }
#plate { display: block; width: 100%; height: clamp(300px, 38vw, 430px); cursor: crosshair; touch-action: pan-y; }
.sim-controls { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px 32px; padding: 18px 20px; align-items: start; border-bottom: 1px solid var(--rule); }
.sim-controls > * { min-width: 0; }
.sim-sliders { display: grid; gap: 14px; }
.sim-head { display: flex; justify-content: space-between; gap: 10px; font-size: 0.95rem; font-weight: 500; }
.sim-head output { font-family: var(--mono); font-weight: 400; }
.sim input[type="range"] { display: block; width: 100%; height: 26px; margin: 4px 0 0; background: transparent; appearance: none; -webkit-appearance: none; cursor: pointer; }
.sim input[type="range"]::-webkit-slider-runnable-track { height: 2px; background: var(--muted); }
.sim input[type="range"]::-moz-range-track { height: 2px; background: var(--muted); }
.sim input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: -8px; border-radius: 50%; background: var(--accent); border: 2px solid var(--bg); box-shadow: 0 0 0 1px var(--accent); }
.sim input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); border: 2px solid var(--bg); box-shadow: 0 0 0 1px var(--accent); }
.prose .sim-state { margin: 0; font-size: 0.975rem; }
.sim-state strong { font-weight: 600; }
.prose .sim-read { margin: 2px 0 10px; color: var(--muted); font-size: 0.875rem; font-variant-numeric: tabular-nums; }
.sim-buttons, .prose .sim-buttons { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 6px; }
.sim-buttons button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.sim-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.sim-panel { padding: 14px 16px 12px; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); min-width: 0; }
.sim-panel:nth-child(3n) { border-right: 0; }
.sim-panel h3 { font-size: 0.95rem; margin: 0 0 8px; }
.sim-panel canvas { display: block; width: 100%; height: 190px; }
.prose .sim-panel p { margin: 8px 0 0; font-size: 0.85rem; line-height: 1.4; color: var(--muted); }
#map { cursor: pointer; }
.sim-note { padding: 10px 16px; font-size: 0.85rem; color: var(--muted); }
.regimes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 28px; margin: 16px 0; max-width: 46rem; }
.regime { border-top: 1px solid var(--rule); padding-top: 9px; font-size: 0.975rem; }
.prose .regime p { margin: 3px 0 0; font-size: 0.95rem; line-height: 1.45; color: var(--muted); }
.swatch { display: inline-block; width: 11px; height: 11px; margin-right: 8px; border: 1px solid var(--rule); }
button { font-family: var(--sans); font-size: 0.9rem; font-weight: 500; color: var(--ink); background: var(--bg); border: 1px solid var(--rule); border-radius: 2px; padding: 6px 12px; cursor: pointer; }
button:hover { background: var(--surface); border-color: var(--muted); }

/* Experience */
.timeline { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--ink); }
.timeline li:target { background: var(--surface); }
.timeline li { display: grid; grid-template-columns: var(--label) minmax(0, 1fr); gap: 4px var(--gap); padding-block: 26px; border-bottom: 1px solid var(--rule); }
.when { color: var(--muted); font-size: 0.95rem; font-variant-numeric: tabular-nums; padding-top: 3px; }
.timeline h2 { font-size: 1.2rem; line-height: 1.3; }
.timeline p { margin: 8px 0 0; max-width: 42rem; }
.timeline .where { color: var(--muted); margin-top: 2px; }
.timeline a { white-space: nowrap; }

/* About */
.about-top { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 40px 72px; align-items: start; padding-block: 56px 0; }
.about-top p:not(.lede) { max-width: 42rem; margin: 16px 0 0; }
.cv { margin: 0; border-top: 1px solid var(--ink); }
.cv > div { display: grid; grid-template-columns: var(--label) minmax(0, 1fr); gap: 4px var(--gap); padding-block: 18px; border-bottom: 1px solid var(--rule); }
.cv dt { color: var(--muted); font-size: 0.95rem; padding-top: 2px; }
.cv dd { margin: 0; max-width: 42rem; }
.cv dd p { margin: 0; }
.cv dd p + p { margin-top: 8px; }

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
@media (max-width: 960px) {
  .toc { position: static; max-height: none; border-block: 1px solid var(--rule); padding-block: 10px; }
  .cards-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sim-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sim-panel:nth-child(3n) { border-right: 1px solid var(--rule); }
  .sim-panel:nth-child(2n) { border-right: 0; }
  :root { --label: 150px; --gap: 32px; }
  .hero, .about-top { grid-template-columns: minmax(0, 1fr); padding-top: 48px; }
  .me { max-width: 280px; }
  .project-body { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 680px) {
  body { font-size: 1rem; }
  .site-head nav { width: 100%; justify-content: space-between; gap: 2px 6px; font-size: 0.875rem; }
  .head-row { padding-block: 14px; }
  .section { margin-top: 60px; }
  .page-top { padding-block: 40px 32px; }
  .card-row, .list .card-row, .cards-3 { grid-template-columns: minmax(0, 1fr); }
  .rows > li, .timeline li, .cv > div, .ledger > div, .brief { grid-template-columns: minmax(0, 1fr); }
  .pair { grid-template-columns: minmax(0, 1fr); }
  .float-r { float: none; width: 100%; max-width: 340px; margin: 22px 0; }
  .sim-controls { grid-template-columns: minmax(0, 1fr); padding: 16px; }
  .sim-grid, .regimes { grid-template-columns: minmax(0, 1fr); }
  .sim-panel { border-right: 0; }
  .site-foot { margin-top: 64px; }
}
