/* elymiller.com — one stylesheet for every page.
   One sans-serif (Inter, system fallback), one accent (pine), light + dark. */

/* Palette "Ponderosa": warm paper, pine-green accent; dark mode is a
   Flagstaff dark-sky night. Chart series colors are validated against both
   surfaces (scripts: dataviz validate_palette.js). */
:root {
  color-scheme: light;
  --bg: #faf8f3;
  --surface: #f2efe7;
  --card: #fffdf9;
  --ink: #1b1d1a;
  --ink-2: #4d5249;
  --muted: #676b60;
  --rule: #e4e0d5;
  --rule-2: #d5d0c2;
  --accent: #2f6b4f;          /* the one accent: pine */
  --accent-soft: #e4ede5;
  --accent-ink: #24563f;
  --todo: #7c7f75;
  --shadow: 0 1px 2px rgb(40 36 20 / 0.04), 0 4px 16px rgb(40 36 20 / 0.05);

  /* chart roles (validated categorical slots 1-3 + neutral baseline) */
  --chart-surface: #faf8f3;
  --grid: #ebe7dc;
  --axis: #c6c1b3;
  --obs: #1b1d1a;
  --s-oracle: #2a78d6;
  --s-groundhog: #eb6834;
  --s-ensemble: #1baf7a;
  --s-baseline: #898781;

  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --measure: 46rem;
  --wide: 64rem;
  --radius: 12px;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --bg: #0e1116;
    --surface: #151920;
    --card: #12161c;
    --ink: #eef0ea;
    --ink-2: #b9beb3;
    --muted: #8d9389;
    --rule: #232830;
    --rule-2: #313741;
    --accent: #8fd1a8;
    --accent-soft: #1a2a21;
    --accent-ink: #a6dcba;
    --todo: #858a80;
    --shadow: none;
    --chart-surface: #0e1116;
    --grid: #1f242b;
    --axis: #3a4048;
    --obs: #eef0ea;
    --s-oracle: #3987e5;
    --s-groundhog: #d95926;
    --s-ensemble: #199e70;
    --s-baseline: #9a988f;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1116;
  --surface: #151920;
  --card: #12161c;
  --ink: #eef0ea;
  --ink-2: #b9beb3;
  --muted: #8d9389;
  --rule: #232830;
  --rule-2: #313741;
  --accent: #8fd1a8;
  --accent-soft: #1a2a21;
  --accent-ink: #a6dcba;
  --todo: #858a80;
  --shadow: none;
  --chart-surface: #0e1116;
  --grid: #1f242b;
  --axis: #3a4048;
  --obs: #eef0ea;
  --s-oracle: #3987e5;
  --s-groundhog: #d95926;
  --s-ensemble: #199e70;
  --s-baseline: #9a988f;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
  font-feature-settings: "cv11", "ss01";
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 8px; background: var(--bg); padding: 4px 8px; z-index: 10; }

/* ---------- header / nav ---------- */
.site-header {
  border-bottom: 1px solid var(--rule);
  position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(1.2) blur(8px);
}
.site-header .inner {
  max-width: 64rem; margin: 0 auto; padding: 14px 24px;
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
}
.brand { font-weight: 600; color: var(--ink); text-decoration: none; letter-spacing: -0.01em; display: inline-flex; align-items: center; gap: 10px; }
.brand::before {
  content: "EM"; display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px;
  background: var(--accent); color: var(--bg); font-size: 12px; font-weight: 700; letter-spacing: -0.02em;
}
.nav { display: flex; gap: 4px 18px; flex-wrap: wrap; margin-left: auto; align-items: center; }
.nav a { color: var(--ink-2); text-decoration: none; font-size: 15px; padding: 2px 0; }
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); }
.theme-toggle {
  border: 1px solid var(--rule); background: transparent; color: var(--ink-2);
  border-radius: 999px; width: 32px; height: 32px; cursor: pointer;
  display: inline-grid; place-items: center; padding: 0;
}
.theme-toggle:hover { color: var(--ink); border-color: var(--muted); }
.theme-toggle svg { width: 16px; height: 16px; }

