:root {
  --bg: #faf9f6;
  --surface: #ffffff;
  --text: #1a1a18;
  --muted: #6b675f;
  --border: #e8e4da;
  --accent: #1d4ed8;
  --accent-soft: #eff4ff;
  --serif: 'Newsreader', Georgia, serif;
  --sans: 'Inter', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.06);
}

[data-theme="dark"] {
  --bg: #121110;
  --surface: #1c1b19;
  --text: #ece9e2;
  --muted: #a39d90;
  --border: #2e2c28;
  --accent: #7aa5ff;
  --accent-soft: #1e2a4a;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  transition: background .3s, color .3s;
}
::selection { background: var(--accent); color: #fff; }

/* NAV */
.nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 2rem;
  padding: .9rem clamp(1rem, 5vw, 3rem);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-brand {
  font-family: var(--serif); font-weight: 600; font-size: 1.4rem;
  text-decoration: none; color: var(--text);
}
.nav-brand-dot { color: var(--accent); }
.nav-links { display: flex; gap: 1.4rem; margin-left: auto; }
.nav-links a {
  text-decoration: none; color: var(--muted);
  font-size: .92rem; font-weight: 500;
}
.nav-links a:hover { color: var(--accent); }
.theme-toggle {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; width: 38px; height: 38px;
  display: grid; place-items: center; cursor: pointer; color: var(--text);
}
.icon-moon { display: none; }
[data-theme="dark"] .icon-moon { display: block; }
[data-theme="dark"] .icon-sun { display: none; }

/* HERO */
.hero { padding: clamp(3rem, 8vw, 6rem) clamp(1rem, 5vw, 3rem) clamp(2rem, 5vw, 4rem); }
.hero-inner { max-width: 780px; margin: 0 auto; text-align: center; }
.hero-photo {
  width: 128px; height: 128px; border-radius: 50%;
  margin: 0 auto 1.4rem; overflow: hidden; position: relative;
  background: var(--accent-soft); border: 2px solid var(--border);
  display: grid; place-items: center;
}
.hero-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero-initials { font-family: var(--serif); font-size: 2.6rem; font-weight: 600; color: var(--accent); }
.hero-kicker { font-family: var(--mono); font-size: .85rem; color: var(--accent); margin-bottom: .6rem; }
.hero h1 { font-family: var(--serif); font-weight: 600; font-size: clamp(2.4rem, 6vw, 3.6rem); line-height: 1.1; }
.hero-role { font-size: 1.1rem; font-weight: 500; margin-top: .5rem; }
.hero-affil { color: var(--muted); margin-top: .3rem; }
.hero-links { display: flex; flex-wrap: wrap; gap: .7rem; justify-content: center; margin-top: 1.6rem; }
.hero-links a {
  text-decoration: none; font-size: .9rem; font-weight: 500;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 999px;
  padding: .5rem 1.1rem; transition: all .2s;
}
.hero-links a:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }

/* SECTIONS */
.section { max-width: 960px; margin: 0 auto; padding: 3.5rem clamp(1rem, 5vw, 3rem); }
.section-kicker { font-family: var(--mono); font-size: .85rem; color: var(--accent); margin-bottom: .4rem; }
.section h2 { font-family: var(--serif); font-weight: 600; font-size: clamp(1.7rem, 4vw, 2.2rem); margin-bottom: 1.6rem; }

/* ABOUT */
.about-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 2rem; }
.about-bio p { margin-bottom: 1rem; color: var(--text); }
.about-bio strong { font-weight: 600; }
.interests { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.2rem; }
.chip {
  font-family: var(--mono); font-size: .78rem;
  background: var(--accent-soft); color: var(--accent);
  padding: .3rem .8rem; border-radius: 999px;
}
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; margin-bottom: 1.4rem; }
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem .6rem; text-align: center;
}
.stat-num { display: block; font-family: var(--serif); font-size: 1.5rem; font-weight: 600; color: var(--accent); }
.stat-label { font-size: .75rem; color: var(--muted); }
.edu-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.3rem; box-shadow: var(--shadow);
}
.edu-card h3 { font-family: var(--serif); font-size: 1.15rem; margin-bottom: .9rem; }
.edu-item + .edu-item { margin-top: .9rem; padding-top: .9rem; border-top: 1px solid var(--border); }
.edu-degree { font-weight: 600; font-size: .95rem; }
.edu-when { font-weight: 400; color: var(--muted); font-size: .85rem; }
.edu-school { font-size: .9rem; }
.edu-note { font-size: .85rem; color: var(--muted); }

/* CARDS */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem; }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow);
  transition: transform .2s, box-shadow .2s;
}
.card:hover { transform: translateY(-3px); }
.card-kicker { font-family: var(--mono); font-size: .75rem; color: var(--accent); margin-bottom: .5rem; }
.card h3 { font-family: var(--serif); font-size: 1.2rem; font-weight: 600; margin-bottom: .6rem; line-height: 1.35; }
.card p { font-size: .92rem; color: var(--muted); }
.card p strong { color: var(--text); }
.tags { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: 1rem; }
.tags span {
  font-size: .75rem; border: 1px solid var(--border);
  padding: .2rem .7rem; border-radius: 999px; color: var(--muted);
}

