/* ===========================================================
   Design tokens
   =========================================================== */
:root {
  --bg: #f7f6f2;
  --surface: #ffffff;
  --surface-2: #f0eee8;
  --text: #1b1f27;
  --muted: #59626f;
  --faint: #8b929c;
  --border: #e4e1d8;
  --accent: #2c55c9;
  --accent-soft: rgba(44, 85, 201, 0.08);
  --conf: #2c55c9;   --conf-soft: rgba(44, 85, 201, 0.10);
  --jour: #0d7f6f;   --jour-soft: rgba(13, 127, 111, 0.10);
  --work: #b45309;   --work-soft: rgba(180, 83, 9, 0.10);
  --pat:  #7c3aed;   --pat-soft:  rgba(124, 58, 237, 0.10);
  --new: #dc2626;
  --ok: #16a34a;
  --shadow: 0 1px 2px rgba(20, 24, 33, 0.04), 0 8px 24px rgba(20, 24, 33, 0.06);
  --glow-1: rgba(44, 85, 201, 0.10);
  --glow-2: rgba(13, 127, 111, 0.08);

  --serif: "Source Serif 4", Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "PingFang SC", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --radius: 14px;
}

:root[data-theme="dark"] {
  --bg: #0d0f13; --surface: #151820; --surface-2: #1b1f29; --text: #e6e8ed;
  --muted: #a1a9b5; --faint: #6c7480; --border: #252a35;
  --accent: #8fa9ff; --accent-soft: rgba(143, 169, 255, 0.12);
  --conf: #8fa9ff; --conf-soft: rgba(143, 169, 255, 0.14);
  --jour: #4fd1bd; --jour-soft: rgba(79, 209, 189, 0.13);
  --work: #f5a35c; --work-soft: rgba(245, 163, 92, 0.13);
  --pat:  #b79cff; --pat-soft:  rgba(183, 156, 255, 0.14);
  --new: #f87171; --ok: #4ade80;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
  --glow-1: rgba(143, 169, 255, 0.10); --glow-2: rgba(79, 209, 189, 0.06);
}

/* ===========================================================
   Base
   =========================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 86px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15.5px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background-color .3s, color .3s;
}
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(900px 500px at 8% -10%, var(--glow-1), transparent 60%),
    radial-gradient(700px 500px at 100% 0%, var(--glow-2), transparent 60%);
}
a { color: var(--accent); text-decoration: none; text-underline-offset: 3px; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
p { margin: 0 0 .9em; }
h1, h2, h3, h4 { margin: 0; }

/* ===========================================================
   Top bar
   =========================================================== */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.topbar.scrolled { border-bottom-color: var(--border); }
.topbar-inner {
  max-width: 1180px; margin: 0 auto; padding: 0 24px;
  height: 66px; display: flex; align-items: center; gap: 24px;
}
.brand {
  font-family: var(--serif); font-weight: 700; font-size: 24px; letter-spacing: -.01em;
  color: var(--text); white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.nav { display: flex; gap: 4px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  color: var(--muted); font-size: 14px; font-weight: 500;
  padding: 6px 12px; border-radius: 999px; white-space: nowrap;
  transition: color .15s, background-color .15s;
}
.nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav a.active { color: var(--accent); background: var(--accent-soft); }
.theme-toggle {
  flex: none; width: 36px; height: 36px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  cursor: pointer; display: grid; place-items: center; font-size: 14px;
  transition: color .15s, transform .2s;
}
.theme-toggle:hover { color: var(--text); transform: rotate(-15deg); }
.icon-sun { display: none; }
:root[data-theme="dark"] .icon-sun { display: inline; }
:root[data-theme="dark"] .icon-moon { display: none; }

/* ===========================================================
   Layout
   =========================================================== */
.page {
  max-width: 1180px; margin: 0 auto; padding: 40px 24px 40px;
  display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 64px;
}
.content { max-width: 780px; min-width: 0; }

/* ===========================================================
   Profile card
   =========================================================== */
.profile { position: sticky; top: 98px; align-self: start; }
.profile-text { text-align: center; }
.avatar { max-width: 200px; margin: 0 auto 20px; }
.avatar img {
  width: 100%; aspect-ratio: 3 / 4; object-fit: cover; height: auto;
  border-radius: 18px; box-shadow: var(--shadow);
}
.avatar figcaption { font-size: 12px; color: var(--faint); margin-top: 8px; text-align: center; }
.name { font-family: var(--serif); font-size: 32px; font-weight: 700; letter-spacing: -.01em; line-height: 1.15; }
.name-alt { color: var(--faint); font-size: 14px; margin: 2px 0 12px; }
.role { font-weight: 600; margin: 10px 0 2px; }
.org { color: var(--muted); font-size: 14px; line-height: 1.5; }
.org a { color: inherit; }
.org { margin-bottom: 6px; }
.address { font-size: 13px; color: var(--muted); line-height: 1.5; margin: 0 0 .9em; }
.address i { color: var(--faint); font-size: 12px; margin-right: 6px; }
.address a { color: inherit; }
.address a:hover { color: var(--accent); }
.status {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 500; color: var(--text);
  background: var(--surface); border: 1px solid var(--border);
  padding: 5px 12px; border-radius: 999px; margin: 4px 0 16px;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); position: relative; }
