/* =============================================================================
   style.css
   Colours, fonts and spacing are defined once as tokens at the top. Change a
   token and the whole site follows. The site always uses the dark theme
   (data-theme="dark" on <html> in both pages); the light tokens below are
   what "Print / save as PDF" uses.
   ============================================================================= */

/* ---------- 1. Design tokens ---------- */
:root {
  --font-serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  /* Light theme: cool paper, deep-navy ink, teal accent */
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #eaeff5;
  --ink: #0b1b33;
  --ink-2: #364559;
  --ink-3: #5a6880;
  --rule: #dce3eb;
  --rule-strong: #c5cfdb;
  --accent: #0f766e;
  --accent-soft: #dff3f0;
  --on-accent: #ffffff;
  --inverse-accent: #5eead4;
  --signal: #e0662b;
  --ok: #157a3c;
  --ok-soft: #e4f3ea;
  --warn: #9a5b00;
  --warn-soft: #fbefd9;
  --inverse-bg: #0b1f3a;
  --inverse-surface: #12294a;
  --inverse-ink: #f1f5fb;
  --inverse-ink-2: #b7c3d6;
  --inverse-rule: rgba(255, 255, 255, 0.12);
  --grid-line: rgba(11, 27, 51, 0.055);
  --shadow: 0 1px 2px rgba(11, 27, 51, 0.05), 0 14px 34px -18px rgba(11, 27, 51, 0.22);
  /* The navy band used by the header and hero in both themes */
  --band-bg: #0b1f3a;
  --band-bg-2: #091a31;
  /* Frosted glass: translucent panels over soft background glows */
  --glass: rgba(255, 255, 255, 0.7);
  --glass-2: rgba(255, 255, 255, 0.46);
  --glass-edge: rgba(11, 27, 51, 0.09);
  --glass-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85), 0 1px 2px rgba(11, 27, 51, 0.04), 0 18px 40px -26px rgba(11, 27, 51, 0.32);
  --page-glow-1: rgba(45, 212, 191, 0.17);
  --page-glow-2: rgba(56, 132, 255, 0.13);

  --radius: 14px;
  --radius-sm: 9px;
  --container: 1160px;
  --gutter: clamp(16px, 4vw, 40px);
  --header-h: 64px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #06101d;
  --surface: #0c1829;
  --surface-2: #112136;
  --ink: #e9eef6;
  --ink-2: #aab6c8;
  --ink-3: #8593a8;
  --rule: #1b2a40;
  --rule-strong: #283a55;
  --accent: #2dd4bf;
  --accent-soft: rgba(45, 212, 191, 0.12);
  --on-accent: #042f2a;
  --signal: #fb923c;
  --ok: #5fd28f;
  --ok-soft: rgba(95, 210, 143, 0.12);
  --warn: #e7b85a;
  --warn-soft: rgba(231, 184, 90, 0.12);
  --inverse-bg: #0d2240;
  --inverse-surface: #14305a;
  --inverse-ink: #f1f5fb;
  --inverse-ink-2: #b7c3d6;
  --inverse-rule: rgba(255, 255, 255, 0.1);
  --grid-line: rgba(255, 255, 255, 0.04);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 16px 40px -20px rgba(0, 0, 0, 0.65);
  --band-bg: #0b1f3a;
  --band-bg-2: #081629;
  --glass: rgba(18, 36, 62, 0.62);
  --glass-2: rgba(12, 26, 46, 0.42);
  --glass-edge: rgba(255, 255, 255, 0.07);
  --glass-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 20px 50px -28px rgba(0, 0, 0, 0.75);
  --page-glow-1: rgba(45, 212, 191, 0.09);
  --page-glow-2: rgba(56, 132, 255, 0.1);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #06101d;
    --surface: #0c1829;
    --surface-2: #112136;
    --ink: #e9eef6;
    --ink-2: #aab6c8;
    --ink-3: #8593a8;
    --rule: #1b2a40;
    --rule-strong: #283a55;
    --accent: #2dd4bf;
    --accent-soft: rgba(45, 212, 191, 0.12);
    --on-accent: #042f2a;
    --signal: #fb923c;
    --ok: #5fd28f;
    --ok-soft: rgba(95, 210, 143, 0.12);
    --warn: #e7b85a;
    --warn-soft: rgba(231, 184, 90, 0.12);
    --inverse-bg: #0d2240;
    --inverse-surface: #14305a;
    --inverse-ink: #f1f5fb;
    --inverse-ink-2: #b7c3d6;
    --inverse-rule: rgba(255, 255, 255, 0.1);
    --grid-line: rgba(255, 255, 255, 0.04);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 16px 40px -20px rgba(0, 0, 0, 0.65);
    --band-bg: #0b1f3a;
    --band-bg-2: #081629;
    --glass: rgba(18, 36, 62, 0.62);
    --glass-2: rgba(12, 26, 46, 0.42);
    --glass-edge: rgba(255, 255, 255, 0.07);
    --glass-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 20px 50px -28px rgba(0, 0, 0, 0.75);
    --page-glow-1: rgba(45, 212, 191, 0.09);
    --page-glow-2: rgba(56, 132, 255, 0.1);
    color-scheme: dark;
  }
}

/* The navy band (header + hero): re-maps the tokens so every component inside
   switches to light-on-navy automatically. */
.site-header, .hero {
  --bg: var(--band-bg);
  --surface: #102a4c;
  --surface-2: #15335a;
  --ink: #f1f5fb;
  --ink-2: #c3cfe0;
  --ink-3: #9aaac1;
  --rule: rgba(255, 255, 255, 0.12);
  --rule-strong: rgba(255, 255, 255, 0.22);
  --accent: #5eead4;
  --accent-soft: rgba(94, 234, 212, 0.14);
  --on-accent: #042f2a;
  --ok: #6ee7a8;
  --ok-soft: rgba(110, 231, 168, 0.14);
  --grid-line: rgba(255, 255, 255, 0.05);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 22px 50px -22px rgba(0, 0, 0, 0.7);
  color-scheme: dark;
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 20px);
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink-2);
  font: 400 1rem/1.65 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--accent); text-decoration: none; text-underline-offset: 3px; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; color: var(--ink); font-weight: 500; }
p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button { font: inherit; color: inherit; }
code { font: 0.92em var(--font-mono); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--accent); color: var(--on-accent); }

.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link {
  position: absolute; left: 12px; top: -80px; z-index: 100;
  padding: 10px 16px; border-radius: var(--radius-sm);
  background: var(--ink); color: var(--bg); font-weight: 500;
}
.skip-link:focus { top: 12px; text-decoration: none; }
.load-error { margin: 24px; padding: 16px 20px; border-radius: var(--radius-sm); background: var(--warn-soft); color: var(--ink); }
.noscript { padding: 24px var(--gutter); background: var(--warn-soft); color: var(--ink); text-align: center; }

.i { width: 18px; height: 18px; flex: none; }

