/* Academic homepage: persistent profile, document-style content. */
:root {
  color-scheme: light;
  --bg: #fff;
  --text: #252525;
  --text-soft: #404040;
  --muted: #686868;
  --border: #dedede;
  --accent: #234e70;
  --accent-bg: #f1f5f8;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  --serif: Georgia, "Times New Roman", serif;
}
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #191b1e;
  --text: #e6e6e6;
  --text-soft: #c7c9cc;
  --muted: #a4a9af;
  --border: #373c42;
  --accent: #a8c8e1;
  --accent-bg: #222e39;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 32px; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--serif); font-size: 16px; line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; text-underline-offset: 3px; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 4px;
}
button { font: inherit; }
strong { font-weight: 700; }
.muted { color: var(--muted); }
.page-layout {
  display: grid; grid-template-columns: 230px minmax(0, 1fr);
  column-gap: 54px; max-width: 1200px; padding: 0 36px; margin: 0 auto;
  align-items: start;
}
.main-content { min-width: 0; padding-top: 45px; }
.container { width: 100%; }
.skip-link {
  position: fixed; top: 8px; left: 12px; z-index: 100;
  padding: 8px 16px; background: var(--bg); border: 1px solid var(--accent);
  transform: translateY(-160%); font-family: var(--sans);
}
.skip-link:focus { transform: translateY(0); }