.dot::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 2px solid var(--ok); opacity: 0; animation: pulse 2.2s ease-out infinite;
}
@keyframes pulse { 0% { transform: scale(.5); opacity: .7; } 100% { transform: scale(1.4); opacity: 0; } }
.social { display: flex; justify-content: center; gap: 8px; margin-bottom: 14px; }
.social a {
  width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--border); color: var(--muted); font-size: 17px;
  transition: color .15s, border-color .15s, transform .15s;
}
.social a:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-2px); text-decoration: none; }
.social .social-text { font-size: 11px; font-weight: 700; letter-spacing: -.01em; font-family: var(--mono); }
.cv-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  background: var(--text); color: var(--bg); font-weight: 600; font-size: 14px;
  padding: 10px 16px; border-radius: 10px; transition: opacity .15s, transform .15s;
}
.cv-button:hover { text-decoration: none; opacity: .88; transform: translateY(-1px); }
.email { font-size: 13px; color: var(--muted); margin-top: 12px; word-break: break-all; }
.email a { color: inherit; display: inline-flex; align-items: center; gap: 6px; }
.email a:hover { color: var(--accent); }

/* ===========================================================
   Sections
   =========================================================== */
.section { padding: 8px 0 44px; }
.section-title {
  font-family: var(--serif); font-size: 26px; font-weight: 700; letter-spacing: -.01em;
  display: flex; align-items: center; gap: 14px; margin-bottom: 20px;
}
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.sub-title {
  font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
  color: var(--faint); margin: 28px 0 12px;
}
.lead { font-size: 17px; }
.note { font-size: 13px; color: var(--muted); }

.chips { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, max-content); gap: 8px; }
.chips li { justify-self: stretch; }
.chips li {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  padding: 7px 14px; border-radius: 999px; font-size: 14px; font-weight: 500;
}
.chips i { color: var(--accent); font-size: 13px; }