/* ---------- 3. Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s, background-color 0.2s;
}
.site-header.is-scrolled { border-bottom-color: var(--rule); box-shadow: 0 10px 30px -18px rgba(0, 0, 0, 0.55); }
.nav { display: flex; align-items: center; gap: 20px; height: var(--header-h); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px;
  background: var(--ink); color: var(--bg);
  font: 500 12.5px/1 var(--font-mono); letter-spacing: 0.02em;
}
.nav-links { display: flex; gap: 2px; margin-left: auto; }
.nav-links a {
  position: relative; padding: 8px 12px; border-radius: 8px;
  color: var(--ink-2); font-size: 0.92rem; font-weight: 500;
}
.nav-links a:hover { color: var(--ink); background: var(--surface-2); text-decoration: none; }
.nav-links a.is-active { color: var(--ink); }
.nav-links a.is-active::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: 3px; height: 2px;
  border-radius: 2px; background: var(--accent);
}
.nav-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  display: grid; place-items: center; width: 38px; height: 38px;
  border-radius: 10px; border: 1px solid var(--rule); background: var(--surface);
  color: var(--ink-2); cursor: pointer; transition: border-color 0.15s, color 0.15s;
}
.icon-btn:hover { color: var(--ink); border-color: var(--rule-strong); }
.menu-btn { display: none; }

@media (max-width: 920px) {
  .nav-links {
    position: absolute; top: var(--header-h); left: 0; right: 0;
    display: none; flex-direction: column; gap: 0;
    padding: 8px var(--gutter) 18px; margin: 0;
    background: var(--bg); border-bottom: 1px solid var(--rule);
    box-shadow: 0 18px 30px -24px rgba(0, 0, 0, 0.35);
  }
  .nav-links.is-open { display: flex; }
  .nav-links { max-height: calc(100vh - var(--header-h)); max-height: calc(100dvh - var(--header-h)); overflow-y: auto; overscroll-behavior: contain; }
  .nav-links a { padding: 12px 4px; border-radius: 0; border-bottom: 1px solid var(--rule); font-size: 1rem; }
  .nav-links a:last-child { border-bottom: 0; }
  .nav-links a:hover { background: transparent; }
  .nav-links a.is-active::after { display: none; }
  .nav-actions { margin-left: auto; }
  .menu-btn { display: grid; }
}
@media (max-width: 420px) {
  .brand-name { display: none; }
}

/* ---------- 4. Buttons, chips, badges ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 18px; border-radius: 10px;
  border: 1px solid transparent; cursor: pointer; white-space: nowrap;
  font: 500 0.95rem/1 var(--font-sans);
  transition: transform 0.15s var(--ease), background-color 0.15s, border-color 0.15s, color 0.15s;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: none; }
.btn-primary { background: var(--ink); color: var(--bg); }
.btn-primary:hover { background: var(--accent); color: var(--on-accent); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--rule-strong); }
.btn-ghost:hover { border-color: var(--ink); }
.btn-text { padding: 0 8px; color: var(--ink); }
.btn-text:hover { color: var(--accent); }
.btn-text .i { transition: transform 0.2s var(--ease); }
.btn-text:hover .i { transform: translateX(3px); }
.btn-sm { height: 36px; padding: 0 14px; border-radius: 9px; font-size: 0.88rem; }
.btn-sm .i { width: 16px; height: 16px; }

.badge {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 10px 4px 9px; border-radius: 999px;
  font: 500 0.7rem/1.3 var(--font-mono); letter-spacing: 0.07em; text-transform: uppercase;
  white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge--published, .badge--accepted { color: var(--ok); background: var(--ok-soft); }
.badge--preprint, .badge--under-review { color: var(--accent); background: var(--accent-soft); }
.badge--manuscript, .badge--in-preparation { color: var(--warn); background: var(--warn-soft); }
.badge--other { color: var(--ink-2); background: var(--surface-2); }
.btn-placeholder {
  background: transparent !important; color: var(--ink-3) !important; border: 1.5px dashed var(--rule-strong) !important;
  cursor: default; transform: none !important; font-weight: 500;
}
.contact-card .btn-placeholder { color: var(--inverse-ink-2) !important; border-color: var(--inverse-rule) !important; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  padding: 5px 8px; border-radius: 6px;
  background: var(--surface-2); color: var(--ink-2);
  font: 500 0.74rem/1.2 var(--font-mono);
}
.eyebrow { font: 500 0.76rem/1.5 var(--font-mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }

/* ---------- 5. Hero ---------- */
.hero {
  position: relative; padding: clamp(40px, 7vw, 88px) 0 0; overflow: hidden; color: var(--ink-2);
  background:
    radial-gradient(900px 520px at 88% 8%, rgba(45, 212, 191, 0.18), transparent 62%),
    radial-gradient(760px 520px at -5% 105%, rgba(56, 132, 255, 0.16), transparent 60%),
    linear-gradient(180deg, var(--band-bg), var(--band-bg-2));
}
.hero .highlights { border-top-color: var(--rule); }
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 32px 32px;
  -webkit-mask-image: radial-gradient(ellipse 75% 65% at 72% 32%, #000 25%, transparent 72%);
  mask-image: radial-gradient(ellipse 75% 65% at 72% 32%, #000 25%, transparent 72%);
}
.hero-grid {
  position: relative; display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.88fr);
  gap: clamp(36px, 5vw, 72px); align-items: center;
}
.hero-id { display: flex; align-items: center; gap: 16px; margin-bottom: 26px; }
.avatar {
  flex: none; width: 100px; height: 100px; border-radius: 50%; object-fit: cover; object-position: center 30%;
  border: 1px solid var(--rule); box-shadow: 0 0 0 4px var(--surface), 0 0 0 5px var(--rule);
}
@media (max-width: 560px) { .avatar { width: 80px; height: 80px; } }
.avatar-mono {
  display: grid; place-items: center;
  background: linear-gradient(140deg, var(--accent-soft), var(--surface-2));
  color: var(--accent); font: 500 1.75rem/1 var(--font-serif); letter-spacing: 0.01em;
}
.hero-affil { margin-top: 3px; font-size: 0.95rem; color: var(--ink-2); }
.hero-name {
  font-family: var(--font-serif); font-weight: 500; color: var(--ink);
  font-size: clamp(2.9rem, 7.2vw, 5.4rem); line-height: 0.98; letter-spacing: -0.028em;
}
.hero-lead { margin-top: 24px; max-width: 37em; font-size: clamp(1.05rem, 1.55vw, 1.19rem); line-height: 1.68; color: var(--ink-2); }
.hero-lead strong { color: var(--ink); font-weight: 600; }
.status {
  display: inline-flex; align-items: center; gap: 10px; margin-top: 24px;
  padding: 7px 14px 7px 12px; border-radius: 999px;
  background: var(--ok-soft); color: var(--ok); font-size: 0.88rem; font-weight: 500; line-height: 1.35;
}
.status-dot { position: relative; flex: none; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status-dot::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 2px solid currentColor; opacity: 0; animation: ping 2.4s var(--ease) infinite;
}
@keyframes ping { 0% { transform: scale(0.5); opacity: 0.7; } 80%, 100% { transform: scale(1.6); opacity: 0; } }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin-top: 28px; }
.socials { display: flex; flex-wrap: wrap; gap: 4px; margin: 22px 0 0 -10px; }
.social {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 10px; border-radius: 8px;
  border: 1px solid transparent; color: var(--ink-2); font-size: 0.87rem;
}
.social:hover { color: var(--ink); background: var(--surface); border-color: var(--rule); text-decoration: none; }
.social .i { width: 16px; height: 16px; }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.highlights {
  position: relative; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: clamp(44px, 6vw, 76px); border-top: 1px solid var(--rule);
}
.hl { padding: 22px 22px 26px 0; }
.hl + .hl { padding-left: 22px; border-left: 1px solid var(--rule); }
.hl-value { display: block; font: 500 clamp(1.65rem, 2.8vw, 2.15rem)/1.1 var(--font-serif); color: var(--ink); letter-spacing: -0.01em; }
.hl-label { display: block; margin-top: 6px; font-size: 0.86rem; line-height: 1.45; color: var(--ink-3); }

@media (max-width: 960px) {
  .hero-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .highlights { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hl:nth-child(odd) { padding-left: 0; border-left: 0; }
  .hl:nth-child(even) { padding-left: 18px; }
  .hl:nth-child(n + 3) { border-top: 1px solid var(--rule); }
  .hl { padding-right: 12px; }
}

/* ---------- 6. Sections ---------- */
.section { padding: clamp(64px, 9vw, 112px) 0; border-top: 1px solid var(--rule); }
.section-head {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 0.85fr);
  gap: 14px 56px; align-items: end; margin-bottom: clamp(32px, 5vw, 56px);
}
.kicker {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 10px;
  font: 500 0.76rem/1.4 var(--font-mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent);
}
.kicker .num { color: var(--ink-3); }
.kicker::after { content: ""; width: 64px; height: 1px; background: var(--rule-strong); }
.section-title { font-family: var(--font-serif); font-weight: 500; font-size: clamp(2rem, 4.3vw, 3.1rem); line-height: 1.06; letter-spacing: -0.022em; }
.section-intro { max-width: 34em; color: var(--ink-3); }
.subhead {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 20px;
  padding-bottom: 14px; border-bottom: 1px solid var(--ink);
}
.subhead h3 { font: 500 1.5rem/1.2 var(--font-serif); letter-spacing: -0.01em; }
.subhead p { font-size: 0.86rem; color: var(--ink-3); }
@media (max-width: 800px) { .section-head { grid-template-columns: 1fr; } }

/* ---------- 7. About ---------- */
.about-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.9fr); gap: clamp(32px, 5vw, 72px); align-items: start; }
.prose p { font-size: 1.07rem; line-height: 1.78; color: var(--ink-2); }
.prose p + p { margin-top: 1.1em; }
.prose strong { color: var(--ink); font-weight: 600; }
.prose em { font-family: var(--font-serif); font-size: 1.08em; }
.prose p:first-child { font-size: 1.16rem; color: var(--ink); }
.section-title, .hero-name, .case-title, .contact-card h2 { text-wrap: balance; }
.hero-lead, .case-lead, .prose p, .statement { text-wrap: pretty; }
.about-side { display: grid; gap: 16px; }
.side-card { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 22px 22px 18px; }
.side-title { margin-bottom: 12px; font: 500 0.72rem/1.4 var(--font-mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); }
.now-list li, .news-list li {
  display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 12px;
  padding: 11px 0; border-top: 1px solid var(--rule); font-size: 0.93rem; line-height: 1.55;
}
.now-list li:first-child, .news-list li:first-child { border-top: 0; padding-top: 2px; }
.now-label, .news-list time { font: 500 0.72rem/1.9 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.news-list time { color: var(--ink-3); }
@media (max-width: 900px) { .about-grid { grid-template-columns: 1fr; } }

/* ---------- 8. Research ---------- */
.statement {
  max-width: 46em; margin-bottom: clamp(28px, 4vw, 40px); padding-left: 22px; border-left: 3px solid var(--accent);
  font: 400 clamp(1.25rem, 2.2vw, 1.6rem)/1.45 var(--font-serif); color: var(--ink-2); letter-spacing: -0.005em;
}
.statement strong { color: var(--ink); font-weight: 500; }
.interests { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: clamp(56px, 8vw, 88px); }
.interest {
  position: relative; display: flex; flex-direction: column;
  padding: 24px 24px 22px; border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--surface); transition: border-color 0.2s, box-shadow 0.2s;
}
.interest:hover { border-color: var(--rule-strong); box-shadow: var(--shadow); }
.interest-idx { font: 500 0.72rem/1 var(--font-mono); letter-spacing: 0.1em; color: var(--ink-3); }
.interest h3 { margin-top: 12px; font: 500 1.32rem/1.25 var(--font-serif); letter-spacing: -0.01em; }
.interest p { margin-top: 8px; flex: 1; font-size: 0.95rem; color: var(--ink-2); }
.interest-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.chip-link {
  display: inline-flex; align-items: center; gap: 5px; padding: 5px 9px; border-radius: 6px;
  background: var(--surface-2); color: var(--ink-2); font: 500 0.76rem/1.2 var(--font-mono);
}
.chip-link .i { width: 12px; height: 12px; }
.chip-link:hover { background: var(--accent-soft); color: var(--accent); text-decoration: none; }
@media (max-width: 760px) { .interests { grid-template-columns: 1fr; } }

