/*
 * Yiwei Li academic website — shared screen styles.
 * Change the variables below to adjust the whole site. No build step required.
 * Forum's local @font-face declarations are kept separately in fonts.css.
 */

:root {
  --font-body: "Forum", "Songti SC", "SimSun", serif;
  --font-size-body: 18px;
  --line-height-body: 30px;
  --font-size-section: 20px;
  --font-size-body-mobile: 17px;
  --line-height-body-mobile: 28px;
  --font-size-section-mobile: 19px;
  --text-color: #000000;
  --blue: #28527b;
  --blue-hover: #6699cc;
  --page-background: #ececec;
  --surface: #fcfefc;
  --rule-color: #c0c0c0;
  --site-width: 1200px;
  --sidebar-width: 220px;
  --column-gap: 40px;
  --header-height: 49px;
  --sidebar-top: 81px;
  --publication-gap: 8px;
}

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

html {
  color-scheme: light;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-height) + 20px);
}

body {
  margin: 0;
  background: var(--page-background);
  color: var(--text-color);
  font-family: var(--font-body);
  font-size: var(--font-size-body);
  font-weight: 400;
  line-height: var(--line-height-body);
}

button,
input {
  font: inherit;
}

img {
  max-width: 100%;
}

a,
a:visited {
  color: var(--blue);
  text-decoration-line: underline;
  text-decoration-color: currentColor;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 150ms ease, background-color 150ms ease;
}

a:hover,
a:focus-visible {
  color: var(--blue-hover);
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--blue-hover);
  outline-offset: 4px;
}

[hidden] {
  display: none !important;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 12px;
  padding: 5px 12px;
  background: #ffffff;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

/* A quiet, thin navigation bar; the information sidebar remains independent. */
.site-header {
  position: sticky;
  z-index: 50;
  top: 0;
  background: var(--surface);
  border-bottom: 1px solid #d8dfe3;
}

.header-inner {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: var(--site-width);
  min-height: var(--header-height);
  margin: 0 auto;
  padding: 0 20px;
}

.site-nav {
  display: flex;
  align-items: stretch;
  justify-content: flex-start;
  column-gap: 25px;
  min-width: 0;
  min-height: var(--header-height);
}

.site-nav a,
.site-nav a:visited {
  display: flex;
  align-items: center;
  min-height: var(--header-height);
  padding: 0 2px;
  border-bottom: 2px solid transparent;
  color: var(--blue);
  font-size: 18px;
  font-weight: 700;
  line-height: 26px;
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--blue-hover);
}

.site-nav a[aria-current="page"] {
  border-bottom-color: var(--blue);
}

.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 8px;
  border: 0;
  background: transparent;
  color: var(--blue);
  cursor: pointer;
}

.menu-toggle svg {
  display: block;
  width: 24px;
  height: 24px;
}

.menu-toggle-bars {
  display: block;
  width: 24px;
  height: 18px;
  background: linear-gradient(to bottom,
    currentColor 0, currentColor 2px,
    transparent 2px, transparent 8px,
    currentColor 8px, currentColor 10px,
    transparent 10px, transparent 16px,
    currentColor 16px, currentColor 18px);
}

/* Desktop: 1200px includes 40px padding, 220px profile, 40px gap, 900px text. */
.site-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  column-gap: var(--column-gap);
  width: 100%;
  max-width: var(--site-width);
  min-height: calc(100vh - var(--header-height));
  margin: 0 auto;
  padding: 38px 20px 42px;
  background: var(--surface);
}

.profile-sidebar {
  min-width: 0;
  align-self: stretch;
}

.profile-inner {
  position: sticky;
  top: var(--sidebar-top);
  text-align: left;
}

.profile-photo {
  display: block;
  width: 150px;
  height: 200px;
  margin: 0 0 18px;
  object-fit: cover;
}

.profile-name {
  margin: 0 0 12px;
  color: var(--blue);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.3;
}

.profile-name-cn {
  display: inline-block;
  font-size: 20px;
  white-space: nowrap;
}

.profile-position {
  display: none;
}

.profile-affiliation {
  color: var(--text-color);
  font-size: 17px;
  line-height: 25.5px;
}

.profile-affiliation p {
  margin: 0 0 5px;
}

.profile-address .link-icon {
  color: var(--blue);
}

/* Keep wrapped address lines aligned with the text beside the marker. */
.profile-affiliation .profile-address {
  display: flex;
  align-items: baseline;
  column-gap: 0.4em;
  margin-top: 8px;
  margin-bottom: 10px;
}

.profile-address > span {
  min-width: 0;
}

.profile-affiliation a,
.profile-links a {
  font-weight: 700;
}

/* Decorative SVGs inherit text colour; link icons also follow hover colour. */
.profile-email a,
.profile-links a {
  display: inline-flex;
  align-items: baseline;
  column-gap: 0.4em;
}

.profile-email a {
  font-size: 18px;
}

