/* =========================================================
   Xinlong Chen — homepage v2
   Keeps the original AcadHomepage structure (top bar + left profile
   sidebar + content column) with refined typography and badges.

   Type scale (desktop):
     section title  21px / 700
     group title    15.5px / 600
     body           15px / 400
     paper title    15px / 600
     authors        11px / 400, muted (own name: 600, full color)
     venue / HF     11.5px / 600
   ========================================================= */

:root {
  /* Same stack as the original site ($sans-serif in _variables.scss), plus CJK fallbacks */
  --font: "Trebuchet MS", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;

  --max-w: 1100px;
  --sidebar-w: 224px;
  --nav-h: 52px;

  --bg: #ffffff;
  --nav-bg: rgba(255, 255, 255, 0.88);
  --surface-hover: #f3f5f8;
  --text: #2c313a;         /* body */
  --text-strong: #11151c;  /* titles, own name */
  --text-muted: #646b75;   /* authors, dates */
  --text-faint: #949ba4;
  --rule: #e6e8ec;
  --rule-soft: #eff1f4;
  --link: #1c53b5;
  --link-hover: #113880;
  --accent-bar: #3867c6;

  /* Venue badges */
  --badge: linear-gradient(180deg, #e8f0fe 0%, #dce8fc 100%);
  --badge-border: #b8cef8;
  --badge-shadow: 0 1px 1px rgba(25, 68, 148, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  --badge-text: #163e8c;
  --preprint-bg: linear-gradient(180deg, #f3f5f8 0%, #eaedf2 100%);
  --preprint-border: #cfd6e0;
  --preprint-text: #4b5565;

  /* Hugging Face two-tone counter badge */
  --hf-left-bg: #f1f5f9;
  --hf-left-text: #334155;
  --hf-right-bg: #ffffff;
  --hf-right-hover: #f8fafc;
  --hf-border: #cbd5e1;
  --hf-border-hover: #94a3b8;
  --hf-dl: #64748b;
  --hf-count: #0f172a;
  --author-me: #242931;
  --author-me-line: #d0d5dd;
}

[data-theme="dark"] {
  --bg: #16181c;
  --nav-bg: rgba(22, 24, 28, 0.88);
  --surface-hover: #23262d;
  --text: #d5d8de;
  --text-strong: #f2f4f7;
  --text-muted: #969ca6;
  --text-faint: #6c727c;
  --rule: #2a2e36;
  --rule-soft: #22262d;
  --link: #8ab4f8;
  --link-hover: #b4d0fc;
  --accent-bar: #5e8be3;

  --badge: rgba(88, 144, 255, 0.22);
  --badge-border: rgba(125, 175, 255, 0.38);
  --badge-shadow: none;
  --badge-text: #b6d1ff;
  --preprint-bg: rgba(160, 168, 180, 0.16);
  --preprint-border: rgba(160, 168, 180, 0.30);
  --preprint-text: #c2c8d2;

  --hf-left-bg: rgba(255, 255, 255, 0.10);
  --hf-left-text: #e2e8f0;
  --hf-right-bg: rgba(255, 255, 255, 0.04);
  --hf-right-hover: rgba(255, 255, 255, 0.08);
  --hf-border: rgba(148, 163, 184, 0.30);
  --hf-border-hover: rgba(203, 213, 225, 0.50);
  --hf-dl: #94a3b8;
  --hf-count: #f1f5f9;
  --author-me: #e5e8ee;
  --author-me-line: #3e4450;
}

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

html {
  scroll-padding-top: calc(var(--nav-h) + 16px);
  -webkit-text-size-adjust: 100%;
}

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

a {
  color: var(--link);
  text-decoration: none;
  transition: color 0.15s ease;
}
a:hover {
  color: var(--link-hover);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
a:focus-visible, button:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }

h1, h2, h3 { margin: 0; color: var(--text-strong); line-height: 1.3; }
p { margin: 0 0 0.75em; }
strong { font-weight: 600; color: var(--text-strong); }
a strong { color: inherit; }  /* bold links keep the link color */
img { max-width: 100%; }
ul, ol { margin: 0; }

/* ---------- Top bar ---------- */
.masthead {
  position: sticky;
  top: 0;
  z-index: 10;
  height: var(--nav-h);
  background: var(--nav-bg);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--rule);
}
.masthead-inner {
  max-width: var(--max-w);
  height: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 28px;
}
.masthead-home {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-strong);
}
.masthead-home:hover { color: var(--link); text-decoration: none; }
.nav-links {
  list-style: none;
  display: flex;
  gap: 22px;
  padding: 0;
  margin-right: auto;
  font-size: 14.5px;
}
.nav-links a {
  color: var(--text-muted);
  white-space: nowrap;
  padding: 4px 0;
}
.nav-links a:hover { color: var(--text-strong); text-decoration: none; }
.nav-links a.active {
  color: var(--text-strong);
  font-weight: 500;
}
nav { margin-right: auto; }

.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.theme-toggle:hover {
  color: var(--text-strong);
  background: var(--surface-hover);
}
.theme-toggle svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
html:not(.js) .theme-toggle { display: none; }
.icon-sun { display: none; }
[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }

/* ---------- Layout ---------- */
.layout {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 36px 24px 0;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  gap: 48px;
}

/* ---------- Sidebar ---------- */
.sidebar .profile {
  position: sticky;
  top: calc(var(--nav-h) + 36px);
}
.avatar {
  display: block;
  width: 160px;
  height: 160px;
  object-fit: cover;
  border-radius: 50%;
  border: 1px solid var(--rule);
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.06);
  margin-bottom: 16px;
}
.profile-name {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin-bottom: 4px;
}
.profile-bio {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0 0 14px;
}
.profile-links {
  list-style: none;
  padding: 0;
  font-size: 14px;
  color: var(--text-muted);
}
.profile-links li {
  display: flex;
  align-items: center;
  padding: 3.5px 0;
}
.profile-links a {
  display: inline-flex;
  align-items: center;
  color: var(--text);
}
.profile-links a:hover {
  color: var(--link);
  text-decoration: none;
}
.profile-links svg {
  width: 15px;
  height: 15px;
  margin-right: 9px;
  flex: none;
  fill: currentColor;
  color: var(--text-muted);
  transition: color 0.15s ease;
}
.profile-links a:hover svg { color: var(--link); }

