/* ---------- Tokens ---------- */
:root {
  --bg: #FFFFFF;
  --surface: #FFFFFF;
  --ink: #15171C;
  --muted: #5B6270;
  --faint: #767C87;
  --rule: #E6E6E3;
  --accent: #1E4B7A;
  --accent-ink: #FFFFFF;
  --accent-soft: #E7EDF4;
  --warm: #B4531C;
  --plate: #FFFFFF;
  --plate-rule: #E3E3E0;
  --shadow: 0 1px 2px rgba(20, 22, 28, .05), 0 10px 30px -14px rgba(20, 22, 28, .14);
  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 14px;
  --wrap: 1120px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1013; --surface: #15181D; --ink: #ECEDEF; --muted: #A3A9B4; --faint: #737A86;
    --rule: #262A31; --accent: #8DB8F2; --accent-ink: #0E1013; --accent-soft: #19232F; --warm: #F0A069;
    --plate: #F3F2EE; --plate-rule: #2A2E35;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px -14px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E1013; --surface: #15181D; --ink: #ECEDEF; --muted: #A3A9B4; --faint: #737A86;
  --rule: #262A31; --accent: #8DB8F2; --accent-ink: #0E1013; --accent-soft: #19232F; --warm: #F0A069;
  --plate: #F3F2EE; --plate-rule: #2A2E35;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px -14px rgba(0,0,0,.6);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 17px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; letter-spacing: -0.01em; margin: 0; }
p { margin: 0 0 1em; }
.wrap { width: min(100% - 32px, var(--wrap)); margin-inline: auto; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 16px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(12px); -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid transparent; transition: border-color .2s;
}
.site-header.scrolled { border-bottom-color: var(--rule); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.wordmark { font-family: var(--serif); font-size: 21px; font-weight: 500; color: var(--ink); text-decoration: none; letter-spacing: -0.01em; }
.nav { display: flex; align-items: center; gap: 26px; }
.nav a { color: var(--muted); text-decoration: none; font-size: 15px; font-weight: 500; transition: color .15s; }
.nav a:hover, .nav a.active { color: var(--ink); }
.theme-btn {
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--rule); background: transparent;
  color: var(--muted); display: grid; place-items: center; cursor: pointer; transition: color .15s, border-color .15s;
}
.theme-btn:hover { color: var(--ink); border-color: var(--faint); }
.theme-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.theme-btn .i-moon { display: none; }
:root[data-theme="dark"] .theme-btn .i-sun { display: none; }
:root[data-theme="dark"] .theme-btn .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-btn .i-sun { display: none; }
  :root:not([data-theme="light"]) .theme-btn .i-moon { display: block; }
}
.menu-btn { display: none; }

/* ---------- Hero ---------- */
.hero { display: grid; grid-template-columns: 1.15fr .85fr; gap: 64px; align-items: center; padding: 72px 0 40px; }
.eyebrow, .kicker { font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin-bottom: 18px; }
.hero h1 { font-size: clamp(38px, 5.2vw, 60px); line-height: 1.06; margin-bottom: 22px; }
.lead { font-size: 19px; line-height: 1.6; color: var(--muted); max-width: 36em; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; margin: 28px 0 22px; }
.btn {
  display: inline-flex; align-items: center; height: 44px; padding: 0 20px; border-radius: 999px;
  border: 1px solid var(--rule); color: var(--ink); background: var(--surface);
  font-size: 15px; font-weight: 500; text-decoration: none; transition: transform .15s, border-color .15s, background .15s;
}
.btn:hover { border-color: var(--faint); transform: translateY(-1px); }
.btn-primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.social { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 22px; font-size: 15px; }
.social a { color: var(--muted); text-decoration: none; border-bottom: 1px solid var(--rule); padding-bottom: 1px; }
.social a:hover { color: var(--ink); border-color: var(--ink); }

.hero-figure { margin: 0; justify-self: end; width: min(100%, 350px); }
.hero-figure figcaption { font-size: 13.5px; color: var(--faint); margin-top: 12px; line-height: 1.5; }

