/* ==========================================================================
   Veselin Filev — homepage styles
   Tokens first; light is the default, dark via OS setting or the toggle.
   ========================================================================== */

:root {
  color-scheme: light;
  --bg: #f8f7f3;
  --surface: #fffefb;
  --surface-2: #f1efe8;
  --ink: #15171b;
  --ink-2: #474a52;
  --muted: #74777f;
  --line: #e3e0d6;
  --line-strong: #cfcbbf;
  --accent: #1d4f91;
  --accent-ink: #ffffff;
  --accent-hover: #163d71;
  --accent-soft: #e5edf8;
  --accent-wash: rgba(29, 79, 145, 0.10);
  --focus: #1d4f91;

  /* chart series (validated categorical slots 1–5) */
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4;
  --chart-grid: #e7e4db;
  --chart-axis: #c8c4b8;

  /* canvas art */
  --art-line: rgba(29, 54, 92, 0.16);
  --art-boundary: rgba(29, 54, 92, 0.45);
  --art-curve: #1d4f91;
  --art-wedge: rgba(42, 120, 214, 0.13);
  --art-ref: #8f8a7e;
  --art-nn: #eb6834;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(20, 22, 26, 0.04), 0 8px 24px rgba(20, 22, 26, 0.06);
  --maxw: 1140px;
  --gutter: clamp(16px, 4vw, 40px);
  --header-h: 64px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f1114;
    --surface: #15181d;
    --surface-2: #1c2026;
    --ink: #eceef2;
    --ink-2: #b8bdc6;
    --muted: #8b919b;
    --line: #262b33;
    --line-strong: #353b45;
    --accent: #84b4ff;
    --accent-ink: #0d1726;
    --accent-hover: #a7c9ff;
    --accent-soft: #1a2638;
    --accent-wash: rgba(132, 180, 255, 0.12);
    --focus: #84b4ff;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181;
    --chart-grid: #232830;
    --chart-axis: #3a404a;
    --art-line: rgba(170, 196, 235, 0.13);
    --art-boundary: rgba(170, 196, 235, 0.45);
    --art-curve: #84b4ff;
    --art-wedge: rgba(57, 135, 229, 0.18);
    --art-ref: #7d828b;
    --art-nn: #f08a5d;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1114;
  --surface: #15181d;
  --surface-2: #1c2026;
  --ink: #eceef2;
  --ink-2: #b8bdc6;
  --muted: #8b919b;
  --line: #262b33;
  --line-strong: #353b45;
  --accent: #84b4ff;
  --accent-ink: #0d1726;
  --accent-hover: #a7c9ff;
  --accent-soft: #1a2638;
  --accent-wash: rgba(132, 180, 255, 0.12);
  --focus: #84b4ff;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181;
  --chart-grid: #232830;
  --chart-axis: #3a404a;
  --art-line: rgba(170, 196, 235, 0.13);
  --art-boundary: rgba(170, 196, 235, 0.45);
  --art-curve: #84b4ff;
  --art-wedge: rgba(57, 135, 229, 0.18);
  --art-ref: #7d828b;
  --art-nn: #f08a5d;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 12px); -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16.5px/1.6 var(--sans);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0; letter-spacing: -0.005em; }
p { margin: 0 0 1em; }
sub, sup { line-height: 0; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -48px; background: var(--accent); color: var(--accent-ink); padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { top: 12px; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s ease;
}
.site-header.scrolled { border-bottom-color: var(--line); }
.site-header .wrap { display: flex; align-items: center; gap: 16px; height: var(--header-h); }
.brand { font-family: var(--serif); font-weight: 600; font-size: 1.12rem; color: var(--ink); text-decoration: none; white-space: nowrap; }
.brand span { color: var(--muted); font-family: var(--sans); font-weight: 400; font-size: .85rem; margin-left: 8px; }
.nav { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.nav a {
  color: var(--ink-2); text-decoration: none; font-size: .93rem; padding: 8px 11px; border-radius: 999px;
  transition: background-color .15s ease, color .15s ease;
}
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a.active { color: var(--accent); background: var(--accent-wash); }
.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; flex: none;
}
.icon-btn:hover { color: var(--ink); border-color: var(--line-strong); }
.icon-btn svg { width: 18px; height: 18px; }
.menu-btn { display: none; }
@media (max-width: 920px) {
  .brand span { display: none; }
  .menu-btn { display: inline-grid; margin-left: auto; }
  .nav {
    position: absolute; left: 0; right: 0; top: var(--header-h); margin: 0;
    flex-direction: column; align-items: stretch; gap: 0; padding: 8px var(--gutter) 16px;
    background: var(--bg); border-bottom: 1px solid var(--line); box-shadow: var(--shadow);
    display: none;
  }
  .nav.open { display: flex; }
  .nav a { border-radius: 10px; padding: 12px 12px; font-size: 1rem; }
}

/* ---------- hero ---------- */
.hero { padding: clamp(28px, 6vw, 72px) 0 clamp(32px, 6vw, 64px); }
.hero .wrap { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); gap: clamp(24px, 5vw, 64px); align-items: center; }
.eyebrow { font-size: .8rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 0 0 14px; font-weight: 600; }
.hero h1 { font-size: clamp(2.5rem, 6.2vw, 4.1rem); line-height: 1.02; margin-bottom: 18px; letter-spacing: -0.015em; }
.roles { list-style: none; padding: 0; margin: 0 0 22px; display: grid; gap: 6px; }
.roles li { color: var(--ink-2); font-size: 1.02rem; display: flex; gap: 10px; align-items: baseline; }
.roles li::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; transform: translateY(-2px); }
.roles strong { color: var(--ink); font-weight: 600; }
.lede { font-family: var(--serif); font-size: clamp(1.15rem, 2.1vw, 1.32rem); line-height: 1.5; color: var(--ink); max-width: 40ch; margin-bottom: 26px; }
.btns { display: flex; flex-wrap: wrap; gap: 10px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 999px;
  font-size: .95rem; font-weight: 500; text-decoration: none; border: 1px solid var(--line-strong);
  color: var(--ink); background: var(--surface); cursor: pointer; transition: border-color .15s, background-color .15s, color .15s;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); }