.pub { display: grid; grid-template-columns: 148px minmax(0, 1fr); gap: 28px; padding: 28px 0; border-bottom: 1px solid var(--rule); }
.pub:target { background: linear-gradient(90deg, var(--accent-soft), transparent 70%); }
.pub-meta { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.pub-year { font: 500 0.88rem var(--font-mono); color: var(--ink-3); }
.pub-title { font: 500 1.3rem/1.35 var(--font-serif); letter-spacing: -0.005em; color: var(--ink); }
.pub-authors { margin-top: 8px; font-size: 0.95rem; color: var(--ink-2); }
.pub-authors strong { color: var(--ink); font-weight: 600; }
.pub-venue { margin-top: 2px; font-size: 0.93rem; font-style: italic; color: var(--ink-3); }
.pub-note { display: flex; align-items: flex-start; gap: 7px; margin-top: 10px; font-size: 0.86rem; color: var(--ink-3); }
.pub-note .i { width: 15px; height: 15px; margin-top: 2px; }
.pub-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.act {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 11px;
  border: 1px solid var(--rule-strong); border-radius: 8px; background: var(--surface);
  color: var(--ink-2); font: 500 0.8rem/1 var(--font-sans); cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background-color 0.15s;
}
.act:hover { border-color: var(--ink); color: var(--ink); text-decoration: none; }
.act .i { width: 14px; height: 14px; }
.act .chev { transition: transform 0.2s var(--ease); }
.act[aria-expanded="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.act[aria-expanded="true"] .chev { transform: rotate(180deg); }
.pub-panel { margin-top: 14px; padding: 16px 18px; border-radius: 10px; background: var(--surface-2); font-size: 0.95rem; line-height: 1.7; }
.pub-panel[hidden] { display: none; }
.bib { position: relative; padding-right: 92px; }
.bib pre { margin: 0; white-space: pre-wrap; word-break: break-word; font: 400 0.8rem/1.65 var(--font-mono); color: var(--ink-2); }
.bib .act { position: absolute; top: 12px; right: 12px; }
.empty { padding: 28px 0; color: var(--ink-3); }
@media (max-width: 700px) {
  .pub { grid-template-columns: 1fr; gap: 12px; }
  .pub-meta { flex-direction: row; align-items: center; }
  .bib { padding-right: 18px; padding-top: 52px; }
}

/* ---------- 9. Projects ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }
.filter {
  display: inline-flex; align-items: center; height: 36px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--rule-strong); background: transparent; color: var(--ink-2);
  font: 500 0.88rem/1 var(--font-sans); cursor: pointer; transition: all 0.15s;
}
.filter:hover { border-color: var(--ink); color: var(--ink); }
.filter .count { margin-left: 7px; font: 500 0.72rem var(--font-mono); color: var(--ink-3); }
.filter[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.filter[aria-pressed="true"] .count { color: inherit; opacity: 0.65; }

.projects { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.project {
  position: relative; display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius);
  transition: transform 0.25s var(--ease), box-shadow 0.25s, border-color 0.25s;
}
.project:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--rule-strong); }
.project[hidden] { display: none !important; } /* also beats the featured card's display: grid */
.media {
  position: relative; display: block; aspect-ratio: 16 / 10; overflow: hidden;
  background-color: var(--surface-2);
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 20px 20px; background-position: -1px -1px;
  border-bottom: 1px solid var(--rule);
}
.media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s var(--ease); }
.media img.fit-contain { object-fit: contain; padding: 4%; background: var(--surface); }
.media img.on-white, .case-figure .media img.on-white { background: #fff; } /* imageBg: "white" */
.project:hover .media img { transform: scale(1.03); }
.media .illo { width: 100%; height: 100%; padding: 4% 3%; transition: transform 0.5s var(--ease); }
.project:hover .media .illo { transform: scale(1.025); }
.media-tag {
  position: absolute; top: 12px; left: 12px; padding: 4px 8px; border-radius: 6px;
  background: var(--surface); border: 1px solid var(--rule); color: var(--ink-2);
  font: 500 0.68rem/1.3 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase;
}
.media-note {
  position: absolute; right: 10px; bottom: 9px; padding: 2px 7px; border-radius: 5px;
  background: color-mix(in srgb, var(--surface) 85%, transparent); color: var(--ink-3);
  font: 500 0.62rem/1.4 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase;
}
.case-figure .media-note { display: none; }
.project-body { display: flex; flex-direction: column; flex: 1; padding: 20px 22px 20px; }
.project-summary a { position: relative; z-index: 2; }
.project-kicker { font: 500 0.72rem/1.4 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.project h3 { margin-top: 8px; font: 500 1.28rem/1.25 var(--font-serif); letter-spacing: -0.01em; }
.project h3 a { color: var(--ink); }
.project h3 a:hover { text-decoration: none; }
.stretched::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.project:hover h3 a { color: var(--accent); }
.project-summary { margin-top: 10px; font-size: 0.94rem; color: var(--ink-2); }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 12px 18px; margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--rule-strong); }
.metric { display: flex; flex-direction: column; gap: 2px; }
.metric-value { font: 500 1.3rem/1.15 var(--font-serif); color: var(--ink); overflow-wrap: anywhere; }
.metric-label { font-size: 0.8rem; line-height: 1.4; color: var(--ink-3); }
.project .tags { margin-top: 16px; }
.project-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: auto; padding-top: 18px; }
.more { display: inline-flex; align-items: center; gap: 6px; font-size: 0.9rem; font-weight: 500; color: var(--ink); }
.more .i { width: 16px; height: 16px; transition: transform 0.2s var(--ease); }
.project:hover .more { color: var(--accent); }
.project:hover .more .i { transform: translateX(3px); }
.mini-links { position: relative; z-index: 2; display: flex; gap: 2px; }
.mini-links a {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; color: var(--ink-3);
}
.mini-links a:hover { background: var(--surface-2); color: var(--ink); }
.mini-links .i { width: 16px; height: 16px; }

.project.is-featured { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); }
.project.is-featured .media { aspect-ratio: auto; height: 100%; min-height: 340px; border-bottom: 0; border-right: 1px solid var(--rule); }
.project.is-featured .media .illo { padding: 7% 6%; }
.project.is-featured .project-body { padding: clamp(24px, 3.5vw, 40px); }
.project.is-featured h3 { font-size: clamp(1.5rem, 2.6vw, 2rem); line-height: 1.15; }
.project.is-featured .project-summary { font-size: 1rem; }
.project.is-featured .metric-value { font-size: 1.55rem; }

