/* ---------- Tokens: dark blueprint by default, light on request ---------- */
:root {
  --bg: #0a1529;
  --bg-2: #0f1d36;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-2: rgba(255, 255, 255, 0.08);
  --ink: #e9eef7;
  --ink-2: #b9c6da;
  --muted: #8392ac;
  --line: rgba(150, 180, 225, 0.16);
  --line-strong: rgba(150, 180, 225, 0.34);
  --cyan: #3fd3e6;
  --cyan-2: #8fe8f3;
  --amber: #f2b64d;
  --coral: #ff7b8b;
  --cyan-glow: rgba(63, 211, 230, 0.45);
  --amber-glow: rgba(242, 182, 77, 0.55);
  --grid: rgba(100, 140, 210, 0.11);
  --grid-strong: rgba(100, 140, 210, 0.22);
  --btn-bg: #3fd3e6;
  --btn-bg-hover: #8fe8f3;
  --btn-fg: #06111f;
  --header-bg: rgba(10, 21, 41, 0.78);
  --shadow: 0 24px 48px -28px rgba(0, 0, 0, 0.75);
  --glow-a: rgba(63, 211, 230, 0.16);
  --glow-b: rgba(242, 182, 77, 0.11);
  --h-grad: linear-gradient(90deg, #ffffff 0%, #bfe9f2 100%);
  --media-bg: radial-gradient(70% 70% at 50% 50%, rgba(63, 211, 230, 0.10), rgba(10, 21, 41, 0) 70%), #0c1a33;
  --chip-hover: rgba(63, 211, 230, 0.16);
  --card-bg: rgba(14, 27, 50, 0.92);

  --sans: "Archivo", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --hand: "Caveat", "Segoe Print", "Bradley Hand", cursive;
  --max: 1080px;
  --gutter: clamp(20px, 5vw, 48px);
  --t-sm: 0.875rem;
  --t-base: 1.0625rem;
  --t-md: 1.2rem;
  --t-lg: 1.5rem;
  --t-xl: clamp(2rem, 3.6vw, 2.75rem);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f6f8fb;
  --bg-2: #eaf0f7;
  --surface: rgba(16, 38, 69, 0.035);
  --surface-2: rgba(16, 38, 69, 0.07);
  --ink: #0f1f3a;
  --ink-2: #3f5170;
  --muted: #6b7a92;
  --line: rgba(16, 38, 69, 0.12);
  --line-strong: rgba(16, 38, 69, 0.26);
  --cyan: #0a8aa3;
  --cyan-2: #0b6f84;
  --amber: #a56f0a;
  --coral: #c9263b;
  --cyan-glow: rgba(10, 138, 163, 0.25);
  --amber-glow: rgba(165, 111, 10, 0.25);
  --grid: rgba(16, 60, 120, 0.08);
  --grid-strong: rgba(16, 60, 120, 0.16);
  --btn-bg: #0a8aa3;
  --btn-bg-hover: #0b6f84;
  --btn-fg: #ffffff;
  --header-bg: rgba(246, 248, 251, 0.82);
  --shadow: 0 24px 48px -32px rgba(16, 38, 69, 0.35);
  --glow-a: rgba(10, 138, 163, 0.10);
  --glow-b: rgba(165, 111, 10, 0.08);
  --h-grad: linear-gradient(90deg, #0f1f3a 0%, #0a8aa3 100%);
  --media-bg: radial-gradient(70% 70% at 50% 50%, rgba(10, 138, 163, 0.10), rgba(246, 248, 251, 0) 70%), #e6edf5;
  --chip-hover: rgba(10, 138, 163, 0.12);
  --card-bg: rgba(255, 255, 255, 0.82);
  color-scheme: light;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 var(--t-base)/1.6 var(--sans); font-stretch: 100%;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
body::before {
  /* soft page-wide glow: cyan top-left, amber bottom-right */
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60% 45% at 10% -5%, var(--glow-a), transparent 65%),
    radial-gradient(45% 40% at 100% 105%, var(--glow-b), transparent 65%);
}
img, svg { max-width: 100%; display: block; }
a { color: var(--cyan); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.2em; text-decoration-color: transparent; transition: color 0.15s, text-decoration-color 0.15s; }
a:hover { color: var(--cyan-2); text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--cyan); color: #06111f; }
h1, h2, h3 { margin: 0; line-height: 1.15; letter-spacing: -0.015em; }
h2 { font-size: var(--t-xl); font-weight: 700; letter-spacing: -0.025em; line-height: 1.08; }
h3 { font-size: var(--t-md); font-weight: 600; line-height: 1.3; }
p { margin: 0 0 1em; }
[hidden] { display: none !important; }
.container { max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }
.small { font-size: var(--t-sm); }
.muted { color: var(--muted); }
.grad { background: var(--h-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

.skip-link { position: absolute; left: -999px; top: 8px; background: var(--cyan); color: #06111f; padding: 8px 12px; border-radius: 6px; z-index: 100; }
.skip-link:focus { left: 8px; }

/* Placeholders: handwritten notes in coral. Replace them and they disappear. */
.fill { font-family: var(--hand); font-weight: 500; font-size: 1.2em; line-height: 1; color: var(--coral); }
.ph {
  display: grid; place-items: center; text-align: center; padding: 16px;
  border: 1px dashed var(--coral); border-radius: 12px;
  background-color: var(--surface);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 18px 18px;
  color: var(--coral); font-family: var(--hand); font-weight: 500; font-size: 1.3rem; line-height: 1.2;
}

/* ---------- Buttons & pills ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 0.5em;
  padding: 0.75em 1.15em; border-radius: 10px;
  background: var(--btn-bg); color: var(--btn-fg); border: 1px solid transparent;
  font-weight: 600; font-size: var(--t-sm); text-decoration: none; line-height: 1.2;
  box-shadow: 0 10px 24px -14px var(--cyan-glow);
  transition: background 0.15s, transform 0.15s, box-shadow 0.15s, border-color 0.15s, color 0.15s;
}
.btn:hover { background: var(--btn-bg-hover); color: var(--btn-fg); transform: translateY(-1px); text-decoration: none; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); box-shadow: none; }
.btn.ghost:hover { background: var(--surface); border-color: var(--cyan); color: var(--cyan); }
.pills { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0; padding: 0; }
.pills li { font-size: 0.8rem; color: var(--ink-2); border: 1px solid var(--line-strong); background: var(--surface); border-radius: 999px; padding: 5px 11px; line-height: 1.2; }
.status { display: inline-block; font-size: 0.74rem; font-weight: 600; color: var(--amber); border: 1px solid var(--amber); border-radius: 999px; padding: 2px 9px; margin-left: 10px; vertical-align: 3px; line-height: 1.5; letter-spacing: 0.01em; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: var(--header-bg);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.nav { display: flex; align-items: center; gap: 8px; height: 64px; }
.brand { font-weight: 700; color: var(--ink); text-decoration: none; margin-right: auto; letter-spacing: -0.01em; }
.brand:hover { color: var(--cyan); text-decoration: none; }
.nav-links { display: flex; gap: 2px; list-style: none; margin: 0; padding: 0; }
.nav-links a { display: block; padding: 8px 11px; font-size: var(--t-sm); color: var(--ink-2); border-radius: 8px; text-decoration: none; }
.nav-links a:hover { color: var(--ink); background: var(--surface); text-decoration: none; }
.nav-links a[aria-current="true"] { color: var(--cyan); }
.toggle {
  font: 600 var(--t-sm) var(--sans); color: var(--ink);
  background: transparent; border: 1px solid var(--line-strong); border-radius: 8px;
  padding: 7px 11px; cursor: pointer; line-height: 1.2;
}
.toggle:hover { border-color: var(--cyan); color: var(--cyan); }
.nav-toggle { display: none; }
@media (max-width: 760px) {
  .nav-toggle { display: inline-block; }
  .nav-links {
    display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; gap: 0;
    background: var(--bg); border-bottom: 1px solid var(--line); padding: 6px var(--gutter) 12px;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 12px 0; font-size: 1rem; border-bottom: 1px solid var(--line); border-radius: 0; }
  .nav-links li:last-child a { border-bottom: 0; }
}

/* ---------- Hero ---------- */
.hero { position: relative; padding: clamp(60px, 9vw, 112px) 0 clamp(40px, 6vw, 72px); }
#bg { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }
.hero h1 { font-size: clamp(3rem, 9.5vw, 7.25rem); font-weight: 800; font-stretch: 112%; letter-spacing: -0.035em; line-height: 0.95; margin: 0 0 0.3em; padding-bottom: 0.05em; }
.hero .sub { font-size: var(--t-md); line-height: 1.4; color: var(--ink-2); max-width: 54ch; margin: 0 0 1.1em; }
.hero .lede { font-size: 1.15rem; max-width: 60ch; margin: 0 0 1.6em; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.actions .plain-links { display: flex; flex-wrap: wrap; gap: 18px; margin-left: 10px; font-size: var(--t-sm); }

.fig { margin: clamp(44px, 6vw, 76px) 0 0; }
.fig > svg { width: 100%; height: auto; overflow: visible; }
.fig-foot { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-top: 14px; }
@media (max-width: 640px) { .fig-foot { flex-wrap: wrap; } .replay { margin-left: auto; } }
.fig figcaption, .anim figcaption { font-size: var(--t-sm); color: var(--muted); max-width: 72ch; line-height: 1.5; }
.replay { flex: none; display: inline-flex; align-items: center; gap: 8px; font: 600 var(--t-sm) var(--sans); color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 999px; padding: 8px 14px; cursor: pointer; transition: border-color 0.15s, color 0.15s; }
.replay:hover { border-color: var(--cyan); color: var(--cyan); }
.replay svg { width: 16px; height: 16px; }
.replay.replaying svg { animation: spin 0.6s ease; }
@keyframes spin { to { transform: rotate(-360deg); } }

/* Diagram: static styling is the finished state; the .animate class plays it through once */
.fig .scope rect { fill: var(--surface); stroke: var(--line-strong); stroke-width: 1; }
.fig .scope .grid { fill: none; stroke: var(--line); stroke-width: 1; }
.fig .in, .fig .out, .fig .link, .fig .state, .fig .edge, .fig .ring, .fig .win, .fig .target { fill: none; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.fig .in, .fig .out { stroke: var(--amber); stroke-width: 2.5; filter: drop-shadow(0 0 6px var(--amber-glow)); }
.fig .link { stroke: var(--amber); stroke-width: 2; }
.fig .target { stroke: var(--amber); stroke-opacity: 0.45; stroke-width: 1.5; stroke-dasharray: 5 5; }
.fig .win { stroke: var(--amber); stroke-opacity: 0.75; stroke-width: 1.25; }
.fig .state { stroke: var(--ink-2); stroke-opacity: 0.6; stroke-width: 1.25; }
.fig .ring { stroke: var(--ink-2); stroke-width: 1.25; }
.fig .ring.inner { stroke: var(--cyan); stroke-opacity: 0.3; stroke-dasharray: 3 6; }
.fig .halo-in { stop-color: var(--cyan); stop-opacity: 0.16; }
.fig .halo-out { stop-color: var(--cyan); stop-opacity: 0; }
.fig .edge { stroke: var(--cyan); stroke-opacity: 0.5; stroke-width: 1; }
.fig .arrow { fill: var(--cyan); fill-opacity: 0.75; }
.fig .arrow.amber { fill: var(--amber); fill-opacity: 0.9; }
.fig .dot { fill: var(--cyan); filter: drop-shadow(0 0 5px var(--cyan-glow)); }
.fig .dot.input { stroke: var(--amber); stroke-width: 2; }
.fig .ripple { fill: none; stroke: var(--cyan); stroke-width: 1.5; opacity: 0; transform-box: fill-box; transform-origin: center; }
.fig .sum circle { fill: var(--amber); filter: drop-shadow(0 0 8px var(--amber-glow)); }
.fig .sum text { font-family: var(--sans); font-size: 16px; font-weight: 700; fill: #06111f; }
.fig text { font-family: var(--sans); }
.fig .lbl { font-size: 15px; fill: var(--muted); }
.fig .lbl .math { fill: var(--ink-2); font-style: italic; }
.fig text.math { font-size: 14px; font-style: italic; fill: var(--ink-2); }
.fig .lbl.sm { font-size: 12px; }
@media (max-width: 640px) {
  .fig text { display: none; }
  .fig .dot { r: 8; }
  .fig .sum circle { r: 16; }
}
.fig.animate .scope { opacity: 0; animation: fade 0.5s ease forwards; }
.fig.animate .draw { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.1s cubic-bezier(0.4, 0, 0.2, 1) forwards; }
.fig.animate .in { animation-delay: 0.25s; }
.fig.animate .win { opacity: 0; stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 0.5s ease-out forwards, show 0.01s linear forwards; animation-delay: calc(1.25s + var(--i) * 0.07s); }
.fig.animate .halo { opacity: 0; animation: fade 0.8s ease forwards 1.2s; }
.fig.animate .ring { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1s ease forwards 1s; }
.fig.animate .ring.inner { stroke-dasharray: 3 6; stroke-dashoffset: 0; opacity: 0; animation: fade 0.6s ease forwards 1.6s; }
.fig.animate .edge { opacity: 0; animation: fade 0.6s ease forwards 1.7s; }
.fig.animate .dot { transform-box: fill-box; transform-origin: center; transform: scale(0); animation: pop 0.45s cubic-bezier(0.2, 0.8, 0.2, 1.2) forwards; animation-delay: calc(1.55s + var(--i) * 0.06s); }
.fig.animate .ripple { animation: ripple 0.9s ease-out forwards; animation-delay: calc(1.7s + var(--i) * 0.06s); }
.fig.animate .state { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 0.8s ease forwards; animation-delay: calc(2.9s + var(--i) * 0.08s); }
.fig.animate .sum { opacity: 0; transform-box: fill-box; transform-origin: center; transform: scale(0.6); animation: sumin 0.5s cubic-bezier(0.2, 0.8, 0.2, 1.2) forwards 3.5s; }
.fig.animate .link { animation-duration: 0.25s; animation-delay: 3.9s; }
.fig.animate .target { opacity: 0; animation: fade 0.6s ease forwards 4s; }
.fig.animate .out { animation-duration: 0.9s; animation-delay: 4.1s; }
.fig.animate .lbl, .fig.animate text.math { opacity: 0; animation: fade 0.6s ease forwards 4.6s; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fade { to { opacity: 1; } }
@keyframes pop  { to { transform: scale(1); } }
@keyframes ripple { 0% { opacity: 0.7; transform: scale(1); } 100% { opacity: 0; transform: scale(3.2); } }
@keyframes sumin { to { opacity: 1; transform: scale(1); } }
@keyframes show { to { opacity: 1; } }


/* ---------- Small animated figures inside the research and teaching cards ---------- */
.anim { margin: 20px 0 0; padding-top: 20px; border-top: 1px solid var(--line); }
.anim > svg { width: 100%; height: auto; overflow: visible; }
.anim path, .anim line, .anim circle, .anim ellipse, .anim polygon { vector-effect: non-scaling-stroke; }
.anim .nofill { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.anim .amber { stroke: var(--amber); }
.anim .cyan { stroke: var(--cyan); }
.anim .ink { stroke: var(--ink-2); }
.anim .w2 { stroke-width: 2.5; }
.anim .w1 { stroke-width: 1.25; }
.anim .faint { stroke-opacity: 0.35; }
.anim .dash { stroke-dasharray: 3 5; }
.anim .glow-a { filter: drop-shadow(0 0 6px var(--amber-glow)); }
.anim .glow-c { filter: drop-shadow(0 0 6px var(--cyan-glow)); }
.anim .fillc { fill: var(--cyan); }
.anim .fillink { fill: var(--ink-2); }
.anim .scope rect { fill: var(--surface); stroke: var(--line-strong); stroke-width: 1; }
.anim .scope .grid { fill: none; stroke: var(--line); stroke-width: 1; }
.anim .opamp { fill: var(--surface-2); stroke: var(--ink-2); stroke-width: 1.25; }
.anim .disk { fill: var(--surface-2); stroke: var(--line-strong); stroke-width: 1; }
.anim .ring { stroke-opacity: 0.9; }
.anim text { font-family: var(--sans); font-size: 14px; fill: var(--muted); }
.anim text.sm { font-size: 12.5px; }
.anim text.math { font-style: italic; fill: var(--ink-2); }
.anim .flow, .anim .orbit { opacity: 0; }
.anim .flipv { transform-box: view-box; transform: rotate(90deg); }
.anim .prec { transform-box: view-box; }
.anim .spinline { stroke-dasharray: 1; stroke-dashoffset: 0.777; }
.anim .rise { transform-box: view-box; }
@media (max-width: 640px) { .anim text { display: none; } }
.anim.animate .d { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw var(--t, 1s) var(--e, ease) forwards var(--d, 0s); }
.anim.animate .f { opacity: 0; animation: fade var(--t, 0.5s) ease forwards var(--d, 0s); }
.anim.animate .rise { transform: scaleY(0); animation: rise var(--t, 0.8s) ease-out forwards var(--d, 0s); }
.anim.animate .flow { stroke-dasharray: 3 9; animation: flow var(--t, 0.9s) linear var(--d, 0s) var(--n, 3); }
.anim.animate .orbit { stroke-dasharray: 0.2 0.8; animation: orbit var(--t, 0.8s) linear var(--d, 0s) var(--n, 5); }
.anim.animate .flipv { transform: rotate(0deg); animation: flip 0.6s ease-in-out forwards var(--d, 0s); }
.anim.animate .spinline { stroke-dashoffset: 0; animation: decay 3s linear forwards var(--d, 0s); }
.anim.animate .spiral { stroke-dasharray: 1; stroke-dashoffset: 1; animation: spiral 3s linear forwards var(--d, 0s); }
.anim .hide { opacity: 0; }
.anim .tilt { transform-box: view-box; transform: scaleY(0.354); }
.anim .pole, .anim .tank, .anim .pad { fill: var(--surface-2); stroke: var(--line-strong); stroke-width: 1; }
.anim .chan { fill: var(--surface); stroke: var(--line-strong); stroke-width: 1; }
.anim .filla { fill: var(--amber); }
.anim .drops circle { fill: var(--amber); fill-opacity: 0.8; }
.anim .plume-outer { fill: var(--amber); fill-opacity: 0.55; filter: drop-shadow(0 0 10px var(--amber-glow)); }
.anim .plume-inner { fill: #fff3c4; fill-opacity: 0.85; }
.anim .plume { transform-box: view-box; }
.anim .padglow { fill: var(--amber); fill-opacity: 0.35; filter: drop-shadow(0 0 10px var(--amber-glow)); }
.anim .rocket { transform-box: view-box; transform: translate(800px, 30px) rotate(55deg); }
.anim .rk-body { fill: var(--ink); } .anim .rk-fin { fill: var(--cyan); } .anim .rk-flame { fill: var(--amber); filter: drop-shadow(0 0 6px var(--amber-glow)); }
.anim.animate .hide { opacity: 1; animation: hideit 0.01s linear forwards var(--d2, 0s); }
.anim.animate .show { opacity: 0; animation: precess 3s linear forwards var(--d, 0s), showit 0.01s linear forwards var(--d2, 0s); }
.anim.animate .drops { animation: drift var(--t, 1.2s) linear var(--d, 0s) var(--n, 6); }
.anim.animate .plume { opacity: 0; animation: ignite 0.4s ease-out forwards var(--d, 0s), flicker 0.35s ease-in-out var(--d, 0s) 10 alternate; }
.anim.animate .rocket { transform: translate(540px, 292px) rotate(0deg); animation: launch 3.2s ease-in forwards var(--d, 0s); }
.anim.animate .rk-flame { animation: flicker 0.2s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: top; }
@keyframes hideit { to { opacity: 0; } }
@keyframes showit { to { opacity: 1; } }
@keyframes drift { to { transform: translateX(48px); } }
@keyframes ignite { to { opacity: 1; } }
@keyframes flicker { from { transform: scaleY(1); } to { transform: scaleY(1.12); } }
@keyframes launch { 0% { transform: translate(540px, 292px) rotate(0deg); } 18% { transform: translate(542px, 248px) rotate(3deg); } 42% { transform: translate(570px, 150px) rotate(16deg); } 72% { transform: translate(670px, 66px) rotate(38deg); } 100% { transform: translate(800px, 30px) rotate(55deg); } }
@keyframes rise { to { transform: scaleY(1); } }
@keyframes flow { from { opacity: 1; stroke-dashoffset: 0; } to { opacity: 1; stroke-dashoffset: -24; } }
@keyframes orbit { from { opacity: 1; stroke-dashoffset: 0; } to { opacity: 1; stroke-dashoffset: -1; } }
@keyframes flip { to { transform: rotate(90deg); } }
@keyframes precess { to { transform: rotate(1080deg); } }
@keyframes decay { 0% { stroke-dashoffset: 0; } 25% { stroke-dashoffset: 0.313; } 50% { stroke-dashoffset: 0.528; } 75% { stroke-dashoffset: 0.675; } 100% { stroke-dashoffset: 0.777; } }
@keyframes spiral { 0% { stroke-dashoffset: 1; } 25% { stroke-dashoffset: 0.597; } 50% { stroke-dashoffset: 0.321; } 75% { stroke-dashoffset: 0.131; } 100% { stroke-dashoffset: 0; } }

/* ---------- Sections ---------- */
.section { padding: clamp(56px, 8vw, 96px) 0; }
.section-head { margin-bottom: clamp(28px, 4vw, 44px); }
.section-head h2::after { content: ""; display: block; width: 64px; height: 3px; border-radius: 2px; margin-top: 16px; background: linear-gradient(90deg, var(--amber), var(--cyan)); }
.section-head p { font-size: var(--t-md); line-height: 1.45; color: var(--ink-2); max-width: 56ch; margin: 16px 0 0; }
.sub-title { font-size: var(--t-lg); font-weight: 700; margin: clamp(40px, 6vw, 64px) 0 18px; }

/* Cards */
.card {
  background: var(--card-bg); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: var(--shadow); position: relative;
  transition: border-color 0.2s, transform 0.2s;
}
.card::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; background: linear-gradient(180deg, rgba(255,255,255,0.06), transparent 40%); }
:root[data-theme="light"] .card::after { background: linear-gradient(180deg, rgba(255,255,255,0.7), transparent 40%); }
.card:hover { border-color: var(--line-strong); }

/* Label + value rows */
.spec { margin: 0; padding: 0; }
.spec > div { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.spec > div:first-child { border-top: 0; padding-top: 0; }
.spec > div:last-child { padding-bottom: 0; }
.spec dt { color: var(--cyan); font-size: var(--t-sm); font-weight: 600; padding-top: 2px; }
.spec dd { margin: 0; }
@media (max-width: 640px) { .spec > div { grid-template-columns: 1fr; gap: 2px; } }

/* Areas of interest */
.interests { margin-top: 26px; }
.eyebrow { font-size: 0.78rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin: 0 0 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; list-style: none; margin: 0; padding: 0; }
.chips li { padding: 9px 15px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); font-size: 0.95rem; line-height: 1.3; cursor: default; transition: background 0.18s, border-color 0.18s, color 0.18s, transform 0.18s; }
.chips li:hover { background: var(--chip-hover); border-color: var(--cyan); color: var(--cyan-2); transform: translateY(-1px); }

/* About */
.about { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: clamp(28px, 5vw, 56px); align-items: start; }
.prose { max-width: 66ch; }
.prose p:first-child { font-size: 1.1rem; }
.about .card { padding: 22px 24px; margin-top: 28px; max-width: 66ch; }
.photo { margin: 0; position: sticky; top: 90px; }
.photo .ph, .photo img { aspect-ratio: 3 / 4; width: 100%; height: auto; max-width: 340px; object-fit: cover; border-radius: 16px; }
.photo img { border: 1px solid var(--line-strong); box-shadow: var(--shadow); }
.photo figcaption { font-size: var(--t-sm); color: var(--muted); margin-top: 10px; }
@media (max-width: 760px) {
  .about { grid-template-columns: 1fr; }
  .photo { position: static; }
  .photo .ph, .photo img { max-width: 260px; }
}

/* Timeline (research, teaching): condensed cards that expand on click */
.container-wide { max-width: 1280px; }
.research-grid { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr); gap: 28px; align-items: start; }
.pubs-col .sub-title { margin: 0 0 16px; font-size: 1.3rem; }
@media (max-width: 1000px) { .research-grid { grid-template-columns: 1fr; } .pubs-col .sub-title { margin-top: 36px; } }
.entry { padding: 0; }
.entry-head { display: grid; grid-template-columns: minmax(0, 1fr) auto 24px; gap: 4px 18px; align-items: start; width: 100%; padding: 22px 24px; margin: 0; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; border-radius: 18px; }
.entry-head:hover .role { color: var(--cyan-2); }
.entry-head:focus-visible { outline: 2px solid var(--cyan); outline-offset: -2px; }
.entry-title { display: block; min-width: 0; }
.role { display: block; font-weight: 700; font-size: 1.2rem; line-height: 1.3; letter-spacing: -0.01em; transition: color 0.15s; }
.group { display: block; color: var(--cyan); font-size: 0.95rem; font-weight: 500; margin-top: 2px; }
.entry-head .when { padding-top: 5px; color: var(--muted); font-weight: 500; }
.chev { width: 22px; height: 22px; margin-top: 4px; color: var(--muted); transition: transform 0.25s, color 0.15s; }
.entry.open .chev { transform: rotate(180deg); color: var(--cyan); }
.brief { grid-column: 1 / -1; display: block; color: var(--ink-2); margin-top: 8px; line-height: 1.55; }
.entry-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.4s cubic-bezier(0.2, 0.7, 0.2, 1); }
.entry.open .entry-body { grid-template-rows: 1fr; }
.entry-inner { overflow: hidden; min-height: 0; padding: 0 24px; }
.entry.open .entry-inner { padding-bottom: 22px; }
.entry-inner > .org { margin: 0 0 12px; padding-top: 16px; border-top: 1px solid var(--line); }
@media (max-width: 640px) { .entry-head { grid-template-columns: minmax(0, 1fr) 24px; } .entry-head .when { grid-column: 1; padding-top: 0; order: 3; } .chev { grid-row: 1; grid-column: 2; } }

/* (old timeline rules, overridden above) */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline > li { position: relative; margin: 0 0 18px; }
.entry .top { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; margin-bottom: 4px; }
.when { font-size: 0.82rem; font-weight: 600; color: var(--amber); font-variant-numeric: tabular-nums; white-space: nowrap; }
.entry .org { margin: 0 0 0.8em; color: var(--ink-2); }
.entry .bullets { list-style: disc; margin: 0 0 0.9em; padding-left: 1.15em; max-width: 68ch; }
.entry .bullets li { margin: 0.35em 0; }
.entry .bullets li::marker { color: var(--cyan); }
.meta { font-size: var(--t-sm); color: var(--muted); margin: 0; }

/* Publications */
.pubs { list-style: none; margin: 0; padding: 0; counter-reset: pub; display: grid; gap: 14px; }
.pubs > li { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 12px; padding: 18px 22px; }
.pubs > li::before { counter-increment: pub; content: "[" counter(pub) "]"; color: var(--cyan); font-weight: 600; font-variant-numeric: tabular-nums; padding-top: 2px; }
.pubs p { margin: 0; }
.pubs .title { font-weight: 600; }
.pubs .venue { color: var(--ink-2); }

/* Designs & projects */
.projects { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(22px, 3vw, 30px); margin: 0; padding: 0; list-style: none; }
.projects > .featured { grid-column: 1 / -1; }
.project { margin: 0; overflow: hidden; display: flex; flex-direction: column; }
.media {
  display: block; width: 100%; padding: 0; margin: 0; border: 0; border-bottom: 1px solid var(--line);
  aspect-ratio: 16 / 10; background: var(--media-bg); overflow: hidden; cursor: zoom-in; position: relative;
}
.media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1); }
.media.contain img { object-fit: contain; padding: 7%; }
.project:hover .media img { transform: scale(1.025); }
.project:hover .media.contain img { transform: scale(1.04); }
.media:focus-visible { outline-offset: -3px; }
.project .ph { aspect-ratio: 16 / 10; border-radius: 0; border-width: 0 0 1px 0; border-style: solid; border-color: var(--line); }
.project .body { padding: 22px 24px 24px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.project h3 { font-size: 1.3rem; margin: 0; }
.project p { margin: 0; color: var(--ink-2); }
.project .links { display: flex; gap: 18px; font-size: var(--t-sm); margin-top: auto; padding-top: 4px; }
.thumbs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 4px; }
.thumbs.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.thumbs.three .thumb { aspect-ratio: 3 / 2; }
.thumbs.three .thumb img { padding: 5%; }
@media (max-width: 480px) { .thumbs.three { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.thumb { display: block; width: 100%; padding: 0; margin: 0; border: 1px solid var(--line); border-radius: 12px; aspect-ratio: 4 / 3; background: var(--media-bg); overflow: hidden; cursor: zoom-in; }
.thumb img { width: 100%; height: 100%; object-fit: contain; padding: 8%; transition: transform 0.4s ease; }
.thumb:hover { border-color: var(--line-strong); }
.thumb:hover img { transform: scale(1.05); }
/* Featured project: full width, with a spec table beside the description */
.project.featured .body { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 20px clamp(24px, 4vw, 48px); align-items: start; }
.project.featured h3 { font-size: var(--t-lg); }
.project.featured .text > * + * { margin-top: 12px; }
.project.featured .spec > div { grid-template-columns: 110px minmax(0, 1fr); padding: 11px 0; }
.project.featured .spec dd { font-size: var(--t-sm); color: var(--ink-2); }
@media (max-width: 760px) {
  .projects { grid-template-columns: 1fr; }
  .project.featured .body { grid-template-columns: 1fr; }
}

/* Designs & projects: compact cards that open a page each */
.projects { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pcard { display: flex; flex-direction: column; height: 100%; text-decoration: none; color: inherit; overflow: hidden; transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s; }
.pcard:hover { border-color: var(--cyan); transform: translateY(-3px); box-shadow: 0 24px 40px -24px var(--cyan-glow); text-decoration: none; color: inherit; }
.pmedia { display: block; aspect-ratio: 16 / 10; background: var(--media-bg); border-bottom: 1px solid var(--line); overflow: hidden; }
.pmedia img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s cubic-bezier(0.2, 0.7, 0.2, 1); }
.pmedia.contain img { object-fit: contain; padding: 8%; }
.pcard:hover .pmedia img { transform: scale(1.03); }
.pbody { display: flex; flex-direction: column; gap: 12px; padding: 20px 22px 22px; flex: 1; }
.pbody h3 { font-size: 1.2rem; }
.pbody p { margin: 0; color: var(--ink-2); font-size: 0.97rem; }
.more { margin-top: auto; padding-top: 6px; display: inline-flex; align-items: center; gap: 8px; color: var(--cyan); font-weight: 600; font-size: var(--t-sm); }
.more svg { width: 18px; height: 18px; transition: transform 0.2s; }
.pcard:hover .more { color: var(--cyan-2); }
.pcard:hover .more svg { transform: translateX(4px); }
@media (max-width: 900px) { .projects { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .projects { grid-template-columns: 1fr; } }

/* Project pages */
.back { display: inline-flex; align-items: center; gap: 8px; font-size: var(--t-sm); font-weight: 600; margin-bottom: 22px; }
.back svg { width: 18px; height: 18px; }
.project-page .section-head h2 { font-size: clamp(1.7rem, 3vw, 2.3rem); }
.project-page .section-head h2 .status { vertical-align: middle; }
.project-page .project.featured { margin-top: 8px; }
.project-page .project.featured .body { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); }

/* Activities & honors */
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; margin-top: clamp(36px, 5vw, 56px); align-items: start; }
.two-col .card { padding: 22px 24px; }
.two-col h3 { margin: 0 0 12px; }
.rows { list-style: none; margin: 0; padding: 0; }
.rows > li { padding: 12px 0; border-top: 1px solid var(--line); }
.rows > li:first-child { border-top: 0; padding-top: 0; }
.rows > li:last-child { padding-bottom: 0; }
.rows .meta { margin-top: 2px; }
@media (max-width: 640px) { .two-col { grid-template-columns: 1fr; } }

/* CV & skills */
.cv { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 20px; padding: 22px 24px; margin-bottom: 22px; }
.cv p { margin: 0; color: var(--ink-2); font-size: var(--t-sm); flex: 1 1 260px; }
.skills { padding: 22px 24px; }
.skills > div { grid-template-columns: 200px minmax(0, 1fr); align-items: start; }
.skills .pills li { font-size: 0.84rem; }
@media (max-width: 640px) { .skills > div { grid-template-columns: 1fr; gap: 8px; } }

/* Contact */
.contact .card { padding: 24px 26px; }
.email { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-bottom: 12px; }
.email a { font-size: clamp(1rem, 2.4vw, 1.5rem); font-weight: 700; letter-spacing: -0.015em; overflow-wrap: anywhere; color: var(--ink); }
.email a:hover { color: var(--cyan); }
.copy { font: 600 var(--t-sm) var(--sans); background: transparent; border: 1px solid var(--line-strong); border-radius: 8px; padding: 6px 11px; color: var(--ink); cursor: pointer; line-height: 1.2; }
.copy:hover { border-color: var(--cyan); color: var(--cyan); }
.copy[data-done="true"] { border-color: var(--cyan); color: var(--cyan); background: var(--surface); }
.profiles { list-style: none; margin: 0; padding: 0; }
.profiles > li { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line); }
.profiles > li:first-child { border-top: 0; padding-top: 0; }
.profiles > li:last-child { padding-bottom: 0; }
.profiles a { font-weight: 600; }
.profiles .handle { color: var(--muted); font-size: var(--t-sm); text-align: right; }
@media (max-width: 760px) { .contact { grid-template-columns: 1fr; } }

/* Connect (footer) */
.connect { border-top: 1px solid var(--line); padding-bottom: calc(clamp(56px, 8vw, 96px) + env(safe-area-inset-bottom, 0px)); }
.connect-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 32px clamp(28px, 5vw, 64px); align-items: end; }
.connect-main h2 { margin-bottom: 16px; }
.connect-main p { color: var(--ink-2); max-width: 54ch; font-size: 1.05rem; margin: 0 0 22px; }
.connect .btn svg { width: 18px; height: 18px; }
.connect-side { display: flex; flex-direction: column; align-items: flex-end; gap: 18px; }
.icon-row { display: flex; gap: 14px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 52px; height: 52px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink); transition: background 0.18s, border-color 0.18s, color 0.18s, transform 0.18s; }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn:hover { background: var(--chip-hover); border-color: var(--cyan); color: var(--cyan-2); transform: translateY(-2px); text-decoration: none; }
@media (max-width: 760px) { .connect-grid { grid-template-columns: 1fr; } .connect-side { align-items: flex-start; } }

/* Footer (unused on the index; kept for the project pages) */
.site-footer { border-top: 1px solid var(--line); padding: 28px 0 calc(28px + env(safe-area-inset-bottom, 0px)); font-size: var(--t-sm); color: var(--muted); }
.site-footer .container { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px 24px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 18px; }

/* Lightbox */
.lightbox { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px; background: rgba(4, 10, 22, 0.92); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); cursor: zoom-out; }
.lightbox-cap { position: absolute; left: 24px; right: 24px; bottom: 14px; margin: 0; text-align: center; color: #c9d4e4; font-size: var(--t-sm); pointer-events: none; }
.lightbox img { max-width: min(96vw, 1800px); max-height: 84vh; width: auto; height: auto; border-radius: 10px; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.8); cursor: default; }
.lightbox-close { position: absolute; top: 16px; right: 16px; width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(255,255,255,0.3); background: rgba(255,255,255,0.08); color: #fff; font-size: 26px; line-height: 1; cursor: pointer; }
.lightbox-close:hover { background: rgba(255,255,255,0.18); }

@media print {
  .site-header, .toggle, .copy, .lightbox { display: none; }
  .hero::before, body::before { display: none; }
}