.link-icon {
  position: relative;
  top: 0.1em;
  flex: 0 0 1em;
  width: 1em;
  height: 1em;
  fill: currentColor;
}

.profile-links {
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
  font-size: 18px;
  line-height: 30px;
}

.profile-links li {
  margin: 0;
  padding: 0;
}

.profile-link-separator {
  display: none;
}

/* Main content: one typeface and rhythm, with explicit, limited exceptions. */
.site-main {
  min-width: 0;
  font-size: var(--font-size-body);
  line-height: var(--line-height-body);
  text-align: justify;
  overflow-wrap: break-word;
}

/* All ordinary content inherits one shared size, including link/emphasis text. */
.site-main p,
.site-main li,
.site-main a,
.site-main strong,
.site-main b,
.site-main em,
.site-main .author-self {
  font-size: inherit;
  line-height: inherit;
}

.site-main p {
  margin: 0 0 12px;
}

.site-main ul,
.site-main ol {
  margin: 0 0 14px;
  padding-left: 1.5em;
}

.site-main li {
  margin: 0;
  padding-left: 0;
}

.site-main li::marker {
  color: var(--blue);
}

.site-main li > p:last-child {
  margin-bottom: 0;
}

.site-main strong,
.site-main b {
  color: var(--blue);
  font-weight: 700;
}

.site-main a strong,
.site-main a b {
  color: inherit;
  font-weight: inherit;
}

.site-main a {
  font-weight: 700;
}

.site-main a.publication-title,
.site-main a.publication-title:visited {
  font-weight: 400;
}

.site-main em,
.publication-venue {
  color: var(--text-color);
  font-style: italic;
  font-weight: 400;
}

.author-self,
.text-emphasis {
  color: var(--blue);
  font-weight: 700;
}

.content-section {
  margin: 0 0 24px;
  scroll-margin-top: calc(var(--header-height) + 20px);
}

.content-section:last-child {
  margin-bottom: 0;
}

.section-title {
  margin: 0 0 14px;
  padding: 0 0 3px;
  border-bottom: 1px solid var(--rule-color);
  color: var(--blue);
  font-size: var(--font-size-section);
  font-weight: 700;
  line-height: var(--line-height-body);
  text-align: left;
}

.section-note {
  font-size: var(--font-size-body);
  line-height: var(--line-height-body);
  font-weight: 400;
}

.site-main h3,
.subsection-title {
  margin: 22px 0 8px;
  color: var(--blue);
  font-size: var(--font-size-section);
  font-weight: 700;
  line-height: var(--line-height-body);
  text-align: left;
}

.site-main .page-intro {
  margin: 0 0 24px;
  text-align: left;
}

body[data-page="publications"] .site-main ol > li {
  margin-bottom: var(--publication-gap);
}

body[data-page="publications"] .site-main ol > li:last-child {
  margin-bottom: 0;
}

.closing-note {
  margin-top: 22px;
  color: var(--blue);
  font-weight: 700;
  text-align: left;
}

.site-footer {
  width: 100%;
  max-width: var(--site-width);
  margin: 0 auto;
  padding: 18px 20px 22px;
  border-top: 1px solid #d8dfe3;
  background: var(--surface);
  color: #434745;
  font-size: 16px;
  line-height: 24px;
}

.site-footer p {
  margin: 0;
}

.back-to-top {
  position: fixed;
  z-index: 45;
  right: 24px;
  bottom: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid #d0d8de;
  border-radius: 3px;
  background: var(--blue);
  color: #ffffff;
  font-size: 25px;
  line-height: 1;
  cursor: pointer;
  transition: background-color 150ms ease;
}

.back-to-top:hover {
  background: var(--blue-hover);
}

/* On short desktop viewports, allow the full profile to scroll into view. */
@media (min-width: 1100px) and (max-height: 760px) {
  .profile-inner {
    position: static;
  }
}

/* Tablet / narrow desktop: profile becomes a compact row above the text. */
@media (max-width: 1099px) {
  .site-shell {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 30px;
    padding: 30px 24px 36px;
  }

  .header-inner {
    padding-right: 24px;
    padding-left: 24px;
  }

  .profile-inner {
    position: static;
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    column-gap: 26px;
    row-gap: 5px;
    align-items: start;
  }

  .profile-photo {
    grid-column: 1;
    grid-row: 1 / span 3;
    margin: 0;
  }

  .profile-name,
  .profile-affiliation,
  .profile-links {
    grid-column: 2;
  }

  .profile-name {
    margin: 0;
  }

  .profile-affiliation {
    max-width: 650px;
  }

  .profile-links {
    display: flex;
    flex-wrap: wrap;
    column-gap: 18px;
    row-gap: 0;
    margin: 0;
  }

  .site-footer {
    padding-right: 24px;
    padding-left: 24px;
  }
}