@media (max-width: 1040px) { .projects { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) {
  .project.is-featured { display: flex; }
  .project.is-featured .media { height: auto; min-height: 0; aspect-ratio: 16 / 10; border-right: 0; border-bottom: 1px solid var(--rule); }
}
@media (max-width: 680px) {
  .projects { grid-template-columns: 1fr; }
}

/* ---------- 10. Experience & education ---------- */
.xp-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: clamp(36px, 5vw, 72px); align-items: start; }
.col-title {
  display: flex; align-items: center; gap: 10px; padding-bottom: 14px; border-bottom: 1px solid var(--ink);
  font: 500 0.76rem/1.4 var(--font-mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-2);
}
.col-title .i { width: 16px; height: 16px; color: var(--ink-3); }
.tl-item { position: relative; padding: 24px 0 24px 30px; border-bottom: 1px solid var(--rule); }
.tl-item::before {
  content: ""; position: absolute; left: 0; top: 33px; width: 11px; height: 11px; border-radius: 50%;
  border: 2px solid var(--rule-strong); background: var(--bg);
}
.tl-item.is-current::before { border-color: var(--ok); background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); }
.tl-item::after { content: ""; position: absolute; left: 5px; top: 48px; bottom: -34px; width: 1px; background: var(--rule); }
.tl-item:last-child::after { display: none; }
.tl-top { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; }
.tl-role { font: 500 1.22rem/1.3 var(--font-serif); color: var(--ink); letter-spacing: -0.005em; }
.tl-period { font: 500 0.78rem/1.6 var(--font-mono); color: var(--ink-3); white-space: nowrap; }
.tl-org { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 4px; font-size: 0.95rem; color: var(--ink-2); }
.tl-org b { color: var(--ink); font-weight: 600; }
.pill {
  padding: 3px 8px; border-radius: 999px; background: var(--surface-2); color: var(--ink-3);
  font: 500 0.68rem/1.4 var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase;
}
.grade {
  display: inline-block; margin-top: 10px; padding: 4px 10px; border-radius: 6px;
  background: var(--accent-soft); color: var(--accent); font: 500 0.8rem/1.4 var(--font-mono);
}
.tl-facts { display: grid; gap: 4px; margin-top: 12px; font-size: 0.93rem; }
.tl-facts div { display: flex; flex-wrap: wrap; gap: 4px 8px; }
.tl-facts dt { color: var(--ink-3); }
.tl-facts dt::after { content: ":"; }
.tl-facts dd { color: var(--ink); }
.points { margin-top: 12px; }
.points li { position: relative; margin-top: 7px; padding-left: 18px; font-size: 0.94rem; line-height: 1.6; color: var(--ink-2); }
.points li::before { content: ""; position: absolute; left: 1px; top: 0.8em; width: 8px; height: 1px; background: var(--ink-3); }
.points strong { color: var(--ink); font-weight: 600; }
.tl-item .tags { margin-top: 14px; }
@media (max-width: 900px) { .xp-grid { grid-template-columns: 1fr; } }

/* ---------- 11. Skills & honours ---------- */
.skills { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--rule); border-left: 1px solid var(--rule); }
.skill-group { padding: 24px 24px 26px; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); background: var(--surface); }
.skill-group h3 { display: flex; align-items: baseline; gap: 10px; font: 500 1.14rem/1.3 var(--font-serif); }
.skill-group h3 .idx { font: 500 0.7rem var(--font-mono); color: var(--ink-3); letter-spacing: 0.08em; }
.skill-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.skill { padding: 5px 10px; border-radius: 6px; border: 1px solid var(--rule); background: var(--bg); color: var(--ink-2); font-size: 0.86rem; line-height: 1.35; }
.honors-wrap { margin-top: clamp(48px, 7vw, 72px); }
.honors { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 20px; }
.honor { display: flex; gap: 14px; padding: 20px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); }
.honor-icon { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); }
.honor h4 { font: 600 0.97rem/1.4 var(--font-sans); color: var(--ink); }
.honor p { margin-top: 3px; font-size: 0.86rem; color: var(--ink-3); }
@media (max-width: 960px) { .skills, .honors { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .skills, .honors { grid-template-columns: 1fr; } }

/* ---------- 12. Contact ---------- */
.contact { padding: clamp(56px, 8vw, 96px) 0; border-top: 1px solid var(--rule); }
.contact-card {
  position: relative; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: clamp(28px, 5vw, 64px); padding: clamp(28px, 5vw, 60px); border-radius: calc(var(--radius) + 6px);
  background: var(--inverse-bg); color: var(--inverse-ink-2);
}
.contact-card::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 32px 32px;
  -webkit-mask-image: radial-gradient(ellipse 60% 80% at 100% 0%, #000 10%, transparent 70%);
  mask-image: radial-gradient(ellipse 60% 80% at 100% 0%, #000 10%, transparent 70%);
}
.contact-card > * { position: relative; }
.contact-card .eyebrow { color: var(--inverse-accent); }
.contact-card a:not(.btn):not(.contact-row) { color: var(--inverse-accent); text-decoration: underline; }
.contact-card :focus-visible { outline-color: var(--inverse-accent); }
.contact-card:not(:has(.contact-list)) { grid-template-columns: minmax(0, 1fr); }
.contact-actions:not(:has(*)) { display: none; }
.contact-card h2 { margin-top: 14px; font: 500 clamp(2.1rem, 4.6vw, 3.4rem)/1.04 var(--font-serif); letter-spacing: -0.022em; color: var(--inverse-ink); }
.contact-text { margin-top: 18px; max-width: 34em; font-size: 1.04rem; line-height: 1.7; }
.contact-text strong { color: var(--inverse-ink); font-weight: 600; }
.contact-secondary { margin-top: 12px; font-size: 0.92rem; color: var(--inverse-ink-2); opacity: 0.85; }
.contact-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.btn-invert { background: var(--inverse-ink); color: var(--inverse-bg); }
.btn-invert:hover { background: #fff; color: #000; }
.btn-outline-invert { color: var(--inverse-ink); border-color: var(--inverse-rule); background: transparent; }
.btn-outline-invert:hover { border-color: var(--inverse-ink); }
.contact-list { align-self: center; border-top: 1px solid var(--inverse-rule); }
.contact-row {
  display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; gap: 14px;
  padding: 14px 4px; border-bottom: 1px solid var(--inverse-rule); color: var(--inverse-ink);
}
a.contact-row:hover { text-decoration: none; background: rgba(255, 255, 255, 0.04); }
.contact-row .ico { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; background: var(--inverse-surface); color: var(--inverse-accent); }
.contact-row .ico .i { width: 17px; height: 17px; }
.contact-row small { display: block; font: 500 0.68rem/1.4 var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--inverse-ink-2); }
.contact-row div > span { display: block; overflow-wrap: anywhere; font-size: 0.95rem; }
.contact-row .go { width: 16px; height: 16px; color: var(--inverse-ink-2); transition: transform 0.2s var(--ease); }
a.contact-row:hover .go { transform: translate(2px, -2px); color: var(--inverse-ink); }
@media (max-width: 860px) { .contact-card { grid-template-columns: 1fr; } }

/* ---------- 13. Footer ---------- */
.site-footer { padding: 28px 0 44px; border-top: 1px solid var(--rule); font-size: 0.86rem; color: var(--ink-3); }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 6px 20px; }
.footer-links a, .footer-links button { padding: 0; border: 0; background: none; color: var(--ink-3); cursor: pointer; font: inherit; }
.footer-links a:hover, .footer-links button:hover { color: var(--ink); text-decoration: none; }

/* ---------- 14. Case-study page ---------- */
.crumbs {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: clamp(24px, 4vw, 40px);
  font: 500 0.76rem/1.4 var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3);
}
.crumbs a { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }
.crumbs a:hover { color: var(--accent); text-decoration: none; }
.crumbs .i { width: 14px; height: 14px; }
.case-head { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 24px 56px; align-items: end; padding: 28px 0 36px; }
.case-title { margin-top: 14px; font: 500 clamp(2.2rem, 5.2vw, 3.9rem)/1.03 var(--font-serif); letter-spacing: -0.025em; color: var(--ink); }
.case-lead { margin-top: 18px; max-width: 40em; font-size: clamp(1.05rem, 1.5vw, 1.18rem); line-height: 1.65; color: var(--ink-2); }
.case-meta { display: grid; grid-template-columns: 1fr 1fr; column-gap: 20px; border-top: 1px solid var(--ink); }
.case-meta div { padding: 12px 0; border-bottom: 1px solid var(--rule); }
.case-meta dt { font: 500 0.68rem/1.4 var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); }
.case-meta dd { margin-top: 3px; font-size: 0.94rem; color: var(--ink); }
.case-figure { overflow: hidden; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); }
.case-figure .media { aspect-ratio: 2 / 1; border-bottom: 0; }
.case-figure .media img { object-fit: contain; padding: 2%; background: var(--surface); }
.case-figure .media > a { display: block; height: 100%; cursor: zoom-in; }
.case-figure .media.is-portrait { aspect-ratio: 4 / 3; }
@media (max-width: 560px) { .case-figure .media.is-portrait { aspect-ratio: 3 / 4; } }
.case-figure .media .illo { padding: 4% 12%; }
.case-figure figcaption { padding: 12px 18px; border-top: 1px solid var(--rule); font-size: 0.86rem; color: var(--ink-3); }
.case-metrics { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); margin-top: 28px; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.case-metrics .metric { padding: 20px 20px 22px 0; }
.case-metrics .metric + .metric { padding-left: 20px; border-left: 1px solid var(--rule); }
.case-metrics .metric-value { font-size: clamp(1.5rem, 2.6vw, 2rem); }
.case-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 400px); gap: clamp(32px, 5vw, 64px); padding: clamp(40px, 6vw, 64px) 0 clamp(36px, 5vw, 56px); align-items: start; }
.case-section + .case-section { margin-top: 44px; }
.case-section h2 { display: flex; align-items: baseline; gap: 14px; font: 500 1.65rem/1.2 var(--font-serif); letter-spacing: -0.012em; }
.case-section h2 .num { font: 500 0.78rem var(--font-mono); color: var(--accent); letter-spacing: 0.06em; }
.case-section p { margin-top: 14px; font-size: 1.05rem; line-height: 1.78; }
.case-section p strong { color: var(--ink); font-weight: 600; }
.case-section .points li { font-size: 1.02rem; line-height: 1.7; margin-top: 10px; }
.callout {
  margin-top: 18px !important; padding: 14px 16px; border-left: 3px solid var(--warn);
  border-radius: 0 8px 8px 0; background: var(--warn-soft); color: var(--ink); font-size: 0.95rem !important; line-height: 1.6 !important;
}
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; margin-top: 18px; }
.gallery figure { overflow: hidden; border: 1px solid var(--rule); border-radius: var(--radius-sm); background: var(--surface); }
.gallery img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; padding: 6px; background: #fff; }
.gallery a { display: block; cursor: zoom-in; }
/* a gallery entry with srcDark: the light image in the light theme, the dark one in the dark theme */
.gallery img.g-dark { display: none; background: #0b1f3a; }
:root[data-theme="dark"] .gallery img.g-light { display: none; }
:root[data-theme="dark"] .gallery img.g-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .gallery img.g-light { display: none; }
  :root:not([data-theme="light"]) .gallery img.g-dark { display: block; }
}
@supports selector(:has(*)) {
  .gallery figure:has(a:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
  .gallery a:focus-visible { outline: none; }
}
.case-section .gallery-hint { margin-top: 6px; font-size: 0.86rem; color: var(--ink-3); }
.gallery a:hover img { opacity: 0.92; }
.gallery figcaption { padding: 10px 12px; font-size: 0.84rem; color: var(--ink-3); }
.case-aside { position: sticky; top: calc(var(--header-h) + 24px); display: grid; gap: 16px; }
.aside-card { padding: 20px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); }
.aside-card .side-title { margin-bottom: 14px; }
.link-list { display: grid; gap: 4px; }
.link-list a {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; margin: 0 -10px; border-radius: 8px;
  color: var(--ink); font-size: 0.93rem; font-weight: 500;
}
.link-list a:hover { background: var(--surface-2); text-decoration: none; }
.link-list .i { width: 16px; height: 16px; color: var(--ink-3); }
.link-list .go { margin-left: auto; }
/* a link set to "soon": announced, not clickable */
.link-soon { display: flex; align-items: flex-start; gap: 10px; padding: 9px 0; font-size: 0.93rem; color: var(--ink-2); }
.link-soon .i { flex: none; margin-top: 2px; }
.link-soon strong { color: var(--ink); font-weight: 500; }
.link-soon small { display: block; margin-top: 4px; font-size: 0.8rem; line-height: 1.45; color: var(--ink-3); }
.aside-pub .pub-title { font-size: 1.02rem; margin-top: 10px; }
.aside-pub .aside-venue { margin-top: 6px; font-size: 0.84rem; line-height: 1.45; color: var(--ink-3); }
.aside-pub a { display: inline-flex; align-items: center; gap: 6px; margin-top: 12px; font-size: 0.9rem; font-weight: 500; }
.aside-pub a .i { width: 15px; height: 15px; }
.aside-cta p { font-size: 0.93rem; color: var(--ink-2); }
.aside-cta .btn { margin-top: 14px; width: 100%; }
.case-extras { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; padding-bottom: clamp(40px, 6vw, 64px); }
.case-extras:not(:has(*)) { display: none; }

