/* =========================================================================
   Academic Homepage — stylesheet (PRISM-inspired: navy + gold, Georgia serif)
   Tokens → base → intro → layout card → sidebar → content → components
   Change the palette in :root (and [data-theme="dark"]) below.
   ========================================================================= */

/* ----------------------------- Design tokens ----------------------------- */
:root {
  --font-sans: "Geist", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: Georgia, "Times New Roman", "Source Han Serif SC", serif;

  /* Light theme — Navy Academic: deep-navy structure, cobalt-blue highlight */
  --page: #f7f9fd;          /* faint cool page tint */
  --bg: #fcfdff;            /* off-white surfaces */
  --surface-2: #fcfdff;     /* nested cards (publications, projects) */
  --soft: #eef2fb;          /* navy-tinted soft fills */
  --text: #0f172a;          /* slate-900 */
  --text-muted: #5b6a85;    /* cool muted */
  --border: #dde5f2;        /* navy-tinted border */
  --navy: #1e3a8a;          /* deep navy — headings / brand / buttons */
  --navy-soft: #eef2fb;
  --sidebar-bg: #eef3fb;    /* light-navy navigation rail */
  --accent: #2563eb;        /* cobalt blue — highlight */
  --accent-dark: #1d4ed8;   /* deeper blue (small text) */
  --accent-soft: #e7eefe;   /* pale blue tint */
  --accent-contrast: #ffffff;

  --shadow: 0 1px 2px rgba(30, 58, 138, 0.05), 0 10px 28px rgba(30, 58, 138, 0.08);
  --shadow-lg: 0 18px 44px -16px rgba(30, 58, 138, 0.20);

  --sidebar-w: 320px;
  --content-max: 1120px;
  --radius: 14px;
  --topnav-h: 56px;
}

[data-theme="dark"] {
  --page: #0b1326;
  --bg: #0f172a;
  --surface-2: #18233c;
  --soft: #16223c;
  --text: #eef2f9;
  --text-muted: #93a1ba;
  --border: rgba(120, 145, 190, 0.22);
  --navy: #dbe4f5;          /* light cool — headings on dark */
  --navy-soft: #16223c;
  --sidebar-bg: #0c1630;    /* deep navy rail */
  --accent: #60a5fa;
  --accent-dark: #3b82f6;
  --accent-soft: rgba(96, 165, 250, 0.16);
  --accent-contrast: #0b1326;

  --shadow: 0 1px 3px rgba(0, 0, 0, 0.45), 0 14px 34px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 22px 50px -16px rgba(0, 0, 0, 0.65);
}

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

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

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background: var(--page);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 0.3s ease, color 0.3s ease;
}

a { color: var(--accent-dark); text-decoration: none; }
a:hover { color: var(--accent); text-decoration: underline; }
[data-theme="dark"] a { color: var(--accent); }

img { max-width: 100%; display: block; }
h1, h2, h3 { line-height: 1.25; }

.hl { color: var(--accent-dark); font-weight: 600; }
[data-theme="dark"] .hl { color: var(--accent); }

/* Pre-hide animated elements only when GSAP is present */
.has-gsap .intro-name,
.has-gsap .reveal { visibility: hidden; }
@media (prefers-reduced-motion: reduce) {
  .has-gsap .intro-name,
  .has-gsap .reveal { visibility: visible; }
}

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--accent); color: var(--accent-contrast);
  padding: 10px 16px; border-radius: 0 0 8px 0; z-index: 200;
}
.skip-link:focus { left: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* Custom scrollbar (subtle, academic) */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 6px; border: 2px solid var(--page); }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ------------------------------- Intro (cover) -------------------------- */
.intro {
  position: relative;
  min-height: 100vh; min-height: 100svh;
  display: flex; align-items: center; justify-content: center;
  text-align: center; overflow: hidden; padding: 48px 24px;
  /* 自定义动态背景（多智能体 / 轨迹网络，见 main.js）。想用照片：加 url("../img/cover.jpg") */
  background: linear-gradient(160deg, #0b1020 0%, #0f172a 55%, #131a2e 100%);
}
/* Robotic canvas background (see cover-robotics.js) */
.cover-canvas { position: absolute; inset: 0; z-index: 0; pointer-events: none; display: block; }

.intro-overlay {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background:
    radial-gradient(52% 46% at 50% 46%, rgba(9, 13, 24, 0.78) 0%, rgba(9, 13, 24, 0.40) 45%, rgba(9, 13, 24, 0.06) 80%),
    linear-gradient(to bottom, rgba(9, 13, 24, 0.10) 0%, rgba(9, 13, 24, 0.35) 100%);
}
.intro-inner { position: relative; z-index: 2; max-width: 720px; }

.intro-avatar {
  width: 104px; height: 104px; border-radius: 50%; object-fit: cover;
  margin: 0 auto 22px; border: 3px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
}
.intro-name {
  margin: 0;
  font-family: var(--font-serif); font-weight: 700;
  font-size: clamp(2.4rem, 7vw, 5rem);
  letter-spacing: -0.02em; line-height: 1.05;
  color: #ffffff; font-kerning: none;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.35);
}
.intro-divider { display: block; width: 56px; height: 2px; background: rgba(255, 255, 255, 0.55); margin: 18px auto; }
.intro-subtitle {
  margin: 0; color: rgba(255, 255, 255, 0.82);
  font-size: clamp(0.95rem, 2.2vw, 1.15rem); letter-spacing: 0.04em;
}
.intro-subtitle strong, .intro-subtitle .hl { color: var(--accent); }

.intro-nav { margin-top: 28px; display: flex; flex-direction: column; align-items: center; gap: 11px; }
.intro-nav a {
  font-family: var(--font-serif); font-weight: 700; font-size: 1.08rem; color: #ffffff;
  padding-bottom: 3px; border-bottom: 1px solid rgba(255, 255, 255, 0.45);
  transition: color 0.2s, border-color 0.2s;
}
.intro-nav a:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }

