/* ============================================================
   Zihe Zhou — shared site styles (homepage + research pages)
   ============================================================ */
:root {
  --bg: #ffffff;
  --fg: #1a1a1a;
  --muted: #666;
  --faint: #8a8a8a;
  --line: #e6e6e6;
  --accent: #b3122b;        /* crimson — Highway brand */
  --accent-soft: #f7e9ec;
  --card: #fafafa;
  --btn-bg: #eef0f2;
  --btn-border: #d3d5da;
  --btn-fg: #2a2a2e;
  --maxw: 820px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131316; --fg: #e9e9ec; --muted: #9a9aa2; --faint: #77777f;
    --line: #2a2a30; --accent: #ff5d78; --accent-soft: #2a1620; --card: #1b1b20;
    --btn-bg: #26262e; --btn-border: #3d3d48; --btn-fg: #e9e9ec;
  }
}
:root[data-theme="light"] {
  --bg:#fff; --fg:#1a1a1a; --muted:#666; --faint:#8a8a8a; --line:#e6e6e6;
  --accent:#b3122b; --accent-soft:#f7e9ec; --card:#fafafa;
  --btn-bg:#eef0f2; --btn-border:#d3d5da; --btn-fg:#2a2a2e;
}
:root[data-theme="dark"] {
  --bg:#131316; --fg:#e9e9ec; --muted:#9a9aa2; --faint:#77777f; --line:#2a2a30;
  --accent:#ff5d78; --accent-soft:#2a1620; --card:#1b1b20;
  --btn-bg:#26262e; --btn-border:#3d3d48; --btn-fg:#e9e9ec;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px; line-height: 1.65; -webkit-font-smoothing: antialiased;
}
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; font-weight: 650; }

/* ---------- top navigation bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { display: flex; align-items: center; gap: 16px; height: 56px; }
.brand { color: var(--fg); font-weight: 700; font-size: 15px; letter-spacing: -.2px; white-space: nowrap; }
.brand:hover { color: var(--accent); text-decoration: none; }
.nav-links { display: flex; gap: 4px; margin-left: auto; }
.nav-links a {
  color: var(--muted); font-size: 14px; font-weight: 500;
  padding: 6px 10px; border-radius: 7px; white-space: nowrap;
}
.nav-links a:hover { color: var(--fg); background: var(--btn-bg); text-decoration: none; }
.nav-links a.active { color: var(--accent); }

.controls { display: flex; gap: 8px; }
.toggle {
  background: var(--btn-bg); border: 1px solid var(--btn-border); color: var(--btn-fg);
  border-radius: 999px; height: 34px; min-width: 34px; padding: 0 9px; cursor: pointer;
  font-size: 13px; font-weight: 600; display: grid; place-items: center; transition: .15s;
}
.toggle:hover { color: var(--accent); border-color: var(--accent); }
.langtoggle {
  position: relative; display: flex; height: 34px; padding: 3px;
  background: var(--btn-bg); border: 1px solid var(--btn-border); border-radius: 999px;
}
.langtoggle::before {
  content: ""; position: absolute; top: 3px; left: 3px; bottom: 3px;
  width: calc(50% - 3px); background: var(--accent); border-radius: 999px;
  transition: transform .28s cubic-bezier(.34, 1.2, .5, 1); z-index: 0;
}
.langtoggle.is-en::before { transform: translateX(100%); }
.langtoggle .langopt {
  position: relative; z-index: 1; flex: 1 0 0; border: none; background: transparent;
  color: var(--muted); cursor: pointer; font-size: 12.5px; font-weight: 600; line-height: 1;
  padding: 0 10px; border-radius: 999px; transition: color .2s ease;
}
.langtoggle .langopt:hover { color: var(--fg); }
.langtoggle .langopt.active { color: #fff; }

/* ---------- homepage hero ---------- */
.hero-wrap { padding: 40px 0 8px; }
.hero { display: flex; gap: 30px; align-items: flex-start; flex-wrap: wrap; }
.avatar {
  width: 128px; height: 128px; border-radius: 14px; object-fit: cover;
  border: 1px solid var(--line); background: var(--card); flex-shrink: 0;
}
.avatar.placeholder { display: grid; place-items: center; color: var(--faint); font-size: 12px; text-align: center; line-height: 1.4; }
.avatar.monogram { background: linear-gradient(150deg, var(--accent-soft), var(--card)); border-color: var(--accent); }
.avatar.monogram .mono-mark { font-size: 60px; font-weight: 500; color: var(--accent); font-family: "Songti SC", "STSong", "Noto Serif SC", serif; line-height: 1; }
.intro { flex: 1; min-width: 260px; }
.intro h1 { margin: 2px 0 4px; font-size: 30px; letter-spacing: -.5px; }
.intro .role { color: var(--muted); font-size: 16px; margin: 0 0 14px; }
.intro .role strong { color: var(--fg); font-weight: 600; }