/* Build log beside the case study */
.buildlog { padding: 18px 18px 16px; }
.bl-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.bl-head .side-title { margin: 0; }
.bl-count { font: 500 0.72rem/1 var(--font-mono); letter-spacing: 0.08em; color: var(--accent); }
.bl-art {
  margin-top: 12px; aspect-ratio: 400 / 250; overflow: hidden; border-radius: 10px;
  --surface: #10284a; --surface-2: #15335a; --ink-2: #d6e4f5; --ink-3: #8fb0d6;
  --accent: #5eead4; --accent-soft: rgba(94, 234, 212, 0.16); --signal: #fb923c;
  background-color: #0b1f3a;
  background-image:
    linear-gradient(rgba(94, 234, 212, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(94, 234, 212, 0.08) 1px, transparent 1px);
  background-size: 16px 16px; background-position: -1px -1px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}
.bl-art .illo { width: 100%; height: 100%; padding: 3%; }
/* liveDemo: the running ball-and-plate simulation from the home page (story.js, STORY.rig) */
.bl-art.is-live { position: relative; aspect-ratio: 480 / 404; --ink: #eef4fb; }
.bl-art.is-live .story-svg { display: block; width: 100%; height: 100%; cursor: crosshair; }
.bl-art.is-live .story-cta { top: 6px; left: 8px; }
.bl-stages { display: grid; gap: 2px; margin-top: 14px; }
.bl-stages li {
  display: flex; align-items: baseline; gap: 10px; padding: 7px 10px; border-radius: 8px;
  font-size: 0.9rem; line-height: 1.35; color: var(--ink-3); transition: background-color 0.3s, color 0.3s;
}
.bl-stages li span { flex: none; font: 500 0.7rem/1 var(--font-mono); color: var(--ink-3); }
.bl-stages li.is-done { color: var(--ink-2); }
.bl-stages li.is-done span { color: var(--accent); }
.bl-stages li.is-active { background: var(--accent-soft); color: var(--ink); font-weight: 500; }
.bl-stages li.is-active span { color: var(--accent); }
.bl-note { margin-top: 12px; font-size: 0.78rem; line-height: 1.45; color: var(--ink-3); }
.case-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 32px 0 clamp(56px, 8vw, 96px); border-top: 1px solid var(--rule); }
.case-nav a { display: block; padding: 20px 22px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); transition: border-color 0.2s, transform 0.2s var(--ease); }
.case-nav a:hover { border-color: var(--rule-strong); transform: translateY(-2px); text-decoration: none; }
.case-nav small { display: flex; align-items: center; gap: 6px; font: 500 0.7rem/1.4 var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); }
.case-nav small .i { width: 14px; height: 14px; }
.case-nav span { display: block; margin-top: 6px; font: 500 1.15rem/1.3 var(--font-serif); color: var(--ink); }
.case-nav .next { text-align: right; }
.case-nav .next small { justify-content: flex-end; }
.not-found { padding: clamp(64px, 12vw, 140px) 0; }
.not-found h1 { font: 500 clamp(2rem, 5vw, 3rem)/1.1 var(--font-serif); }
.not-found p { margin-top: 14px; }
.not-found .btn { margin-top: 24px; }
@media (max-width: 900px), (max-height: 600px) {
  .case-head, .case-body { grid-template-columns: 1fr; }
  .case-aside { position: static; order: -1; }
  .buildlog { max-width: 560px; }
  .case-figure .media .illo { padding: 4% 6%; }
}
@media (max-width: 640px) {
  .case-metrics { grid-auto-flow: row; grid-template-columns: 1fr; }
  .case-metrics .metric + .metric { padding-left: 0; border-left: 0; border-top: 1px solid var(--rule); }
}
@media (max-width: 560px) {
  .case-nav { grid-template-columns: 1fr; }
  .case-nav .next { text-align: left; }
  .case-nav .next small { justify-content: flex-start; }
  .case-figure .media { aspect-ratio: 16 / 10; }
}

