:root {
  --bg: #f1efeb;
  --sidebar: #f7f6f2;
  --surface: #ffffff;
  --accent: #1c5aa0;
  --accent-strong: #133f72;
  --accent-soft: #e9f0f8;
  --gold: #9a6a10;
  --crimson: #b03a2e;
  --green: #1d6f47;
  --slate: #5b6472;
  --text: #2b303b;
  --heading: #1b2437;
  --muted: #6a7180;
  --line: #e2ded7;
  --line-soft: #eceae4;
  --surface-raise: #f2f5f9;
  --radius: 14px;
  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-serif: 'Lora', Georgia, serif;
}

html[data-theme="dark"] {
  --bg: #12151a;
  --sidebar: #171b21;
  --surface: #1e242d;
  --accent: #6aa3e8;
  --accent-strong: #9cc2f2;
  --accent-soft: #1d2c40;
  --gold: #d3a24a;
  --crimson: #e07a6d;
  --green: #4fae82;
  --slate: #94a0b0;
  --text: #cdd5e0;
  --heading: #e8edf4;
  --muted: #8b95a5;
  --line: #2c333e;
  --line-soft: #232933;
  --surface-raise: #242c38;
}

*, *::before, *::after { box-sizing: border-box; }

html { color-scheme: light; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

.layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: 100vh;
  max-width: 1200px;
  margin: 0 auto;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
}

/* ---------- Sidebar ---------- */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 48px 32px;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.avatar-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 6px;
}

.avatar {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid #ffffff;
  box-shadow: 0 4px 18px rgba(27, 36, 55, 0.14);
}

.name {
  margin: 8px 0 2px;
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--heading);
  line-height: 1.2;
  text-align: center;
}

.role {
  margin: 0 0 4px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--accent-strong);
  text-align: center;
}

.affil {
  margin: 0 0 14px;
  font-size: 0.82rem;
  color: var(--muted);
  text-align: center;
}
.affil span { display: block; }

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 16px 12px 10px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: 10px;
}

.update-time {
  margin: auto 0 0 0;
  font-size: .8rem;
  color: var(--muted);
  text-align: center;
  padding: 8px 0 0;
  border-top: 1px solid var(--line-soft);
  line-height: 1.4;
}
.nav a {
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--slate);
}
.nav a:hover { background: var(--accent-soft); color: var(--accent-strong); text-decoration: none; }

.social-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 14px;
}
.social { list-style: none; margin: 0; padding: 0; display: flex; gap: 8px; }
.social li { margin: 0; }
.social a {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--line-soft);
  background: var(--surface);
  color: var(--slate);
  transition: all 0.15s ease;
}
.social a svg { width: 18px; height: 18px; flex: none; color: var(--accent); }
.social a:hover { color: var(--accent-strong); border-color: var(--accent); background: var(--accent-soft); text-decoration: none; }

.theme-toggle {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: var(--surface);
  color: var(--slate);
  cursor: pointer;
  transition: all 0.15s ease;
}
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle:hover { color: var(--accent-strong); border-color: var(--accent); background: var(--accent-soft); }

/* ---------- Main ---------- */
.main {
  padding: 56px 64px 40px;
  max-width: 940px;
}

.hero h2 {
  margin: 6px 0 14px;
  font-family: var(--font-serif);
  font-size: 2.3rem;
  font-weight: 600;
  color: var(--heading);
  line-height: 1.15;
}

.lede {
  margin: 0 0 24px;
  font-size: 1.08rem;
  color: var(--text);
  max-width: 42em;
}

/* ---------- Research cards ---------- */
.research-cards { margin-top: 42px; }
.rc-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.rc-card {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.rc-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 16px rgba(27, 36, 55, 0.1);
}
.rc-card img {
  width: 100%;
  height: auto;
  display: block;
}
.rc-body { padding: 16px 18px 18px; }
.rc-body h3 {
  margin: 0 0 8px;
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--heading);
}
.rc-body p {
  margin: 0;
  font-size: 0.92rem;
  color: var(--muted);
  line-height: 1.55;
}

.section { margin-top: 56px; }

.section-title {
  margin: 0 0 18px;
  font-family: var(--font-serif);
  font-size: 1.55rem;
  font-weight: 600;
  color: var(--heading);
  padding-bottom: 10px;
  border-bottom: 2px solid var(--accent);
  display: inline-block;
}

.section-note { margin: -6px 0 20px; font-size: 0.85rem; color: var(--muted); }

