/* ------------------------------------------------------------------
   Tokens
------------------------------------------------------------------ */
:root {
  --bg: #f8fafb;
  --bg-soft: #eff3f5;
  --surface: #ffffff;
  --border: #e2e8ec;
  --text: #111a22;
  --text-2: #3f4b57;
  --text-3: #5d6976;
  --accent: #2563eb;        /* blue: 5.2:1 on white */
  --accent-strong: #1d4ed8;
  --accent-soft: #edf3ff;
  --accent-line: #cddcfc;
  --award: #9a5b06;
  --award-soft: #fdf6e3;
  --shadow: 0 1px 2px rgba(17, 26, 34, .04), 0 4px 16px rgba(17, 26, 34, .06);
  --radius: 14px;
  --maxw: 1040px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1418;
    --bg-soft: #161e24;
    --surface: #141b21;
    --border: #26313a;
    --text: #e8eef2;
    --text-2: #b8c3cc;
    --text-3: #8e9ba6;
    --accent: #7cb1ff;
    --accent-strong: #a8caff;
    --accent-soft: rgba(124, 177, 255, .12);
    --accent-line: rgba(124, 177, 255, .28);
    --award: #f5c46b;
    --award-soft: #2e2817;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1418;
  --bg-soft: #161e24;
  --surface: #141b21;
  --border: #26313a;
  --text: #e8eef2;
  --text-2: #b8c3cc;
  --text-3: #8e9ba6;
  --accent: #7cb1ff;
  --accent-strong: #a8caff;
  --accent-soft: rgba(124, 177, 255, .12);
  --accent-line: rgba(124, 177, 255, .28);
  --award: #f5c46b;
  --award-soft: #2e2817;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

/* ------------------------------------------------------------------
   Base
------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/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; text-underline-offset: 3px; }
h1, h2, h3 { margin: 0; letter-spacing: -0.02em; }
p { margin: 0; }
.muted { color: var(--text-3); }
.small { font-size: .85rem; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* ------------------------------------------------------------------
   Nav
------------------------------------------------------------------ */
.nav {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 0 24px;
  height: 56px; display: flex; align-items: center; gap: 24px;
}
.nav-name { font-weight: 700; color: var(--text); white-space: nowrap; }
.nav-name:hover { text-decoration: none; }
.nav-links { display: flex; gap: 4px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.nav-links::-webkit-scrollbar { display: none; }
.nav-links a {
  color: var(--text-2); font-size: .9rem; font-weight: 500;
  padding: 6px 10px; border-radius: 8px; white-space: nowrap;
}
.nav-links a:hover, .nav-links a.active { color: var(--text); background: var(--bg-soft); text-decoration: none; }
.theme-toggle {
  flex: none; width: 36px; height: 36px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  cursor: pointer; display: grid; place-items: center;
}
.theme-toggle:hover { color: var(--text); }
.icon-sun { display: none; }
:root[data-theme="dark"] .icon-sun { display: inline; }
:root[data-theme="dark"] .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: inline; }
  :root:not([data-theme="light"]) .icon-moon { display: none; }
}

/* ------------------------------------------------------------------
   Hero
------------------------------------------------------------------ */
.hero {
  display: grid; grid-template-columns: 200px 1fr; gap: 40px;
  align-items: center; padding: 56px 0 24px;
}
.avatar {
  width: 200px; height: 200px; object-fit: cover; border-radius: 24px;
  box-shadow: var(--shadow);
}
.hero h1 { font-size: 2.6rem; font-weight: 700; line-height: 1.1; }
.hero-role { margin-top: 8px; font-size: 1.1rem; color: var(--text-2); font-weight: 500; }
.hero-bio { margin-top: 16px; color: var(--text-2); max-width: 62ch; }
.hero-links { margin-top: 20px; display: flex; flex-wrap: wrap; gap: 8px; }

/* chips / tags */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font-size: .85rem; font-weight: 500; line-height: 1.4;
  transition: border-color .15s, color .15s, background .15s;
}
.chip i { font-size: .95em; color: var(--text-3); transition: color .15s; }
a.chip:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
a.chip:hover i { color: var(--accent); }
.chip-static { color: var(--text-2); }