/* ---------- 15. Illustrations ---------- */
.illo text { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.04em; fill: var(--ink-3); }
.illo .t-ink { fill: var(--ink-2); font-weight: 500; }
.illo .t-acc { fill: var(--accent); font-weight: 500; }
.illo .illo-big { font-family: var(--font-serif); font-size: 92px; fill: var(--ink-3); opacity: 0.55; }
.illo .ln { fill: none; stroke: var(--ink-2); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.illo .ln2 { fill: none; stroke: var(--ink-3); stroke-width: 1; stroke-linecap: round; stroke-linejoin: round; }
.illo .dash { fill: none; stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 3 4; }
.illo .dash-ac { fill: none; stroke: var(--accent); stroke-width: 1.4; stroke-dasharray: 3 3; }
.illo .ac { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.illo .bo { fill: none; stroke: var(--ink-2); stroke-width: 18; stroke-linecap: round; }
.illo .bi { fill: none; stroke: var(--surface); stroke-width: 15; stroke-linecap: round; }
.illo .w1 { stroke-width: 1.3; }
.illo .w2 { stroke-width: 2.4; }
.illo .w3 { stroke-width: 3.2; }
.illo .w4 { stroke-width: 4; }
.illo .w5 { stroke-width: 5; }
.illo .tb-o { fill: none; stroke: var(--ink-2); stroke-width: 9; stroke-linejoin: round; } /* a tube: outline… */
.illo .tb-i { fill: none; stroke: var(--surface); stroke-width: 6; stroke-linejoin: round; } /* …and bore */
.illo .chain { fill: none; stroke: var(--ink-2); stroke-width: 1.4; stroke-linecap: round; stroke-dasharray: 0.1 3.9; }
.illo .fs { fill: var(--surface); }
.illo .fa { fill: var(--accent-soft); }
.illo .fi { fill: var(--ink-2); }
.illo .fac { fill: var(--accent); }
.illo .sig { fill: var(--signal); }
.illo .sg { fill: none; stroke: var(--signal); stroke-width: 2; stroke-linecap: round; }

/* Drawings that "run": on a card's back (hover / flipped) and in a case study's build log */
:is(.illo.is-running, .project:hover .flip-back .illo, .project:focus-within .flip-back .illo, .is-flipped .flip-back .illo) {
  --run: running;
}
.illo .flow { animation: mv-flow 1.8s linear infinite paused; }
:is(.illo.is-running, .project:hover .flip-back .illo, .project:focus-within .flip-back .illo, .is-flipped .flip-back .illo) .ac.flow { stroke-dasharray: 4 3; }
.illo .mv-pend { transform-origin: 296px 148px; animation: mv-pend 2.6s ease-in-out infinite paused; }
.illo .mv-ball { animation: mv-ball 5s ease-in-out infinite alternate paused; }
/* Ambulator: the pusher closes on the bag, which is squeezed against the fixed stopper (left edge x 158) */
.illo .mv-push { animation: mv-push 3.2s ease-in-out infinite paused; }
.illo .mv-squeeze { transform-origin: 158px 118px; animation: mv-squeeze 3.2s ease-in-out infinite paused; }
.illo .mv-thread { animation: mv-thread 0.45s linear infinite paused; }
.illo .mv-chain { animation: mv-chain 0.5s linear infinite paused; }
.illo .mv-drive { animation: mv-drive 4.5s ease-in-out infinite paused; }
.illo .mv-fill .liquid { transform-box: fill-box; transform-origin: bottom; animation: mv-fill 3.2s ease-in infinite; animation-play-state: var(--run, paused); }
.illo .mv-blink { animation: mv-blink 1.2s steps(2, jump-none) infinite paused; }
.illo .mv-blade { animation: mv-blade 1.6s ease-in-out infinite paused; }
.illo .mv-pulse { transform-box: fill-box; transform-origin: center; animation: mv-pulse 1.6s ease-in-out infinite paused; }
.illo .mv-glow { animation: mv-blink 2s ease-in-out infinite paused; }
.illo .mv-a1 { animation: mv-a1 6s ease-in-out infinite paused; }
.illo .mv-a2 { animation: mv-a2 6s ease-in-out infinite paused; }
.illo .mv-spin { transform-origin: 226px 122px; animation: mv-spin 1.1s linear infinite paused; }
.illo .mv-carriage { animation: mv-carriage 4s ease-in-out infinite alternate paused; }
/* GA path planning: the best route redraws itself (pathLength 100); paused, it shows in full */
.illo .mv-route { stroke-dasharray: 100; animation: mv-route 5s ease-in-out infinite paused; }
/* FEA: the deflected beam flexes about the wall (x 36, y 80) */
.illo .mv-bend { transform-origin: 36px 80px; animation: mv-bend 3s ease-in-out infinite paused; }
.illo :is(.flow, .mv-pend, .mv-ball, .mv-push, .mv-squeeze, .mv-thread, .mv-chain, .mv-drive, .liquid, .mv-blink, .mv-blade, .mv-pulse, .mv-glow, .mv-a1, .mv-a2, .mv-spin, .mv-carriage, .mv-route, .mv-bend) {
  animation-play-state: var(--run, paused);
}
@keyframes mv-flow { to { stroke-dashoffset: -42; } } /* 42 = whole number of 3-4, 3-3 and 4-3 dash periods */
@keyframes mv-pend { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }
@keyframes mv-ball { 0% { transform: translate(0, 0); } 70% { transform: translate(-58px, 27px); } 100% { transform: translate(-52px, 24px); } }
@keyframes mv-push { 0%, 100% { transform: translateX(0); } 45% { transform: translateX(-11px); } }    /* 60 px bag × (1 − 0.82) */
@keyframes mv-squeeze { 0%, 100% { transform: scaleX(1); } 45% { transform: scaleX(0.82); } }
@keyframes mv-thread { to { transform: translateX(5px); } }   /* one thread pitch */
@keyframes mv-chain { to { stroke-dashoffset: -8; } }          /* two link pitches */
@keyframes mv-drive { 0% { transform: translateX(0); opacity: 0; } 12% { opacity: 1; } 70%, 86% { transform: translateX(118px); opacity: 1; } 100% { transform: translateX(118px); opacity: 0; } }
@keyframes mv-fill { 0% { transform: scaleY(0.12); } 75%, 100% { transform: scaleY(1); } }
@keyframes mv-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
@keyframes mv-blade { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(8px); } }
@keyframes mv-pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.7); opacity: 0.45; } }
@keyframes mv-a1 { 0%, 10% { transform: translateX(0); } 25%, 55% { transform: translateX(40px); } 70%, 100% { transform: translateX(0); } }
@keyframes mv-a2 { 0%, 25% { transform: translateX(0); } 40%, 70% { transform: translateX(40px); } 85%, 100% { transform: translateX(0); } }
@keyframes mv-spin { to { transform: rotate(360deg); } }
@keyframes mv-carriage { from { transform: translateX(0); } to { transform: translateX(-24px); } }
@keyframes mv-route { 0%, 30% { stroke-dashoffset: 0; opacity: 1; } 38% { stroke-dashoffset: 0; opacity: 0; } 39% { stroke-dashoffset: 100; opacity: 1; } 90%, 100% { stroke-dashoffset: 0; opacity: 1; } }
@keyframes mv-bend { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(0.2); } }

/* ---------- 15b. Glass ---------- */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60vw 52vh at 88% 12%, var(--page-glow-1), transparent 70%),
    radial-gradient(55vw 60vh at -4% 58%, var(--page-glow-2), transparent 70%),
    radial-gradient(48vw 42vh at 62% 104%, var(--page-glow-1), transparent 70%);
}
.project, .interest, .side-card, .aside-card, .honor, .case-nav a, .case-figure, .gallery figure, .skill-group, .act, .filter {
  background: linear-gradient(155deg, var(--glass), var(--glass-2));
  border-color: var(--glass-edge);
}
.project, .interest, .side-card, .aside-card, .honor, .case-nav a, .case-figure, .gallery figure {
  box-shadow: var(--glass-shadow);
}
.project:hover { box-shadow: var(--glass-shadow), 0 26px 50px -30px rgba(11, 27, 51, 0.45); }
.skills { border-color: var(--glass-edge); }
.skill-group { border-color: var(--glass-edge); }
.skill { background: var(--glass-2); border-color: var(--glass-edge); }
.filter[aria-pressed="true"], .act[aria-expanded="true"] { background: var(--ink); border-color: var(--ink); }
.site-header {
  background: rgba(11, 31, 58, 0.82); /* --band-bg at 82% */
  -webkit-backdrop-filter: blur(16px) saturate(1.5);
  backdrop-filter: blur(16px) saturate(1.5);
}
.site-header.is-scrolled { border-bottom-color: rgba(255, 255, 255, 0.08); }
.hero .btn-ghost { background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.2); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.hero .btn-ghost:hover { border-color: var(--accent); }
.contact-card { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 30px 60px -36px rgba(11, 27, 51, 0.6); }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .site-header { background: var(--band-bg); }
}