/* Profile and persistent navigation */
.sidebar {
  position: sticky; top: 36px; max-height: calc(100dvh - 60px);
  overflow-y: auto; scrollbar-width: thin; padding: 0 27px 12px 0;
  margin-top: 45px; border-right: 1px solid var(--border);
  font-family: var(--sans); font-size: 13px;
}
.portrait-link { display: block; width: fit-content; }
.avatar { display: block; width: 144px; height: 162px; object-fit: cover; object-position: center 28%; }
.profile h1 { font: 700 27px/1.2 var(--serif); letter-spacing: -.5px; margin: 17px 0 4px; }
.profile h1 a { color: var(--text); }
.name-zh { margin: 0 0 15px; font-size: 15px; color: var(--muted); }
.profile-role { margin: 0; font-weight: 600; }
.profile-affiliation { margin: 3px 0 0; color: var(--text-soft); font-size: 12px; line-height: 1.6; }
.profile-location { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.sidebar-contact { margin: 19px 0 20px; display: grid; gap: 4px; font-size: 12px; }
.sidebar-contact > a { overflow-wrap: anywhere; }
.cv-link { margin-top: 8px; font-weight: 600; }
.cv-link span { font-weight: 400; }
.profile-links { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 5px; }
.sidebar-nav { border-top: 1px solid var(--border); padding-top: 9px; }
.nav-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 11px; letter-spacing: .04em; }
.nav-actions { display: flex; gap: 4px; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border: 0; padding: 0;
  color: var(--muted); background: transparent; cursor: pointer;
}
.icon-btn:hover { color: var(--accent); }
.menu-toggle { display: none; flex-direction: column; gap: 4px; }
.menu-toggle span { width: 17px; height: 1.5px; background: currentColor; }
.nav-links { display: grid; margin-top: 3px; gap: 2px; }
.nav-links a { border-left: 2px solid transparent; padding: 3px 0 3px 12px; margin-left: -1px; color: var(--muted); line-height: 1.65; }
.nav-links a:hover, .nav-links a[aria-current="location"] { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.nav-links a[aria-current="location"] { font-weight: 600; }

/* Introduction and section hierarchy */
.section { margin-top: 32px; }
.section-title {
  font: 400 26px/1.25 var(--serif); letter-spacing: -.4px;
  margin: 0 0 18px; padding-bottom: 9px; border-bottom: 1px solid var(--border);
}
.intro .section-title { margin-bottom: 14px; }
.hero-tagline { margin: 0 0 12px; font-size: 16px; }
.availability { margin: 17px 0 0; padding: 10px 14px; border-left: 2px solid var(--accent); background: var(--accent-bg); font: 13px/1.65 var(--sans); }
.availability strong { color: var(--accent); }
.section-lead { font: 12px/1.65 var(--sans); color: var(--muted); margin: -5px 0 20px; }
.subhead { font: 600 13px/1.5 var(--sans); margin: 25px 0 17px; color: var(--text-soft); }
.subhead:first-of-type { margin-top: 18px; }

/* Compact news */
.news { list-style: none; padding: 0; margin: 0; display: grid; gap: 9px; }
.news li { display: grid; grid-template-columns: 65px minmax(0, 1fr); gap: 17px; align-items: baseline; }
.news-date { font: 11px/1.6 var(--sans); color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.news-text { font-size: 14px; line-height: 1.55; color: var(--text-soft); }
.news-archive { margin-top: 12px; }
.news-archive summary { width: fit-content; cursor: pointer; color: var(--accent); font: 12px/1.6 var(--sans); }
.news-archive[open] summary { margin-bottom: 14px; }

/* Publications as a bibliography */
.pubs { counter-reset: pub; list-style: none; padding: 0; margin: 0; display: grid; gap: 21px; }
.pubs-collaborative { counter-reset: pub 6; }
.pubs li { position: relative; padding-left: 31px; scroll-margin-top: 35px; }
.pubs li::before { counter-increment: pub; content: "[" counter(pub) "]"; position: absolute; left: 0; top: 3px; font: 11px/1.6 var(--sans); color: var(--muted); }
.pubs li:target { background: var(--accent-bg); outline: 6px solid var(--accent-bg); }
.pub-title { font-weight: 700; font-size: 16px; line-height: 1.4; margin: 0 0 5px; }
.pub-authors { font-size: 14px; line-height: 1.5; color: var(--text-soft); margin: 0 0 4px; }
.pub-venue { font: 12px/1.6 var(--sans); color: var(--muted); margin: 0; }
.pub-links { font: 12px/1.6 var(--sans); margin: 5px 0 0; }
.badge { font-family: var(--sans); font-size: 11px; font-weight: 600; color: var(--accent); }
.pub-venue .badge { margin-right: 5px; }
.badge-review { color: var(--muted); font-style: italic; font-weight: 400; }
.badge-patent { color: var(--text-soft); }

/* Research narratives */
.projects { display: grid; gap: 27px; }
.project + .project { padding-top: 23px; border-top: 1px solid var(--border); }
.project-head { margin-bottom: 10px; }
.project-head h3 { font: 700 18px/1.4 var(--serif); margin: 0 0 6px; }
.project-meta { display: block; font: 11px/1.7 var(--sans); color: var(--muted); }
.project > p { margin: 10px 0 12px; color: var(--text-soft); font-size: 15px; }
.project ul { margin: 0; padding-left: 19px; display: grid; gap: 8px; }
.project li { font-size: 14px; color: var(--text-soft); }
.project li strong { color: var(--text); }
.project-pubs { margin-top: 14px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 7px; font: 11px/1.6 var(--sans); color: var(--muted); }
.project-pubs .pub-ref { max-width: 100%; }
.project-pubs .badge { font-size: 10px; font-weight: 400; }
.project-pubs .badge::before { content: "("; }
.project-pubs .badge::after { content: ")"; }

/* Background and experience */
.interests { display: grid; gap: 12px; }
.interest-card { display: grid; grid-template-columns: 205px minmax(0, 1fr); gap: 20px; }
.interest-card h3 { margin: 0; font: 600 12px/1.6 var(--sans); }
.interest-card p { margin: 0; font-size: 14px; color: var(--text-soft); }
.timeline { display: grid; gap: 14px; }
.tl-item { display: grid; grid-template-columns: 158px minmax(0, 1fr); gap: 19px; }
.tl-when { font: 11px/1.7 var(--sans); color: var(--muted); padding-top: 3px; font-variant-numeric: tabular-nums; }
.tl-what { font-size: 14px; }
.tl-what p { margin: 3px 0 0; font-size: 13px; color: var(--text-soft); }
.gallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px 14px; }
.shot { margin: 0; min-width: 0; }
.shot-wide { grid-column: 1 / -1; }
.shot img { display: block; width: 100%; height: 160px; object-fit: contain; background: #0c0c10; }
.shot-wide img { height: auto; max-height: 260px; }
.shot figcaption { padding-top: 7px; font: 11px/1.6 var(--sans); color: var(--muted); }
.skills { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 30px; }
.skill-group h4 { font: 600 12px/1.5 var(--sans); margin: 0 0 5px; }
.skill-group p { font-size: 14px; margin: 0; color: var(--text-soft); }
code { font-size: .9em; }
.contact-links { display: flex; flex-wrap: wrap; gap: 10px 22px; }
.btn { display: inline-flex; align-items: center; gap: 6px; font: 12px/1.6 var(--sans); overflow-wrap: anywhere; }
.btn svg, .btn .ico-img { width: 13px; height: 13px; flex: none; object-fit: contain; }
.footer { grid-column: 2; margin: 35px 0 24px; padding-top: 15px; border-top: 1px solid var(--border); }
.footer p { margin: 0; font: 11px/1.6 var(--sans); color: var(--muted); }

/* Compact profile above content on tablets and phones. */
@media (max-width: 900px) {
  html { scroll-padding-top: 20px; }
  .page-layout { grid-template-columns: 1fr; padding: 0 30px; max-width: 800px; }
  .sidebar { position: static; max-height: none; overflow: visible; margin-top: 28px; padding: 0; border: 0; display: grid; grid-template-columns: 1.2fr 1fr; gap: 20px 28px; }
  .profile { display: flex; gap: 18px; align-items: start; }
  .avatar { width: 95px; height: 110px; }
  .profile h1 { font-size: 24px; margin-top: 0; }
  .name-zh { margin-bottom: 8px; font-size: 13px; }
  .profile-role { font-size: 12px; }
  .profile-location { display: none; }
  .sidebar-contact { margin: 0; align-content: start; }
  .sidebar-nav { grid-column: 1 / -1; border-bottom: 1px solid var(--border); padding: 5px 0; }
  .nav-heading { font-size: 12px; }
  .nav-links { display: none; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 10px 0; margin: 0; }
  .nav-links.open { display: grid; }
  .nav-links a { padding: 7px 10px; }
  .menu-toggle { display: inline-flex; }
  .main-content { padding-top: 26px; }
  .footer { grid-column: 1; }
}
@media (max-width: 560px) {
  .page-layout { padding: 0 22px; }
  .sidebar { grid-template-columns: 1fr; gap: 15px; margin-top: 22px; }
  .profile { gap: 18px; }
  .avatar { width: 100px; height: 118px; }
  .profile-affiliation { font-size: 11px; }
  .sidebar-contact { display: flex; flex-wrap: wrap; gap: 5px 15px; }
  .sidebar-contact .cv-link { margin: 0; }
  .profile-links { margin: 0; gap: 15px; }
  .nav-links { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-tagline { font-size: 15px; }
  .section-title { font-size: 24px; }
  .section { margin-top: 28px; }
  .news li { grid-template-columns: 60px minmax(0, 1fr); gap: 12px; }
  .pubs li { padding-left: 27px; }
  .pub-title { font-size: 15px; }
  .interest-card, .tl-item { grid-template-columns: 1fr; gap: 3px; }
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .shot img { height: 140px; }
  .skills { grid-template-columns: 1fr; }
}
@media (max-width: 360px) {
  .page-layout { padding: 0 16px; }
  .profile { gap: 14px; }
  .avatar { width: 80px; height: 100px; }
  .profile h1 { font-size: 23px; }
  .news li { grid-template-columns: 1fr; gap: 1px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
@media print {
  :root, html[data-theme="dark"] { --bg: #fff; --text: #000; --text-soft: #222; --muted: #444; --accent: #222; --border: #ccc; }
  .page-layout { display: block; max-width: none; padding: 0; }
  .sidebar { position: static; max-height: none; overflow: visible; margin: 0 0 20px; padding: 0; border: 0; }
  .profile { display: flex; gap: 20px; }
  .avatar { width: 80px; height: 90px; }
  .profile h1 { margin-top: 0; }
  .sidebar-contact { margin: 10px 0; }
  .sidebar-nav, .skip-link, .news-archive, .footer { display: none; }
  .main-content { padding: 0; }
  .section { margin-top: 20px; }
  .pubs li, .tl-item, .shot { break-inside: avoid; }
  .project-head { break-after: avoid; }
  a { color: inherit; }
}
