/* ===== Distill Style — Academic homepage ===== */
/* Light theme (default) — pure white paper */
:root {
  --bg: #ffffff;
  --bg-secondary: #f3f4f6;
  --text: #1f2933;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --hairline: #e5e7eb;
  --accent: #2a7ae2;   /* academic blue: links/citations */
  --data: #e4572e;     /* chart orange: data emphasis */
  /* 拉丁：IBM Plex Serif（正文）/ IBM Plex Mono（UI、代码），本地自托管
     中文：直接使用系统字体，零下载、即时渲染（macOS 宋体 / Windows 宋体 / Linux 思源宋体） */
  --serif: "IBM Plex Serif", "Songti SC", "STSong", "SimSun", "Noto Serif CJK SC", "Source Han Serif SC", serif;
  --mono: "IBM Plex Mono", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", ui-monospace, Menlo, Consolas, monospace;
  --sans: var(--mono);
}

/* Dark theme — deep neutral, warm off-white text */
:root[data-theme="dark"] {
  --bg: #14171c;
  --bg-secondary: #1d2129;
  --text: #e8eaed;
  --text-secondary: #a3abb8;
  --text-muted: #6b7280;
  --hairline: #2c313a;
  --accent: #6fa8ec;
  --data: #f0805a;
}

/* [BASE] */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 5rem; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  transition: background-color .2s ease, color .2s ease;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
strong { font-weight: 600; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; color: var(--text); letter-spacing: -0.01em; line-height: 1.25; }
img { max-width: 100%; display: block; }

/* 图标：引用 index.html 中的 SVG sprite（#i-*） */
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon {
  width: 1em; height: 1em; flex: none;
  fill: none; stroke: currentColor;
  stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
  vertical-align: -0.125em;
}
a.with-icon { display: inline-flex; align-items: center; gap: .34em; }

/* [NAV] */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.2) blur(8px);
  border-bottom: 1px solid var(--hairline);
}
.nav-inner {
  max-width: 64rem; margin: 0 auto; padding: .75rem 1.5rem;
  display: flex; align-items: center; gap: 1.5rem;
}
.nav-brand { font-family: var(--serif); font-weight: 600; color: var(--text); font-size: 1.05rem; }
.nav-brand:hover { text-decoration: none; }
.nav-links { display: flex; gap: 1.25rem; margin-left: auto; }
.nav-links a {
  font-family: var(--sans); font-size: .875rem; color: var(--text-secondary);
  transition: color .15s ease;
}
.nav-links a:hover { color: var(--accent); text-decoration: none; }
.theme-toggle {
  width: 2.1rem; height: 2.1rem; padding: 0; cursor: pointer;
  display: grid; place-items: center;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--hairline); border-radius: 6px;
  transition: background-color .15s ease, border-color .15s ease;
}
.theme-toggle:hover { background: var(--bg-secondary); border-color: var(--accent); }
.theme-toggle-icon { font-size: 1rem; line-height: 1; }
.theme-toggle-icon[data-icon="moon"] { display: none; }
:root[data-theme="dark"] .theme-toggle-icon[data-icon="sun"] { display: none; }
:root[data-theme="dark"] .theme-toggle-icon[data-icon="moon"] { display: block; }

/* [HERO] */
.hero { max-width: 64rem; margin: 0 auto; padding: 3.5rem 1.5rem 2.5rem; }
.hero-inner { display: flex; gap: 2rem; align-items: flex-start; }
.hero-avatar {
  width: 120px; height: 120px; flex: 0 0 120px;
  border-radius: 6px; border: 1px solid var(--hairline);
  object-fit: cover;
}
.hero-name { font-size: 2.25rem; margin: 0 0 .25rem; }
.hero-title { font-family: var(--sans); color: var(--text-secondary); font-size: .95rem; margin: 0 0 .5rem; }
.hero-tagline { margin: 0 0 1.25rem; color: var(--text); }
.byline {
  list-style: none; margin: 0; padding: 1rem 0 0; border-top: 1px solid var(--hairline);
  display: grid; grid-template-columns: 1fr 1fr; gap: .5rem 2rem;
}
.byline li { display: flex; flex-direction: column; gap: .1rem; }
.byline-label {
  font-family: var(--sans); font-size: .7rem; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--text-muted);
  display: inline-flex; align-items: center; gap: .38em;
}
.byline-label .icon { width: 1em; height: 1em; }
.byline-value { font-family: var(--sans); font-size: .9rem; color: var(--text); }