.tag {
  display: inline-block; padding: 2px 10px; border-radius: 6px;
  background: var(--accent-soft); color: var(--accent-strong);
  font-size: .8rem; font-weight: 600;
}
a.tag:hover { text-decoration: none; filter: brightness(.95); }
.tag-static { background: var(--bg-soft); color: var(--text); font-weight: 500; }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; }

/* ------------------------------------------------------------------
   Sections
------------------------------------------------------------------ */
.section { padding-top: 56px; }
.section > h2, .section-head h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: 20px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}

.research-grid { display: grid; grid-template-columns: repeat(3, 1fr); column-gap: 16px; row-gap: 16px; }
/* subgrid: title / text / tags / link share row heights across the three cards,
   so the paper buttons start at the same height in every card */
.research-card {
  display: grid; grid-row: span 4; grid-template-rows: subgrid; row-gap: 10px;
  align-content: start;
}
.research-card h3 { font-size: 1.02rem; font-weight: 600; }
.research-card p { color: var(--text-2); font-size: .92rem; }
.research-card .tag-row { align-content: flex-start; align-items: flex-start; margin-top: 4px; }
.card-link { justify-self: start; align-self: start; margin-top: 4px; font-size: .85rem; font-weight: 600; }
.card-link i { font-size: .75em; margin-left: 2px; transition: transform .15s; }
.card-link:hover { text-decoration: none; }
.card-link:hover i { transform: translateX(3px); }

/* News */
.news { list-style: none; margin: 0; padding: 0; }
.news li {
  display: grid; grid-template-columns: 92px 1fr; gap: 16px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.news li:last-child { border-bottom: 0; }
.news-date { color: var(--text-3); font-size: .88rem; font-weight: 500; font-variant-numeric: tabular-nums; padding-top: 1px; }
.news .news-extra { display: none; }
.news.expanded .news-extra { display: grid; }
.text-btn {
  margin-top: 12px; background: none; border: 0; padding: 4px 0; cursor: pointer;
  color: var(--accent); font: inherit; font-size: .9rem; font-weight: 600;
}
.text-btn i { font-size: .75em; margin-left: 4px; transition: transform .2s; }
.text-btn[aria-expanded="true"] i { transform: rotate(180deg); }

/* ------------------------------------------------------------------
   Publications
------------------------------------------------------------------ */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.filter {
  padding: 6px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  font: inherit; font-size: .88rem; font-weight: 500;
}
.filter span { color: var(--text-3); margin-left: 4px; font-size: .8rem; }
.filter:hover { border-color: var(--text-3); color: var(--text); }
.filter.active { background: var(--text); border-color: var(--text); color: var(--bg); }
.filter.active span { color: var(--bg); opacity: .7; }

.pub-list { display: flex; flex-direction: column; gap: 16px; }
.pub {
  display: grid; grid-template-columns: 260px 1fr; column-gap: 24px; row-gap: 0;
  padding: 24px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--border);
  transition: border-color .15s, box-shadow .15s;
}
.pub:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); box-shadow: var(--shadow); }
.pub[hidden] { display: none; }
.pub-media {
  aspect-ratio: 16 / 10; border-radius: 12px; overflow: hidden;
  background: #fff; align-self: center; order: -1;
}
/* contain: always show the whole figure / video, never crop */
.pub-media img, .pub-media video { width: 100%; height: 100%; object-fit: contain; display: block; }
.pub-body { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.pub-title { font-size: 1.15rem; font-weight: 600; line-height: 1.35; }
.pub-title a { color: var(--text); }
.pub-title a:hover { color: var(--accent); text-decoration: none; }
.pub-authors { color: var(--text-2); font-size: .93rem; }
.pub-authors strong {
  color: var(--text); font-weight: 500;
  text-decoration: underline; text-decoration-color: var(--accent);
  text-decoration-thickness: 2px; text-underline-offset: 4px;
}
.pub-meta { display: flex; flex-wrap: wrap; align-items: center; font-size: .95rem; }
.pub-venue { color: var(--accent); font-weight: 600; }
.pub-cat { color: var(--text-3); padding-left: 12px; margin-left: 12px; border-left: 1px solid var(--border); }
.pub-note { color: var(--award); font-size: .85rem; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.pub-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 10px; }
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px; border-radius: 8px;
  background: var(--accent-soft); color: var(--accent-strong);
  border: 1px solid var(--accent-line);
  font-size: .85rem; font-weight: 600; line-height: 1.3;
  transition: filter .15s, transform .15s;
}
.btn:hover { text-decoration: none; filter: brightness(.96); transform: translateY(-1px); }
.btn .stars {
  display: inline-flex; align-items: center; gap: 4px;
  margin-left: 2px; padding-left: 8px;
  border-left: 1px solid var(--accent-line);
  font-variant-numeric: tabular-nums;
}
.btn .stars i { font-size: .8em; }
button.btn { font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer; }
.btn-abs i { transition: transform .2s; }
.btn-abs[aria-expanded="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Abstract: full-width row under the card, expands to its text height */
.pub-abstract {
  grid-column: 1 / -1;
  display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows .25s ease, margin .25s ease;
  margin-top: 0;   /* no row gap: collapsed abstract takes no space */
}
.pub-abstract > div { overflow: hidden; min-height: 0; visibility: hidden; transition: visibility .25s; }
.pub-abstract p {
  margin: 0; padding: 16px 18px; border-radius: 10px;
  background: var(--bg-soft); color: var(--text-2);
  font-size: .9rem; line-height: 1.7; text-align: justify; hyphens: auto;
}
.pub.abs-open .pub-abstract { grid-template-rows: 1fr; margin-top: 20px; }
.pub.abs-open .pub-abstract > div { visibility: visible; }

/* ------------------------------------------------------------------
   Experience / Honors
------------------------------------------------------------------ */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }
.col-title {
  font-size: .95rem; font-weight: 600; margin-bottom: 14px;
  display: flex; align-items: center; gap: 8px;
}
.col-title i { color: var(--accent); font-size: .9em; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 2px solid var(--border); }
.timeline li { position: relative; padding: 0 0 20px 4px; display: flex; flex-direction: column; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
  content: ""; position: absolute; left: -26px; top: 6px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--accent);
}
.tl-period { font-size: .82rem; color: var(--text-3); font-weight: 500; font-variant-numeric: tabular-nums; }
.tl-role { font-weight: 600; }
.tl-role .muted { font-weight: 400; }
.tl-note { font-size: .88rem; color: var(--text-2); }