/* About: diagrams */
.diagrams {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px;
  margin: 22px 0 24px;
}
.diagram {
  position: relative;
  margin: 0; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 14px 10px;
}
.diagram svg { width: 100%; height: auto; display: block; overflow: visible; }
.diagram figcaption { font-size: 13px; color: var(--muted); text-align: center; margin-top: 4px; }
.diagram text { font-family: var(--sans); }
.fig-ctrl {
  position: absolute; top: 10px; left: 10px; z-index: 2;
  width: 26px; height: 26px; border-radius: 999px;
  display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--border); color: var(--faint);
  font-size: 10px; cursor: pointer; opacity: .75;
  transition: color .15s, border-color .15s, opacity .15s, background-color .15s;
}
.fig-ctrl:hover { color: var(--text); border-color: var(--faint); opacity: 1; }
.fig-stage { transition: opacity .3s ease; }
.diagram[data-focus="1"] .fig-stage-2,
.diagram[data-focus="1"] .fig-stage-3,
.diagram[data-focus="1"] .fig-stage-4,
.diagram[data-focus="2"] .fig-stage-1,
.diagram[data-focus="2"] .fig-stage-3,
.diagram[data-focus="2"] .fig-stage-4,
.diagram[data-focus="3"] .fig-stage-1,
.diagram[data-focus="3"] .fig-stage-2,
.diagram[data-focus="3"] .fig-stage-4,
.diagram[data-focus="4"] .fig-stage-1,
.diagram[data-focus="4"] .fig-stage-2,
.diagram[data-focus="4"] .fig-stage-3 { opacity: .22; }
.fig-car { pointer-events: none; }
.fig-car-fix-body { fill: var(--ok); }
.fig-car-enf-body { fill: var(--pat); }
.fig-pulse-bad { fill: none; stroke: var(--new); stroke-width: 1.5; opacity: 0; transform-box: fill-box; transform-origin: center; }
.fig-pulse-explain { fill: none; stroke: var(--work); stroke-width: 1.6; opacity: 0; transform-box: fill-box; transform-origin: center; }
.fig-pulse-enf { fill: none; stroke: var(--pat); stroke-width: 1.6; opacity: 0; transform-box: fill-box; transform-origin: center; }
.fig-stage-2.is-pulsing #figDecisionPulse,
.fig-stage-4.is-pulsing #figEnfPulse { animation: figRing 1.4s ease-out infinite; }
.fig-stage-1.is-pulsing #figPulseBad { animation: figRingRect 1.2s ease-out 1; }
.fig-stage-2.is-pulsing .fig-net-bad .fig-net-hl,
.fig-stage-3.is-pulsing .fig-net-fixed .fig-net-hl,
.fig-stage-4.is-pulsing .fig-shield-icon { animation: figGlow 1.1s ease-in-out infinite alternate; }
@keyframes figRing {
  0% { transform: scale(1); opacity: .75; }
  100% { transform: scale(2.8); opacity: 0; }
}
@keyframes figRingRect {
  0% { transform: scale(1); opacity: .75; }
  100% { transform: scale(1.35, 1.65); opacity: 0; }
}
@keyframes figGlow {
  0% { stroke-width: 2.2; opacity: .75; }
  100% { stroke-width: 3.4; opacity: 1; }
}
.diagrams.cols-1 { grid-template-columns: 1fr; }
.fig-text { font-size: 11.5px; font-weight: 400; fill: var(--muted); letter-spacing: .01em; }
.fig-text-ego { fill: var(--accent); font-weight: 500; }
.fig-text-bad { fill: var(--new); font-weight: 500; }
.fig-text-fix { fill: var(--ok); }
.fig-text-enf { fill: var(--pat); font-weight: 500; }
.fig-text-hazard { fill: var(--muted); font-size: 11px; }
.fig-lane-edge { stroke: var(--faint); stroke-width: 1.2; opacity: .7; }
.fig-lane-mid { stroke: var(--faint); stroke-width: 1.2; stroke-dasharray: 10 8; opacity: .6; }
.fig-ego { fill: var(--accent); }
.fig-obstacle { fill: var(--faint); }
.fig-hazard { fill: color-mix(in srgb, var(--new) 14%, var(--surface-2)); stroke: var(--new); stroke-width: 1.2; stroke-dasharray: 4 3; }
.fig-blocked { stroke: var(--new); stroke-width: 1; stroke-dasharray: 3 4; opacity: .45; }
.fig-footprint-bad { fill: color-mix(in srgb, var(--new) 12%, transparent); stroke: var(--new); stroke-width: 1.5; }
.fig-footprint-fix { fill: color-mix(in srgb, var(--ok) 12%, var(--surface)); stroke: var(--ok); stroke-width: 1.5; }
.fig-footprint-enf { fill: color-mix(in srgb, var(--pat) 14%, var(--surface)); stroke: var(--pat); stroke-width: 1.5; }
.fig-traj { stroke: var(--accent); stroke-width: 1.3; opacity: .55; }
.fig-step { fill: var(--accent); }
.fig-traj-fix { fill: none; stroke: var(--ok); stroke-width: 1.3; opacity: .7; }
.fig-step-fix { fill: var(--ok); }
.fig-traj-enf { fill: none; stroke: var(--pat); stroke-width: 1.3; opacity: .75; }
.fig-step-enf { fill: var(--pat); }
.fig-decision { fill: var(--surface); stroke: var(--work); stroke-width: 2; }
.fig-enf-node { fill: var(--surface); stroke: var(--pat); stroke-width: 2; }
.fig-explain { fill: none; stroke: var(--work); stroke-width: 1.2; stroke-dasharray: 4 4; }
.fig-explain-head { fill: var(--work); }
.fig-link-fix { fill: none; stroke: var(--ok); stroke-width: 1.2; stroke-dasharray: 4 4; }
.fig-fix-head { fill: var(--ok); }
.fig-link-enf { fill: none; stroke: var(--pat); stroke-width: 1.2; stroke-dasharray: 4 4; }
.fig-enf-head { fill: var(--pat); }
.fig-shield-icon { fill: color-mix(in srgb, var(--pat) 12%, transparent); stroke: var(--pat); stroke-width: 1.7; stroke-linejoin: round; }
.fig-shield-check { fill: none; stroke: var(--pat); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.fig-net-panel { fill: var(--surface); stroke: var(--border); stroke-width: 1; }
.fig-net-edge line { stroke: var(--faint); stroke-width: .8; opacity: .45; }
.fig-net-node circle { fill: var(--surface); stroke: var(--accent); stroke-width: 1.5; }
.fig-net-hl { stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.fig-net-bad { color: var(--work); }
.fig-net-fixed { color: var(--ok); }
.fig-on { font-size: 13px; font-weight: 700; stroke: var(--surface); stroke-width: 6px; stroke-linejoin: round; paint-order: stroke; }
.fig-on-bad { fill: var(--new); stroke: none; }
.fig-on-explain { fill: var(--work); }
.fig-on-fix { fill: var(--ok); }
.fig-on-enf { fill: var(--pat); }

/* About: find / explain / fix / enforce */
.steps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 14px 0 24px; }
.step {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 16px 14px; display: flex; flex-direction: column;
  transition: border-color .25s ease, box-shadow .25s ease, transform .2s ease;
}
.step:nth-child(1).is-active { border-color: color-mix(in srgb, var(--new) 55%, var(--border)); box-shadow: 0 2px 14px color-mix(in srgb, var(--new) 12%, transparent); }
.step:nth-child(2).is-active { border-color: color-mix(in srgb, var(--work) 55%, var(--border)); box-shadow: 0 2px 14px color-mix(in srgb, var(--work) 12%, transparent); }
.step:nth-child(3).is-active { border-color: color-mix(in srgb, var(--ok) 55%, var(--border)); box-shadow: 0 2px 14px color-mix(in srgb, var(--ok) 12%, transparent); }
.step:nth-child(4).is-active { border-color: color-mix(in srgb, var(--pat) 55%, var(--border)); box-shadow: 0 2px 14px color-mix(in srgb, var(--pat) 12%, transparent); }
.step-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.step-num { font-size: 16px; font-weight: 700; color: var(--faint); }
.step:nth-child(1) .step-num { color: var(--new); }
.step:nth-child(2) .step-num { color: var(--work); }
.step:nth-child(3) .step-num { color: var(--ok); }
.step:nth-child(4) .step-num { color: var(--pat); }
.step h4 { font-size: 16px; font-weight: 700; }
.step p { font-size: 14px; margin: 0; }
.step .step-ref { font-size: 12.5px; color: var(--faint); margin-top: auto; padding-top: 10px; }

.callout {
  display: flex; gap: 14px; align-items: flex-start; margin-top: 24px;
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  border-radius: var(--radius); padding: 14px 18px;
}
.callout i { color: var(--accent); margin-top: 4px; }
.callout p { margin: 0; }

/* News */
.news { list-style: none; padding: 0; margin: 0; }
.news li {
  display: grid; grid-template-columns: 96px 1fr; gap: 16px;
  padding: 10px 0; border-bottom: 1px dashed var(--border);
}
.news li:last-child { border-bottom: 0; }
.news time, .talks time, .awards time {
  font-family: var(--mono); font-size: 12.5px; color: var(--faint); padding-top: 3px; white-space: nowrap;
}
.news p { margin: 0; }
.news.collapsed li.extra { display: none; }
.new {
  display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: #fff; background: var(--new); border-radius: 4px; padding: 1px 6px; margin-right: 8px;
  vertical-align: 2px;
}
.news-icon { color: #d4a017; margin-right: 6px; }
.more-button {
  margin-top: 12px; background: none; border: 1px solid var(--border); color: var(--muted);
  font: 500 13px var(--sans); padding: 7px 14px; border-radius: 999px; cursor: pointer;
}
.more-button:hover { color: var(--text); border-color: var(--faint); }
.more-button i { font-size: 10px; margin-left: 4px; transition: transform .2s; }
.more-button.open i { transform: rotate(180deg); }

/* Publications */
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 0 4px; }
.filter {
  font: 500 13px var(--sans); color: var(--muted);
  background: var(--surface); border: 1px solid var(--border);
  padding: 6px 14px; border-radius: 999px; cursor: pointer; transition: all .15s;
}
.filter:hover { color: var(--text); }
.filter.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.pub-group.hidden, .pub.hidden { display: none; }
.filters-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin: 16px 0 4px; }
.filters-row .filters { margin: 0; }
.filters[hidden] { display: none; }
.view-toggle {
  display: inline-flex; padding: 3px; gap: 2px; flex: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
}
.view-toggle button {
  font: 500 13px var(--sans); color: var(--muted); background: none; border: 0;
  padding: 4px 12px; border-radius: 999px; cursor: pointer; transition: all .15s;
}
.view-toggle button:hover { color: var(--text); }
.view-toggle button.active { background: var(--accent-soft); color: var(--accent); }
.pub {
  display: grid; grid-template-columns: 118px 1fr; gap: 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; margin-bottom: 12px;
  transition: transform .2s, box-shadow .2s, border-color .2s;
}
.pub:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--accent) 30%, var(--border)); }
.venue {
  align-self: start; justify-self: start; display: inline-flex; align-items: baseline; gap: 5px;
  white-space: nowrap; border-radius: 7px; padding: 4px 10px; margin-top: 1px;
  font-weight: 700; font-size: 12.5px; letter-spacing: .02em; line-height: 1.3;
}
.venue span { font-family: var(--mono); font-weight: 500; font-size: 11px; opacity: .8; }
.venue.conf { color: var(--conf); background: var(--conf-soft); }
.venue.jour { color: var(--jour); background: var(--jour-soft); }
.venue.work { color: var(--work); background: var(--work-soft); }
.venue.pat  { color: var(--pat);  background: var(--pat-soft); }
.pub h4 { font-size: 16px; font-weight: 600; line-height: 1.4; margin-bottom: 6px; }
.pub h4 a { color: var(--text); }
.pub h4 a:hover { color: var(--accent); }
.authors { font-size: 14px; color: var(--muted); margin: 0 0 2px; }
.me { color: var(--text); font-weight: 600; border-bottom: 2px solid var(--accent); }
.where { font-size: 13.5px; color: var(--faint); font-style: italic; margin: 0; }
.where em { color: var(--work); font-style: normal; font-weight: 500; }
.links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.links a, .mini-link {
  font-size: 12.5px; font-weight: 500; color: var(--muted);
  border: 1px solid var(--border); border-radius: 7px; padding: 3px 10px;
  display: inline-flex; align-items: center; gap: 6px; transition: all .15s;
}
.links a:hover, .mini-link:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); text-decoration: none; }
.mini-link { padding: 1px 8px; margin-left: 4px; vertical-align: 1px; }