/* [SECTION] */
.prose { max-width: 64rem; margin: 0 auto; padding: 0 1.5rem; }
.section { padding: 3rem 0; border-top: 1px solid var(--hairline); }
.section-title {
  font-size: 1.5rem; margin: 0 0 1.25rem;
  display: flex; align-items: center; gap: .5rem;
}
.section-title .icon { width: 1.05em; height: 1.05em; color: var(--text-secondary); }
.sub-title { font-size: 1.05rem; margin: 1.5rem 0 .5rem; }
.section p { margin: 0 0 1rem; }
.news-list, .award-list { list-style: none; margin: 0; padding: 0; }
.news-list li, .award-list li {
  display: flex; gap: 1rem; padding: .55rem 0;
  border-bottom: 1px solid var(--hairline);
}
.news-list li:last-child, .award-list li:last-child { border-bottom: none; }
.news-date, .award-year {
  flex: 0 0 4.5rem; font-family: var(--mono); font-size: .82rem;
  color: var(--data); padding-top: .15rem;
}
.plain-list { margin: 0; padding-left: 1.2rem; }
.plain-list li { margin: .25rem 0; }

/* [RESEARCH] */
.research-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; margin: 1.25rem 0; }
.research-card {
  background: var(--bg); border: 1px solid var(--hairline); border-radius: 6px;
  padding: 1.1rem 1.2rem;
  min-width: 0; overflow-wrap: break-word;
}
.research-card-title { font-size: 1.02rem; margin: 0 0 .4rem; overflow-wrap: break-word; }
.research-card p { margin: 0; font-size: .95rem; color: var(--text-secondary); overflow-wrap: break-word; }

/* [PUB] */
.pub-year {
  font-family: var(--sans); font-size: .78rem; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--text-muted); margin: 1.5rem 0 .5rem;
}
.pub-list { list-style: none; margin: 0; padding: 0; counter-reset: none; }
.pub-item {
  display: flex; gap: 1.25rem; align-items: flex-start;
  padding: 1rem 0; border-bottom: 1px solid var(--hairline);
}
.pub-item:last-child { border-bottom: none; }
.pub-item p { margin: 0; }
.pub-thumb {
  flex: 0 0 9rem; width: 9rem; aspect-ratio: 4 / 3;
  border: 1px solid var(--hairline); border-radius: 6px; overflow: hidden;
  background: var(--bg-secondary);
  display: flex; align-items: center; justify-content: center;
}
.pub-thumb img { width: 100%; height: 100%; object-fit: cover; }
.pub-main { flex: 1 1 auto; min-width: 0; }
.pub-item-title { font-weight: 600; }
.pub-item-authors { font-size: .92rem; color: var(--text); }
.pub-item-venue { font-size: .88rem; color: var(--text-secondary); font-style: italic; }
.pub-item-links { font-family: var(--sans); font-size: .82rem; margin-top: .3rem !important; }
.pub-empty { color: var(--text-secondary); font-style: italic; }

/* [TABLE] booktabs: horizontal rules only, no verticals, no zebra */
.booktabs {
  width: 100%; border-collapse: collapse; margin: 1rem 0;
  font-size: .92rem;
}
.booktabs thead th {
  font-family: var(--sans); font-weight: 600; text-align: left;
  padding: .5rem .6rem; border-bottom: 1px solid var(--text);
}
.booktabs thead { border-top: 2px solid var(--text); }
.booktabs tbody { border-bottom: 2px solid var(--text); }
.booktabs td { padding: .5rem .6rem; }

/* [BIBTEX + ERROR] */
.bibtex {
  font-family: var(--mono); font-size: .78rem; line-height: 1.55;
  background: var(--bg-secondary); color: var(--text-secondary);
  border: 1px solid var(--hairline); border-radius: 6px;
  padding: .8rem 1rem; margin: .6rem 0 0; overflow-x: auto;
  white-space: pre;
}
.bib-toggle { cursor: pointer; }
.load-error {
  max-width: 42rem; margin: 1rem auto 0; padding: .75rem 1rem;
  font-family: var(--sans); font-size: .85rem;
  color: var(--data); background: var(--bg-secondary);
  border: 1px solid var(--hairline); border-radius: 6px;
}

/* [FOOTER] */
.footer { border-top: 1px solid var(--hairline); margin-top: 2rem; }
.footer-inner {
  max-width: 64rem; margin: 0 auto; padding: 1.5rem 1.5rem 2.5rem;
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem;
  font-family: var(--sans); font-size: .8rem; color: var(--text-muted);
}

/* [RESPONSIVE] */
@media (min-width: 768px) {
  .research-grid { grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }
}
@media (max-width: 640px) {
  .hero-inner { flex-direction: column; gap: 1.25rem; }
  .hero-avatar { width: 96px; height: 96px; flex-basis: 96px; }
  .hero-name { font-size: 1.85rem; }
  .byline { grid-template-columns: 1fr; }
  .nav-links { display: none; }
  .pub-item { gap: .9rem; }
  .pub-thumb { flex-basis: 6rem; width: 6rem; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