/* ---------- layout ---------- */
main { max-width: var(--measure); margin: 0 auto; padding: 56px 24px 80px; }
main.wide { max-width: var(--wide); }
main.medium { max-width: 56rem; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -0.02em; font-weight: 650; }
h1 { font-size: clamp(2rem, 5vw, 2.6rem); margin: 0 0 8px; }
h2 { font-size: 1.35rem; margin: 64px 0 16px; }
main h2::before { content: ""; display: block; width: 28px; height: 3px; border-radius: 2px; background: var(--accent); margin-bottom: 14px; }
.card h2::before, .project h2::before { display: none; }
h3 { font-size: 1.05rem; margin: 28px 0 6px; }
p { margin: 0 0 16px; }
.lede { color: var(--ink-2); font-size: 1.1rem; }
.eyebrow { font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 0 0 8px; }
section > h2:first-child { margin-top: 0; }
section + section { margin-top: 64px; }
hr { border: 0; border-top: 1px solid var(--rule); margin: 48px 0; }

/* ---------- prose placeholders (Ely writes these) ---------- */
.todo {
  color: var(--todo); font-style: italic; font-size: 0.95em;
}
.todo::before { content: "["; } .todo::after { content: "]"; }
p.todo, li.todo, div.todo { display: block; }

/* ---------- home hero ---------- */
.hero { display: grid; grid-template-columns: 184px 1fr; gap: 40px; align-items: center; }
.hero h1 { font-size: clamp(2.2rem, 5.5vw, 3rem); }
.photo {
  width: 184px; height: 184px; border-radius: 50%; object-fit: cover;
  background: var(--surface); box-shadow: 0 0 0 6px var(--accent-soft);
}
.photo-slot {
  display: grid; place-items: center; color: var(--todo); font-size: 13px; font-style: italic; text-align: center; padding: 16px;
}
.pronouns { color: var(--muted); font-weight: 400; font-size: 0.55em; letter-spacing: 0; margin-left: 6px; white-space: nowrap; }
.affil { margin: 4px 0 16px; color: var(--ink-2); }
.links { display: flex; flex-wrap: wrap; gap: 8px 10px; padding: 0; margin: 0; list-style: none; }
.links a, .btn {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--rule-2); border-radius: 999px; padding: 5px 14px;
  font-size: 14px; color: var(--ink); text-decoration: none; background: var(--card);
}
.links a:hover, .btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--bg); font-weight: 500; }
.btn.primary:hover { color: var(--bg); filter: brightness(1.08); }
.ic { width: 16px; height: 16px; flex: none; color: var(--muted); }
a:hover .ic, .btn.primary .ic { color: currentColor; }
.links .todo-link { color: var(--todo); font-style: italic; border-style: dashed; }

.tags { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0; list-style: none; }
.tags li { background: var(--accent-soft); color: var(--accent-ink); border-radius: 6px; padding: 3px 10px; font-size: 14px; font-weight: 500; }
.tags li.todo { background: transparent; border: 1px dashed var(--rule); }

/* ---------- entries (research, CV, pubs) ---------- */
.entry { padding: 20px 0; border-top: 1px solid var(--rule); }
.entry:first-of-type { border-top: 0; padding-top: 0; }
.entry h3 { margin: 0 0 4px; }
.meta { color: var(--muted); font-size: 14px; margin: 0 0 8px; }
.people { font-size: 15px; color: var(--ink-2); margin: 8px 0 0; }
.people strong { font-weight: 600; color: var(--ink); }
.cv-row { display: grid; grid-template-columns: 9rem 1fr; gap: 4px 24px; padding: 14px 0; border-top: 1px solid var(--rule); }
.cv-row:first-of-type { border-top: 0; }
.cv-row .when { color: var(--muted); font-size: 14px; padding-top: 2px; font-variant-numeric: tabular-nums; }
.cv-row h3 { margin: 0; font-size: 1rem; }
.pubs { padding-left: 1.2em; }
.pubs li { margin-bottom: 14px; }