.honors-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.plain { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.plain li { display: flex; flex-direction: column; font-size: .92rem; }

.footer {
  margin-top: 72px; padding: 24px 0 40px; border-top: 1px solid var(--border);
  color: var(--text-3); font-size: .85rem;
}

/* ------------------------------------------------------------------
   Responsive
------------------------------------------------------------------ */
@media (max-width: 860px) {
  .research-grid { grid-template-columns: 1fr; }
  .research-card { grid-row: auto; grid-template-rows: none; }
  .pub { grid-template-columns: 200px 1fr; column-gap: 20px; }
}
@media (max-width: 640px) {
  .container, .nav-inner { padding: 0 16px; }
  .nav-inner { gap: 12px; }
  .nav-name { display: none; }
  .nav-links { margin-left: 0; flex: 1; gap: 0; }
  .nav-links a { padding: 6px 8px; font-size: .85rem; }
  .hero { grid-template-columns: 1fr; gap: 20px; padding-top: 32px; text-align: left; }
  .avatar { width: 120px; height: 120px; border-radius: 20px; }
  .hero h1 { font-size: 2rem; }
  .section { padding-top: 44px; }
  .pub { grid-template-columns: 1fr; padding: 16px; }
  .pub-media { margin-bottom: 14px; }
  .pub.abs-open .pub-abstract { margin-top: 14px; }
  .pub-abstract p { text-align: left; hyphens: manual; }
  .pub-meta { flex-direction: column; align-items: flex-start; gap: 2px; }
  .pub-cat { border-left: 0; margin-left: 0; padding-left: 0; font-size: .88rem; }
  .two-col, .honors-grid { grid-template-columns: 1fr; gap: 28px; }
  .news li { grid-template-columns: 1fr; gap: 2px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
