/* Xiaohui Yan — homepage styles */

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

:root {
  --bg: #FFFFFF;
  --bg-soft: #F5F8FD;
  --ink: #0B1220;
  --ink-2: #3B4558;
  --ink-3: #5F6B7E;
  --accent: #2F5BEA;
  --accent-2: #12A4D9;
  --accent-soft: #EAF0FF;
  --line: #E4E8F0;
  --grad: linear-gradient(120deg, var(--accent) 0%, var(--accent-2) 100%);
  --shadow: 0 1px 2px rgba(11,18,32,.04), 0 8px 24px -12px rgba(11,18,32,.12);
  --shadow-lg: 0 2px 4px rgba(11,18,32,.04), 0 24px 48px -20px rgba(47,91,234,.28);
  --radius: 18px;
  --ff: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --nav-h: 64px;
}

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--ff);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
html[lang="zh-CN"] body { line-height: 1.85; }

/* Bilingual: hide the inactive language */
html[lang="en"] body [lang="zh-CN"],
html[lang="zh-CN"] body [lang="en"] { display: none; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
img { max-width: 100%; display: block; }
strong { font-weight: 600; color: var(--ink); }

.container { max-width: 1120px; margin: 0 auto; padding: 0 24px; }

/* ── NAV ─────────────────────────────────────────── */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.85);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav-inner { display: flex; align-items: center; gap: 20px; height: var(--nav-h); }
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 16px; color: var(--ink); letter-spacing: -0.01em;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px;
  background: var(--grad); color: #fff;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 800; letter-spacing: .02em;
}
.nav-menu { margin-left: auto; }
.nav-links { display: flex; gap: 2px; list-style: none; }
.nav-links a {
  display: block; padding: 7px 12px; border-radius: 9px;
  font-size: 14.5px; font-weight: 500; color: var(--ink-2); white-space: nowrap;
  transition: background .2s, color .2s;
}
.nav-links a:hover, .nav-links a.active { background: var(--accent-soft); color: var(--accent); text-decoration: none; }
.lang-btn {
  display: inline-flex; align-items: center; gap: 6px;
  font: 600 13px var(--ff); color: var(--ink);
  background: #fff; border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 14px; cursor: pointer;
  transition: border-color .2s, color .2s;
}
.lang-btn:hover { border-color: var(--accent); color: var(--accent); }
.lang-btn svg { width: 15px; height: 15px; }
html[lang="en"] .lbl-to-en, html[lang="zh-CN"] .lbl-to-zh { display: none; }

/* ── HERO ────────────────────────────────────────── */
.hero { position: relative; isolation: isolate; overflow: hidden; padding: 96px 0; }
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -2;
  background:
    radial-gradient(640px 420px at 12% 18%, rgba(47,91,234,.16), transparent 70%),
    radial-gradient(720px 460px at 88% 0%, rgba(18,164,217,.18), transparent 70%),
    linear-gradient(180deg, #F3F7FF 0%, #FFFFFF 100%);
}
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background-image: radial-gradient(rgba(11,18,32,.09) 1px, transparent 1px);
  background-size: 22px 22px;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 85%);
  mask-image: linear-gradient(180deg, #000 0%, transparent 85%);
}
.hero-grid { display: grid; grid-template-columns: 232px 1fr; gap: 56px; align-items: center; }
.avatar {
  width: 232px; height: 232px; border-radius: 50%; padding: 5px;
  background: var(--grad);
  box-shadow: 0 30px 60px -28px rgba(47,91,234,.6);
}
.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; border: 5px solid #fff; background: #fff; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13.5px; font-weight: 600; color: var(--accent);
  background: rgba(255,255,255,.8); border: 1px solid rgba(47,91,234,.2);
  border-radius: 999px; padding: 5px 14px 5px 10px; margin-bottom: 18px;
}
.eyebrow .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--grad); box-shadow: 0 0 0 4px rgba(47,91,234,.12); }
.hero h1 {
  font-size: clamp(40px, 6vw, 72px); font-weight: 800;
  letter-spacing: -0.035em; line-height: 1.02; color: var(--ink);
}
.hero h1 .cn { font-size: .42em; font-weight: 500; letter-spacing: .06em; color: var(--ink-3); margin-left: .35em; vertical-align: .35em; }
.tagline { margin-top: 18px; max-width: 660px; font-size: clamp(18px, 2vw, 21px); line-height: 1.6; color: var(--ink-2); text-wrap: balance; }
html[lang="zh-CN"] .tagline { word-break: keep-all; }
.tagline em { font-style: normal; font-weight: 600; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 30px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 14.5px; font-weight: 600; line-height: 1;
  padding: 11px 18px; border-radius: 999px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  transition: transform .2s, box-shadow .2s, border-color .2s, color .2s;
}
.btn svg { width: 17px; height: 17px; flex-shrink: 0; }
.btn:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--accent); color: var(--accent); }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 10px 24px -12px rgba(47,91,234,.8); }
.btn--primary:hover { color: #fff; background: #2448C4; border-color: #2448C4; }

/* ── SECTIONS ────────────────────────────────────── */
.section { padding: 96px 0; }
.section--soft { background: var(--bg-soft); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
section[id] { scroll-margin-top: calc(var(--nav-h) + 8px); }
.section-head { margin-bottom: 40px; }
.section-head--compact { margin-bottom: 18px; }
.kicker {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--accent);
  margin-bottom: 10px;
}
.kicker::before { content: ""; width: 28px; height: 2px; border-radius: 2px; background: var(--grad); }
.section-head h2 { font-size: clamp(28px, 3.4vw, 38px); font-weight: 800; letter-spacing: -0.025em; line-height: 1.2; }
.section-head p { margin-top: 10px; color: var(--ink-3); max-width: 680px; }
.sub-head { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 8px; }
.sub-head + .pub-list { margin-top: 4px; }

/* ── ABOUT ───────────────────────────────────────── */
.about-grid { display: grid; grid-template-columns: 1.55fr 1fr; gap: 56px; align-items: start; }
.bio p { font-size: 17.5px; color: var(--ink-2); line-height: 1.8; }
html[lang="zh-CN"] .bio p { line-height: 1.95; }
.bio p + p { margin-top: 18px; }
.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.interests { padding: 28px; }
.interests h3 { font-size: 14px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 14px; font-weight: 500; color: var(--ink-2);
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 999px; padding: 6px 13px;
}
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--grad); }