.intro-social { list-style: none; margin: 30px 0 0; padding: 0; display: flex; gap: 20px; justify-content: center; }
.intro-social a { color: #ffffff; opacity: 0.85; transition: opacity 0.2s, color 0.2s, transform 0.2s; }
.intro-social a:hover { color: var(--accent); opacity: 1; transform: translateY(-2px); text-decoration: none; }
.intro-social svg { width: 20px; height: 20px; fill: currentColor; }

/* Desktop: name + menu left, point-cloud scene framed on the right */
@media (min-width: 1024px) {
  .intro { justify-content: flex-start; text-align: left; padding: 48px 8vw; }
  .intro-inner { max-width: 640px; }
  .intro-name { font-size: clamp(2.6rem, 4.6vw, 4.4rem); white-space: nowrap; }
  .intro-avatar { margin-left: 0; }
  .intro-divider { margin-left: 0; }
  .intro-nav { flex-direction: row; flex-wrap: wrap; justify-content: flex-start; gap: 8px 22px; margin-top: 30px; }
  .intro-social { justify-content: flex-start; }
}

/* About: PhD application callout (palette tokens, so it adapts to dark mode) */
.phd-callout {
  margin-top: 18px; padding: 12px 16px;
  background: var(--accent-soft); border-left: 3px solid var(--accent);
  border-radius: 0 10px 10px 0;
  color: var(--accent-dark); font-weight: 600;
}
[data-theme="dark"] .phd-callout { color: var(--accent); }

/* --------------------------- Layout (card) ------------------------------ */
.layout {
  display: flex;
  align-items: flex-start;
  width: 100%;
}

/* ------------------------------ Top nav --------------------------------- */
.topnav {
  position: sticky; top: 0; z-index: 200;
  height: var(--topnav-h);
  display: flex; align-items: center; gap: 14px;
  padding: 0 28px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.topnav-brand {
  flex-shrink: 0; font-family: var(--font-serif); font-weight: 700;
  font-size: 1.05rem; letter-spacing: -0.01em; color: var(--navy);
}
.topnav-brand:hover { color: var(--accent); text-decoration: none; }
.topnav-links {
  list-style: none; margin: 0 0 0 auto; padding: 0;
  display: flex; align-items: center; gap: 4px;
  overflow-x: auto; scrollbar-width: none;
}
.topnav-links::-webkit-scrollbar { display: none; }
.topnav-links a {
  display: block; padding: 7px 13px; border-radius: 8px; white-space: nowrap;
  color: var(--text-muted); font-size: 0.92rem; font-weight: 500;
  transition: color 0.2s, background 0.2s;
}
.topnav-links a:hover { color: var(--navy); background: var(--soft); text-decoration: none; }
.topnav-links a.active { color: var(--accent); background: var(--accent-soft); font-weight: 600; }

.theme-toggle {
  flex-shrink: 0; width: 38px; height: 38px;
  border: 1px solid var(--border); border-radius: 50%;
  background: var(--bg); color: var(--text); cursor: pointer; font-size: 1rem;
  display: grid; place-items: center; transition: border-color 0.2s;
}
.theme-toggle:hover { border-color: var(--accent); }

/* ------------------------------ Sidebar --------------------------------- */
.sidebar {
  position: sticky; top: var(--topnav-h);
  width: var(--sidebar-w); height: calc(100vh - var(--topnav-h)); flex-shrink: 0;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 40px 26px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
}

.avatar {
  width: 152px; height: 152px;
  border-radius: 18px;            /* rounded square, PRISM-style */
  object-fit: cover;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  background: var(--soft);
}
.identity { margin-top: 18px; }
.name { margin: 0; font-family: var(--font-serif); font-size: 1.55rem; font-weight: 700; letter-spacing: -0.01em; color: var(--navy); }
.tagline { margin: 6px 0 0; color: var(--accent-dark); font-weight: 600; font-size: 0.92rem; }
[data-theme="dark"] .tagline { color: var(--accent); }
.affiliation { margin: 8px 0 0; color: var(--text-muted); font-size: 0.86rem; line-height: 1.5; }

.theme-icon-dark { display: none; }
[data-theme="dark"] .theme-icon-light { display: none; }
[data-theme="dark"] .theme-icon-dark { display: inline; }

.social { list-style: none; margin: 24px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 11px; justify-content: center; }
.social a {
  width: 38px; height: 38px; display: grid; place-items: center;
  border: 1px solid var(--border); border-radius: 10px; color: var(--text-muted);
  transition: color 0.2s, border-color 0.2s, transform 0.2s;
}
.social a:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-2px); }
.social svg { width: 18px; height: 18px; fill: currentColor; }

.nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: block; padding: 8px 14px; border-radius: 8px;
  color: var(--text-muted); font-size: 0.95rem; font-weight: 500;
  transition: color 0.2s, background 0.2s, box-shadow 0.2s;
}
.nav a:hover { color: var(--text); background: var(--soft); text-decoration: none; }
.nav a.active {
  color: var(--text); background: var(--accent-soft); font-weight: 600;
  box-shadow: inset 3px 0 0 var(--accent);
}

/* Research interests box (PRISM left-column style) */
.interests-box { width: 100%; margin-top: 24px; text-align: left; background: var(--soft); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.interests-title { margin: 0 0 9px; font-size: 0.74rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); }
.interests-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.interests-list li { font-size: 0.9rem; color: var(--text); }

.sidebar-footer { margin-top: auto; padding-top: 16px; color: var(--text-muted); font-size: 0.74rem; }

/* ------------------------------ Content --------------------------------- */
.content { flex: 1; min-width: 0; max-width: var(--content-max); margin: 0 auto; padding: 64px 64px 56px; }
.section { margin-bottom: 60px; scroll-margin-top: 80px; }
.section:last-of-type { margin-bottom: 28px; }

.section-title {
  margin: 0 0 22px;
  font-family: var(--font-serif);
  font-size: 1.6rem; font-weight: 700; letter-spacing: -0.01em;
  color: var(--navy);
  position: relative; padding-bottom: 12px;
}
.section-title::after {
  content: ""; position: absolute; left: 0; bottom: 0;
  width: 40px; height: 3px; background: var(--accent); border-radius: 3px;
}
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.section-head .section-title { margin: 0; }
.see-all { flex-shrink: 0; font-size: 0.88rem; font-weight: 600; color: var(--accent); }
.see-all:hover { text-decoration: underline; }

/* Standalone all-publications page (publications.html) */
.pubs-main { width: min(960px, 100% - 40px); margin: 0 auto; padding: 44px 0 80px; }
.pubs-main .section-title { margin: 0 0 8px; }
.pubs-main .section-note { margin: 0 0 28px; }
.section p { margin: 0 0 14px; }
.section-note { color: var(--text-muted); font-size: 0.88rem; }

/* News */
.news-list { list-style: none; margin: 0; padding: 0; }
.news-item { display: flex; gap: 16px; padding: 9px 0; }
.news-date { flex-shrink: 0; width: 70px; color: var(--accent-dark); font-variant-numeric: tabular-nums; font-size: 0.85rem; font-weight: 700; padding-top: 1px; }
[data-theme="dark"] .news-date { color: var(--accent); }
.news-body { font-size: 0.95rem; }

/* Publications — bordered sub-cards */
.pub-list { display: flex; flex-direction: column; gap: 16px; }
.pub-group { margin: 16px 0 0; font-family: var(--font-serif); font-size: 1rem; font-weight: 700; color: var(--text-muted); letter-spacing: 0.02em; }
.pub-group:first-child { margin-top: 0; }
.pub-item {
  padding: 18px 20px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-2); transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}