/* Navigation opens below its 49px row; links stay comfortably clickable. */
@media (max-width: 640px) {
  :root {
    --font-size-body: var(--font-size-body-mobile);
    --line-height-body: var(--line-height-body-mobile);
    --font-size-section: var(--font-size-section-mobile);
  }

  .header-inner {
    display: flex;
    flex-wrap: wrap;
    column-gap: 12px;
    justify-content: flex-start;
    min-height: var(--header-height);
    padding: 0 20px;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .site-nav {
    display: none;
    flex: 0 0 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    min-height: 0;
    max-height: calc(100dvh - var(--header-height));
    padding: 3px 0 10px;
    overflow-y: auto;
  }

  .site-nav.is-open,
  body.nav-open .site-nav {
    display: flex;
  }

  .site-nav a,
  .site-nav a:visited {
    min-height: 44px;
    padding: 5px 10px;
    border: 0;
    font-size: var(--font-size-body);
  }

  .site-nav a[aria-current="page"] {
    background: #edf2f6;
  }

  .no-js .site-nav {
    display: flex;
  }

  .no-js .menu-toggle {
    display: none;
  }
}

/* Phone: preserve the font size while avoiding wide justified word spaces. */
@media (max-width: 640px) {
  .site-shell {
    row-gap: 27px;
    padding: 26px 20px 32px;
  }

  .profile-inner {
    display: block;
  }

  .profile-photo {
    width: 120px;
    height: 160px;
    margin: 0 auto 16px;
  }

  .profile-name {
    margin: 0 0 9px;
    font-size: 22px;
  }

  .profile-name-cn {
    font-size: 18px;
  }

  .profile-position {
    display: inline;
    color: var(--text-color);
    font-size: var(--font-size-body);
    font-weight: 400;
    line-height: var(--line-height-body);
  }

  .profile-affiliation {
    font-size: var(--font-size-body);
    line-height: var(--line-height-body);
  }

  .profile-email a {
    font-size: var(--font-size-body);
  }

  .profile-links {
    column-gap: 18px;
    row-gap: 4px;
    margin-top: 12px;
    font-size: var(--font-size-body);
    line-height: var(--line-height-body);
  }

  .site-main {
    text-align: left;
  }

  /* Personal details appear once on phone, on the Home page. */
  body:not([data-page="home"]) .profile-sidebar {
    display: none;
  }

  .site-main ul,
  .site-main ol {
    padding-left: 1.35em;
  }

  .site-footer {
    padding-right: 20px;
    padding-left: 20px;
    font-size: var(--font-size-body);
    line-height: var(--line-height-body);
  }

  .back-to-top {
    right: 14px;
    bottom: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  a,
  button {
    transition: none;
  }
}

@media print {
  body {
    background: #ffffff;
  }

  .site-header,
  .profile-sidebar,
  .back-to-top,
  .skip-link {
    display: none !important;
  }

  .site-shell {
    display: block;
    max-width: none;
    min-height: 0;
    padding: 0;
    background: #ffffff;
  }

  .site-footer {
    max-width: none;
    margin-top: 20px;
    padding: 10px 0 0;
    background: #ffffff;
  }

  .section-title {
    break-after: avoid;
  }
}

/* Content inserted by the maintenance tool stays within the text column. */
.site-main h1, .site-main h2:not(.section-title), .site-main h4, .site-main h5, .site-main h6 {
  margin: 22px 0 8px;
  color: var(--blue);
  font-size: var(--font-size-section);
  line-height: var(--line-height-body);
  text-align: left;
}
.site-main img { display: block; max-width: 100%; height: auto; margin: 12px 0; }
.site-main pre { overflow-x: auto; padding: 12px; background: #f0f3f5; text-align: left; }
.site-main table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; }
.site-main th, .site-main td { padding: 4px 10px; border: 1px solid var(--rule-color); text-align: left; }
.site-main blockquote { margin: 12px 0; padding-left: 16px; border-left: 3px solid var(--rule-color); }

/* 期刊、会议、专利：统一使用中括号编号 */
@counter-style publication-brackets {
  system: extends decimal;
  prefix: "[";
  suffix: "] ";
}

body[data-page="publications"] ol.publication-list {
  list-style-type: publication-brackets;
  padding-left: 2em;
}

/* 编号统一为黑色 */
body[data-page="publications"] ol.publication-list > li::marker {
  color: #000;
}

/* 正文列表的小圆点大小：保留 1.5 倍，内层列表继续使用原生标记。 */
.site-main ul > li::marker {
  font-size: 1.5em;
}

/* 主圆点按首行行高居中；用几何圆形避免中英文字体的圆点字形差异。 */
.site-main .content-section > ul > li {
  position: relative;
}

.site-main .content-section > ul > li::marker {
  font-size: 0;
}

.site-main .content-section > ul > li::before {
  content: "";
  position: absolute;
  top: calc(var(--line-height-body) / 2); /* 若需微调，可在 / 2 后加 1px 或减 1px。 */
  right: calc(100% + 0.48em);
  width: 0.28em;
  height: 0.28em;
  font-size: 1.5em; /* 保留你设置的 1.5 倍大小，圆的直径随此值缩放。 */
  background-color: var(--blue);
  border-radius: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}