/* ---------- Plates (figure frames) ---------- */
.plate {
  background: var(--plate); border: 1px solid var(--plate-rule); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.plate:not(.dark) img { mix-blend-mode: multiply; } /* white figure backgrounds take the plate colour */
button.plate { padding: 0; cursor: zoom-in; font: inherit; color: inherit; width: 100%; display: block; }
button.plate img { transition: transform .5s cubic-bezier(.2,.7,.2,1); }
button.plate:hover img { transform: scale(1.02); }

/* posture crossfade */
.posture { position: relative; aspect-ratio: 605 / 1022; width: 100%; padding: 0; }
.posture img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 18px 18px 44px; opacity: 0; animation: pose 9s infinite; }
.posture img:nth-child(1) { animation-delay: 0s; }
.posture img:nth-child(2) { animation-delay: 3s; }
.posture img:nth-child(3) { animation-delay: 6s; }
@keyframes pose { 0% { opacity: 0; } 6% { opacity: 1; } 33% { opacity: 1; } 40% { opacity: 0; } 100% { opacity: 0; } }
.posture-steps {
  position: absolute; left: 0; right: 0; bottom: 14px; margin: 0; padding: 0; list-style: none;
  display: flex; justify-content: center; gap: 18px; font-size: 12px; font-weight: 500; color: #8A909B;
}
.posture-steps li { position: relative; padding-top: 10px; }
.posture-steps li::before { content: ""; position: absolute; top: 0; left: 50%; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: currentColor; }
.posture-steps li { animation: step 9s infinite; }
.posture-steps li:nth-child(2) { animation-delay: 3s; }
.posture-steps li:nth-child(3) { animation-delay: 6s; }
@keyframes step { 0%, 38%, 100% { color: #A9AEB6; } 6%, 33% { color: #1E4B7A; } }

/* ---------- Facts ---------- */
.facts { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); margin-top: 28px; }
.facts div { padding: 22px 20px 20px 0; }
.facts div + div { padding-left: 20px; border-left: 1px solid var(--rule); }
.facts strong { display: block; font-family: var(--serif); font-size: 38px; font-weight: 500; line-height: 1; margin-bottom: 8px; }
.facts span { font-size: 14px; color: var(--muted); }

/* ---------- Sections ---------- */
.section { padding: 112px 0 0; }
.section-head { max-width: 720px; margin-bottom: 48px; }
.section-head h2, .contact h2 { font-size: clamp(30px, 3.6vw, 42px); line-height: 1.12; }
.section-intro { color: var(--muted); font-size: 18px; margin-top: 16px; }
.mini { font-family: var(--sans); font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); margin: 0 0 14px; }

/* About */
.about-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 64px; }
.prose p { font-size: 18px; line-height: 1.7; }
.prose em { font-style: italic; }
.about-side { border-left: 1px solid var(--rule); padding-left: 36px; }
.edu { list-style: none; padding: 0; margin: 0 0 34px; }
.edu li { display: grid; grid-template-columns: 92px 1fr; gap: 12px; padding: 10px 0; font-size: 15px; line-height: 1.45; color: var(--muted); }
.edu li + li { border-top: 1px solid var(--rule); }
.edu strong { color: var(--ink); font-weight: 600; }
.yr { font-variant-numeric: tabular-nums; color: var(--faint); font-size: 14px; }
.skills { display: grid; grid-template-columns: 92px 1fr; gap: 8px 12px; margin: 0; font-size: 15px; line-height: 1.5; }
.skills dt { color: var(--ink); font-weight: 600; }
.skills dd { margin: 0; color: var(--muted); }

/* Research roadmap figure */
.roadmap { margin: 0 0 24px; max-width: 900px; }
.roadmap img { width: 100%; padding: 22px; }
.roadmap figcaption { font-size: 14px; color: var(--faint); margin-top: 12px; line-height: 1.5; max-width: 640px; }

