/* ============================================================
   wenbowu.com — editorial academic style
   Warm paper background, serif text, single deep-green accent.
   ============================================================ */

:root {
  color-scheme: light;
  --bg: #ffffff;
  --bg-card: #f6f6f3;
  --text: #141413;
  --muted: #6b6a64;
  --accent: #1f6f54;
  --accent-soft: #e3ede7;
  --hairline: #e9e7e2;
  --avatar-bg: #efeeea;
  --avatar-fg: #c9c5ba;
  --accent-contrast: #ffffff;
}

/* dark theme: follows the system unless the toggle pins data-theme,
   so the same token set appears twice (system path + manual path) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #16181b;
    --bg-card: #1d2024;
    --text: #e7e5df;
    --muted: #9a968c;
    --accent: #5cbb95;
    --accent-soft: #1e2e28;
    --hairline: #2a2d32;
    --avatar-bg: #23262b;
    --avatar-fg: #3a3e45;
    --accent-contrast: #10241c;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #16181b;
  --bg-card: #1d2024;
  --text: #e7e5df;
  --muted: #9a968c;
  --accent: #5cbb95;
  --accent-soft: #1e2e28;
  --hairline: #2a2d32;
  --avatar-bg: #23262b;
  --avatar-fg: #3a3e45;
  --accent-contrast: #10241c;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Charter, "Bitstream Charter", "Source Serif 4", Georgia,
    "Songti SC", "Noto Serif CJK SC", serif;
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s ease;
}
a:hover { border-bottom-color: var(--accent); }

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

/* ---------- theme toggle ---------- */

.theme-toggle {
  position: fixed;
  top: 20px;
  right: 24px;
  z-index: 10;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
}
.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.theme-toggle svg { width: 17px; height: 17px; display: block; }

/* icon mirrors the effective theme: moon in light mode, sun in dark */
.theme-toggle .icon-sun { display: none; }
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
  html:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
}
html[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: block; }

/* ---------- layout ---------- */

.layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 720px);
  gap: 64px;
  max-width: 1120px;
  margin: 0 auto;
  padding: 72px 32px;
}

/* ---------- sidebar ---------- */

.sidebar {
  position: sticky;
  top: 72px;
  align-self: start;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "PingFang SC", "Noto Sans CJK SC", sans-serif;
}

.avatar svg, .avatar-img {
  width: 148px;
  height: 148px;
  border-radius: 50%;
  display: block;
  object-fit: cover;
}

.name {
  font-family: Charter, Georgia, "Songti SC", serif;
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  margin: 20px 0 0;
}

.name-cjk {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  letter-spacing: 0.3em;
}

.role {
  margin: 14px 0 0;
  font-size: 0.92rem;
  line-height: 1.55;
}

.side-nav {
  margin: 28px 0 0;
  padding: 18px 0;
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.side-nav a {
  color: var(--text);
  font-size: 0.9rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  width: fit-content;
}
.side-nav a:hover { color: var(--accent); }

.links {
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  font-size: 0.8rem;
  padding: 4px 12px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  color: var(--text);
  background: var(--bg-card);
  transition: all 0.15s ease;
}
.pill:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

/* ---------- content ---------- */

.content { min-width: 0; }

section { margin-bottom: 64px; }

h2 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin: 0 0 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--hairline);
}

.kicker {
  color: var(--accent);
  font-size: 0.8rem;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  vertical-align: 0.25em;
  margin-right: 12px;
  letter-spacing: 0.1em;
}

p { margin: 0 0 1em; }

/* news */

.news-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.news-list li {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 16px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--hairline);
}
.news-list li:last-child { border-bottom: none; }
.news-list .date {
  color: var(--muted);
  font-size: 0.85rem;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  padding-top: 2px;
}

/* research cards */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}
.card {
  background: var(--bg-card);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  padding: 18px 20px;
}
.card h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  color: var(--accent);
}
.card p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.6;
}

/* publications — results-by-year mini bar chart (PubMed style) */

.pub-chart { margin: 2px 0 34px; }

.pc-cap {
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 14px;
}

.pc-plot {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 30px;
  padding: 0 8px;
  border-bottom: 2px solid var(--hairline);
  margin-bottom: 40px;
}

/* PubMed detail: accent segment linking first and last year dots */
.pc-range {
  position: absolute;
  bottom: -2.5px;
  height: 3px;
  border-radius: 2px;
  background: var(--accent);
}

.pc-col {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.pc-count {
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 5px;
}

.pc-bar {
  display: block;
  width: 64px;
  background: var(--accent);
  border-radius: 4px 4px 0 0;
  transition: opacity 0.15s ease;
}
.pc-col:hover .pc-bar { opacity: 0.8; }

/* PubMed-style timeline dot straddling the baseline */
.pc-dot {
  position: absolute;
  bottom: -7px;
  left: 50%;
  transform: translateX(-50%);
  width: 9px;
  height: 9px;
  border: 1.5px solid var(--accent);
  border-radius: 50%;
  background: var(--bg);
  z-index: 1;
}

.pc-year {
  position: absolute;
  bottom: -34px;
  left: 50%;
  transform: translateX(-50%);
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.85rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* publications */

.pub-list {
  margin: 0;
  padding-left: 1.4em;
}
.pub-list li { margin-bottom: 22px; }
.pub-list li::marker { color: var(--muted); }
.pub-title { margin: 0; font-weight: 600; }
.pub-authors { margin: 2px 0 0; font-size: 0.92rem; }
.pub-venue { margin: 2px 0 0; font-size: 0.92rem; color: var(--muted); }

.tag {
  display: inline-block;
  font-size: 0.72rem;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  letter-spacing: 0.05em;
  padding: 1px 8px;
  margin-left: 6px;
  border: 1px solid var(--hairline);
  border-radius: 4px;
  color: var(--accent);
  vertical-align: 1px;
}
.tag:hover { border-color: var(--accent); }

.tag-first {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
  font-weight: 600;
}

/* footer */

footer {
  border-top: 1px solid var(--hairline);
  padding-top: 20px;
  color: var(--muted);
  font-size: 0.8rem;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
    gap: 40px;
    padding: 40px 22px;
  }
  .sidebar { position: static; }
  .avatar svg, .avatar-img { width: 110px; height: 110px; }
  .side-nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px 18px;
  }
  .theme-toggle { top: 14px; right: 14px; }
}
