:root {
  --bg: #ffffff;
  --fg: #1d2330;
  --muted: #5d6576;
  --faint: #8a91a0;
  --line: #e6e8ee;
  --chip: #f2f4f8;
  --accent: #1f5fae;
  --accent-soft: #e8f0fb;
  --hl: #b4441b;
  --hl-soft: #fdeee6;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151b;
    --fg: #e4e7ee;
    --muted: #a2a9b8;
    --faint: #737b8c;
    --line: #262b35;
    --chip: #1c2029;
    --accent: #7fb0f0;
    --accent-soft: #1b2a40;
    --hl: #f0a07a;
    --hl-soft: #3a2419;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.65;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }

.page {
  max-width: 880px;
  margin: 0 auto;
  padding: 64px 24px 48px;
}

/* ---------- Intro ---------- */
/* Avatar floats right so the bio text wraps underneath it */
.intro { display: flow-root; }
.intro h1 {
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0 0 4px;
}
.role { color: var(--muted); margin: 0 0 20px; font-weight: 500; }
.intro p { margin: 0 0 14px; }

.avatar {
  float: right;
  width: 140px;
  height: 140px;
  margin: 4px 0 12px 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--line);
}

.subhead {
  font-size: 1rem;
  font-weight: 600;
  margin: 22px 0 4px;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}
.links a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--fg);
  font-size: 0.9rem;
  font-weight: 500;
  transition: border-color .15s, background .15s;
}
.links a:hover { text-decoration: none; border-color: var(--accent); background: var(--accent-soft); }
.links i { color: var(--accent); font-size: 1rem; }

/* ---------- Sections ---------- */
section { margin-top: 52px; }
h2 {
  font-size: 1.3rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  margin: 0 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 8px;
}
.section-head h2 { border: 0; margin: 0; }
.note { color: var(--faint); font-size: 0.85rem; margin: 0 0 8px; }

.news { margin: 0; padding-left: 20px; font-size: 0.92rem; }
.news li { padding: 3px 0; }
.news li::marker { color: var(--faint); }

/* ---------- Experience ---------- */
.exp { list-style: none; padding: 0; margin: 0; }
.exp li { padding: 10px 0; }
.exp .logo {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  object-fit: contain;
  vertical-align: -3px;
  margin-right: 8px;
}
.exp-head {
  display: flex;
  justify-content: space-between;
  gap: 4px 16px;
  flex-wrap: wrap;
}
.exp-date { color: var(--muted); font-size: 0.9rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.exp-loc { color: var(--faint); font-size: 0.88rem; }
.exp-desc { color: var(--muted); font-size: 0.92rem; }

/* ---------- Publications ---------- */
.filter {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 10px;
}
.filter button {
  font: inherit;
  font-size: 0.85rem;
  padding: 4px 12px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.filter button + button { border-left: 1px solid var(--line); }
.filter button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.pubs .year {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--faint);
  padding: 24px 0 2px;
}

.pubs { list-style: none; padding: 0; margin: 0; }
.pub {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px dashed var(--line);
}

/* Default view: selected papers only, as one flat list */
[data-view="selected"] .pub:not([data-selected]),
[data-view="selected"] .year { display: none; }
.venue {
  align-self: start;
  margin-top: 3px;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 5px;
  padding: 3px 6px;
}
.pub .title {
  display: block;
  font-weight: 600;
  color: var(--fg);
  line-height: 1.4;
}
.pub .title:hover { color: var(--accent); }
.authors { color: var(--muted); font-size: 0.92rem; margin-top: 3px; }
.authors b { color: var(--fg); font-weight: 600; }
.meta { font-size: 0.88rem; color: var(--muted); margin-top: 3px; }

.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--hl);
  background: var(--hl-soft);
  border-radius: 4px;
  padding: 0 6px;
  margin-left: 4px;
  vertical-align: 1px;
}

.cites {
  display: inline-flex;
  vertical-align: 1px;
  margin-left: 6px;
  font-size: 0.72rem;
  line-height: 1.5;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.cites span { padding: 0 6px; color: var(--muted); background: var(--chip); }
.cites b { padding: 0 6px; color: var(--accent); font-weight: 700; font-variant-numeric: tabular-nums; }
.cites:hover { text-decoration: none; border-color: var(--accent); }

footer {
  margin-top: 64px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 0.82rem;
}

/* ---------- Small screens ---------- */
@media (max-width: 640px) {
  .page { padding: 36px 16px 32px; }
  .intro h1, .role { text-align: center; }
  .avatar { float: none; display: block; margin: 0 auto 16px; width: 112px; height: 112px; }
  .pub { grid-template-columns: 1fr; gap: 6px; }
  .venue { justify-self: start; }
}