.links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.links a {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--btn-border); border-radius: 8px;
  padding: 6px 12px; font-size: 13.5px; font-weight: 500; color: var(--btn-fg);
  background: var(--btn-bg); transition: .15s;
}
.links a:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }
.links a .ic { width: 15px; height: 15px; flex-shrink: 0; display: block; }

/* ---------- sections ---------- */
section { padding: 30px 0; border-top: 1px solid var(--line); }
.lead { margin-top: 0; }
.lead p { margin: 0 0 12px; color: var(--fg); }
h2.sec { font-size: 13px; text-transform: uppercase; letter-spacing: 1.4px; color: var(--faint); margin: 0 0 6px; font-weight: 700; }
.sec-note { color: var(--faint); font-size: 13.5px; margin: 0 0 18px; }

/* ---------- news timeline ---------- */
.news { list-style: none; margin: 0; padding: 0; }
.news li { display: grid; grid-template-columns: 78px 22px 1fr; align-items: start; font-size: 15px; }
.news .date { color: var(--faint); font-variant-numeric: tabular-nums; font-size: 13.5px; padding: 8px 0; line-height: 1.5; }
.news .rail { position: relative; align-self: stretch; }
.news .rail::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; background: var(--line); transform: translateX(-50%); }
.news li:first-child .rail::before { top: 18px; }
.news li:last-child  .rail::before { bottom: calc(100% - 18px); }
.news .dot { position: absolute; left: 50%; top: 18px; transform: translate(-50%, -50%); width: 9px; height: 9px; border-radius: 50%; background: var(--faint); border: 2px solid var(--bg); z-index: 1; }
.news .what { color: var(--fg); padding: 8px 0; line-height: 1.5; }
.news .now .date { color: var(--accent); font-weight: 700; }
.news .now .dot { background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.news .now .what { padding: 0; }
.badge { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .3px; color: var(--accent); background: var(--accent-soft); padding: 1px 7px; border-radius: 5px; margin-left: 6px; vertical-align: 1px; }

/* ---------- publications ---------- */
.pub { display: flex; gap: 18px; padding: 18px 0; border-top: 1px solid var(--line); }
.pub:first-of-type { border-top: none; padding-top: 0; }
.pub .thumb { width: 120px; height: 84px; flex-shrink: 0; border-radius: 8px; border: 1px solid var(--line); background: var(--card); display: grid; place-items: center; color: var(--faint); font-size: 11px; text-align:center; overflow: hidden; }
.pub .thumb img { width: 100%; height: 100%; object-fit: cover; }
.pub .body { flex: 1; min-width: 0; }
.pub .title { font-size: 16.5px; font-weight: 650; margin: 0 0 3px; }
.pub .title a { color: var(--fg); }
.pub .title a:hover { color: var(--accent); }
.pub .authors { color: var(--fg); font-size: 14.5px; margin: 0 0 3px; font-weight: 650; }
.pub .venue { color: var(--faint); font-size: 14px; font-style: italic; margin: 0 0 8px; }
.pub .venue .status { font-style: normal; color: var(--accent); font-weight: 600; }
.plinks { display: flex; flex-wrap: wrap; gap: 6px; }
.plinks a {
  font-size: 12.5px; border: 1px solid var(--btn-border); border-radius: 6px;
  padding: 3px 10px; color: var(--btn-fg); background: var(--btn-bg);
}
.plinks a:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }
.pub .note { font-size: 13px; color: var(--faint); margin: 8px 0 0; }