/* ---------- 15c. Project cards: photo flips to the schematic ---------- */
.media.can-flip { background: var(--band-bg); }
.flip-face {
  position: absolute; inset: 0; overflow: hidden;
  -webkit-backface-visibility: hidden; backface-visibility: hidden;
  transition: transform 0.8s cubic-bezier(0.3, 0.7, 0.2, 1);
}
.flip-front { transform: perspective(1400px) rotateY(0deg); background: var(--surface); }
.flip-back {
  transform: perspective(1400px) rotateY(180deg);
  /* blueprint: re-map the drawing colours to light-on-navy */
  --surface: #10284a; --surface-2: #15335a; --ink-2: #d6e4f5; --ink-3: #8fb0d6;
  --accent: #5eead4; --accent-soft: rgba(94, 234, 212, 0.16); --signal: #fb923c;
  background-color: #0b1f3a;
  background-image:
    linear-gradient(rgba(94, 234, 212, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(94, 234, 212, 0.08) 1px, transparent 1px);
  background-size: 20px 20px; background-position: -1px -1px;
}
.flip-back .illo { width: 100%; height: 100%; padding: 4% 4% 30px; }
.project.is-featured .flip-back .illo { padding: 7% 6% 40px; }
.flip-back .media-note { bottom: 8px; background: rgba(94, 234, 212, 0.12); color: #9fe7dc; }
.can-flip .flip-front img, .project:hover .can-flip .flip-front img { transform: none; }
@media (hover: hover) {
  .project:hover .can-flip .flip-front, .project:focus-within .can-flip .flip-front { transform: perspective(1400px) rotateY(-180deg); }
  .project:hover .can-flip .flip-back, .project:focus-within .can-flip .flip-back { transform: perspective(1400px) rotateY(0deg); }
}
.can-flip.is-flipped .flip-front { transform: perspective(1400px) rotateY(-180deg); }
.can-flip.is-flipped .flip-back { transform: perspective(1400px) rotateY(0deg); }
.flip-btn {
  position: absolute; top: 10px; right: 10px; z-index: 3;
  display: none; align-items: center; gap: 6px; height: 32px; padding: 0 11px; border-radius: 999px;
  border: 1px solid rgba(11, 31, 58, 0.9); background: rgba(11, 31, 58, 0.88); color: #fff; /* readable on white covers too */
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  font: 500 0.74rem/1 var(--font-mono); letter-spacing: 0.04em; cursor: pointer;
}
.flip-btn .i { width: 14px; height: 14px; }
@media (hover: none) { .flip-btn { display: inline-flex; } }
@media (prefers-reduced-motion: reduce) {
  .flip-face { -webkit-backface-visibility: visible; backface-visibility: visible; transform: none !important; }
  .flip-back { opacity: 0; }
  .can-flip.is-flipped .flip-back { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) and (hover: hover) {
  .project:hover .can-flip .flip-back, .project:focus-within .can-flip .flip-back { opacity: 1; }
}

/* ---------- 15d. Scroll story: "Closing the loop" (story.js) ---------- */
.hero-headline {
  margin-top: 14px; max-width: 22em;
  font: 500 clamp(1.45rem, 2.6vw, 2.05rem)/1.2 var(--font-serif); letter-spacing: -0.012em; color: var(--accent);
}
.hero-headline + .hero-lead { margin-top: 16px; }
.story-slot:empty { display: none; }
.story-panel {
  --ink: #eef4fb; --ink-2: #cfdcec; --ink-3: #9fb4cf; --accent: #5eead4; --signal: #fb923c;
  position: relative; display: flex; flex-direction: column; gap: 8px;
  padding: 14px 18px 12px 34px; overflow: hidden;
  border: 1px solid rgba(94, 234, 212, 0.2); border-radius: 20px;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.02) 42%),
    repeating-linear-gradient(0deg, rgba(94, 234, 212, 0.055) 0 1px, transparent 1px 24px),
    repeating-linear-gradient(90deg, rgba(94, 234, 212, 0.055) 0 1px, transparent 1px 24px),
    rgba(11, 31, 58, 0.93);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 30px 60px -30px rgba(11, 31, 58, 0.6);
  color: var(--ink-2);
}
.story-panel :focus-visible { outline-color: var(--accent); }
.story-example { align-self: flex-start; font: 500 0.72rem/1.4 var(--font-mono); letter-spacing: 0.04em; color: var(--accent); }
.story-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.story-stage { margin-right: auto; font: 500 0.76rem/1.4 var(--font-mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }
.story-chip, .story-ctrl {
  padding: 3px 8px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.2);
  font: 500 0.64rem/1.3 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2);
}
.story-ctrl { display: inline-flex; align-items: center; gap: 6px; }
.story-ctrl::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #64748b; }
.story-ctrl.is-on { color: var(--accent); border-color: rgba(94, 234, 212, 0.45); }
.story-ctrl.is-on::before { background: var(--accent); box-shadow: 0 0 0 3px rgba(94, 234, 212, 0.18); }
.story-pause {
  height: 28px; padding: 0 10px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.05); color: var(--ink); font: 500 0.72rem/1 var(--font-sans); cursor: pointer;
}
.story-pause:hover { border-color: var(--accent); }
.story-figure { position: relative; flex: 1; min-height: 0; border-radius: 12px; }
.story-svg { display: block; width: 100%; height: 100%; }
.story-panel.is-clickable .story-svg { cursor: crosshair; }
.story-caption { min-height: 3.1em; font: 400 0.96rem/1.5 var(--font-sans); color: #e6f0fb; }
.story-caption.is-in { animation: fade-in 0.28s var(--ease) both; }
.story-foot { font: 400 0.68rem/1.45 var(--font-mono); color: #b9cbe2; }
.story-rail { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 9px; }
.story-rail button {
  width: 9px; height: 9px; padding: 0; border-radius: 999px; cursor: pointer;
  border: 1.5px solid rgba(255, 255, 255, 0.45); background: transparent;
  transition: height 0.25s var(--ease), background-color 0.25s, border-color 0.25s;
}
.story-rail button.is-done { background: rgba(94, 234, 212, 0.55); border-color: transparent; }
.story-rail button.is-active { height: 24px; background: var(--accent); border-color: var(--accent); }
.story-pills { display: none; flex-wrap: wrap; gap: 6px; }
.story-pills button {
  min-height: 36px; padding: 0 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.22); background: rgba(255, 255, 255, 0.04);
  color: var(--ink-2); font: 500 0.78rem/1 var(--font-sans);
}
.story-pills button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #042f2a; }

/* drawing */
.story-svg text { font-family: var(--font-mono); fill: var(--ink-3); }
.story-svg .tx { font-size: 12.5px; fill: var(--ink); }
.story-svg .tx-s { font-size: 10.5px; letter-spacing: 0.04em; }
.story-svg .acc { fill: var(--accent); }
.story-svg .sl {
  stroke: var(--ink-2); stroke-width: 1.25; stroke-linejoin: round; stroke-linecap: round;
  stroke-dasharray: 1 1; fill-opacity: var(--fl, 0);
}
.story-svg .f-r { fill-opacity: calc(var(--fl, 0) * 0.7); }
.story-svg .f-l { fill-opacity: calc(var(--fl, 0) * 0.5); }
.story-svg .m-base { fill: #8ea8c8; }
.story-svg .m-post, .story-svg .m-joint { fill: #d3deeb; }
.story-svg .m-motor { fill: #2a4f86; }
.story-svg .m-plate { fill: rgba(94, 234, 212, 0.4); }
.story-svg .m-pcb { fill: #c27a33; }
.story-svg .m-chip { fill: #0b1626; stroke: var(--ink-3); }
.story-svg .foot { stroke: #8ea8c8; stroke-width: 4; fill: none; }
.story-svg .shaft { stroke-width: 3; fill: none; }
.story-svg .crank { stroke: var(--accent); stroke-width: 3.2; fill: none; }
.story-svg .rod { stroke: #d3deeb; stroke-width: 2.2; fill: none; }
.story-svg .grid { stroke: rgba(255, 255, 255, 0.2); stroke-width: 0.8; fill: none; }
.story-svg .glare { stroke: rgba(255, 255, 255, 0.55); stroke-width: 1.6; stroke-linecap: round; fill: none; }
.story-svg .cross { fill: none; stroke: var(--accent); stroke-width: 1.7; }
.story-svg .ball circle { fill: #e9eff7; stroke: var(--accent); stroke-width: 1.5; }
.story-svg .ball-hi { fill: none; stroke: #fff; stroke-width: 1.6; stroke-linecap: round; }
.story-svg .shadow { fill: rgba(0, 0, 0, 0.35); }
.story-svg .parked { fill: none; stroke: var(--ink-3); stroke-width: 1.2; stroke-dasharray: 3 3; }
.story-svg .trail { fill: none; stroke: var(--accent); stroke-width: 1.4; stroke-dasharray: 2 3; opacity: 0.55; }
.story-svg .ping { fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 3 3; }
.story-svg .call-line { fill: none; stroke: var(--ink-3); stroke-width: 1; }
.story-svg .dashed { stroke-dasharray: 3 3; }
.story-svg .dim { fill: none; stroke: var(--accent); stroke-width: 1; }
.story-svg .titleblock rect, .story-svg .tb-rule { fill: rgba(255, 255, 255, 0.035); stroke: rgba(255, 255, 255, 0.2); stroke-width: 1; }
.story-svg .tb-rule { fill: none; }
.story-svg .tb-t { font-size: 9.6px; letter-spacing: 0.02em; } /* the title block's first line fits its box */
/* pulses fill-opacity, so the script can still fade the hint out with opacity */
.story-svg .hint { fill: var(--accent); animation: hint-pulse 1.4s ease-in-out infinite alternate; }
@keyframes hint-pulse { from { fill-opacity: 0.35; } to { fill-opacity: 1; } }
.story-svg .lt-screen { fill: rgba(255, 255, 255, 0.05); stroke: rgba(255, 255, 255, 0.3); }
.story-svg .lt-base { fill: rgba(255, 255, 255, 0.14); }
.story-svg .lt-plot { fill: none; stroke: var(--accent); stroke-width: 1.5; }
.story-svg .lt-zero { fill: none; stroke: var(--ink-3); stroke-dasharray: 2 3; }
.story-svg .wifi { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; }
.story-svg .wire { fill: none; stroke: var(--ink-2); stroke-width: 1.4; }
.story-svg .fb { stroke-dasharray: 1 1; }
.story-svg .fb-tip { fill: var(--accent); }
.story-svg .open { fill: var(--signal); font-size: 17px; }
.story-svg .status { letter-spacing: 0.12em; }
/* solid fills (the old 4% white / 12% mint tints on the navy) hide the wires and signal dots behind the labels */
.story-svg .blk rect, .story-svg .blk circle { fill: #172a43; stroke: rgba(255, 255, 255, 0.28); stroke-width: 1.2; transition: stroke 0.3s, fill 0.3s; }
.story-svg .blk.on rect, .story-svg .blk.on circle { fill: #173a4d; stroke: var(--accent); }
.story-svg .plus { fill: none; stroke: var(--ink-2); stroke-width: 1.3; }
.story-svg .lqr rect { fill: none; stroke: var(--ink-3); stroke-width: 1.2; stroke-dasharray: 4 3; }
.story-svg .sig { fill: var(--accent); }
.story-svg .ring { fill: none; stroke: var(--accent); stroke-width: 2; }
.story-svg .axis { fill: none; stroke: var(--ink-3); stroke-width: 1; }
.story-svg .zero { fill: none; stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 4 4; }
.story-svg .trace-x { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.story-svg .trace-y { fill: none; stroke: #8fb8ff; stroke-width: 1.5; stroke-linejoin: round; opacity: 0.85; }
/* "Disturb the ball" / "Try it now": the site's mint, in the top-left corner of the figure,
   with a navy halo so the plate can pass behind it */
.story-cta {
  position: absolute; top: 0; left: 2px; z-index: 1; display: grid; justify-items: start; pointer-events: none;
  color: var(--accent); text-shadow: 0 0 2px #0b1f3a, 0 0 6px #0b1f3a, 0 0 12px #0b1f3a;
}
.story-cta .cta-1 { font: 700 1.12rem/1.2 var(--font-sans); }
.story-cta .cta-2 { font: 600 0.92rem/1.3 var(--font-sans); }
.story-cta .cta-3 { font: 500 0.76rem/1.35 var(--font-sans); }

/* phones and narrow windows: the card sits in the introduction */
.story-panel.is-phone { margin-top: 28px; padding: 14px 14px 12px; }
.story-panel.is-phone .story-figure { height: min(100vw, 420px); flex: none; }
.story-panel.is-phone .story-foot { font-size: 0.64rem; }
.story-panel.is-phone .story-rail { display: none; }
.story-panel.is-phone .story-pills { display: flex; }

/* wide screens: content shifts left, the story panel stays beside it */
@media (min-width: 1100px) and (min-height: 560px) {
  .has-story { --story-w: clamp(400px, 37vw, 640px); --content-max: 820px; }
  .has-story #main { position: relative; }
  .has-story #main .container {
    --area: calc(100% - var(--story-w) - var(--gutter));
    max-width: none; margin-right: 0;
    width: min(calc(var(--content-max) + 2 * var(--gutter)), var(--area));
    margin-left: max(0px, calc((var(--area) - min(calc(var(--content-max) + 2 * var(--gutter)), var(--area))) / 2));
  }
  .has-story .site-header .container { max-width: none; }
  .has-story .story {
    position: absolute; top: 0; right: 0; bottom: 0; z-index: 5;
    width: calc(var(--story-w) + var(--gutter)); padding: 16px var(--gutter) 24px 0; pointer-events: none;
  }
  .has-story .story-panel {
    position: sticky; top: calc(var(--header-h) + 14px);
    height: calc(100vh - var(--header-h) - 28px); max-height: 900px; pointer-events: auto;
  }
  .has-story .hero-grid { grid-template-columns: minmax(0, 1fr); }
  .has-story .projects { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .has-story .section-head { grid-template-columns: minmax(0, 1fr); }
  .has-story .section-intro { max-width: 40em; }
  .has-story .project.is-featured { grid-template-columns: minmax(0, 1fr); }
  .has-story .project.is-featured .media { height: auto; min-height: 0; aspect-ratio: 16 / 10; border-right: 0; border-bottom: 1px solid var(--rule); }
}
@media (min-width: 1100px) and (max-width: 1399px) and (min-height: 560px) {
  .has-story .about-grid, .has-story .xp-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (min-width: 1100px) and (max-width: 1279px) {
  .has-story .story-example { display: none; }
  .has-story .story-caption { font-size: 0.88rem; }
}
@media (max-height: 760px) {
  .has-story .story-example { display: none; }
}

/* ---------- 15e. Videos: the home-page overview and each project's film ---------- */
.video-frame { position: relative; margin: 0; }
.video-frame video { display: block; width: 100%; height: auto; max-height: 72vh; background: #000; border-radius: 10px; }
.video-frame figcaption { margin-top: 10px; font-size: 0.86rem; line-height: 1.5; color: var(--ink-3); }
.section-video { padding-bottom: clamp(36px, 5vw, 60px); }
.intro-video { max-width: 980px; padding: 10px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.intro-video .video-frame figcaption { padding: 0 6px 4px; }
.aside-video .video-frame video { border-radius: 8px; }
/* the one-file preview leaves the video files out */
.video-frame.is-missing::after {
  content: "The video plays on the website (it is not inside this preview file).";
  position: absolute; left: 10px; right: 10px; top: 10px; padding: 8px 10px; border-radius: 8px;
  background: rgba(11, 31, 58, 0.88); color: #e6f0fb; font: 500 0.8rem/1.4 var(--font-sans);
}

/* ---------- 16. Local setup checklist (never shown on the live site) ---------- */
.setup {
  position: fixed; left: 16px; bottom: 16px; z-index: 60; width: min(380px, calc(100vw - 32px));
  border: 1px solid var(--rule-strong); border-radius: 12px; background: var(--surface);
  box-shadow: 0 18px 50px -18px rgba(0, 0, 0, 0.35); font-size: 0.86rem;
}
.setup summary {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; cursor: pointer; list-style: none;
  font: 500 0.78rem/1.4 var(--font-mono); letter-spacing: 0.04em; color: var(--ink);
}
.setup summary::-webkit-details-marker { display: none; }
.setup-count { padding: 1px 8px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); }
.setup-hint { margin-left: auto; color: var(--ink-3); font-size: 0.7rem; }
.setup ul { max-height: min(52vh, 420px); overflow: auto; padding: 2px 14px 6px; }
.setup li { padding: 8px 0 8px 18px; position: relative; border-top: 1px solid var(--rule); color: var(--ink-2); line-height: 1.5; }
.setup li::before { content: ""; position: absolute; left: 2px; top: 15px; width: 8px; height: 8px; border-radius: 2px; border: 1.5px solid var(--warn); }
.setup code { padding: 1px 5px; border-radius: 4px; background: var(--surface-2); color: var(--ink); font-size: 0.78rem; }
.setup-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--rule); color: var(--ink-3); font-size: 0.76rem; }
.setup-foot button { padding: 4px 10px; border: 1px solid var(--rule-strong); border-radius: 6px; background: var(--bg); color: var(--ink-2); cursor: pointer; font-size: 0.76rem; }

/* ---------- 17. Motion ---------- */
.js-reveal .reveal { opacity: 0; transform: translateY(10px); transition: opacity 0.55s var(--ease), transform 0.55s var(--ease); transition-delay: var(--d, 0ms); }
.js-reveal .reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .js-reveal .reveal { opacity: 1; transform: none; }
}

/* ---------- 18. Print (File → Print gives a clean, CV-like document) ---------- */
@media print {
  :root, :root[data-theme], :root:not([data-theme]), .hero, .site-header {
    --bg: #fff; --surface: #fff; --surface-2: #f3f3f3; --ink: #000; --ink-2: #222; --ink-3: #555;
    --rule: #ccc; --rule-strong: #bbb; --accent: #000; --accent-soft: #f0f0f0; --on-accent: #fff;
    --ok: #157a3c; --ok-soft: #e4f3ea; --warn: #946200; --warn-soft: #f9f0d9; --signal: #d4462a;
    --grid-line: transparent; --shadow: none;
    --inverse-bg: #fff; --inverse-ink: #000; --inverse-ink-2: #333; --inverse-rule: #ccc; --inverse-surface: #f3f3f3;
    --inverse-accent: #000;
    --glass: #fff; --glass-2: #fff; --glass-edge: #ccc; --glass-shadow: none;
    --page-glow-1: transparent; --page-glow-2: transparent;
    color-scheme: light;
  }
  body::before { display: none; }
  body { font-size: 10.5pt; }
  .site-header, .skip-link, .hero::before, .hero-actions, .socials, .filters, .pub-actions,
  .mini-links, .more, .contact-actions, .contact-card::before, .footer-links, .setup, .case-nav, .aside-cta, .case-aside, .story,
  .media, .case-figure, .section-video, .aside-video { display: none !important; }
  .js-reveal .reveal { opacity: 1 !important; transform: none !important; }
  .hero { padding-top: 0; background: none !important; color: #222; }
  .hero-grid, .about-grid, .xp-grid, .case-head, .case-body, .contact-card { grid-template-columns: 1fr !important; }
  .section, .contact { padding: 18pt 0; }
  .projects { grid-template-columns: 1fr 1fr; }
  .project.is-featured { display: flex; grid-column: 1 / -1; }
  .project, .pub, .tl-item, .interest, .honor, .skill-group, .side-card { break-inside: avoid; box-shadow: none !important; }
  .contact-card { border: 1px solid #ccc; padding: 18pt; }
  a { color: #000; }
  .status-dot::after { display: none; }
  .gallery img.g-light { display: block !important; }
  .gallery img.g-dark { display: none !important; }
}