.btn svg { width: 16px; height: 16px; }
.btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.disk-figure { margin: 0; position: relative; }
.disk-figure canvas { width: 100%; aspect-ratio: 1 / 1; display: block; touch-action: pan-y; cursor: crosshair; }
.disk-figure figcaption { font-size: .86rem; color: var(--muted); margin-top: 10px; text-align: center; line-height: 1.45; }
.disk-readout {
  display: table; margin: 6px auto 0; min-height: 1.3em;
  font: 500 .82rem/1.3 var(--mono); color: var(--ink-2); background: var(--surface);
  border: 1px solid var(--line); padding: 6px 12px; border-radius: 999px; white-space: nowrap;
}
.disk-readout sub { font-size: .75em; }
@media (max-width: 860px) {
  .hero .wrap { grid-template-columns: 1fr; }
  .disk-figure { max-width: 460px; width: 100%; justify-self: center; }
}

/* ---------- sections ---------- */
section.block { padding: clamp(48px, 8vw, 96px) 0; border-top: 1px solid var(--line); }
.section-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 16px; margin-bottom: clamp(24px, 4vw, 40px); }
.section-head h2 { font-size: clamp(1.8rem, 3.6vw, 2.5rem); }
.section-head .kicker { display: block; font-family: var(--sans); font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); font-weight: 600; margin-bottom: 10px; }
.section-head p { color: var(--ink-2); max-width: 62ch; margin: 12px 0 0; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }

/* ---------- about ---------- */
.about-grid { display: grid; grid-template-columns: 260px minmax(0, 1fr) minmax(0, .9fr); gap: clamp(24px, 4vw, 48px); align-items: start; }
.portrait { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); }
.portrait img { width: 100%; height: auto; aspect-ratio: 348 / 412; object-fit: cover; }
.bio p { font-size: 1.03rem; color: var(--ink-2); }
.bio p:first-child { color: var(--ink); }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 8px; bottom: 8px; width: 1px; background: var(--line-strong); }
.timeline li { position: relative; padding: 0 0 16px 26px; }
.timeline li::before { content: ""; position: absolute; left: 0; top: 7px; width: 11px; height: 11px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line-strong); }
.timeline li.now::before { border-color: var(--accent); background: var(--accent); }
.timeline .yr { font: 600 .78rem/1.2 var(--mono); color: var(--muted); display: block; margin-bottom: 2px; }
.timeline .what { font-weight: 600; color: var(--ink); display: block; font-size: .97rem; }
.timeline .where { color: var(--ink-2); font-size: .92rem; }
.career h3 { font-family: var(--sans); font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 0 0 14px; font-weight: 600; }
@media (max-width: 980px) {
  .about-grid { grid-template-columns: 200px minmax(0, 1fr); }
  .about-grid .career { grid-column: 1 / -1; }
}
@media (max-width: 600px) {
  .about-grid { grid-template-columns: 1fr; }
  .portrait { max-width: 220px; }
}