/* Talks */
.talks, .awards { list-style: none; padding: 0; margin: 0; }
.talks li, .awards li { display: grid; grid-template-columns: 96px 1fr; gap: 16px; padding: 12px 0; border-bottom: 1px dashed var(--border); }
.talks li:last-child, .awards li:last-child { border-bottom: 0; }
.talks a:not(.mini-link) { font-weight: 600; color: var(--text); }
.talks a:not(.mini-link):hover { color: var(--accent); }
.talks p { margin: 4px 0 0; font-size: 14px; color: var(--muted); }
.tag {
  font-size: 11px; font-weight: 600; color: var(--jour); background: var(--jour-soft);
  border-radius: 4px; padding: 1px 6px; margin-left: 4px; vertical-align: 1px;
}

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0 0 0 22px; position: relative; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 8px; bottom: 8px; width: 2px; background: var(--border); }
.timeline li { position: relative; padding: 0 0 20px; }
.timeline li::before {
  content: ""; position: absolute; left: -22px; top: 6px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--accent);
}
.timeline li:first-child::before { background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.when { font-family: var(--mono); font-size: 12px; color: var(--faint); }
.timeline h4 { font-size: 16px; font-weight: 600; }
.timeline p { margin: 0; color: var(--muted); font-size: 14px; }

/* Cards */
.cards { display: grid; gap: 12px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px;
}
.card h4 { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.card-meta { font-size: 13.5px; color: var(--muted); }
.card ul { margin: 0; padding-left: 20px; font-size: 14.5px; }
.card li { margin-bottom: 4px; }
.card.grant p:last-child { margin: 0; }

.plain { margin: 0; padding-left: 20px; }
.plain li { margin-bottom: 6px; font-size: 14.5px; }
.plain li::marker { color: var(--faint); }
/* Service: badge + venue name + role, same rhythm as news/talks */
.svc { list-style: none; padding: 0; margin: 0; }
.svc li {
  display: grid; grid-template-columns: 124px 1fr; gap: 12px; align-items: start;
  padding: 9px 0; border-bottom: 1px dashed var(--border);
}
.svc li:last-child { border-bottom: 0; }
.svc .venue {
  justify-self: start; display: inline-flex; align-items: baseline; gap: 5px; margin-top: 1px;
  padding: 2px 9px; border-radius: 6px; font-size: 12px; white-space: nowrap;
}
.svc .venue span { display: inline; margin: 0; font-size: 11px; }
.svc-line { margin: 0; font-size: 14.5px; line-height: 1.55; }
.svc-role { font-weight: 600; }
.svc-name { color: var(--muted); }
.svc-note { font-size: 13.5px; color: var(--muted); margin: 18px 0 0; }
.svc-note span { font-weight: 600; color: var(--text); }

.awards div { font-size: 14.5px; }

/* Footer */
.footer {
  border-top: 1px solid var(--border); margin-top: 20px; padding-top: 28px;
  text-align: center; color: var(--faint); font-size: 13px;
}
.visitors { display: flex; justify-content: center; margin-bottom: 16px; opacity: .9; }

.to-top {
  position: fixed; right: 24px; bottom: 24px; width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center; background: var(--surface); color: var(--muted);
  border: 1px solid var(--border); box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transform: translateY(8px); transition: all .25s;
}
.to-top.show { opacity: 1; pointer-events: auto; transform: none; }
.to-top:hover { color: var(--accent); text-decoration: none; }

/* Reveal on scroll (only when JS is on) */
.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s ease; }
.js .reveal.in { opacity: 1; transform: none; }

/* ===========================================================
   Responsive
   =========================================================== */
@media (max-width: 980px) {
  .page { grid-template-columns: 1fr; gap: 28px; padding-top: 24px; }
  .profile { position: static; display: grid; grid-template-columns: 150px 1fr; gap: 24px; align-items: center; }
  .avatar { margin: 0; }
  .cv-button { width: auto; }
  .profile-text { text-align: left; }
  .social { justify-content: flex-start; }
  .content { max-width: none; }
}
@media (max-width: 640px) {
  .topbar-inner { padding: 0 16px; gap: 12px; }
  .brand { display: none; }
  .nav { margin-left: 0; }
  .page { padding: 20px 16px 32px; }
  .profile { grid-template-columns: 1fr; text-align: center; }
  .avatar { max-width: 160px; margin: 0 auto; }
  .profile-text { text-align: center; }
  .social { justify-content: center; }
  .news li, .talks li, .awards li { grid-template-columns: 1fr; gap: 2px; }
  .pub { grid-template-columns: 1fr; gap: 10px; padding: 16px; }
  .diagrams, .steps { grid-template-columns: 1fr; }
  .chips { grid-template-columns: 1fr; }
  .svc li { grid-template-columns: 1fr; gap: 4px; }
  .section-title { font-size: 23px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js .reveal { opacity: 1; transform: none; }
}

@media print {
  .topbar, .to-top, .theme-toggle, .filters, .more-button, .visitors, .fig-ctrl { display: none !important; }
  .page { display: block; }
  .profile { position: static; }
  .news.collapsed li.extra { display: grid; }
}