/* CV-style bullet lists and skill table */
.cv-row ul, .entry ul { margin: 6px 0 0; padding-left: 1.1em; font-size: 15px; color: var(--ink-2); }
.cv-row li, .entry li { margin-bottom: 6px; }
.cv-text { font-size: 15px; color: var(--ink-2); margin: 4px 0; }
.cv-row .meta { margin-bottom: 4px; }
.toc { margin-top: 24px; font-size: 14px; color: var(--muted); line-height: 2; }
.toc a { color: var(--ink-2); text-decoration: none; white-space: nowrap; }
.toc a:hover { color: var(--accent); }
.skills { display: grid; grid-template-columns: 12rem 1fr; gap: 10px 24px; margin: 0; font-size: 15px; }
.skills dt { font-weight: 600; }
.skills dd { margin: 0; color: var(--ink-2); }
.entry h3 .meta { font-weight: 400; font-size: 14px; }
section[id] { scroll-margin-top: 80px; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--rule); color: var(--muted); font-size: 14px; }
.site-footer .inner { max-width: 64rem; margin: 0 auto; padding: 24px; display: flex; gap: 12px 24px; flex-wrap: wrap; justify-content: space-between; }
.site-footer a { color: var(--muted); }

/* ---------- forecast page ---------- */
.controls { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: end; margin: 24px 0 12px; }
.control { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.control select {
  font: inherit; font-size: 15px; color: var(--ink); background: var(--bg);
  border: 1px solid var(--rule); border-radius: 8px; padding: 6px 30px 6px 10px; min-width: 11rem;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 55%, calc(100% - 10px) 55%;
  background-size: 5px 5px; background-repeat: no-repeat;
}
.toggles { display: flex; flex-wrap: wrap; gap: 6px 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none;
  border: 1px solid var(--rule); border-radius: 999px; padding: 4px 12px 4px 10px; font-size: 14px; color: var(--ink);
  white-space: nowrap;
}
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip .sw { width: 12px; height: 12px; border-radius: 3px; background: var(--c); }
.chip:has(input:not(:checked)) { color: var(--muted); }
.chip:has(input:not(:checked)) .sw { background: transparent; box-shadow: inset 0 0 0 1.5px var(--c); }
.chip:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.chip.baseline .sw { background: repeating-linear-gradient(90deg, var(--c) 0 4px, transparent 4px 6px); }

.chart-wrap { position: relative; margin: 8px 0 0; }
.chart-wrap svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-wrap .grid line { stroke: var(--grid); stroke-width: 1; }
.chart-wrap .axis text { fill: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.chart-wrap .axis .base { stroke: var(--axis); }
.chart-wrap .refline { stroke: var(--muted); stroke-dasharray: 2 3; }
.chart-wrap .reflabel { fill: var(--muted); font-size: 12px; }
.chart-wrap .obs-line { fill: none; stroke: var(--obs); stroke-width: 1.5; opacity: 0.55; }
.chart-wrap .obs-dot { fill: var(--obs); stroke: var(--chart-surface); stroke-width: 2; }
.chart-wrap .obs-dot.later { fill: var(--chart-surface); stroke: var(--obs); stroke-width: 1.5; }
.chart-wrap .crosshair { stroke: var(--muted); stroke-width: 1; }
.chart-wrap .dlabel { font-size: 12px; fill: var(--ink-2); }
.tooltip {
  position: absolute; pointer-events: none; z-index: 3;
  background: var(--bg); border: 1px solid var(--rule); border-radius: 8px;
  box-shadow: 0 6px 24px rgb(0 0 0 / 0.12); padding: 10px 12px; font-size: 13px; line-height: 1.45;
  min-width: 14rem; max-width: 20rem;
}
.tooltip .tt-date { font-weight: 600; margin-bottom: 4px; }
.tooltip table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
.tooltip td { padding: 1px 0; vertical-align: top; }
.tooltip td + td { text-align: right; padding-left: 12px; }
.tooltip .key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.tooltip .rng { color: var(--muted); font-size: 12px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--ink-2); margin: 12px 0 0; padding: 0; list-style: none; }
.legend .k { display: inline-block; vertical-align: -2px; margin-right: 6px; }
.chart-note { font-size: 13px; color: var(--muted); margin-top: 12px; }
.empty { padding: 40px 0; color: var(--muted); text-align: center; }
details.table-view { margin-top: 16px; font-size: 14px; }
details.table-view summary { cursor: pointer; color: var(--ink-2); }
.table-scroll { overflow-x: auto; }
table.data { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; margin-top: 8px; }
table.data th, table.data td { text-align: right; padding: 6px 10px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data th { font-weight: 600; color: var(--ink-2); font-size: 13px; }

.model-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 16px; margin-top: 16px; }
.card { border: 1px solid var(--rule); border-radius: var(--radius); padding: 18px 20px; background: var(--card); box-shadow: var(--shadow); }
.card h3 { margin: 0 0 2px; display: flex; align-items: center; gap: 8px; }
.card h3 .sw { width: 12px; height: 12px; border-radius: 3px; background: var(--c); flex: none; }
.card code { font-size: 13px; color: var(--muted); }
.disease { display: grid; grid-template-columns: 9rem 1fr; gap: 4px 24px; padding: 14px 0; border-top: 1px solid var(--rule); }
.disease:first-of-type { border-top: 0; }
.status { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.status.live { color: var(--accent); }


/* ---------- shared bits ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600;
  letter-spacing: 0.02em; padding: 2px 9px; border-radius: 999px; white-space: nowrap;
  background: var(--surface); color: var(--ink-2); border: 1px solid var(--rule);
}
.badge.live { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }
.badge.live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.pill-links { display: flex; flex-wrap: wrap; gap: 6px 8px; margin: 14px 0 0; padding: 0; list-style: none; }
.pill-links a {
  display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 500;
  padding: 3px 10px; border-radius: 999px; border: 1px solid var(--rule-2); color: var(--ink); text-decoration: none;
}
.pill-links a:hover { border-color: var(--accent); color: var(--accent); }
.pill-links .ic { width: 13px; height: 13px; }
details.more { margin-top: 6px; }
details.more > summary {
  cursor: pointer; font-size: 14px; color: var(--accent); list-style: none; display: inline-flex; align-items: center; gap: 6px;
}
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: "+"; font-weight: 600; width: 1em; text-align: center; }
details.more[open] > summary::before { content: "–"; }
details.more[open] > summary .closed, details.more:not([open]) > summary .opened { display: none; }

/* ---------- home: current work strip ---------- */
.featured { margin-top: 56px; display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.featured .card { display: block; text-decoration: none; color: var(--ink); transition: border-color .15s, transform .15s; }
.featured a.card:hover { border-color: var(--accent); transform: translateY(-1px); }
.featured .card h3 { margin: 6px 0 4px; font-size: 1rem; }
.featured .card .meta { margin: 0; font-size: 13px; }
.featured .spark { grid-column: 1 / -1; padding: 20px 22px 14px; }
.spark-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.spark-head h3 { margin: 0; font-size: 1.05rem; }
.spark-head .meta { margin: 0; }
.spark svg { width: 100%; height: auto; display: block; margin-top: 10px; overflow: visible; }
.spark .go { font-size: 14px; color: var(--accent); }
.spark .s-band { opacity: 0.16; }
.spark .s-line { fill: none; stroke-width: 2; stroke-linecap: round; }
.spark .s-obs { fill: var(--obs); stroke: var(--card); stroke-width: 1.5; }
.spark .s-obs-line { fill: none; stroke: var(--obs); stroke-width: 1.25; opacity: .5; }
.spark .s-ref { stroke: var(--muted); stroke-dasharray: 2 3; }
.spark text { font-size: 11px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.spark text.lab { fill: var(--ink-2); font-size: 12px; font-weight: 500; }

/* ---------- research: project cards ---------- */
.project {
  background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 22px 24px; box-shadow: var(--shadow); margin: 0 0 16px; scroll-margin-top: 90px;
}
.project-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.project h3 { margin: 0 0 4px; font-size: 1.1rem; }
.project .meta { margin: 0 0 12px; }
.project ul { margin: 6px 0 0; padding-left: 1.1em; font-size: 15px; color: var(--ink-2); }
.project li { margin-bottom: 6px; }
.project .lead { font-size: 15px; color: var(--ink-2); margin: 0; }
.project-foot { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--rule); }
.project-foot .people { margin: 0 0 4px; font-size: 14px; }
.project .pill-links { padding: 0; margin-top: 12px; font-size: inherit; color: inherit; }
.project .pill-links li { margin: 0; }
.project-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.project-grid .project { margin: 0; }

/* ---------- publications ---------- */
.pub-tools { display: flex; align-items: center; gap: 8px; margin: 0 0 14px; font-size: 13px; color: var(--muted); }
.seg { display: inline-flex; border: 1px solid var(--rule-2); border-radius: 999px; padding: 2px; background: var(--card); }
.seg button {
  font: inherit; font-size: 13px; border: 0; background: transparent; color: var(--ink-2);
  padding: 3px 12px; border-radius: 999px; cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.pub-list { list-style: none; padding: 0; margin: 0; }
.pub-list > li {
  display: grid; grid-template-columns: 4.5rem 1fr; gap: 4px 20px; padding: 16px 0; border-top: 1px solid var(--rule);
  font-size: 15px; color: var(--ink-2); line-height: 1.6;
}
.pub-list > li:first-child { border-top: 0; }
.pub-list .yr { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; font-size: 15px; }
.pub-list .ttl { color: var(--ink); font-weight: 550; display: block; margin: 2px 0; }
.pub-list strong { color: var(--accent-ink); font-weight: 650; background: var(--accent-soft); border-radius: 4px; padding: 0 2px; margin: 0 -2px; }
.pub-list .venue em { color: var(--ink); }
.pub-list .pill-links { margin-top: 8px; padding: 0; }

/* ---------- CV ---------- */
.cv-top { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin: 20px 0 0; }
.cv-summary {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; margin: 32px 0 0;
  background: var(--rule); border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden;
}
.cv-summary div { background: var(--card); padding: 14px 18px; }
.cv-summary dt { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 0 0 4px; }
.cv-summary dd { margin: 0; font-weight: 550; font-size: 15px; line-height: 1.4; }
.cv-layout { display: grid; grid-template-columns: 12rem minmax(0, 1fr); gap: 48px; margin-top: 48px; align-items: start; }
.cv-rail { position: sticky; top: 84px; font-size: 14px; }
.cv-rail ol { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--rule); }
.cv-rail a {
  display: block; padding: 5px 0 5px 14px; margin-left: -2px; border-left: 2px solid transparent;
  color: var(--muted); text-decoration: none; line-height: 1.35;
}
.cv-rail a:hover { color: var(--ink); }
.cv-rail a[aria-current="true"] { color: var(--accent-ink); border-left-color: var(--accent); font-weight: 600; }
.cv-body > section:first-child h2 { margin-top: 0; }
.cv-body .cv-row { grid-template-columns: 8.5rem 1fr; border-top: 0; padding: 0; gap: 0 28px; }
.cv-body .cv-row > div:last-child { position: relative; padding: 0 0 26px 22px; border-left: 2px solid var(--rule); }
.cv-body .cv-row:last-of-type > div:last-child { border-left-color: transparent; padding-bottom: 4px; }
.cv-body .cv-row > div:last-child::before {
  content: ""; position: absolute; left: -7px; top: 6px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--rule-2);
}
.cv-body .cv-row.now > div:last-child::before { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.cv-body .cv-row .when { text-align: right; padding-top: 1px; line-height: 1.4; }
.cv-row.now .when { color: var(--accent-ink); font-weight: 600; }
.cv-body .cv-row h3 { font-size: 1.02rem; }
.award-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.award { background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); padding: 14px 16px; display: flex; gap: 14px; align-items: flex-start; }
.award .yr { font-size: 13px; font-weight: 700; color: var(--accent-ink); background: var(--accent-soft); border-radius: 6px; padding: 2px 8px; font-variant-numeric: tabular-nums; }
.award h3 { margin: 0; font-size: 0.98rem; line-height: 1.35; }
.award .meta { margin: 2px 0 0; font-size: 13px; }
.skill-groups { display: grid; gap: 18px; }
.skill-groups h3 { margin: 0 0 8px; font-size: 0.95rem; }
.skill-groups ul { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0; }
.skill-groups li { font-size: 13.5px; padding: 3px 10px; border-radius: 6px; background: var(--surface); color: var(--ink-2); border: 1px solid var(--rule); }

@media (max-width: 960px) {
  .cv-layout { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .cv-rail, .cv-rail ol { min-width: 0; }
  .cv-rail { position: static; margin: 0 -24px; padding: 4px 24px 8px; }
  .cv-rail ol { display: flex; gap: 6px; overflow-x: auto; border-left: 0; scrollbar-width: none; }
  .cv-rail a { border: 1px solid var(--rule-2); border-radius: 999px; padding: 3px 12px; margin: 0; white-space: nowrap; }
  .cv-rail a[aria-current="true"] { border-color: var(--accent); background: var(--accent-soft); }
}

/* ---------- phone width ---------- */
@media (max-width: 640px) {
  body { font-size: 16px; }
  .site-header .inner { padding: 12px 16px; gap: 8px 16px; }
  .nav { margin-left: 0; width: 100%; gap: 4px 16px; }
  .theme-toggle { position: absolute; right: 16px; top: 10px; }
  .site-header .inner { position: relative; padding-right: 60px; }
  main { padding: 36px 16px 64px; }
  .hero { grid-template-columns: 1fr; gap: 20px; }
  .photo { width: 120px; height: 120px; }
  .cv-row, .disease, .skills { grid-template-columns: 1fr; gap: 2px; }
  .skills dd { margin-bottom: 10px; }
  h2 { margin-top: 48px; }
  .control select { min-width: 0; width: 100%; }
  .control { flex: 1 1 9rem; }
  .control:has(.toggles) { flex-basis: 100%; }
  .chip { font-size: 13px; padding: 3px 10px 3px 8px; }
  .featured, .project-grid, .award-grid { grid-template-columns: 1fr; }
  .featured .spark { padding: 16px; }
  .project { padding: 18px; }
  .project-head { flex-direction: column-reverse; gap: 6px; }
  .pub-list > li { grid-template-columns: 1fr; }
  .cv-summary { grid-template-columns: 1fr; }
  .cv-rail { margin: 0 -16px; padding: 8px 16px; }
  .cv-body .cv-row { grid-template-columns: minmax(0, 1fr); }
  .cv-body .cv-row .when { text-align: left; padding: 0 0 4px 22px; border-left: 2px solid var(--rule); margin: 0; }
  .cv-body .cv-row:last-of-type .when { border-left-color: var(--rule); }
  .hero .photo { box-shadow: 0 0 0 5px var(--accent-soft); }
}