/* ---------- research ---------- */
.themes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.theme {
  padding: 22px 22px 18px; position: relative; overflow: hidden;
}
.theme::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c, var(--s1)); }
.theme header { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; margin-bottom: 8px; }
.theme h3 { font-size: 1.28rem; }
.theme .span { font: 500 .8rem/1 var(--mono); color: var(--muted); white-space: nowrap; }
.theme p { color: var(--ink-2); font-size: .98rem; margin-bottom: 12px; }
.theme .key { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 6px; }
.theme .key li { font-size: .9rem; line-height: 1.4; }
.theme .key a { text-decoration: none; }
.theme .key a:hover { text-decoration: underline; }
.theme .key .cite { color: var(--muted); font-size: .8rem; white-space: nowrap; }
.theme .more { background: none; border: 0; padding: 0; color: var(--accent); font: 500 .9rem var(--sans); cursor: pointer; }
.theme .more:hover { text-decoration: underline; }
.theme.featured { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.25fr); gap: 28px; padding: 26px; }
.stats-row.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .stats-row.four { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.theme.featured .badge-new { display: inline-block; font: 600 .7rem/1 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--accent); background: var(--accent-wash); padding: 5px 8px; border-radius: 999px; margin-bottom: 10px; }
@media (max-width: 860px) {
  .themes { grid-template-columns: 1fr; }
  .theme.featured { grid-template-columns: 1fr; }
}

/* demo panels */
.demo { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.demo-title { font: 600 .95rem/1.3 var(--sans); margin: 0 0 4px; color: var(--ink); }
.demo-sub { font-size: .85rem; color: var(--muted); margin: 0 0 12px; }
.demo canvas { width: 100%; display: block; border-radius: 10px; background: var(--surface); }
.demo .controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.demo .btn { padding: 7px 13px; font-size: .88rem; }
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 8px; margin-top: 12px; }
.stat-mini { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.stat-mini .l { font-size: .74rem; color: var(--muted); display: block; }
.stat-mini .v { font: 600 .95rem/1.3 var(--mono); color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.nn-wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .9fr); gap: 12px; align-items: stretch; }
.nn-wrap .loss canvas { height: 100%; min-height: 150px; }
@media (max-width: 520px) { .nn-wrap { grid-template-columns: 1fr; } .nn-wrap .loss canvas { min-height: 130px; } }

/* ---------- publications ---------- */
.stat-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.tile { padding: 16px 18px; }
.tile .label { font-size: .84rem; color: var(--muted); display: block; margin-bottom: 2px; }
.tile .value { display: block; font: 600 clamp(1.6rem, 3.6vw, 2.2rem)/1.15 var(--sans); color: var(--ink); }
.tile .note { display: block; }
.tile .note { font-size: .8rem; color: var(--muted); }
@media (max-width: 520px) { .stat-tiles { gap: 8px; } .tile { padding: 12px; } }

.chart-card { padding: 18px 18px 12px; margin-bottom: 18px; }
.chart-card h3 { font-family: var(--sans); font-size: 1rem; font-weight: 600; }
.chart-card .sub { font-size: .85rem; color: var(--muted); margin: 2px 0 10px; }
.legend { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 12px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-2); font: 500 .86rem/1.2 var(--sans); text-align: left; cursor: pointer; transition: border-color .15s, background-color .15s, color .15s, opacity .15s;
}
.chip:hover { border-color: var(--line-strong); color: var(--ink); }
.chip .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; }
.chip[aria-pressed="true"] { border-color: var(--ink-2); color: var(--ink); background: var(--surface-2); }
.chip .n { color: var(--muted); font-variant-numeric: tabular-nums; }
.dotplot { width: 100%; overflow: visible; display: block; }
.dotplot .grid { stroke: var(--chart-grid); stroke-width: 1; }
.dotplot .axis { stroke: var(--chart-axis); stroke-width: 1; }
.dotplot text { fill: var(--muted); font: 11px var(--sans); font-variant-numeric: tabular-nums; }
.dotplot circle.p { stroke: var(--surface); stroke-width: 2; cursor: pointer; transition: opacity .2s; }
.dotplot circle.p.dim { opacity: .16; }
.dotplot circle.hit { fill: transparent; cursor: pointer; }
.dotplot circle.p.hl { stroke: var(--ink); }
.tooltip {
  position: fixed; z-index: 80; pointer-events: none; max-width: 320px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: var(--shadow);
  padding: 10px 12px; font-size: .85rem; line-height: 1.4; opacity: 0; transform: translateY(4px); transition: opacity .12s, transform .12s;
}
.tooltip.show { opacity: 1; transform: none; }
.tooltip .tt-title { font-weight: 600; margin-bottom: 4px; }
.tooltip .tt-meta { color: var(--ink-2); }
.tooltip .tt-key { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }

