:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --text: #1c2230;
  --muted: #5d6677;
  --line: #e3e6ec;
  --accent: #2a5bd7;
  --accent-soft: #e8eefc;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 30, 60, .06), 0 8px 24px rgba(20, 30, 60, .06);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f131b; --surface: #171c27; --text: #e8ebf2; --muted: #9aa4b6;
    --line: #262d3b; --accent: #7aa2ff; --accent-soft: #1d2740;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.3);
  }
}
:root[data-theme="dark"] {
  --bg: #0f131b; --surface: #171c27; --text: #e8ebf2; --muted: #9aa4b6;
  --line: #262d3b; --accent: #7aa2ff; --accent-soft: #1d2740;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.3);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 17px/1.65 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 20px; }

/* Nav */
.nav {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.nav .wrap { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.nav .brand { font-weight: 700; color: var(--text); }
.nav ul { display: flex; gap: 22px; list-style: none; margin: 0; padding: 0; }
.nav ul a { color: var(--muted); font-size: 15px; font-weight: 500; }
.nav ul a:hover { color: var(--text); text-decoration: none; }
@media (max-width: 640px) { .nav .wrap { height: auto; min-height: 56px; padding-top: 8px; padding-bottom: 8px; } .nav ul { gap: 4px 14px; flex-wrap: wrap; justify-content: center; width: 100%; } .nav ul a { font-size: 13px; } .nav .brand { display: none; } }

/* Hero */
.hero { padding: 72px 0 40px; }
.hero .wrap { display: grid; grid-template-columns: 168px 1fr; gap: 36px; align-items: center; }
.avatar { width: 168px; height: 168px; border-radius: 50%; object-fit: cover; box-shadow: var(--shadow); border: 4px solid var(--surface); }
.eyebrow { color: var(--accent); font-weight: 600; font-size: 14px; letter-spacing: .08em; text-transform: uppercase; margin: 0 0 6px; }
h1 { font-size: clamp(34px, 5vw, 52px); line-height: 1.1; margin: 0 0 10px; letter-spacing: -.02em; }
.lead { font-size: 20px; color: var(--muted); margin: 0 0 20px; max-width: 620px; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); font-size: 15px; font-weight: 500;
}
.btn:hover { text-decoration: none; border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { color: #fff; opacity: .9; }
@media (max-width: 640px) {
  .hero { padding-top: 40px; }
  .hero .wrap { grid-template-columns: 1fr; text-align: center; justify-items: center; }
  .chips { justify-content: center; }
}

/* Sections */
section { padding: 48px 0; }
h2 { font-size: 28px; margin: 0 0 24px; letter-spacing: -.01em; }
.prose { max-width: 760px; }
.prose p { margin: 0 0 16px; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }

/* Timeline */
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
@media (max-width: 820px) { .cols { grid-template-columns: 1fr; } }
.tl { list-style: none; margin: 0; padding: 0 0 0 22px; border-left: 2px solid var(--line); }
.tl li { position: relative; padding: 0 0 22px 4px; }
.tl li::before {
  content: ""; position: absolute; left: -29px; top: 7px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--bg); border: 3px solid var(--accent);
}
.tl .when { font-size: 13px; color: var(--muted); font-weight: 500; }
.tl .what { font-weight: 600; }
.tl .where { color: var(--muted); font-size: 15px; }
.tl-title { font-size: 14px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 16px; }

/* Research areas */
.areas { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 8px; }
@media (max-width: 820px) { .areas { grid-template-columns: 1fr; } }
.area { padding: 20px; }
.area h3 { margin: 0 0 6px; font-size: 18px; }
.area p { margin: 0; color: var(--muted); font-size: 15px; }

/* Projects */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 22px; }
.project { overflow: hidden; display: flex; flex-direction: column; transition: transform .15s ease; }
.project:hover { transform: translateY(-3px); }
.project .thumb { aspect-ratio: 16 / 10; background: var(--accent-soft); display: grid; place-items: center; overflow: hidden; }
.project .thumb img { width: 100%; height: 100%; object-fit: cover; }
.project .body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.project h3 { margin: 0; font-size: 18px; line-height: 1.3; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; }
.tags li { font-size: 12px; padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.project .more { margin-top: auto; font-weight: 600; font-size: 15px; }

/* XStar */
.xstar { padding: 28px; }
.xstar p { margin: 0 0 14px; }
.xstar p:last-child { margin: 0; }

/* Contact */
form { display: grid; gap: 14px; max-width: 560px; }
label { font-size: 14px; font-weight: 500; display: grid; gap: 6px; }
input[type=text], input[type=email], textarea {
  font: inherit; padding: 11px 13px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text);
}
input:focus, textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }
button.btn { cursor: pointer; font: inherit; font-weight: 600; justify-self: start; }
.hp { position: absolute; left: -9999px; }

footer { padding: 32px 0 48px; color: var(--muted); font-size: 14px; border-top: 1px solid var(--line); margin-top: 24px; }

.tl .desc { font-size: 14.5px; color: var(--muted); margin-top: 4px; line-height: 1.5; }
.skills { display: grid; grid-template-columns: 96px 1fr; gap: 8px 14px; margin: 0; font-size: 14.5px; }
.skills dt { color: var(--muted); font-weight: 500; }
.skills dd { margin: 0; }
.pubs { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 14px; }
.pubs li { display: grid; grid-template-columns: 48px 1fr; gap: 10px; font-size: 15.5px; line-height: 1.5; }
.pubs .yr { color: var(--accent); font-weight: 600; }
.note { color: var(--muted); font-size: 15px; }

.skip { position: absolute; left: -9999px; top: 8px; background: var(--accent); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 20; }
.skip:focus { left: 12px; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.sub { font-size: 14px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 36px 0 16px; }
.sub:first-of-type { margin-top: 0; }
.ind { border-top: 3px solid var(--accent); }
.ind p { margin: 0; color: var(--muted); font-size: 15px; }
.kind { font-size: 12.5px; font-weight: 600; color: var(--accent); }
.press { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.press li { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; padding: 12px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.press a { font-weight: 600; }
.press span { color: var(--muted); font-size: 14px; }
.more2 { font-size: 15px; margin-left: 12px; font-weight: 500; }
.plinks { font-size: 13.5px; white-space: nowrap; }
.tl .where a { color: inherit; border-bottom: 1px dotted var(--muted); }
.tl .where a:hover { color: var(--accent); text-decoration: none; }
.project .links { margin-top: auto; display: flex; gap: 16px; align-items: baseline; }
.project .links .more { margin-top: 0; }
.more2 { margin-left: 0; }
.video { overflow: hidden; aspect-ratio: 16 / 9; max-width: 760px; }
.video iframe { width: 100%; height: 100%; border: 0; display: block; }

/* ---- Design refresh ---- */
.hero { position: relative; overflow: hidden; padding: 84px 0 28px; }
.hero::before {
  content: ""; position: absolute; inset: -20% -10% auto -10%; height: 520px; z-index: -1;
  background:
    radial-gradient(520px 260px at 15% 20%, color-mix(in srgb, var(--accent) 26%, transparent), transparent 70%),
    radial-gradient(460px 240px at 85% 10%, color-mix(in srgb, #8a5cf6 20%, transparent), transparent 70%);
}
.avatar { width: 176px; height: 176px; box-shadow: 0 0 0 4px var(--bg), 0 0 0 6px var(--accent), var(--shadow); border: 0; }
.hero .wrap { grid-template-columns: 176px 1fr; }
h1 { background: linear-gradient(90deg, var(--text), color-mix(in srgb, var(--accent) 70%, var(--text))); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 44px !important; }
.stats > div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); display: grid; gap: 2px; }
.stats strong { font-size: 26px; letter-spacing: -.02em; color: var(--accent); }
.stats span { font-size: 13.5px; color: var(--muted); line-height: 1.35; }
@media (max-width: 720px) { .stats { grid-template-columns: repeat(2, 1fr); } .hero .wrap { grid-template-columns: 1fr; } }

section.alt { background: var(--surface); border-block: 1px solid var(--line); }
section.alt .card { background: var(--bg); box-shadow: none; }
section.alt .tl li::before { background: var(--surface); }
h2 { font-size: 30px; display: flex; align-items: center; gap: 14px; }
h2::after { content: ""; flex: 0 0 48px; height: 3px; border-radius: 3px; background: var(--accent); }
.section-lead { color: var(--muted); margin: -8px 0 24px; max-width: 640px; }

.nav ul a { padding: 6px 2px; border-bottom: 2px solid transparent; }
.nav ul a.active { color: var(--text); border-bottom-color: var(--accent); }
.nav .wrap { gap: 14px; }
.theme { background: none; border: 1px solid var(--line); color: var(--text); width: 34px; height: 34px; border-radius: 50%; cursor: pointer; font-size: 16px; flex: none; }
.theme:hover { border-color: var(--accent); color: var(--accent); }

.project { transition: transform .18s ease, box-shadow .18s ease; }
.project:hover { transform: translateY(-4px); box-shadow: 0 2px 4px rgba(20,30,60,.08), 0 16px 36px rgba(20,30,60,.12); }
.project .thumb img { transition: transform .4s ease; }
.project:hover .thumb img { transform: scale(1.04); }

/* Videos */
.vgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 22px; }
.vid { display: flex; flex-direction: column; overflow: hidden; color: inherit; transition: transform .18s ease; }
.vid:hover { text-decoration: none; transform: translateY(-3px); }
.vid .thumb { position: relative; display: block; aspect-ratio: 16 / 9; background: #000; overflow: hidden; }
.vid .thumb img { width: 100%; height: 100%; object-fit: cover; opacity: .92; transition: opacity .2s, transform .4s; }
.vid:hover .thumb img { opacity: 1; transform: scale(1.04); }
.vid .thumb iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.vid.playing { transform: none; }
.play { position: absolute; inset: 0; margin: auto; width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: rgba(0,0,0,.62); color: #fff; font-size: 20px; padding-left: 4px; backdrop-filter: blur(4px); transition: background .2s, transform .2s; }
.vid:hover .play { background: var(--accent); transform: scale(1.08); }
.vid .meta { display: grid; gap: 2px; padding: 14px 18px 16px; }
.vid .meta strong { font-size: 16px; line-height: 1.35; }
.vid .meta span { font-size: 13.5px; color: var(--muted); }

.btn { transition: border-color .15s, color .15s, transform .15s; }
.btn:hover { transform: translateY(-1px); }
footer { background: var(--bg); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
.hero .wrap.stats { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 720px) { .hero .wrap.stats { grid-template-columns: repeat(2, 1fr); text-align: left; justify-items: stretch; } }
.hero .wrap.stats { align-items: stretch; }