/* ── NEWS ────────────────────────────────────────── */
.news { list-style: none; border-top: 1px solid var(--line); }
.news li {
  display: grid; grid-template-columns: 132px 1fr; gap: 24px; align-items: baseline;
  padding: 20px 4px; border-bottom: 1px solid var(--line);
}
.news time { font-size: 14px; font-weight: 600; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.news p { font-size: 16.5px; color: var(--ink-2); }
.news em { font-style: italic; color: var(--ink); }
.badge-new {
  display: inline-block; vertical-align: 2px; margin-right: 8px;
  font-size: 11px; font-weight: 800; letter-spacing: .08em; color: #fff;
  background: var(--grad); border-radius: 6px; padding: 2px 7px;
}

/* ── RESEARCH ────────────────────────────────────── */
.project-grid { display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-rows: 1fr; gap: 24px; }
.project {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column;
  padding: 26px 26px 24px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.project:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: rgba(47,91,234,.35); }
.project-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.tag {
  font-size: 12.5px; font-weight: 700; letter-spacing: .04em; color: var(--accent);
  background: var(--accent-soft); border-radius: 999px; padding: 4px 11px;
}
.project h3 a { color: var(--ink); }
.project h3 a:hover { color: var(--accent); text-decoration: none; }
.project .icon {
  width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-items: center; color: #fff; background: var(--grad);
  box-shadow: 0 10px 20px -10px rgba(47,91,234,.7);
}
.project .icon svg { width: 22px; height: 22px; }
.project h3 { font-size: 19px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.3; }
.project .desc { margin-top: 10px; font-size: 14.5px; color: var(--ink-2); }

.links { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: auto; padding-top: 24px; }
.link-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13.5px; font-weight: 600; color: var(--ink);
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 13px; background: #fff;
  transition: border-color .2s, color .2s, background .2s;
}
.link-pill::after { content: "↗"; font-size: .92em; opacity: .55; }
.link-pill:hover { text-decoration: none; border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.link-muted { font-size: 13.5px; color: var(--ink-3); font-style: italic; }

/* ── PUBLICATIONS ────────────────────────────────── */
.pub-list { list-style: none; }
.pub {
  display: grid; grid-template-columns: 120px 1fr auto; gap: 22px; align-items: start;
  padding: 22px 0; border-bottom: 1px solid var(--line);
}
.venue {
  justify-self: start;
  font-size: 12.5px; font-weight: 700; color: var(--accent); white-space: nowrap;
  background: var(--accent-soft); border-radius: 8px; padding: 4px 10px; margin-top: 2px;
}
.pub-title { font-size: 17px; font-weight: 600; line-height: 1.45; color: var(--ink); }
.pub-title a { color: var(--ink); }
.pub-title a:hover { color: var(--accent); }
.pub-authors { margin-top: 4px; font-size: 14.5px; color: var(--ink-3); line-height: 1.6; }
.pub-authors b { font-weight: 700; color: var(--ink); }
.pub-note { margin-top: 2px; font-size: 13.5px; color: var(--ink-3); font-style: italic; }
.pub-links { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; max-width: 250px; }
.pub-links .link-pill { font-size: 12.5px; padding: 4px 11px; }
.pub--compact { padding: 16px 0; }
.pub--compact .pub-title { font-size: 15.5px; }
.pub--compact .pub-authors { font-size: 13.5px; }

.earlier { margin-top: 64px; }
.spotlight {
  display: grid; grid-template-columns: 1.3fr 1fr; gap: 40px; align-items: start;
  margin-top: 18px; padding: 34px 32px; border-radius: var(--radius);
  background: linear-gradient(135deg, #EEF3FF 0%, #E9F7FC 100%);
  border: 1px solid rgba(47,91,234,.16);
}
.spotlight h4 { margin-top: 14px; font-size: 24px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.25; }
.cite-badge {
  display: inline-block; vertical-align: 4px; margin-left: 6px;
  font-size: 13px; font-weight: 700; letter-spacing: 0; color: #fff;
  background: var(--grad); border-radius: 999px; padding: 3px 11px; white-space: nowrap;
}
.cite-badge:hover { text-decoration: none; filter: brightness(1.08); }
.spotlight .desc { margin-top: 12px; font-size: 15.5px; color: var(--ink-2); }
.spot-links { list-style: none; display: grid; gap: 12px; }
.spot-links li { display: grid; grid-template-columns: 112px 1fr; gap: 12px; align-items: center; font-size: 14px; }
.spot-links .k { font-weight: 700; color: var(--ink); }
.spot-links .v { display: flex; flex-wrap: wrap; gap: 6px; }
.spot-links .link-pill { font-size: 12.5px; padding: 4px 11px; }

.older { margin-top: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.older summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 24px; font-size: 16px; font-weight: 600; color: var(--ink);
}
.older summary::-webkit-details-marker { display: none; }
.older summary:hover { color: var(--accent); }
.older .chev { width: 20px; height: 20px; transition: transform .25s; color: var(--ink-3); }
.older[open] .chev { transform: rotate(180deg); }
.older .pub-list { padding: 0 24px 10px; border-top: 1px solid var(--line); }
.older .pub:last-child { border-bottom: 0; }

/* ── EXPERIENCE ──────────────────────────────────── */
.timeline { list-style: none; position: relative; }
.timeline::before { content: ""; position: absolute; left: 191px; top: 10px; bottom: 10px; width: 2px; background: var(--line); }
.tl { position: relative; display: grid; grid-template-columns: 168px 1fr; gap: 48px; padding: 0 0 40px; }
.tl:last-child { padding-bottom: 0; }
.tl::before {
  content: ""; position: absolute; left: 185px; top: 7px;
  width: 14px; height: 14px; border-radius: 50%;
  background: #fff; border: 3px solid var(--accent);
}
.tl:first-child::before { background: var(--accent); box-shadow: 0 0 0 5px rgba(47,91,234,.15); }
.tl-period { font-size: 14px; font-weight: 600; color: var(--ink-3); text-align: right; font-variant-numeric: tabular-nums; padding-top: 1px; }
.tl h3 { font-size: 19px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.35; }
.tl-org { margin-top: 2px; font-size: 15px; font-weight: 600; color: var(--accent); }
.tl-desc { margin-top: 8px; font-size: 15.5px; color: var(--ink-2); max-width: 720px; }

/* ── FOOTER ──────────────────────────────────────── */
.footer { border-top: 1px solid var(--line); background: var(--bg-soft); padding: 36px 0; }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; font-size: 14px; color: var(--ink-3); }
.footer-links { display: flex; flex-wrap: wrap; gap: 18px; list-style: none; }
.footer-links a { color: var(--ink-2); font-weight: 500; }

/* ── REVEAL ──────────────────────────────────────── */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s ease, transform .7s ease; }
.js .reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .project, .btn { transition: none; }
}
@media print {
  .nav { position: static; }
  .js .reveal { opacity: 1; transform: none; }
}