.pub-tools { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; margin: 22px 0 6px; }
.search { position: relative; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); }
.search input, .select {
  width: 100%; font: 15px var(--sans); color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 999px; padding: 10px 14px 10px 36px; outline: none;
}
.select { padding: 10px 34px 10px 14px; width: auto; appearance: none; -webkit-appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 52%, calc(100% - 13px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
.search input:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
.result-count { font-size: .86rem; color: var(--muted); margin: 6px 2px 10px; }
.pub-list { list-style: none; margin: 0; padding: 0; }
.pub {
  display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 14px; padding: 16px 4px; border-top: 1px solid var(--line);
  transition: background-color .4s;
}
.pub:first-child { border-top: 0; }
.pub.flash { background: var(--accent-wash); }
.pub .yr { font: 600 .86rem/1.5 var(--mono); color: var(--muted); display: flex; align-items: baseline; gap: 8px; }
.pub .yr .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); flex: none; transform: translateY(-1px); }
.pub .ttl { font-family: var(--serif); font-size: 1.07rem; font-weight: 600; line-height: 1.35; color: var(--ink); text-decoration: none; }
.pub a.ttl:hover { color: var(--accent); text-decoration: underline; }
.pub .au { color: var(--ink-2); font-size: .92rem; margin-top: 3px; }
.pub .au b { color: var(--ink); font-weight: 600; }
.pub .jr { color: var(--muted); font-size: .88rem; }
.pub .links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pill {
  display: inline-flex; align-items: center; gap: 5px; font: 500 .78rem/1 var(--sans); padding: 5px 9px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--ink-2); text-decoration: none; background: var(--surface);
}
.pill:hover { border-color: var(--accent); color: var(--accent); }
.pub .cites { text-align: right; white-space: nowrap; }
.pub .cites .v { font: 600 1.05rem/1.2 var(--sans); color: var(--ink); display: block; }
.pub .cites .l { font-size: .74rem; color: var(--muted); }
.pub mark { background: var(--accent-wash); color: inherit; border-radius: 3px; padding: 0 1px; }
.empty { padding: 28px 0; color: var(--muted); text-align: center; }
.show-all { display: flex; justify-content: center; padding: 18px 0 4px; border-top: 1px solid var(--line); }
.data-note { font-size: .82rem; color: var(--muted); margin-top: 16px; }
@media (max-width: 640px) {
  .pub { grid-template-columns: minmax(0, 1fr) auto; }
  .pub .yr { grid-column: 1 / -1; }
  .pub-tools { grid-template-columns: 1fr; }
  .select { width: 100%; }
}