/* Research studies */
.study { display: grid; grid-template-columns: 1.1fr .9fr; gap: 56px; align-items: center; padding: 44px 0; }
.study + .study { border-top: 1px solid var(--rule); }
.study.flip .study-media { order: 2; }
.study-media.stack { display: grid; gap: 16px; }
.study-media.stack .plate img { width: 100%; padding: 14px; }
.card.wide .card-media.second { border-top: 1px solid var(--rule); }
.study-media img { width: 100%; padding: 14px; }
.study-text h3 { font-size: 28px; line-height: 1.2; margin: 10px 0 14px; }
.study-text p { color: var(--muted); }
.meta { font-size: 13.5px; color: var(--faint); display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 0; }
.tag { display: inline-block; padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 12.5px; font-weight: 600; }
.tag-accent { background: color-mix(in srgb, var(--warm) 14%, transparent); color: var(--warm); }
.chips { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li { font-size: 12.5px; color: var(--muted); border: 1px solid var(--rule); border-radius: 999px; padding: 3px 11px; }
.links { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 14px 0 0; }
.links a { font-weight: 500; font-size: 15px; text-decoration: none; color: var(--accent); }
.links a::after { content: " ↗"; font-size: .9em; }
.links a:hover { text-decoration: underline; }
.linklike { font: inherit; font-weight: 500; font-size: 15px; color: var(--accent); background: none; border: 0; padding: 0; cursor: zoom-in; }
.linklike::after { content: " ↗"; font-size: .9em; }
.linklike:hover { text-decoration: underline; }

/* Project cards */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.cards + .group-title { margin-top: 64px; }
.cards.two { grid-template-columns: repeat(2, 1fr); }
.card.feature { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(260px, 380px) 1fr; }
.card.feature .card-media { aspect-ratio: auto; border-bottom: 0; border-right: 1px solid var(--rule); background: #0C0D10; }
.card.feature .card-media img { object-fit: contain; padding: 0; }
.card.feature .card-body { padding: 30px 34px; }
.card.feature .card-body h3 { font-size: 26px; }
.card.feature.light .card-media { background: var(--plate); }
.card.feature.light .card-media img { padding: 18px; }
.card.wide { grid-column: 1 / -1; }
.card.wide .card-media { aspect-ratio: auto; }
.card.wide .card-media img { height: auto; padding: 18px 22px 8px; }
.card.wide .card-body { max-width: 820px; }
.feature-diagram { margin: 6px 0 14px; max-width: 520px; }
.feature-diagram img { width: 100%; padding: 8px; }
.keynums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; margin: 18px 0 4px; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.keynums div { padding: 12px 12px 12px 0; }
.keynums div + div { padding-left: 14px; border-left: 1px solid var(--rule); }
.keynums dt { font-family: var(--serif); font-size: 24px; color: var(--ink); line-height: 1.1; }
.keynums dd { margin: 4px 0 0; font-size: 13px; color: var(--faint); line-height: 1.35; }
.group-title { font-family: var(--sans); font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); margin: 0 0 20px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; }
.group-title span { text-transform: none; letter-spacing: 0; font-weight: 500; font-size: 14px; }
.card-media video { width: 100%; height: 100%; object-fit: contain; display: block; mix-blend-mode: multiply; }
.card { background: var(--surface); border: 1px solid var(--rule); box-shadow: 0 1px 2px rgba(20,22,28,.03); border-radius: calc(var(--radius) + 4px); overflow: hidden; display: flex; flex-direction: column; }
.card-media { border: 0; border-bottom: 1px solid var(--rule); border-radius: 0; box-shadow: none; aspect-ratio: 16 / 10; }
.card-media img { width: 100%; height: 100%; object-fit: contain; padding: 18px; }
.card-media.dark { background: #0A0B12; }
.card-media.dark img { object-fit: contain; padding: 0; }
.card-body { padding: 24px 26px 28px; }
.card-body h3 { font-size: 22px; line-height: 1.25; margin: 8px 0 12px; }
.card-body p { color: var(--muted); font-size: 15.5px; }
.card-body .meta { display: block; }

/* Publications */
.pubs { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--rule); }
.pubs li { display: grid; grid-template-columns: 92px 1fr; gap: 16px; padding: 18px 0; border-bottom: 1px solid var(--rule); }
.pubs li > div > a, .pub-title { font-family: var(--serif); font-size: 19px; line-height: 1.35; color: var(--ink); text-decoration: none; }
.pubs li > div > a:hover { color: var(--accent); text-decoration: underline; }
.pubs p { font-size: 14.5px; color: var(--muted); margin: 6px 0 0; }
.pubs b { color: var(--ink); font-weight: 600; }
.pub-other .yr { color: var(--accent); font-weight: 600; font-size: 13px; letter-spacing: .04em; text-transform: uppercase; padding-top: 3px; }

/* Talks */
.timeline { list-style: none; padding: 0; margin: 0; border-left: 1px solid var(--rule); }
.timeline li { position: relative; display: grid; grid-template-columns: 70px 1fr; gap: 16px; padding: 0 0 28px 28px; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: 8px; width: 9px; height: 9px; border-radius: 50%; background: var(--bg); border: 2px solid var(--accent); }
.timeline strong { font-weight: 600; }
.timeline p { color: var(--muted); font-size: 15.5px; margin: 4px 0 0; }
.teach { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; margin-top: 44px; padding-top: 36px; border-top: 1px solid var(--rule); }
.teach p { color: var(--muted); font-size: 15.5px; }

/* Contact */
.contact { padding: 120px 0 96px; text-align: center; }
.contact .lead { margin: 16px auto 0; }
.contact-mail { font-family: var(--serif); font-size: clamp(26px, 3.4vw, 38px); margin: 30px 0 26px; }
.contact-mail a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--rule); }
.contact-mail a:hover { border-color: var(--ink); }
.contact .social { justify-content: center; }