/* ---------- selected research cards ---------- */
.rcards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.rcard {
  border: 1px solid var(--line); border-radius: 12px; padding: 16px 16px 18px;
  background: var(--card); display: flex; flex-direction: column; gap: 6px; transition: .15s;
}
a.rcard { color: inherit; }
a.rcard:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-2px); }
.rcard.feature { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.rcard .rk { font-size: 10.5px; letter-spacing: .6px; text-transform: uppercase; color: var(--faint); font-weight: 700; }
.rcard h3 { font-size: 16px; margin: 0; }
.rcard p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.5; }
.rcard .go { margin-top: auto; padding-top: 6px; font-size: 12.5px; color: var(--accent); font-weight: 600; }
.arc { color: var(--faint); font-size: 13.5px; margin: 0 0 16px; }
.arc b { color: var(--fg); font-weight: 600; }

/* ---------- talks list ---------- */
.talks { list-style: none; margin: 0; padding: 0; }
.talks li { padding: 13px 0; border-top: 1px solid var(--line); }
.talks li:first-child { border-top: none; padding-top: 0; }
.talks .tt { font-weight: 650; font-size: 15px; color: var(--fg); }
.talks .tm { color: var(--muted); font-size: 13.5px; margin-top: 3px; line-height: 1.55; }
.talks .tm .up { color: var(--accent); font-weight: 600; }

/* ---------- generic prose (detail pages) ---------- */
.prose p { color: var(--fg); margin: 0 0 14px; }
.prose p.dim { color: var(--muted); }

/* ---------- breadcrumb + page hero ---------- */
.crumb { font-size: 13px; color: var(--faint); padding: 24px 0 0; }
.crumb a { color: var(--muted); }
.crumb a:hover { color: var(--accent); }
.page-hero { padding: 8px 0 4px; }
.page-hero h1 { font-size: 28px; letter-spacing: -.4px; margin: 8px 0 6px; }
.page-hero .ph-sub { color: var(--muted); font-size: 15.5px; margin: 0 0 6px; }
.page-hero .ph-meta { color: var(--faint); font-size: 14px; font-style: italic; margin: 0 0 14px; }
.page-hero .ph-meta .status { font-style: normal; color: var(--accent); font-weight: 600; }

/* ---------- four-step grid ---------- */
.steps { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.step { border: 1px solid var(--line); border-radius: 12px; padding: 16px; background: var(--card); }
.step .num {
  width: 26px; height: 26px; border-radius: 999px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 13px;
}
.step h3 { font-size: 15px; margin: 10px 0 5px; }
.step p { font-size: 13px; color: var(--muted); margin: 0; line-height: 1.55; }

/* ---------- evidence cards ---------- */
.evidence { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.ev { border: 1px solid var(--line); border-radius: 12px; padding: 20px 16px; background: var(--card); text-align: center; }
.ev .big { font-size: 27px; font-weight: 750; color: var(--accent); line-height: 1.1; }
.ev .lab { font-size: 12.5px; color: var(--muted); margin-top: 6px; line-height: 1.4; }

/* ---------- callout ---------- */
.callout { border-left: 3px solid var(--accent); background: var(--accent-soft); padding: 14px 16px; border-radius: 8px; font-size: 15px; color: var(--fg); }
.callout em { color: var(--muted); }

/* ---------- figure ---------- */
.figure { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--card); }
.figure img { width: 100%; display: block; }
.figure figcaption { font-size: 12.5px; color: var(--faint); padding: 9px 13px; border-top: 1px solid var(--line); }

/* ---------- bibtex ---------- */
.bibtex { position: relative; }
.bibtex pre {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 14px; overflow-x: auto; margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; line-height: 1.6; color: var(--fg);
}
.copybtn {
  position: absolute; top: 9px; right: 9px; background: var(--btn-bg); border: 1px solid var(--btn-border);
  color: var(--btn-fg); border-radius: 6px; padding: 3px 9px; font-size: 12px; cursor: pointer;
}
.copybtn:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- footer ---------- */
footer { padding: 34px 0 60px; color: var(--faint); font-size: 13px; border-top: 1px solid var(--line); margin-top: 10px; }
footer a { color: var(--muted); }

@media (max-width: 640px) {
  .rcards, .evidence { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr; }
  .news li { grid-template-columns: 66px 20px 1fr; }
  .pub { flex-direction: column; gap: 10px; }
  .pub .thumb { width: 100%; height: 130px; }
  .nav-links a { padding: 6px 7px; font-size: 13px; }
  .brand { font-size: 14px; }
}
@media (max-width: 460px) {
  .nav-links { display: none; }   /* keep bar clean on phones; sections still reachable by scroll */
}