.pub-item:hover { border-color: var(--accent); box-shadow: var(--shadow); transform: translateY(-2px); }
.pub-item.has-thumb { display: flex; gap: 20px; align-items: stretch; }
.pub-thumb { flex-shrink: 0; width: 260px; min-height: 130px; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); background: var(--bg); }
.pub-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.pub-fig-placeholder { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--text-muted); background: var(--soft); }
.pub-fig-placeholder svg { width: 26px; height: 26px; fill: currentColor; opacity: 0.8; }
.pub-fig-placeholder span { font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; }
.pub-body { flex: 1; min-width: 0; }
.pub-title { margin: 0 0 5px; font-size: 1.02rem; font-weight: 700; color: var(--navy); }
.pub-authors { margin: 0 0 4px; font-size: 0.9rem; color: var(--text-muted); }
.pub-authors strong { color: var(--accent-dark); font-weight: 600; }
[data-theme="dark"] .pub-authors strong { color: var(--accent); }
.pub-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 2px 0 9px; }
.pub-venue { display: inline-block; padding: 4px 12px; background: var(--soft); border: 1px solid var(--border); border-radius: 999px; font-size: 0.82rem; color: var(--text-muted); }
.pub-award { color: var(--accent-dark); font-weight: 600; }
[data-theme="dark"] .pub-award { color: var(--accent); }
.pub-summary { margin: 0 0 10px; font-size: 0.89rem; color: var(--text-muted); line-height: 1.55; }
.pub-links { display: flex; flex-wrap: wrap; gap: 10px; }
.pub-links a { display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px; background: var(--soft); border: 1px solid var(--border); border-radius: 8px; font-size: 0.83rem; font-weight: 600; color: var(--text); }
.pub-links a:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); text-decoration: none; }
.pub-links a svg { width: 15px; height: 15px; fill: currentColor; opacity: 0.85; }

/* Projects */
.project-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
@media (max-width: 768px) { .project-grid { grid-template-columns: 1fr; } }
.project-card { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface-2); display: flex; flex-direction: column; transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s; }
.project-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--accent); }
.project-media { aspect-ratio: 16 / 9; background: var(--soft); border-bottom: 1px solid var(--border); display: grid; place-items: center; }
.project-media img { width: 100%; height: 100%; object-fit: cover; }
.project-media-placeholder { color: var(--text-muted); font-size: 0.72rem; letter-spacing: 0.1em; }
.project-info { padding: 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.project-info h3 { margin: 0; font-size: 1rem; color: var(--navy); }
.project-info p { margin: 0; font-size: 0.9rem; color: var(--text-muted); flex: 1; }
.project-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.project-tags span { font-size: 0.72rem; color: var(--accent-dark); background: var(--accent-soft); padding: 2px 8px; border-radius: 999px; }
[data-theme="dark"] .project-tags span { color: var(--accent); }
.project-links { display: flex; gap: 12px; }
.project-links a { font-size: 0.82rem; font-weight: 600; }

/* Teaching */
.teaching-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.teaching-item { display: flex; gap: 16px; }
.teaching-term { flex-shrink: 0; width: 96px; color: var(--text-muted); font-size: 0.85rem; font-weight: 600; padding-top: 2px; }
.teaching-item h3 { margin: 0 0 2px; font-size: 0.98rem; color: var(--navy); }
.teaching-item h3 span { color: var(--text-muted); font-weight: 400; }
.teaching-item p { margin: 0; font-size: 0.9rem; color: var(--text-muted); }

/* CV button */
.button { display: inline-block; padding: 10px 22px; background: var(--navy); color: var(--accent-contrast); border-radius: 8px; font-weight: 600; font-size: 0.92rem; transition: background 0.2s, transform 0.2s; }
.button:hover { background: var(--accent); transform: translateY(-1px); text-decoration: none; color: var(--accent-contrast); }

/* Footer */
.page-footer { margin-top: 56px; padding-top: 22px; border-top: 1px solid var(--border); color: var(--text-muted); font-size: 0.82rem; }

/* ----------------------------- Responsive ------------------------------- */
@media (max-width: 899px) {
  .topnav { padding: 0 14px; gap: 10px; }
  .topnav-brand { font-size: 0.98rem; }
  .topnav-links { flex: 1; margin-left: 8px; }
  .topnav-links a { padding: 7px 11px; font-size: 0.88rem; }

  .layout { display: block; width: 100%; }
  .sidebar {
    position: static; width: auto; height: auto;
    border-right: none; border-bottom: 1px solid var(--border);
    padding: 30px 22px;
  }
  .content { max-width: none; padding: 32px 20px 44px; }
  .pub-item.has-thumb { flex-direction: column; }
  .pub-thumb { width: 100%; min-height: 0; aspect-ratio: 16 / 9; }
}

@media (max-width: 420px) {
  body { font-size: 15px; }
  .content { padding: 28px 16px 36px; }
}

/* (accent-color preview switcher removed — navy + cobalt baked into :root) */