/* ---------- Content ---------- */
.section { margin-bottom: 36px; }
.section-about p { line-height: 1.7; }
.section-about p:last-child { margin-bottom: 0; }

.section-title {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.015em;
  padding-bottom: 9px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--rule);
}
.title-aside {
  font-size: 13.5px;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--text-muted);
  margin-left: 6px;
}
.title-aside:hover { color: var(--link); }

.group {
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: -0.005em;
  padding-left: 10px;
  border-left: 3px solid var(--accent-bar);
  line-height: 1.25;
  margin: 22px 0 6px;
}
.section-title + .group { margin-top: 2px; }

/* ---------- Publications ---------- */
.pub-list {
  list-style: none;
  padding: 0;
}
.pub {
  padding: 13px 0 14px;
}
.pub + .pub { border-top: 1px solid var(--rule-soft); }
.pub-head {
  margin: 0 0 6px;
  line-height: 1.6;
}

/* Venue tag */
.venue {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7.5px;
  margin-right: 7px;
  border-radius: 5px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.015em;
  line-height: 1;
  background: var(--badge);
  color: var(--badge-text);
  border: 1px solid var(--badge-border);
  box-shadow: var(--badge-shadow);
  vertical-align: 1px;
  white-space: nowrap;
}
.venue-preprint {
  background: var(--preprint-bg);
  color: var(--preprint-text);
  border-color: var(--preprint-border);
}