/* ── RESPONSIVE ──────────────────────────────────── */
@media (max-width: 1000px) {
  .project-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  :root { --nav-h: 104px; }
  .nav-inner { flex-wrap: wrap; height: auto; padding-top: 10px; gap: 6px 12px; }
  .lang-btn { margin-left: auto; }
  .nav-menu {
    order: 3; margin: 0 -24px; width: calc(100% + 48px);
    overflow-x: auto; scrollbar-width: none;
  }
  .nav-menu::-webkit-scrollbar { display: none; }
  .nav-links { padding: 0 18px 6px; width: max-content; }
  .hero { padding: 56px 0 56px; }
  .hero-grid { grid-template-columns: 1fr; gap: 28px; }
  .avatar { width: 152px; height: 152px; padding: 4px; }
  .avatar img { border-width: 4px; }
  .section { padding: 72px 0; }
  .about-grid, .spotlight { grid-template-columns: 1fr; gap: 28px; }
  .pub { grid-template-columns: 1fr; gap: 8px; }
  .pub-links { justify-content: flex-start; max-width: none; margin-top: 4px; }
  .timeline::before { left: 6px; }
  .tl { grid-template-columns: 1fr; gap: 4px; padding-left: 36px; }
  .tl::before { left: 0; }
  .tl-period { text-align: left; }
}
@media (max-width: 640px) {
  .project-grid { grid-template-columns: 1fr; grid-auto-rows: auto; }
  .news li { grid-template-columns: 1fr; gap: 4px; }
}
@media (max-width: 560px) {
  .container { padding: 0 16px; }
  .nav-menu { margin: 0 -16px; width: calc(100% + 32px); }
  .nav-links { padding: 0 10px 6px; }
  .spotlight { padding: 26px 20px; }
  .spot-links li { grid-template-columns: 1fr; gap: 6px; }
  .older summary { padding: 16px 18px; }
  .older .pub-list { padding: 0 18px 8px; }
  .btn { padding: 10px 15px; font-size: 14px; }
}
