:root {
  --bg: #ffffff;
  --fg: #1f2328;
  --muted: #59636e;
  --link: #1772d0;
  --link-hover: #f09228;
  --rule: #e6e8eb;
  --chip-bg: #f2f4f7;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1115;
    --fg: #e6e8eb;
    --muted: #9aa4af;
    --link: #6cb6ff;
    --link-hover: #ffb35c;
    --rule: #262a31;
    --chip-bg: #1b1f26;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1115;
  --fg: #e6e8eb;
  --muted: #9aa4af;
  --link: #6cb6ff;
  --link-hover: #ffb35c;
  --rule: #262a31;
  --chip-bg: #1b1f26;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

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

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); }

.page { max-width: 860px; margin: 0 auto; padding: 32px 16px 48px; }

/* ---------- 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(--rule);
}
.nav-inner {
  max-width: 860px; margin: 0 auto; padding: 10px 16px;
  display: flex; gap: 18px; align-items: center; flex-wrap: wrap;
  font-size: 14px;
}
.nav-inner .brand { font-weight: 700; color: var(--fg); margin-right: auto; }
.nav-inner a:not(.brand) { color: var(--muted); }
.nav-inner a:not(.brand):hover { color: var(--link); }
#theme-toggle {
  background: none; border: 1px solid var(--rule); border-radius: 6px;
  color: var(--muted); cursor: pointer; padding: 2px 8px; font-size: 14px;
}

/* ---------- Header ---------- */
.hero { display: flex; gap: 32px; align-items: center; padding: 16px 0 8px; }
.hero-text { flex: 1; }
.hero h1 { font-size: 34px; font-weight: 400; margin: 0 0 4px; text-align: center; }
.hero .title { text-align: center; color: var(--muted); margin: 0 0 16px; }
.hero p { margin: 0 0 12px; }
.hero .links { text-align: center; margin-top: 16px; }
.hero .links { display: flex; justify-content: center; gap: 10px; }
.hero .links a {
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; border-radius: 50%; color: var(--muted);
  border: 1px solid var(--rule); transition: color .15s, border-color .15s, transform .15s;
}
.hero .links a:hover { color: var(--link); border-color: var(--link); transform: translateY(-2px); }
.hero .links svg { width: 20px; height: 20px; }
.hero img {
  width: 220px; height: 220px; object-fit: cover; border-radius: 50%;
  flex-shrink: 0; border: 1px solid var(--rule);
}

/* ---------- Sections ---------- */
h2 {
  font-size: 22px; font-weight: 400; margin: 40px 0 12px;
  padding-bottom: 6px; border-bottom: 1px solid var(--rule);
}
.section-note { color: var(--muted); margin-top: -4px; font-size: 14.5px; }

/* News */
.news { list-style: none; padding: 0; margin: 0; }
.news li { display: flex; gap: 16px; padding: 4px 0; }
.news .date { color: var(--muted); min-width: 76px; font-variant-numeric: tabular-nums; }
.news .badge-new {
  display: inline-block; margin-right: 6px; padding: 1px 6px; border-radius: 3px;
  background: #c8322e; color: #fff; font-size: 11px; font-weight: 700;
  letter-spacing: .04em; line-height: 1.35; vertical-align: baseline;
}

/* Highlights */
.highlights { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.card {
  border: 1px solid var(--rule); border-radius: 10px; padding: 14px 16px;
}
.card h3 { margin: 0 0 4px; font-size: 16px; }
.card .org { color: var(--muted); font-size: 13.5px; margin-bottom: 6px; }
.card p { margin: 0; font-size: 14.5px; }

/* Publications */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 16px; }
.filters button {
  border: 1px solid var(--rule); background: var(--chip-bg); color: var(--fg);
  border-radius: 999px; padding: 3px 12px; font-size: 13.5px; cursor: pointer;
}
.filters button.active { background: var(--link); border-color: var(--link); color: #fff; }

.paper {
  display: flex; gap: 20px; padding: 14px 12px; border-radius: 10px; margin: 0 -12px;
}
.paper[hidden] { display: none; }
#paper-list[data-filter="selected"] .paper:not(.featured) { display: none; }
.teaser {
  position: relative; display: block; width: 200px; height: 125px; flex-shrink: 0;
  border-radius: 8px; overflow: hidden; background: #fff; border: 1px solid var(--rule);
}
.teaser img { width: 100%; height: 100%; object-fit: contain; padding: 4px; transition: transform .2s; }
.teaser:hover img { transform: scale(1.04); }
.venue-tag {
  position: absolute; left: 6px; bottom: 6px; padding: 1px 7px; border-radius: 4px;
  background: rgba(15, 23, 42, .78); color: #fff; font-size: 11.5px; font-weight: 700; letter-spacing: .3px;
}
.paper-body { flex: 1; }
.paper-title { font-weight: 700; font-size: 16px; }
.paper-authors, .paper-venue { font-size: 14.5px; }
.paper-venue { color: var(--muted); font-style: italic; }
.paper-links { font-size: 14px; margin-top: 2px; }
.paper-links a { margin-right: 4px; }
.me { font-weight: 700; }

/* Experience timeline */
.timeline { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--rule); }
.timeline li { position: relative; padding: 0 0 18px 20px; }
.timeline li::before {
  content: ""; position: absolute; left: -7px; top: 7px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--bg); border: 2px solid var(--link);
}
.timeline .role { font-weight: 700; }
.timeline .when { color: var(--muted); font-size: 14px; }
.timeline p { margin: 2px 0 0; font-size: 14.5px; }

/* Compact lists */
.compact { padding-left: 18px; margin: 0; }
.compact li { margin-bottom: 4px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 0 32px; }
.muted { color: var(--muted); }

#toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); z-index: 20;
  background: var(--fg); color: var(--bg); padding: 8px 16px; border-radius: 8px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

footer {
  margin-top: 48px; padding-top: 16px; border-top: 1px solid var(--rule);
  color: var(--muted); font-size: 13px; text-align: center;
}

/* ---------- Mobile ---------- */
@media (max-width: 700px) {
  .hero { flex-direction: column-reverse; gap: 16px; }
  .hero img { width: 160px; height: 160px; }
  .highlights, .two-col { grid-template-columns: 1fr; }
  .paper { flex-direction: column; gap: 10px; }
  .teaser { width: 100%; height: 190px; }
  .nav-inner { gap: 12px; }
  .nav-inner .brand { width: 100%; }
}
