/* jemdoc+MathJax academic theme. Tune the variables below first. */
:root {
  --jemdoc-blue: #527bbd;
  --heading-blue: #365f99;
  --jemdoc-blue-dark: #022b6d;
  --text: #222;
  --muted: #666;
  --rule: #aaa;
  --soft-rule: #ddd;
  --menu-bg: #f6f6f6;
  --info-bg: #ffffee;
  --page-width: 100%;
  --menu-width: 190px;
}

/* Base rules follow the default wsshin/jemdoc_mathjax jemdoc.css. */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; padding: 0 0 8px; color: var(--text); background: #fff; font-family: Georgia, "Times New Roman", "Noto Serif CJK SC", "Songti SC", serif; font-size: 16px; line-height: 1.3; }
p { margin: 0 0 0.8em; padding: 0; }
a { color: #224b8d; text-decoration: none; }
a:hover, a:focus-visible { border-bottom: 1px dotted gray; }
img { display: block; max-width: 100%; }
ul, ol { margin: 0.2em 0 0.8em; padding-top: 0; }
ul { list-style-position: outside; list-style-type: square; }
ol { list-style-position: outside; }
li { margin-bottom: 0.35em; }
.skip-link { position: fixed; top: -4rem; left: 1rem; z-index: 100; padding: 0.45em 0.7em; background: #111; color: #fff; }
.skip-link:focus { top: 1rem; }

/* The original uses table#tlayout. Grid preserves that layout responsively. */
.site-shell { display: grid; grid-template-columns: var(--menu-width) minmax(0, 1fr); width: min(var(--page-width), 100%); min-height: 100vh; margin: 0 auto; background: #fff; }
#layout-menu { padding: 0.7em 8px 1.5em; background: var(--menu-bg); border: 1px solid var(--soft-rule); white-space: nowrap; text-align: left; vertical-align: top; }
.nav-list { position: sticky; top: 0.7em; }
.nav-heading { margin: 0.8em 0 0.15em; padding: 0.2em 0 0.1em; border-bottom: 1px solid gray; font-weight: bold; }
.nav-link { display: block; margin-left: 0.5em; padding-left: 16px; color: var(--jemdoc-blue); font-size: 1em; line-height: 1.5em; text-indent: -16px; }
.nav-link:hover { border-bottom: 0; color: var(--jemdoc-blue); }
.nav-link.active { color: var(--jemdoc-blue-dark); font-weight: normal; text-decoration: underline; text-decoration-color: gray; text-underline-offset: 2px; }

/* Main column and title reproduce #layout-content and #toptitle. */
.layout-content { min-width: 0; padding: 0 1.25em 2em; text-align: left; vertical-align: top; }
.section-anchor { scroll-margin-top: 0.7em; }
#toptitle { margin-bottom: 1.5em; padding: 0 0 0.2em; border-bottom: 3px double gray; }
#toptitle h1 { margin-top: 0; padding-top: 0.75em; border-bottom: none; }
#toptitle p { margin: 0; padding-bottom: 0.1em; color: var(--muted); }
h1, h2, h3 { margin-top: 0.7em; margin-bottom: 0.3em; padding-top: 0.5em; padding-bottom: 0.2em; color: var(--jemdoc-blue); border-bottom: 1px solid var(--rule); line-height: 1; }
h1,
#research > h2,
#awards > h2,
#talks > h2,
#service > h2,
#publications h2,
#contact > h2 { color: var(--heading-blue); }
#toptitle h1 { font-size: 175%; }
#research > h2,
#awards > h2,
#talks > h2,
#service > h2,
#publications h2,
#contact > h2 { font-size: 135%; }
h1 { font-size: 165%; }
h2 { padding-top: 0.8em; font-size: 125%; }
h2 + h3 { padding-top: 0.2em; }
h3 { border-bottom: none; font-size: 110%; }
.content-section { margin-top: 0.4em; }

/* Profile and dense academic content retain a compact jemdoc form. */
.profile-grid { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 1.3em; align-items: start; }
.profile-photo { width: 210px; border: 1px solid #ccc; }
.profile-details { padding-top: 0.1em; }
.position { font-weight: bold; }
.profile-links { display: flex; flex-wrap: wrap; gap: 0.4em 1em; }
.research-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6em 1.4em; }
.research-card { padding: 0 0 0.35em; border-bottom: 1px dotted #c5c5c5; }
.research-card h3 { padding-top: 0.25em; }
.research-card p { margin-bottom: 0.3em; }
.subsection-title { margin-top: 1.2em; border-bottom: 1px solid var(--rule); }
.details-stack { margin-top: 0.5em; }
.details-stack details { margin-bottom: 0.45em; border: 1px solid #d0d0d0; background: #fff; }
.details-stack summary { display: flex; justify-content: space-between; gap: 1em; padding: 0.42em 0.55em; color: #224b8d; cursor: pointer; font-weight: bold; }
.details-stack summary:hover { background: var(--menu-bg); }
.details-stack summary span { flex: 0 0 auto; color: var(--muted); font-family: Arial, sans-serif; font-size: 0.75em; font-weight: normal; }
.details-body { padding: 0.55em 0.7em 0.05em; border-top: 1px solid #d0d0d0; }
.project-title-zh { color: #224b8d; }
.project-description-zh { padding-top: 0.45em; border-top: 1px dotted #ccc; }
.section-heading-row { display: flex; align-items: baseline; justify-content: space-between; gap: 1em; border-bottom: 1px solid var(--rule); }
.section-heading-row h2 { flex: 1; margin-bottom: 0; border-bottom: 0; }
.section-heading-row > a { white-space: nowrap; font-size: 0.8em; }
.publication-list { padding-left: 1.6em; }
.publication-list li { margin-bottom: 0.65em; padding-left: 0.15em; }
.paper-badge { display: inline-block; margin-left: 0.25em; padding: 0.08em 0.38em; border: 1px solid currentColor; font-family: Arial, sans-serif; font-size: 0.7em; font-style: normal; font-weight: bold; line-height: 1.35; vertical-align: 0.08em; white-space: nowrap; }
.paper-badge.highly-cited { color: #a33a2b; background: #fff7f3; }
.paper-badge.hot-paper { color: #b06400; background: #fff9e8; }
.paper-badge.paper-award { color: #755400; background: #fff5c7; border-color: #b58a18; }
.timeline-item { display: grid; grid-template-columns: 105px minmax(0, 1fr); gap: 1em; padding: 0.45em 0; border-bottom: 1px dotted #c5c5c5; }
.timeline-date { color: var(--muted); font-family: Arial, sans-serif; font-size: 0.8em; font-weight: bold; }
.timeline-item p { margin-bottom: 0.25em; }
.academic-timeline .timeline-item { grid-template-columns: 120px minmax(0, 1fr); padding: 0.6em 0; }
.academic-timeline h3 { margin-top: 0; padding-top: 0; }
.timeline-details { margin: 0.3em 0 0.15em; padding-left: 1.35em; }
.timeline-details li { margin-bottom: 0.15em; }
/* Professional entries read as one continuous bibliographic line:
   Institution, location · position. Long lines can still wrap naturally. */
#experience .timeline-item > div > h3,
#experience .timeline-item > div > h3 + p { display: inline; }
#experience .timeline-item > div > h3 + p::before { content: ", "; color: var(--text); }
#experience .timeline-item > div > h3 + p::after { content: ""; display: block; margin-bottom: 0.2em; }
.square-list { padding-left: 1.3em; }
.funding-list { padding-left: 1.35em; }
.funding-list li { margin-bottom: 0.8em; }
.funding-zh { margin: 0.4em 0 0; padding: 0.35em 0.5em; border-left: 2px solid #9aadc7; background: #fafafa; }
.link-cloud { margin: 0.45em 0 0.8em; }
.link-cloud a::after { content: " ·"; color: #888; }
.link-cloud a:last-child::after { content: ""; }
.reviewer-list { margin-top: 0.35em; padding-left: 1.35em; }
.reviewer-list li { margin-bottom: 0.3em; }
.tpc-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.2em 1.5em; padding-left: 1.35em; }
.tpc-list li { margin-bottom: 0.1em; }

/* Full course titles remain readable in a compact two-column list. */
.course-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; margin: 0.45em 0 1em; border-top: 1px solid #d5d5d5; }
.course-grid a, .course-grid > span { display: flex; flex-direction: column; gap: 0.12em; padding: 0.4em 0.5em; border-bottom: 1px solid #d5d5d5; }
.course-grid a:nth-child(odd), .course-grid > span:nth-child(odd) { border-right: 1px solid #d5d5d5; }
.course-grid strong { color: #224b8d; font-size: 0.88em; }
.course-grid small { color: var(--muted); font-family: Arial, sans-serif; font-size: 0.72em; line-height: 1.3; }

/* Contact box and footer mirror jemdoc infoblock/footer styling. */
.info-box { margin: 1.2em 0 1.3em; padding: 0.45em 0.6em; border: 1px solid silver; background: var(--info-bg); }
.info-box p:last-child { margin-bottom: 0; }
.footer { margin-top: 4em; padding-top: 0.2em; color: #a0a0a0; border-top: 1px solid #c0c0c0; font-size: small; }
.footer p { margin-bottom: 0.2em; }
.footer a { color: #80a0b0; }

/* Responsive extension for phones; the original template predates mobile. */
@media (max-width: 760px) {
  .site-shell { display: block; width: 100%; }
  #layout-menu { padding: 0.65em 0.8em; white-space: normal; }
  .nav-list { position: static; }
  .nav-heading { display: none; }
  .nav-list { display: flex; gap: 0.3em 0.9em; overflow-x: auto; padding: 0.25em 0; }
  .nav-link { flex: 0 0 auto; margin: 0; padding: 0; text-indent: 0; }
  .layout-content { padding: 0 1em 1.5em; }
  .profile-grid { grid-template-columns: 155px minmax(0, 1fr); gap: 1em; }
  .profile-photo { width: 155px; }
}
@media (max-width: 520px) {
  body { font-size: 15px; }
  .profile-grid, .research-grid, .timeline-item, .course-grid { grid-template-columns: 1fr; }
  .profile-photo { width: min(220px, 72vw); }
  .course-grid a:nth-child(odd), .course-grid > span:nth-child(odd) { border-right: 0; }
  .details-stack summary { display: block; }
  .details-stack summary span { display: block; margin-top: 0.2em; }
  .section-heading-row { display: block; padding-bottom: 0.25em; }
  .tpc-list { grid-template-columns: 1fr; }
}
@media print {
  #layout-menu, .skip-link { display: none; }
  .site-shell { display: block; width: 100%; }
  .layout-content { padding: 0; }
  a { color: inherit; }
}