/* PUBLICATIONS */
.pubs { list-style: none; display: flex; flex-direction: column; gap: 1.1rem; }
.pub {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.3rem 1.5rem;
}
.pub-title { font-weight: 600; font-size: 1.02rem; }
.pub-meta { font-size: .88rem; color: var(--muted); margin-top: .2rem; }
.pub-links { display: flex; flex-wrap: wrap; gap: .8rem; align-items: center; margin-top: .6rem; }
.pub-links a { font-family: var(--mono); font-size: .8rem; color: var(--accent); text-decoration: none; }
.pub-links a:hover { text-decoration: underline; }
.cite-btn {
  font-family: var(--mono); font-size: .78rem; cursor: pointer;
  background: var(--accent-soft); color: var(--accent);
  border: none; border-radius: 8px; padding: .35rem .8rem;
}
.cite-btn:hover { filter: brightness(.95); }
.pubs-note { margin-top: 1rem; font-size: .88rem; color: var(--muted); font-style: italic; }

/* TIMELINE */
.timeline { display: flex; flex-direction: column; gap: 0; }
.tl-item {
  padding: 1.2rem 0 1.2rem 1.6rem; border-left: 2px solid var(--border);
  position: relative;
}
.tl-item::before {
  content: ''; position: absolute; left: -7px; top: 1.6rem;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent);
}
.tl-when { font-family: var(--mono); font-size: .78rem; color: var(--accent); }
.tl-item h3 { font-family: var(--serif); font-size: 1.15rem; margin: .2rem 0; }
.tl-item p { font-size: .92rem; color: var(--muted); }

/* CONTACT */
.contact-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.contact-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.3rem; text-decoration: none;
  color: var(--text); display: flex; flex-direction: column; gap: .3rem;
  transition: border-color .2s;
}
a.contact-card:hover { border-color: var(--accent); }
.contact-label { font-family: var(--mono); font-size: .75rem; color: var(--accent); }
.contact-value { font-weight: 500; font-size: .95rem; }

/* FOOTER */
footer {
  text-align: center; padding: 2.5rem 1rem;
  border-top: 1px solid var(--border);
  color: var(--muted); font-size: .85rem;
}
.footer-note { font-family: var(--mono); font-size: .72rem; margin-top: .4rem; }

/* REVEAL */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.reveal.visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* RESPONSIVE */
@media (max-width: 820px) {
  .about-grid { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr; }
  .nav-links { display: none; }
}

/* ============ DARK IMAGE HERO ============ */
.hero-dark {
  position: relative;
  color: #f5f3ee;
  overflow: hidden;
  padding: clamp(4rem, 10vw, 7rem) clamp(1rem, 5vw, 3rem);
}
.hero-bg {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  transform: scale(1.03);
}
.hero-dark::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(8,10,18,.72) 0%, rgba(8,10,18,.55) 45%, rgba(8,10,18,.78) 100%);
}
.hero-dark .hero-inner { position: relative; z-index: 1; }
.hero-dark .hero-kicker { color: #9fc2ff; }
.hero-dark h1 { color: #fff; }
.hero-dark .hero-role { color: #e8e4da; }
.hero-dark .hero-affil { color: #b9b4a8; }
.hero-dark .hero-photo { border-color: rgba(255,255,255,.35); }
.hero-dark .hero-links a {
  background: rgba(255,255,255,.08);
  border-color: rgba(255,255,255,.25);
  color: #f5f3ee;
  backdrop-filter: blur(6px);
}
.hero-dark .hero-links a:hover { border-color: #9fc2ff; color: #9fc2ff; }

/* ============ RESEARCH CARDS WITH IMAGES ============ */
.card { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.card-img { aspect-ratio: 16/9; overflow: hidden; background: #0a0c14; }
.card-img img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s ease; }
.card:hover .card-img img { transform: scale(1.04); }
.card-body { padding: 1.4rem 1.5rem 1.5rem; display: flex; flex-direction: column; flex: 1; }
.card-body .tags { margin-top: auto; padding-top: 1rem; }

/* ============ TOOLKIT ============ */
.toolkit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; margin-bottom: 1.6rem; }
.toolkit-col {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow);
}
.toolkit-col h3 { font-family: var(--serif); font-size: 1.15rem; margin-bottom: .8rem; }
.toolkit-col ul { list-style: none; display: flex; flex-direction: column; gap: .55rem; }
.toolkit-col li { font-size: .9rem; color: var(--muted); padding-left: 1.1rem; position: relative; }
.toolkit-col li::before { content: '▸'; position: absolute; left: 0; color: var(--accent); }
.pipeline-fig, .map-fig { margin: 0; }
.pipeline-fig img, .map-fig img {
  width: 100%; border-radius: var(--radius);
  border: 1px solid var(--border); box-shadow: var(--shadow); display: block;
}
.pipeline-fig figcaption {
  text-align: center; font-size: .82rem; color: var(--muted);
  margin-top: .6rem; font-style: italic;
}
.map-fig img { aspect-ratio: 21/9; object-fit: cover; }

/* ============ TIMELINE ENRICHMENT ============ */
.tl-org { font-size: .88rem; color: var(--muted); margin-bottom: .4rem; }
.tl-bullets { list-style: none; display: flex; flex-direction: column; gap: .35rem; }
.tl-bullets li { font-size: .9rem; color: var(--muted); padding-left: 1.1rem; position: relative; }
.tl-bullets li::before { content: '–'; position: absolute; left: 0; color: var(--accent); }
.affil-row { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.6rem; }

/* ============ PUB FLAGS ============ */
.pub-flag {
  font-family: var(--mono); font-size: .72rem;
  background: var(--accent-soft); color: var(--accent);
  padding: .15rem .6rem; border-radius: 999px; white-space: nowrap;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 820px) {
  .toolkit-grid { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .contact-grid { grid-template-columns: 1fr; }
}