/* ---------- Stats / highlights ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 0 0 22px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 18px 16px;
  text-align: center;
}
.stat-number {
  display: block;
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--accent-strong);
  line-height: 1.15;
}
.stat-label { font-size: 0.8rem; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; }

.main p { max-width: 46em; }
a.ext { color: var(--accent); font-weight: 500; }

.highlights {
  list-style: none;
  margin: 18px 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.highlights li {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 0.92rem;
}

.hl-badge {
  display: inline-block;
  min-width: 84px;
  text-align: center;
  margin-right: 10px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #fff;
  vertical-align: 1px;
}
.hl-badge.award { background: var(--crimson); }
.hl-badge.honor { background: var(--gold); }
.hl-badge.grant { background: var(--accent); }
.hl-badge.service { background: var(--green); }

/* ---------- Publications ---------- */
.chip, .chip-best {
  display: inline-block;
  padding: 1px 9px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  vertical-align: 1px;
  margin-right: 6px;
}
.chip-q1 { background: #6c5ce7; color: #fff; }
.chip-a { background: var(--crimson); color: #fff; }
.chip-b { background: var(--accent); color: #fff; }
.chip-c { background: var(--slate); color: #fff; }
.chip-best { background: var(--gold); color: #fff; }

.authors sup.ast {
  font-size: 0.62em;
  font-weight: 700;
  color: var(--accent);
  line-height: 0;
}
.authors strong.ttz { color: var(--heading); font-weight: 700; }
sup.ast.ttz {
  font-size: 1.05em;
  font-weight: 800;
  color: var(--crimson);
  line-height: 0;
}
span.ast.ttz {
  font-size: 1em;
  font-weight: 800;
  color: var(--crimson);
}

.pubs { display: grid; gap: 10px; }

.pubs-empty {
  padding: 14px 18px;
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 0.92rem;
}

.pub-list { list-style: none; margin: 0; padding: 8px 0; }
.pub-list li {
  padding: 13px 18px;
  border-top: 1px solid var(--line-soft);
  font-size: 0.94rem;
}
.pub-list .venue { font-weight: 700; color: var(--heading); }
.pub-list .authors { color: var(--muted); font-size: 0.88rem; }
.pub-list .tags { margin-top: 4px; }

.pub-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
}
.pub-filters .label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--slate);
  margin-right: 2px;
}
.filter-chip {
  position: relative;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 5px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--slate);
  cursor: pointer;
  transition: all 0.15s ease;
}
.filter-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.filter-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.filter-chip .n {
  font-size: 0.72rem;
  opacity: 0.75;
  margin-left: 4px;
}

.year-group {
  position: relative;
  margin-bottom: 22px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--surface);
}
details.year-group {
  margin-bottom: 22px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--surface);
}
.year-group .year-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 13px 18px;
  background: linear-gradient(180deg, var(--surface), var(--surface-raise));
  border-radius: var(--radius) var(--radius) 0 0;
  border-bottom: 1px solid var(--line-soft);
}
.year-group .year-head .yr {
  font-family: 'Lora', 'Noto Serif SC', Georgia, serif;
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--accent-strong);
  letter-spacing: 0.02em;
}
.year-group .year-head .count {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--slate);
  background: var(--accent-soft);
  padding: 2px 10px;
  border-radius: 999px;
}
.year-group .year-body { padding: 6px 18px 12px; }
details.year-group > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
}
details.year-group > summary::-webkit-details-marker { display: none; }
details.year-group > summary::after {
  content: '−';
  margin-left: auto;
  font-size: 1.1rem;
  color: var(--slate);
}
details.year-group:not([open]) > summary::after { content: '+'; }
details.year-group:not([open]) { border-radius: var(--radius); }
details.year-group:not([open]) .year-head { border-radius: var(--radius); border-bottom: none; }
.pub-list a.ref {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.85rem;
  font-weight: 600;
}

.error {
  margin-top: 16px;
  padding: 14px 18px;
  background: #fbeae8;
  border: 1px solid #eacfc9;
  border-radius: 10px;
  color: var(--crimson);
  font-size: 0.9rem;
}

/* ---------- Media ---------- */
.media-cards { display: grid; gap: 14px; max-width: 560px; }
.media-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 16px 20px;
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.media-card:hover {
  border-color: var(--accent);
  box-shadow: 0 6px 20px rgba(28, 90, 160, 0.12);
  transform: translateY(-2px);
  text-decoration: none;
}
.media-icon {
  flex: 0 0 auto;
  width: 52px; height: 52px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent-strong);
}
.media-icon svg { width: 28px; height: 28px; }
.media-text { display: flex; flex-direction: column; min-width: 0; }
.media-name { font-weight: 600; color: var(--heading); }
.media-meta { font-size: 0.82rem; color: var(--muted); }
.media-arrow { margin-left: auto; font-size: 1.3rem; color: var(--accent); }

/* ---------- Projects ---------- */
.proj-list {
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.proj-list li {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: grid;
  gap: 4px;
}
.proj-fund {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
}
.proj-no {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  color: var(--muted);
}
.proj-title {
  font-family: var(--font-serif);
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--heading);
  line-height: 1.45;
}
.proj-meta {
  font-size: 0.82rem;
  color: var(--muted);
}

/* ---------- Awards ---------- */
.award-list {
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
  display: grid;
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.award-list li {
  display: flex;
  gap: 14px;
  align-items: baseline;
  padding: 11px 18px;
  border-top: 1px solid var(--line-soft);
}
.award-list li:first-child { border-top: 0; }
.award-year {
  flex: 0 0 auto;
  min-width: 42px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--gold);
}
.award-text {
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text);
}

/* ---------- Footer ---------- */
.footer {
  margin-top: 64px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.84rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.footer a { font-size: 0.84rem; color: var(--muted); }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    align-items: center;
    text-align: center;
    padding: 36px 20px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .nav { flex-direction: row; flex-wrap: wrap; justify-content: center; padding: 8px; }
  .social-row { justify-content: center; }
  .social { justify-content: center; }
  .rc-grid { grid-template-columns: 1fr; }
  .main { padding: 32px 22px; }
  .stats { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .stat-number { font-size: 1.35rem; }
}