/* Footer */
.site-footer { border-top: 1px solid var(--rule); }
.footer-inner { display: flex; justify-content: space-between; gap: 16px; padding: 26px 0 34px; font-size: 14px; color: var(--faint); }
.footer-inner a { color: var(--faint); text-decoration: none; }
.footer-inner a:hover { color: var(--ink); }

/* Lightbox */
.lightbox { border: 0; padding: 0; background: transparent; max-width: min(1400px, 94vw); max-height: 94vh; overflow: visible; }
.lightbox::backdrop { background: rgba(10, 12, 16, .82); backdrop-filter: blur(3px); }
.lightbox figure { margin: 0; }
.lightbox img, .lightbox video { max-width: min(1400px, 94vw); max-height: 82vh; width: auto; background: #FFFFFF; border-radius: 12px; padding: 12px; margin: 0 auto; display: block; }
.lightbox [hidden] { display: none; }
.lightbox figcaption { color: #D7DAE0; font-size: 14px; line-height: 1.5; max-width: 820px; margin: 14px auto 0; text-align: center; }
.lightbox-close {
  position: fixed; top: 18px; right: 22px; width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.08); color: #fff; font-size: 24px; line-height: 1; cursor: pointer;
}
.lightbox-close:hover { background: rgba(255,255,255,.18); }

/* Reveal on scroll */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .7s ease, transform .7s cubic-bezier(.2,.7,.2,1); }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr; gap: 40px; padding-top: 48px; }
  .hero-figure { justify-self: center; width: min(100%, 300px); }
  .study, .about-grid { grid-template-columns: 1fr; gap: 28px; }
  .study.flip .study-media { order: 0; }
  .about-side { border-left: 0; padding-left: 0; border-top: 1px solid var(--rule); padding-top: 28px; }
  .facts { grid-template-columns: repeat(2, 1fr); }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .card.feature { grid-template-columns: minmax(200px, 300px) 1fr; }
  .facts div:nth-child(3) { padding-left: 0; border-left: 0; }
  .facts div:nth-child(n+3) { border-top: 1px solid var(--rule); }
}
@media (max-width: 760px) {
  body { font-size: 16px; }
  .menu-btn {
    display: grid; gap: 6px; place-content: center; width: 40px; height: 40px; border: 1px solid var(--rule);
    border-radius: 10px; background: transparent; cursor: pointer;
  }
  .menu-btn span { display: block; width: 16px; height: 1.5px; background: var(--ink); transition: transform .2s; }
  .menu-btn[aria-expanded="true"] span:first-child { transform: translateY(3.75px) rotate(45deg); }
  .menu-btn[aria-expanded="true"] span:last-child { transform: translateY(-3.75px) rotate(-45deg); }
  .nav {
    position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; align-items: flex-start; gap: 0;
    background: var(--bg); border-bottom: 1px solid var(--rule); padding: 8px 16px 18px; display: none;
  }
  .nav.open { display: flex; }
  .nav a { padding: 11px 0; width: 100%; font-size: 17px; border-bottom: 1px solid var(--rule); }
  .theme-btn { margin-top: 14px; }
  .section { padding-top: 80px; }
  .cards, .cards.two { grid-template-columns: 1fr; }
  .card.feature { grid-template-columns: 1fr; }
  .card.feature .card-media { border-right: 0; border-bottom: 1px solid var(--rule); max-height: 520px; }
  .keynums { grid-template-columns: 1fr; }
  .keynums div + div { padding-left: 0; border-left: 0; border-top: 1px solid var(--rule); }
  .lead { font-size: 17.5px; }
  .pubs li, .edu li { grid-template-columns: 1fr; gap: 4px; }
  .timeline li { grid-template-columns: 1fr; gap: 2px; }
  .teach { grid-template-columns: 1fr; gap: 20px; }
  .footer-inner { flex-direction: column; }
  .study-text h3 { font-size: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .posture img { animation: none; opacity: 0; }
  .posture img:nth-child(2) { opacity: 1; }
  .posture-steps { display: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
  button.plate:hover img { transform: none; }
}
