:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --text: #1d1f23;
  --muted: #5d636e;
  --line: #e4e1da;
  --accent: #003262;      /* Berkeley Blue */
  --accent-2: #b5852a;    /* muted California Gold */
  --link: #0a4f9e;
  --chip: #eef2f7;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --surface: #1b1e23;
    --text: #e7e8ea;
    --muted: #a0a6b0;
    --line: #2c3038;
    --accent: #8db8f0;
    --accent-2: #e2b65a;
    --link: #8db8f0;
    --chip: #232832;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 4.5rem; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 "Source Sans 3", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  max-width: 960px; margin: 0 auto; padding: .7rem 1.25rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}
.nav .brand { font-family: "Source Serif 4", Georgia, serif; font-weight: 600; font-size: 1.15rem; color: var(--text); }
.nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 1.1rem; flex-wrap: wrap; }
.nav ul a { color: var(--muted); font-size: .95rem; }
.nav ul a:hover { color: var(--accent); text-decoration: none; }

/* ---------- layout ---------- */
main { max-width: 960px; margin: 0 auto; padding: 0 1.25rem 4rem; }
section { padding-top: 3rem; }
h1, h2, h3 { font-family: "Source Serif 4", Georgia, serif; line-height: 1.25; }
h2 {
  font-size: 1.6rem; margin: 0 0 1.25rem; color: var(--accent);
  padding-bottom: .4rem; border-bottom: 2px solid var(--line);
}
h3 { font-size: 1.12rem; margin: 1.6rem 0 .6rem; }

/* ---------- hero ---------- */
.hero {
  display: grid; grid-template-columns: 260px 1fr; gap: 2.5rem; align-items: start;
  padding-top: 3rem;
}
.hero img {
  width: 100%; aspect-ratio: 4 / 5; object-fit: cover; object-position: 73% 40%;
  border-radius: 14px; box-shadow: 0 6px 24px rgb(0 0 0 / .12);
}
.hero h1 { font-size: 2.4rem; margin: .2rem 0 .3rem; }
.hero .role { color: var(--muted); font-size: 1.08rem; margin: 0 0 1.1rem; }
.hero p { margin: 0 0 .8rem; }
.links { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.2rem; }
.links a {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .4rem .85rem; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--text); font-size: .92rem;
}
.links a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.links svg { width: 16px; height: 16px; fill: currentColor; }

/* ---------- education / news ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 8.5rem 1fr; gap: 1rem; padding: .55rem 0; border-bottom: 1px dashed var(--line); }
.timeline li:last-child { border-bottom: 0; }
.timeline .when { color: var(--muted); font-variant-numeric: tabular-nums; }
.timeline .sub { color: var(--muted); font-size: .94rem; }

.badge {
  display: inline-block; font-size: .78rem; font-weight: 600; letter-spacing: .02em;
  padding: .08rem .5rem; border-radius: 6px; background: var(--chip); color: var(--accent);
  margin-right: .35rem; vertical-align: 1px;
}
.badge.gold { color: var(--accent-2); }

/* ---------- research interests ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 1rem; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1.15rem;
}
.card h4 { margin: 0 0 .45rem; font-size: 1rem; color: var(--accent); }
.card ul { margin: 0; padding-left: 1.1rem; color: var(--muted); font-size: .94rem; }
.card li { margin: .2rem 0; }

/* ---------- publications ---------- */
.pubs { list-style: none; margin: 0; padding: 0; counter-reset: pub; }
.pubs > li { position: relative; padding: .7rem 0 .7rem 2.6rem; border-bottom: 1px solid var(--line); }
.pubs > li::before {
  counter-increment: pub; content: "[" counter(pub) "]";
  position: absolute; left: 0; top: .7rem; color: var(--muted); font-size: .9rem; font-variant-numeric: tabular-nums;
}
.pubs.rev { counter-reset: pub var(--n); }
.pubs.rev > li::before { counter-increment: pub -1; content: "[" counter(pub) "]"; }
.pub-title { font-weight: 600; }
.pub-authors { color: var(--muted); font-size: .95rem; }
.pub-authors b { color: var(--text); font-weight: 600; }
.pub-venue { font-style: italic; font-size: .95rem; }
.pub-links a { font-size: .88rem; margin-right: .6rem; }

.plain { margin: 0; padding-left: 1.2rem; }
.plain li { margin: .35rem 0; }
.plain .sub { color: var(--muted); font-size: .94rem; }

/* ---------- projects ---------- */
.project { margin-bottom: 2.2rem; }
.project h3 { margin-top: 0; }
.videos { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
.video { aspect-ratio: 16 / 9; width: 100%; border: 0; border-radius: 10px; background: #000; }

/* ---------- gallery ---------- */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .75rem; }
.gallery figure { margin: 0; }
.gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; }
.gallery figcaption { font-size: .82rem; color: var(--muted); margin-top: .3rem; }

footer { text-align: center; color: var(--muted); font-size: .88rem; padding: 2rem 1rem 3rem; border-top: 1px solid var(--line); }

@media (max-width: 720px) {
  .hero { grid-template-columns: 1fr; gap: 1.5rem; }
  .hero img { max-width: 240px; }
  .hero h1 { font-size: 2rem; }
  .timeline li { grid-template-columns: 1fr; gap: 0; }
  .nav ul { gap: .8rem; }
}

/* ---------- multi-page additions ---------- */
.nav ul a.active { color: var(--accent); font-weight: 600; }
.videos.single { grid-template-columns: minmax(0, 720px); }
.lead { color: var(--muted); margin: -.4rem 0 1.6rem; }
.video-card { position: relative; display: block; max-width: 720px; border-radius: 10px; overflow: hidden; }
.video-card img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; transition: transform .3s; }
.video-card:hover img { transform: scale(1.02); }
.video-card .play { position: absolute; inset: 0; display: grid; place-items: center; }
.video-card .play svg { width: 68px; height: 48px; opacity: .9; }
.video-card:hover .play svg { opacity: 1; }

/* ---------- research page ---------- */
.plain.current { list-style: none; padding-left: 0; }
.plain.current li { border-left: 3px solid var(--accent-2); padding: .15rem 0 .15rem .9rem; margin: .9rem 0; }
.plain.current b { color: var(--accent); }
.refs { font-size: .88rem; margin-top: .15rem; }