/* ---------- talks ---------- */
.talk-years { display: grid; gap: 28px; }
.talk-year { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 16px; }
.talk-year > h3 { font: 600 1.4rem/1.2 var(--serif); color: var(--muted); position: sticky; top: calc(var(--header-h) + 16px); align-self: start; }
.talk-list { display: grid; gap: 12px; }
@media (min-width: 960px) { .talk-list { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; } }
.talk { padding: 16px 18px; }
.talk .when { font: 500 .8rem/1.3 var(--mono); color: var(--muted); }
.talk h4 { font-size: 1.12rem; margin: 4px 0 4px; }
.talk .ev { color: var(--ink-2); font-size: .94rem; }
.talk .pl { color: var(--muted); font-size: .88rem; }
.talk .tags { display: inline-flex; gap: 6px; flex-wrap: wrap; margin-left: 6px; vertical-align: 2px; }
.tag { font: 600 .68rem/1 var(--sans); letter-spacing: .06em; text-transform: uppercase; padding: 4px 7px; border-radius: 999px; background: var(--accent-wash); color: var(--accent); }
.talk details { margin-top: 8px; }
.talk summary { cursor: pointer; color: var(--accent); font-size: .88rem; font-weight: 500; list-style: none; display: inline-flex; align-items: center; gap: 6px; }
.talk summary::-webkit-details-marker { display: none; }
.talk summary::before { content: "+"; font-family: var(--mono); }
.talk details[open] summary::before { content: "–"; }
.talk details p { color: var(--ink-2); font-size: .93rem; margin: 8px 0 0; }
.talk .links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.earlier { margin-top: 28px; }
.earlier > summary { cursor: pointer; font: 600 1rem var(--sans); color: var(--accent); padding: 12px 0; list-style: none; }
.earlier > summary::-webkit-details-marker { display: none; }
.earlier table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.earlier td { padding: 8px 10px 8px 0; border-top: 1px solid var(--line); vertical-align: top; }
.earlier td:first-child { font: 500 .8rem/1.6 var(--mono); color: var(--muted); white-space: nowrap; width: 84px; }
.earlier td:nth-child(2) { color: var(--ink-2); width: 44%; }
@media (max-width: 640px) {
  .talk-year { grid-template-columns: 1fr; gap: 8px; }
  .talk-year > h3 { position: static; }
  .earlier td:nth-child(2) { width: auto; }
  .earlier tr { display: grid; grid-template-columns: 84px 1fr; }
  .earlier td:nth-child(3) { grid-column: 2; border-top: 0; padding-top: 0; }
}

/* ---------- teaching ---------- */
.teach-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.course-group { padding: 20px; }
.course-group h3 { font-family: var(--sans); font-size: .8rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }
.course { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); align-items: baseline; }
.course:first-of-type { border-top: 0; padding-top: 0; }
.course code { font: 600 .82rem/1.4 var(--mono); color: var(--accent); }
.course span { color: var(--ink); font-size: .97rem; line-height: 1.4; }
.teach-other { margin-top: 18px; padding: 20px; }
.teach-other h3 { font-family: var(--sans); font-size: .8rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }
.teach-other ul { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 28px; }
.teach-other li { font-size: .95rem; color: var(--ink-2); }
.teach-other li b { color: var(--ink); font-weight: 600; }
@media (max-width: 900px) { .teach-grid { grid-template-columns: 1fr; } .teach-other ul { grid-template-columns: 1fr; } }

/* ---------- beyond ---------- */
.beyond-grid { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: clamp(20px, 4vw, 40px); align-items: start; }
.interest { padding: 18px 20px; display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 14px; margin-bottom: 12px; }
.interest .ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-wash); color: var(--accent); }
.interest .ico svg { width: 22px; height: 22px; }
.interest h3 { font-family: var(--sans); font-size: 1.02rem; margin-bottom: 4px; }
.interest p { color: var(--ink-2); font-size: .94rem; margin: 0; }
.mc-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.mc-grid canvas { height: 210px; }
.sliders { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.slider label { display: flex; justify-content: space-between; font-size: .82rem; color: var(--ink-2); margin-bottom: 4px; }
.slider label output { font: 600 .82rem var(--mono); color: var(--ink); }
.slider input[type=range] { width: 100%; accent-color: var(--accent); }
@media (max-width: 900px) { .beyond-grid { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .mc-grid { grid-template-columns: 1fr; } .sliders { grid-template-columns: 1fr; } }

/* ---------- contact ---------- */
.contact-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.contact-card { padding: 20px; }
.contact-card h3 { font-family: var(--sans); font-size: .8rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.contact-card address { font-style: normal; color: var(--ink-2); line-height: 1.6; }
.contact-card address strong { color: var(--ink); }
.profiles { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.profiles a { display: flex; align-items: center; justify-content: space-between; gap: 10px; text-decoration: none; color: var(--ink); padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); }
.profiles a:hover { border-color: var(--accent); color: var(--accent); }
.profiles a span { color: var(--muted); font-size: .82rem; }
@media (max-width: 900px) { .contact-grid { grid-template-columns: 1fr; } }

footer.site-footer { border-top: 1px solid var(--line); padding: 28px 0 40px; color: var(--muted); font-size: .86rem; }
footer.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; }

/* reveal on scroll (only when JS is present) */
.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s ease; }
.js .reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .js .reveal { opacity: 1; transform: none; transition: none; } }

@media print {
  .site-header, .disk-figure, .demo, .btns, .pub-tools, .legend, .chart-card { display: none !important; }
  body { background: #fff; color: #000; }
  section.block { border: 0; padding: 18px 0; }
  .card { box-shadow: none; }
  .js .reveal { opacity: 1; transform: none; }
}