.pub-title {
  font-size: 15px;
  font-weight: 600;
}
.pub-title a { color: var(--text-strong); }
.pub-title a:hover { color: var(--link); }

/* Hugging Face two-tone counter badge (count filled in by main.js) */
.hf-chip {
  display: inline-flex;
  align-items: stretch;
  height: 20px;
  margin-left: 6px;
  border: 1px solid var(--hf-border);
  border-radius: 5px;
  overflow: hidden;
  box-shadow: 0 1px 1px rgba(15, 23, 42, 0.04);
  font-size: 11px;
  line-height: 1;
  vertical-align: -1.25px;
  white-space: nowrap;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.hf-chip:hover {
  text-decoration: none;
  border-color: var(--hf-border-hover);
  transform: translateY(-0.5px);
  box-shadow: 0 2px 4px rgba(25, 68, 148, 0.10);
}
.hf-brand {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 5.5px 0 5px;
  background: var(--hf-left-bg);
  color: var(--hf-left-text);
}
.hf-logo {
  width: 13px;
  height: 13px;
  flex: none;
}
.hf-label {
  font-weight: 600;
  letter-spacing: 0.015em;
}
.hf-stat {
  display: inline-flex;
  align-items: center;
  gap: 2.5px;
  padding: 0 6.5px 0 5.5px;
  background: var(--hf-right-bg);
  border-left: 1px solid var(--hf-border);
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.hf-chip:hover .hf-stat {
  background: var(--hf-right-hover);
  border-left-color: var(--hf-border-hover);
}
.hf-stat[hidden] { display: none; }
.hf-dl {
  width: 10.5px;
  height: 10.5px;
  flex: none;
  color: var(--hf-dl);
}
.hf-text {
  color: var(--hf-count);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.pub-authors {
  font-size: 11px;
  line-height: 1.55;
  color: var(--text-muted);
  margin: 0;
}
.pub-authors strong {
  color: var(--author-me);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--author-me-line);
  text-underline-offset: 2.5px;
  text-decoration-thickness: 1px;
}

/* ---------- Education / Internships ---------- */
.cv {
  list-style: none;
  padding: 0;
}
.cv-item {
  padding: 8px 0 12px;
}
.cv-item + .cv-item { border-top: 1px solid var(--rule-soft); }
.cv-date {
  display: block;
  margin-bottom: 1px;
  font-size: 13.5px;
  font-style: italic;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.cv-title {
  margin: 0;
}
.cv-title a { color: var(--text-strong); }
.cv-title a:hover { color: var(--link); }
.cv-points {
  padding-left: 1.15em;
  margin-top: 4px;
  font-size: 14px;
  line-height: 1.6;
}
.cv-points li { margin: 2px 0; }
.cv-points li::marker { color: var(--text-faint); }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--rule);
  padding: 14px 0 36px;
  font-size: 13px;
  color: var(--text-faint);
  text-align: center;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .nav-links { gap: 16px; }
  .layout { grid-template-columns: 1fr; gap: 24px; padding-top: 22px; }
  .sidebar .profile {
    position: static;
    display: flex;
    align-items: center;
    gap: 20px;
  }
  .avatar { width: 112px; height: 112px; margin: 0; }
  .profile-links { display: flex; flex-wrap: wrap; column-gap: 16px; }
}

@media (max-width: 640px) {
  .masthead-inner, .layout { padding-left: 16px; padding-right: 16px; }
  .masthead-inner { gap: 12px; }
  .masthead-home { display: none; }
  .nav-links { gap: 14px; font-size: 13.5px; }
  .avatar { width: 88px; height: 88px; }
  .profile-name { font-size: 20px; }
  .section-title { font-size: 19.5px; }
  .cv-date { font-size: 13px; }
}

@media print {
  .masthead, .theme-toggle { display: none; }
  .layout { display: block; }
  .sidebar .profile { position: static; }
}
