/* ==========================================================================
   前台样式
   色彩：白底、墨色文字、一种深蓝作强调色，不依赖任何外部资源。
   字体：全部使用访客设备自带的字体，不加载字体文件。
     默认（非衬线）：中英文统一用等线；没有等线的设备（Mac、手机等）依次退到苹方、微软雅黑、思源黑体。
     衬线：中文宋体，西文 Times New Roman。由页面右上角的开关切换，选择保存在访客的浏览器里。
   版式：全站列表统一为“左侧时间栏 + 右侧内容”。
   ========================================================================== */

/* ---------- 字体 ----------
   衬线模式下，中文页面里的西文要用 Times New Roman，但“”‘’——……这些标点应当交给宋体，
   否则中文引号会变成窄窄的西文引号。做法是给本机的 Times New Roman 起一个别名，
   并用 unicode-range 把通用标点（U+2000–206F）和间隔号排除在外。 */

@font-face {
  font-family: "Latin Serif ZH";
  src: local("Times New Roman"), local("TimesNewRomanPSMT"), local("Times"), local("Liberation Serif"), local("Tinos"), local("Nimbus Roman");
  font-weight: 400; font-style: normal;
  unicode-range: U+0000-00B6, U+00B8-024F, U+0300-036F, U+1E00-1EFF, U+20AC, U+2122, U+2212;
}
@font-face {
  font-family: "Latin Serif ZH";
  src: local("Times New Roman Bold"), local("TimesNewRomanPS-BoldMT"), local("Times Bold"), local("Liberation Serif Bold"), local("Tinos Bold");
  font-weight: 700; font-style: normal;
  unicode-range: U+0000-00B6, U+00B8-024F, U+0300-036F, U+1E00-1EFF, U+20AC, U+2122, U+2212;
}
@font-face {
  font-family: "Latin Serif ZH";
  src: local("Times New Roman Italic"), local("TimesNewRomanPS-ItalicMT"), local("Times Italic"), local("Liberation Serif Italic"), local("Tinos Italic");
  font-weight: 400; font-style: italic;
  unicode-range: U+0000-00B6, U+00B8-024F, U+0300-036F, U+1E00-1EFF, U+20AC, U+2122, U+2212;
}
@font-face {
  font-family: "Latin Serif ZH";
  src: local("Times New Roman Bold Italic"), local("TimesNewRomanPS-BoldItalicMT"), local("Times Bold Italic"), local("Liberation Serif Bold Italic"), local("Tinos Bold Italic");
  font-weight: 700; font-style: italic;
  unicode-range: U+0000-00B6, U+00B8-024F, U+0300-036F, U+1E00-1EFF, U+20AC, U+2122, U+2212;
}

/* 英文页面默认也用等线，但英文里的撇号、引号、破折号改由西文字体显示：
   中文字体把这些标点做成全角，放在英文里会多出一个空格（如 interpreters’ cognitive）。 */
@font-face {
  font-family: "Latin Punct";
  src: local("Segoe UI"), local("Helvetica Neue"), local("Helvetica"), local("Arial"), local("Liberation Sans"), local("DejaVu Sans");
  font-weight: 400;
  unicode-range: U+2010-2027, U+2030-205E;
}
@font-face {
  font-family: "Latin Punct";
  src: local("Segoe UI Bold"), local("Helvetica Neue Bold"), local("Helvetica Bold"), local("Arial Bold"), local("Liberation Sans Bold"), local("DejaVu Sans Bold");
  font-weight: 700;
  unicode-range: U+2010-2027, U+2030-205E;
}

/* ---------- 设计变量 ---------- */

:root {
  --paper: #ffffff;
  --wash: #f3f5f7;
  --ink: #17202a;
  --ink-2: #566170;
  --rule: #dde2e8;
  --accent: #1a5fd0;      /* 强调色：钴蓝。想换颜色只改这两行 */
  --accent-deep: #144cad; /* 鼠标悬停时略深一档 */
  --on-accent: #ffffff;

  --w-site: 62rem;
  --w-text: 43rem;
  --gutter: 6.5rem;

  /* 非衬线：等线优先 */
  --sans: "DengXian", "等线", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", "Noto Sans SC", sans-serif;
  --sans-en: "Latin Punct", "DengXian", "等线", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", "Noto Sans SC", sans-serif;
  /* 衬线：西文 Times New Roman，中文宋体 */
  --serif-en: "Times New Roman", Times, "Liberation Serif", "SimSun", "宋体", "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", "Noto Serif SC", serif;
  --serif-zh: "Latin Serif ZH", "SimSun", "宋体", "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", "Noto Serif SC", serif;

  color-scheme: light;
}

/* 当前字体：由 <html data-font="serif"> 切换；页面里夹着另一种语言的片段（带 lang 属性）时各取各的写法 */
:lang(zh) { --font: var(--sans); --leading: 1.8; --track: 0.02em; }
:lang(en) { --font: var(--sans-en); --leading: 1.65; --track: 0; }
:root[data-font="serif"]:lang(zh), :root[data-font="serif"] :lang(zh) { --font: var(--serif-zh); }
:root[data-font="serif"]:lang(en), :root[data-font="serif"] :lang(en) { --font: var(--serif-en); }

/* ---------- 基础 ---------- */

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

html {
  /* 字号随窗口宽度放大：1440 以下 17px，1920 时 20px，2240 以上 22px。
     版面宽度都以 rem 计，所以整体等比放大，而每行的字数不变。 */
  font-size: clamp(1.0625rem, 0.625vw + 0.5rem, 1.375rem);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  line-height: var(--leading);
  text-autospace: normal;
  line-break: strict;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

:where([lang]) { font-family: var(--font); }
/* 中文页面里夹着的英文片段不沿用中文的字距 */
:where([lang|="en"]) { letter-spacing: 0; }

h1, h2, h3 {
  font-weight: 700;
  line-height: 1.3;
  margin: 0;
  letter-spacing: var(--track);
}

p { margin: 0; }
a { color: inherit; }
img { max-width: 100%; height: auto; }
i, em, cite { font-style: italic; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}
::selection { background: var(--accent); color: var(--on-accent); }

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  background: var(--ink);
  color: var(--paper);
  padding: 0.5rem 0.9rem;
  border-radius: 4px;
  z-index: 10;
}
.skip:focus { top: 1rem; }

/* ---------- 顶栏 ---------- */

.masthead { border-bottom: 1px solid var(--rule); }
.masthead__inner {
  max-width: var(--w-site);
  margin: 0 auto;
  padding: 0.9rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem 2rem;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  margin-right: auto;
}
/* 站标的高度按大写字母来定，y 的尾巴会伸出画框，下面留一点空，不让它碰到顶栏的分隔线 */
.brand__mark { display: block; height: 2.3rem; width: auto; margin-bottom: 0.3rem; color: var(--accent); overflow: visible; }
.brand:hover .brand__mark { color: var(--accent-deep); }
.brand__name {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: var(--track);
}

.nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 1.75rem;
}
.nav a {
  display: block;
  padding: 0.3rem 0;
  color: var(--ink-2);
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
}
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }

.tools { display: flex; align-items: center; gap: 0.9rem; }

/* 字体开关：非衬线 / 衬线 */
.seg {
  display: inline-flex;
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 2px;
  font-size: 0.8125rem;
  line-height: 1.5;
}
.seg button {
  font: inherit;
  padding: 0.1rem 0.7rem;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--ink-2);
  cursor: pointer;
  white-space: nowrap;
}
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--wash); color: var(--ink); }
.seg button[data-font="sans"] { font-family: var(--sans); }
.seg button[data-font="serif"]:lang(en) { font-family: var(--serif-en); }
.seg button[data-font="serif"]:lang(zh) { font-family: var(--serif-zh); }

/* 另一种语言的入口 */
.langlink {
  font-size: 0.875rem;
  color: var(--ink-2);
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-underline-offset: 0.22em;
  white-space: nowrap;
}
.langlink:hover { color: var(--accent); text-decoration-color: currentColor; }

@media (max-width: 760px) {
  .masthead__inner { padding: 0.8rem 1.15rem 0; gap: 0.6rem 0.75rem; }
  /* 手机上把站名、字体开关和语言入口收在同一行 */
  .brand { gap: 0.5rem; }
  .brand__mark { height: 2rem; }
  .brand__name { font-size: 1.05rem; }
  .tools { gap: 0.6rem; }
  .seg { font-size: 0.75rem; }
  .seg button { padding: 0.1rem 0.5rem; }
  .langlink { font-size: 0.8125rem; }
  .nav { order: 3; flex-basis: 100%; margin: 0 -1.15rem; overflow-x: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav ul { padding: 0 1.15rem; gap: 1.5rem; }
  .nav a { padding: 0.45rem 0 0.55rem; }
}
/* 手机竖屏放不下五个栏目：收起“Home”（左上角的站标就是回首页的入口），其余四项一屏排完 */
@media (max-width: 480px) {
  .nav__home { display: none; }
  .nav ul { gap: clamp(0.9rem, 4vw, 1.5rem); }
  .nav a { font-size: 0.94rem; }
}

/* ---------- 主体与页脚 ---------- */

.main {
  flex: 1;
  width: 100%;
  max-width: var(--w-site);
  margin: 0 auto;
  padding: 3.75rem 1.5rem 5.5rem;
}
@media (max-width: 760px) {
  .main { padding: 2.25rem 1.15rem 4rem; }
}

.footer { border-top: 1px solid var(--rule); color: var(--ink-2); font-size: 0.875rem; }
.footer__inner {
  max-width: var(--w-site);
  margin: 0 auto;
  padding: 1.4rem 1.5rem 1.8rem;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.4rem 2rem;
}
.footer__extra { margin-left: 1em; }
.footer__links { display: flex; gap: 1.4rem; flex-wrap: wrap; }
.footer a { text-decoration-color: var(--rule); text-underline-offset: 0.2em; }
.footer a:hover { color: var(--ink); text-decoration-color: currentColor; }

/* ---------- 首页 ---------- */

.home {
  display: grid;
  grid-template-columns: 13.5rem minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  grid-template-areas: "profile hero" "profile body";
  column-gap: 4.5rem;
}
.hero { grid-area: hero; }
/* 左栏固定在页面顶部，头像上沿与右侧姓名的字顶对齐；不随滚动移动 */
.profile { grid-area: profile; align-self: start; margin-top: 0.45rem; }
.home__body { grid-area: body; }

.hero__name {
  font-size: 2.75rem;
  line-height: 1.15;
  letter-spacing: 0.04em;
}
:lang(en) > .hero__name, .hero__name:lang(en) { letter-spacing: -0.005em; }
.hero__alt {
  margin-left: 0.4em;
  font-size: 1.25rem;
  font-weight: 400;
  color: var(--ink-2);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* 研究介绍：主行 + 另一语言的副行，取双语字幕的排法 */
.subtitle__main {
  margin-top: 1.4rem;
  font-size: 1.375rem;
  line-height: 1.55;
  letter-spacing: var(--track);
  text-wrap: pretty;
}

.home__body { margin-top: 2.25rem; padding-top: 2.25rem; border-top: 1px solid var(--rule); }

.profile__photo {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 6px;
  background: var(--wash);
}
.profile__photo--empty {
  display: grid;
  place-items: center;
  font-size: 5rem;
  line-height: 1;
  color: var(--rule);
}
.profile__facts, .profile__links { list-style: none; margin: 0; padding: 0; }
.profile__facts { margin-top: 1.15rem; font-size: 0.9375rem; line-height: 1.6; color: var(--ink-2); }
.profile__facts li + li { margin-top: 0.15rem; }
.profile__role { color: var(--ink); font-weight: 700; }
.profile__links { margin-top: 0.9rem; padding-top: 0.9rem; border-top: 1px solid var(--rule); font-size: 0.9375rem; line-height: 1.6; }
.profile__links li + li { margin-top: 0.3rem; }
.profile__links a { color: var(--accent); text-decoration-color: var(--rule); text-underline-offset: 0.22em; overflow-wrap: anywhere; }
.profile__links a:hover { color: var(--accent-deep); text-decoration-color: currentColor; }

@media (max-width: 900px) {
  .home {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
    grid-template-areas: "hero" "profile" "body";
  }
  .profile {
    display: grid;
    grid-template-columns: 6.5rem minmax(0, 1fr);
    gap: 1.25rem;
    align-items: start;
    margin-top: 1.75rem;
  }
  .profile__photo--empty { font-size: 2.6rem; }
  .profile__facts { margin-top: 0; }
  .home__body { margin-top: 1.75rem; padding-top: 1.75rem; }
  .hero__name { font-size: 2.25rem; }
  .subtitle__main { font-size: 1.25rem; }
}

/* ---------- 列表条目：时间栏 + 内容 ---------- */

.entries { list-style: none; margin: 0; padding: 0; }
.entry {
  display: grid;
  grid-template-columns: var(--gutter) minmax(0, 1fr);
  column-gap: 1.5rem;
  padding: 1.2rem 0 1.25rem;
  border-bottom: 1px solid var(--rule);
}
.entry__time {
  padding-top: 0.2rem;
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums lining-nums;
}
.entry__title {
  font-size: 1.1875rem;
  line-height: 1.45;
  font-weight: 700;
  letter-spacing: var(--track);
  text-wrap: pretty;
}
.entry__title a { text-decoration: underline; text-decoration-color: var(--rule); text-decoration-thickness: 1px; text-underline-offset: 0.24em; }
.entry__title a:hover { color: var(--accent); text-decoration-color: currentColor; }
.entry__meta { margin-top: 0.35rem; font-size: 0.9375rem; line-height: 1.6; color: var(--ink-2); }
.entry__authors, .entry__source { display: block; }
.entry__authors strong { color: var(--ink); font-weight: 700; }
.entry__excerpt { margin-top: 0.4rem; font-size: 0.9688rem; line-height: 1.7; color: var(--ink-2); }
:lang(en).entry__excerpt, .entry__excerpt:lang(en) { line-height: 1.6; }
.entry__links { margin-top: 0.55rem; display: flex; flex-wrap: wrap; gap: 0.2rem 1.25rem; font-size: 0.875rem; }
.entry__links a { color: var(--accent); text-decoration-color: var(--rule); text-underline-offset: 0.22em; }
.entry__links a:hover { color: var(--accent-deep); text-decoration-color: currentColor; }

/* 圆点（主色）：这篇论文附有作者解读 */
.has-note::before {
  content: "";
  display: inline-block;
  width: 0.45em;
  height: 0.45em;
  margin-right: 0.45em;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: 0.12em;
}

.entries--grouped .entry--repeat .entry__time { visibility: hidden; }
.entries--grouped .entry--lead:not(:first-child):not(.entry--first) { margin-top: 1.5rem; }
.entries--grouped .entry--lead .entry__time { color: var(--ink); font-weight: 700; }
.entry[hidden] { display: none; }

.phase { white-space: nowrap; margin-right: 0.75em; }
.phase::before {
  content: "";
  display: inline-block;
  width: 0.45em;
  height: 0.45em;
  margin-right: 0.4em;
  border-radius: 50%;
  border: 1px solid var(--ink-2);
  vertical-align: 0.12em;
}
.phase--ongoing { color: var(--ink); }
.phase--ongoing::before { background: var(--accent); border-color: var(--accent); }

@media (max-width: 640px) {
  .entry { grid-template-columns: minmax(0, 1fr); padding: 1.05rem 0 1.1rem; }
  .entry__time { padding-top: 0; margin-bottom: 0.15rem; }
  .entries--grouped .entry--repeat .entry__time { display: none; }
  .entry__time:empty { display: none; }
}

/* Students 页：网站项目、文章两组列表 */
.group { margin-top: 2.75rem; }
.group__title { font-size: 1.3125rem; line-height: 1.4; padding-bottom: 0.65rem; letter-spacing: var(--track); }
.group .entry__title { font-size: 1.125rem; }
.entry__authors--plain { color: var(--ink); }
/* 姓名和单位排在同一行：姓名用正文色，单位用次要文字色 */
.entry__byline { display: block; }
.entry__byline .entry__authors { display: inline; }
.page__intro.prose { font-size: 1rem; }
.article__author { color: var(--ink); font-weight: 700; }
.article__byline { min-width: 0; }

/* ---------- 栏目页与文章页 ---------- */

.page, .article { max-width: var(--w-text); margin: 0 auto; }
.page--center { text-align: center; padding: 3rem 0; }

.page__head { margin-bottom: 1.75rem; }
.page__head h1, .article__head h1 { font-size: 2.125rem; line-height: 1.3; text-wrap: balance; }
.page__intro { margin-top: 0.8rem; color: var(--ink-2); max-width: 38rem; }
.page--center .page__intro { margin-inline: auto; }
.page__intro a { color: var(--accent); text-decoration-color: var(--rule); text-underline-offset: 0.2em; }
.page .entries { border-top: 1px solid var(--ink); }
.empty { color: var(--ink-2); padding: 2rem 0; border-top: 1px solid var(--rule); }

.crumb { margin-bottom: 0.7rem; font-size: 0.875rem; color: var(--ink-2); }
.crumb a { text-decoration-color: var(--rule); text-underline-offset: 0.22em; }
.crumb a:hover { color: var(--accent); text-decoration-color: currentColor; }

.filter { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-bottom: 1.5rem; }
.filter button {
  font: inherit;
  font-size: 0.875rem;
  line-height: 1.5;
  padding: 0.2rem 0.8rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: none;
  color: var(--ink-2);
  cursor: pointer;
}
.filter button:hover { color: var(--ink); border-color: var(--ink-2); }
.filter button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }

.article__head { margin-bottom: 2.25rem; }
.article__meta {
  margin-top: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.3rem 1.1rem;
  font-size: 0.9375rem;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums lining-nums;
}
.tags { display: inline-flex; flex-wrap: wrap; gap: 0.4rem; }
.tags a {
  padding: 0 0.6rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-size: 0.8125rem;
  line-height: 1.7;
  text-decoration: none;
}
.tags a:hover { color: var(--accent); border-color: currentColor; }

.pubmeta { margin-top: 1rem; line-height: 1.65; }
.pubmeta__authors strong { font-weight: 700; }
.pubmeta__source, .pubmeta__kind { color: var(--ink-2); }
.pubmeta__kind { font-size: 0.9375rem; margin-top: 0.15rem; }

.actions { margin-top: 1.25rem; display: flex; flex-wrap: wrap; gap: 0.6rem; }
.page--center .actions { justify-content: center; }
.btn {
  display: inline-block;
  font: inherit;
  font-size: 0.9063rem;
  line-height: 1.5;
  padding: 0.35rem 0.95rem;
  border: 1px solid var(--ink);
  border-radius: 4px;
  background: none;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: var(--ink); color: var(--paper); }
.btn--solid { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn--solid:hover { background: var(--accent-deep); border-color: var(--accent-deep); color: var(--on-accent); }

.article__section { margin-top: 3rem; }
.article__section > h2 {
  font-size: 1.375rem;
  padding-bottom: 0.55rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--ink);
}
.article__section > h2.has-note::before { vertical-align: 0.18em; margin-right: 0.5em; }
.lead { font-size: 1.1875rem; line-height: 1.7; margin-bottom: 2rem; }

.notice {
  margin-bottom: 1.5rem;
  padding: 0.65rem 1rem;
  background: var(--wash);
  border-radius: 6px;
  font-size: 0.9063rem;
  color: var(--ink-2);
}
.notice--draft { max-width: var(--w-text); margin-inline: auto; color: var(--ink); box-shadow: inset 3px 0 0 var(--accent); }
/* “LLM translated” 标注 */
.llm-tag {
  display: inline-block;
  padding: 0 0.5em;
  border: 1px solid var(--accent);
  border-radius: 4px;
  font-size: 0.75rem;
  line-height: 1.75;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}
.notice--llm .llm-tag { margin-right: 0.7em; background: var(--paper); }
.notice--llm a { margin-left: 0.4em; color: var(--accent); text-decoration-color: var(--rule); text-underline-offset: 0.2em; white-space: nowrap; }
.entry__llm { margin-top: 0.5rem; line-height: 1; }

.pager {
  margin-top: 2.5rem;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1rem;
  align-items: baseline;
  font-size: 0.9375rem;
}
.pager a { text-decoration-color: var(--rule); text-underline-offset: 0.22em; }
.pager a:hover { color: var(--accent); text-decoration-color: currentColor; }
.pager [rel="next"] { text-align: right; grid-column: -2; }
.pager__count { color: var(--ink-2); font-size: 0.875rem; }
.pager--posts { grid-template-columns: 1fr 1fr; margin-top: 3.5rem; padding-top: 1.25rem; border-top: 1px solid var(--rule); align-items: start; }
.pager--posts a { text-decoration: none; }
.pager__label { display: block; font-size: 0.8125rem; color: var(--ink-2); }
.pager__title { font-weight: 700; line-height: 1.45; }

/* ---------- 正文排版 ---------- */

.prose { line-height: var(--leading); font-size: 1rem; }
.prose > * { margin-top: 0; margin-bottom: 0; }
.prose > * + * { margin-top: 1.15em; }
.prose:lang(zh) p { text-align: justify; }
/* 站点设置里把中文正文改成了左对齐（:where 不抬高优先级，题注、文献这些例外照旧） */
:where(:root[data-align-zh="left"]) .prose:lang(zh) p { text-align: left; }
/* 英文每行控制在 80 个字符左右；只约束成段的文字，表格和图片仍占满正文栏 */
.prose:lang(en) > :is(p, ul, ol, blockquote, .footnotes), .lead:lang(en) { max-width: 37rem; }

.prose h2 { font-size: 1.375rem; line-height: 1.4; margin-top: 2.4em; }
.prose h3 { font-size: 1.1563rem; line-height: 1.45; margin-top: 2em; }
.prose h4, .prose h5, .prose h6 { font-size: 1rem; font-weight: 700; margin-top: 1.8em; }
.prose h1 { font-size: 1.625rem; margin-top: 2.4em; }
.prose > :first-child { margin-top: 0; }
.prose h2 + *, .prose h3 + *, .prose h4 + * { margin-top: 0.7em; }

.prose a { color: var(--accent); text-decoration: underline; text-decoration-color: var(--rule); text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
.prose a:hover { color: var(--accent-deep); text-decoration-color: currentColor; }
.prose strong { font-weight: 700; }
/* 下划线与删除线：线画得清楚一点，下划线离开字脚（中文字没有下伸部分，贴得太近会糊在一起） */
.prose u { text-decoration: underline; text-decoration-thickness: max(1px, 0.06em); text-underline-offset: 0.25em; text-decoration-skip-ink: none; }
.prose :is(del, s) { text-decoration: line-through; text-decoration-thickness: max(1px, 0.07em); color: var(--ink-2); }

.prose ul, .prose ol { padding-left: 1.5em; }
.prose li + li { margin-top: 0.3em; }
.prose li > ul, .prose li > ol { margin-top: 0.3em; }
.prose li::marker { color: var(--ink-2); }

.prose blockquote {
  margin-inline: 0;
  padding-left: 1.2rem;
  border-left: 2px solid var(--rule);
  color: var(--ink-2);
}
.prose blockquote > * + * { margin-top: 0.8em; }

.prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.875em;
  background: var(--wash);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}
.prose pre {
  background: var(--wash);
  padding: 1rem 1.15rem;
  border-radius: 6px;
  overflow-x: auto;
  line-height: 1.6;
  font-size: 0.9375rem;
}
.prose pre code { background: none; padding: 0; font-size: 0.875rem; }

.prose img { display: block; border-radius: 4px; }
.prose figure { margin: 2em 0; }
.prose figure img { margin: 0 auto; }
.prose figcaption { margin-top: 0.65em; font-size: 0.875rem; line-height: 1.6; color: var(--ink-2); text-align: center; }
/* 并排的图片（Markdown 里把两到四张图写在同一段）：等宽、裁成同样的比例，手机上改为上下排列 */
.prose .figrow { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 1rem; margin: 2em 0; max-width: none; }
.prose .figrow figure { margin: 0; }
.prose .figrow img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }
@media (max-width: 560px) {
  .prose .figrow { grid-template-columns: 1fr; gap: 1.25rem; }
}
.prose audio, .prose video, .prose iframe { max-width: 100%; }

.table-wrap { overflow-x: auto; }
.prose table { border-collapse: collapse; width: 100%; font-size: 0.9375rem; line-height: 1.6; font-variant-numeric: tabular-nums lining-nums; }
.prose th, .prose td { padding: 0.5rem 1rem 0.5rem 0; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: top; }
.prose th { font-weight: 700; border-bottom-color: var(--ink); white-space: nowrap; }
.prose th:last-child, .prose td:last-child { padding-right: 0; }
@media (max-width: 480px) {
  /* 手机上列与列之间收紧一些，五六列的表格也尽量不用横向滚动 */
  .prose th, .prose td { padding-right: 0.6rem; }
}
/* 通栏的一行（问卷的题干、分组的小标题）：文字可以换行，略重一些 */
.prose tr.row-span > :is(th, td) { white-space: normal; font-weight: 600; padding-right: 0; }
.prose tbody tr.row-span > td { padding-top: 0.9rem; }

.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 2.5em 0; }

.fn-ref { line-height: 0; font-size: 0.75em; }
.fn-ref a { text-decoration: none; color: var(--accent); padding: 0 0.15em; }
.footnotes { margin-top: 3em; padding-top: 1.1em; border-top: 1px solid var(--rule); font-size: 0.9063rem; color: var(--ink-2); }
.footnotes ol { margin: 0; }
.footnotes li:target, :target > .fn-ref { background: var(--wash); }
.prose .fn-back { text-decoration: none; color: var(--ink-2); }
.prose .fn-back:hover { color: var(--accent); }

/* ---------- 其它 ---------- */

/* 站长登录后右下角的一排小按钮：外观（重点色显示，点开是试色和排版的小面板）、表情、编辑 */
.admintools { position: fixed; right: 1.1rem; bottom: 1.1rem; z-index: 21; display: flex; gap: 0.4rem; }
.admintools__btn {
  padding: 0.4rem 0.95rem;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font: inherit;
  font-size: 0.8125rem;
  line-height: 1.5;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 2px 10px rgb(23 32 42 / 0.18);
}
.admintools__btn:hover { background: var(--accent); color: var(--on-accent); }
.admintools__btn--accent { background: var(--accent); color: var(--on-accent); }
.admintools__btn--accent:hover { background: var(--accent-deep, var(--accent)); }
.admintools__btn:is([aria-expanded="true"], [aria-pressed="true"]) { outline: 2px solid var(--accent); outline-offset: 2px; }
@media print { .admintools, .accenttool { display: none !important; } }

[hidden] { display: none !important; }

/* ---------- 长文阅读：博客文章、学生文章、论文解读 ---------- */
/* 这三类页面的正文按“读文章”来排，与其它页面分开设定：
   - 字号：笔记本上 17px，1920 宽约 18.5px，更宽的屏幕到 20px 为止（界面其余部分仍按原来的比例放大）；
   - 行距：中文 1.9，英文 1.7；每行中文约 39 个字，英文约 75 个字符；
   - 段落：中文每段首行缩进两个字；英文每一节的第一段不缩进，其余各段缩进。段与段靠缩进区分，之间只留很小的间隔。
   字号和行距可以在后台“站点设置 → 文章排版”里改，也可以登录后在文章页右下角的“外观”面板里边调边看。 */
:root {
  --read-base: clamp(17px, 0.3125vw + 12.5px, 20px);
  --read-scale: 1;      /* 字号倍率，后台可调（0.85–1.3） */
  --read-leading: 1.9;  /* 中文行距，后台可调；英文自动少 0.2 */
  --read-size: calc(var(--read-base) * var(--read-scale));
}
.article--read { max-width: calc(var(--read-size) * 39); }
.article--read:lang(en) { max-width: calc(var(--read-size) * 1.06 * 35.5); }
.article--read .article__head h1 { font-size: calc(var(--read-base) * 1.85); line-height: 1.35; }

.prose--read { font-size: var(--read-size); line-height: var(--read-leading); }
.prose--read:lang(zh) { text-autospace: normal; }
.prose--read:lang(en) { font-size: calc(var(--read-size) * 1.06); line-height: calc(var(--read-leading) - 0.2); }
.prose--read:lang(en) > :is(p, ul, ol, blockquote, .footnotes) { max-width: none; }

.prose--read > p { text-wrap: pretty; }
.prose--read > p + p { margin-top: 0.5em; }
.prose--read:lang(zh) > p { text-indent: 2em; }
/* 英文：每一节的第一段顶格，其余各段首行缩进。列表、表格、图片、引文之后另起的段落同样缩进，
   这样“哪一段缩进”只取决于它是不是一节的开头，全篇一致。
   （用 :where() 把这几条的优先级压平，后面的例外规则才能按书写顺序生效。） */
/* 英文正文两端对齐。只对齐而不断词的话，词与词之间会被拉出很大的空隙，所以同时打开自动断词
   （断开的词前后至少各留 3 个字母，总长不到 6 个字母的词不拆）。列表项、引文里的段落同样处理。 */
.prose:lang(en) :is(p, li) {
  text-align: justify;
  -webkit-hyphens: auto;
  hyphens: auto;
  hyphenate-limit-chars: 6 3 3;
  overflow-wrap: break-word;
}
/* 站点设置里把英文正文改成了左对齐：不再断词 */
:where(:root[data-align-en="left"]) .prose:lang(en) :is(p, li) { text-align: left; -webkit-hyphens: manual; hyphens: manual; }
@media (max-width: 600px) {
  /* 手机上每行只有三四十个字母，两端对齐容易拉出大空隙：放宽断词，并改回逐行排满的换行方式 */
  .prose:lang(en) :is(p, li) { hyphenate-limit-chars: 5 2 2; text-wrap: wrap; }
}
/* 夹在英文文章里的整段中文不参与英文的断词 */
.prose:lang(en) :is(p, li)[lang|="zh"] { -webkit-hyphens: manual; hyphens: manual; }
.prose--read:lang(en) > p { text-indent: 2em; }
.prose--read:lang(en) > p:where(:first-of-type),
.prose--read:lang(en) > :where(h2, h3, h4, h5, h6, hr) + p,
.prose--read:lang(en) > :where(.abstract) + p { text-indent: 0; }
/* 例外：书信的称呼、摘要、图表的题注、表注不缩进；英文里不成段的短行（标签、条目、署名）也不缩进 */
.prose--read > p:is(.noindent, .abstract, .caption, .tablenote) { text-indent: 0; }
.prose--read:lang(en) > p.line { text-indent: 0; text-align: left; -webkit-hyphens: manual; hyphens: manual; }

/* 正文里的小标题、图注、表格、脚注随正文字号走 */
.prose--read h2 { font-size: 1.3em; margin-top: 2.2em; }
.prose--read h3 { font-size: 1.12em; margin-top: 1.9em; }
.prose--read h4, .prose--read h5, .prose--read h6 { font-size: 1em; }
.prose--read h2 + *, .prose--read h3 + *, .prose--read h4 + * { margin-top: 0.8em; }
.prose--read figcaption { font-size: 0.86em; text-wrap: balance; }
.prose--read table { font-size: 0.92em; }
.prose--read .footnotes { font-size: 0.88em; line-height: 1.75; }
.prose--read li { text-indent: 0; }

/* 标题里不许在内部断行的词和短语（由 site.js 分词后标出） */
:is(h1, h2, h3) .w { white-space: nowrap; }
/* 文章页大标题：site.js 算好了每一行（.tl），各占一行；算出来的行万一放不下，照常折行，不会溢出 */
.article__head h1 .tmain { display: block; }
.article__head h1 .tl { display: block; text-wrap: wrap; }

/* 题目里的副标题（“主标题——副标题”）：另起一行，小一号 */
.article__head h1 .subtitle { display: block; margin-top: 0.35em; font-size: 0.66em; line-height: 1.45; }

/* 论文式的内容：摘要与关键词、参考文献、拼音指南（<ruby>）
   - 摘要、关键词（以“摘要：”“关键词：”“Abstract:”“Keywords:”开头的段落）：不缩进，字略小，左右各收进一些，成为正文之前单独的一块；
   - 参考文献（以 [1]、[2] 开头的段落）：字略小，悬挂缩进，序号单独占一栏；
   - 这些都是渲染时自动识别的，Markdown 里不用写任何标记。 */
.prose--read > p.abstract {
  text-indent: 0;
  margin-inline: 2em;
  font-size: 0.93em;
  line-height: calc(var(--read-leading) - 0.15);
  color: var(--ink-2);
}
.prose--read > p.abstract strong { color: var(--ink); }
.prose--read > p.abstract + p.abstract { margin-top: 0.7em; }
.prose--read > p.abstract + p:not(.abstract) { margin-top: 2.2em; }
.prose--read > p.abstract[lang|="en"] { line-height: calc(var(--read-leading) - 0.3); hyphens: auto; }
/* 摘要块里单独一行的题目（如中文文章里附的英文题目）：写作 <p class="abstract abstract--title">…</p> */
.prose--read > p.abstract--title { text-align: left; text-wrap: balance; hyphens: manual; }
.prose--read > p.abstract + p.abstract--title { margin-top: 1.5em; }
.prose > p.ref {
  text-indent: -2.7em;
  padding-left: 2.7em;
  margin-top: 0.45em;
  font-size: 0.9em;
  line-height: 1.7;
  text-align: left;
  overflow-wrap: anywhere;
}
.prose > p.ref .ref__n { display: inline-block; min-width: 2.7em; text-indent: 0; color: var(--ink-2); font-variant-numeric: tabular-nums; }
/* 不带序号的文献条目（“参考文献 / References”标题下的段落，如 APA 格式）：首行顶格，续行缩进 */
.prose > p.ref--plain { text-indent: -2em; padding-left: 2em; }
.prose > p.ref, .prose :is(ul, ol).refs > li { -webkit-hyphens: manual; hyphens: manual; }
/* 写成列表的文献（“参考文献 / References”标题下面的 - …… 或 1. ……）：字号、行距与文献条目一致；
   圆点列表去掉圆点，改成悬挂缩进；编号列表保留编号 */
.prose :is(ul, ol).refs { font-size: 0.9em; line-height: 1.7; }
.prose :is(ul, ol).refs > li { text-align: left; overflow-wrap: anywhere; text-indent: 0; }
.prose :is(ul, ol).refs > li + li { margin-top: 0.45em; }
.prose ul.refs { list-style: none; padding-left: 0; }
.prose ul.refs > li { padding-left: 2em; text-indent: -2em; }
.prose ul.refs > li::before { content: none; }
/* 表题与图题（紧挨着表格或图片的“表 1 ……”“Figure 1 ……”） */
.prose p.caption { margin-top: 1.7em; font-size: 0.9em; line-height: 1.6; text-align: center; text-wrap: balance; color: var(--ink-2); }
.prose p.caption strong { color: var(--ink); }
.prose p.caption + .table-wrap { margin-top: 0.5em; }
.prose .table-wrap + p.caption { margin-top: 0.6em; }
.prose :is(figure, .figrow) + p.caption { margin-top: -1.3em; }
/* 表注（表格下面以“注：”“Note:”开头的一段） */
.prose p.tablenote { margin-top: 0.6em; font-size: 0.9em; line-height: 1.6; color: var(--ink-2); }
.prose p.tablenote + p { margin-top: 1.15em; }
.prose--read > p[lang|="en"]:not(.abstract, .ref) { hyphens: auto; }
/* 拼音指南 / 逐词对照（<ruby>正文<rt>注音</rt></ruby>）：注音比正文宽时，把正文撑开，而不是让相邻的注音挤在一起 */
/* （用 text-bottom 对齐、行高取 normal：正文那一行的底边正好落在周围文字的底边上，与浏览器怎样给弹性盒取基线无关） */
.prose ruby { display: inline-flex; flex-direction: column-reverse; align-items: center; vertical-align: text-bottom; margin: 0 0.1em; line-height: normal; text-indent: 0; }
.prose rt { display: block; font-size: 0.6em; line-height: 1.15; letter-spacing: 0; color: var(--ink-2); white-space: nowrap; user-select: none; }
/* 中文文章里整段的外文引文（如转写的梵文）：单词长，两端对齐会把词距拉得很开，改为左对齐 */
.prose:lang(zh) blockquote p[lang|="en"] { text-align: left; }
@media (max-width: 480px) {
  .prose--read > p.abstract { margin-inline: 0.75em; }
}
.prose--read :is(ul, ol) { line-height: calc(var(--read-leading) - 0.15); }
@media (max-width: 480px) {
  /* 手机上每行字数少，行距收一点 */
  .prose--read { line-height: calc(var(--read-leading) - 0.1); }
  .prose--read:lang(en) { line-height: calc(var(--read-leading) - 0.25); }
}

/* 嵌在文章里、可以直接翻看的 PDF（![说明](/uploads/x.pdf)）：一个带边框的阅读窗口，下面是说明 */
.prose figure.pdfembed { margin: 1.8em 0; }
.prose figure.pdfembed iframe { display: block; width: 100%; height: min(82vh, 58rem); border: 1px solid var(--rule); border-radius: 6px; background: #e9ecf0; }
.prose figure.pdfembed figcaption a::after { content: " · PDF"; color: var(--ink-2); }
@media (max-width: 600px) { .prose figure.pdfembed iframe { height: min(68vh, 34rem); } }
@media print { .prose figure.pdfembed iframe { display: none; } }

/* 贴在文章上的表情：画在正文上方的一层，不占位置、不挡住选字和点链接 */
.has-stickers { position: relative; }
.prose > .stickers { position: absolute; left: 0; top: 0; width: 0; height: 0; margin: 0; z-index: 3; pointer-events: none; text-indent: 0; text-align: left; font-size: calc(var(--read-size) * 1.55); }
.sticker {
  position: absolute;
  transform: translate(-50%, -50%) rotate(var(--tilt, 0deg));
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Twemoji Mozilla", sans-serif;
  font-style: normal;
  font-weight: 400;
  line-height: 1;
  white-space: nowrap;
  filter: drop-shadow(0 2px 3px rgb(23 32 42 / 0.28));
  -webkit-user-select: none;
  user-select: none;
}
.is-stickering .prose--read { cursor: copy; }
.is-stickering .sticker { pointer-events: auto; cursor: grab; touch-action: none; }
.is-stickering .sticker:hover { filter: drop-shadow(0 0 0 #fff) drop-shadow(0 2px 6px rgb(23 32 42 / 0.45)); }
.is-stickering .sticker.is-dragging { cursor: grabbing; opacity: 0.8; }
@media print { .stickers, .stickerbar { display: none !important; } }
/* 选表情的小面板（站长点右下角的“表情”后出现） */
.stickerbar {
  position: fixed;
  right: 1rem;
  bottom: 3.7rem;
  z-index: 20;
  width: min(21.5rem, calc(100vw - 2rem));
  padding: 0.6rem 0.75rem;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 10px;
  box-shadow: 0 4px 18px rgb(23 32 42 / 0.14);
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--ink);
}
.stickerbar__set { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; }
.stickerbar__set button { padding: 0.2rem 0; border: 1px solid transparent; border-radius: 6px; background: none; font-size: 1.25rem; line-height: 1.3; cursor: pointer; font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }
.stickerbar__set button:hover { background: var(--wash, #f2f4f7); }
.stickerbar__set button.is-on { border-color: var(--accent); background: var(--wash, #f2f4f7); }
.stickerbar input { width: 100%; margin-top: 0.45rem; padding: 0.25rem 0.5rem; border: 1px solid var(--rule); border-radius: 4px; font: inherit; color: var(--ink); background: var(--paper); }
.stickerbar__hint { margin: 0.45rem 0 0; color: var(--ink-2); }
.stickerbar__hint.is-error { color: #b3261e; }

/* 试色与排版的小面板：点右下角的“外观”按钮展开，默认收起 */
.accenttool {
  position: fixed;
  right: 1rem;
  bottom: 3.7rem;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.5rem;
  max-width: min(30rem, calc(100vw - 2rem));
  padding: 0.5rem 0.75rem;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 10px;
  box-shadow: 0 4px 18px rgb(23 32 42 / 0.14);
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--ink);
}
.accenttool__label { font-weight: 700; }
.accenttool input[type="color"] { width: 2rem; height: 1.75rem; padding: 0; border: 1px solid var(--rule); border-radius: 4px; background: none; cursor: pointer; }
.accenttool input[type="text"] { width: 6.5rem; padding: 0.15rem 0.4rem; border: 1px solid var(--rule); border-radius: 4px; font: inherit; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: inherit; background: var(--paper); }
.accenttool button { padding: 0.15rem 0.7rem; border: 1px solid var(--rule); border-radius: 4px; background: var(--paper); font: inherit; color: inherit; cursor: pointer; }
.accenttool button[type="submit"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.accenttool__read { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.5rem; padding-top: 0.5rem; border-top: 1px solid var(--rule); }
.accenttool__read[hidden] { display: none; }
.accenttool__break { flex-basis: 100%; height: 0; }
.accenttool__read select { padding: 0.1rem 0.3rem; border: 1px solid var(--rule); border-radius: 4px; background: var(--paper); font: inherit; color: var(--ink); }
.accenttool__read label { display: inline-flex; align-items: center; gap: 0.35rem; }
.accenttool__read input[type="range"] { width: 6rem; accent-color: var(--accent); }
.accenttool__read output { min-width: 3.1rem; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--ink-2); }
.accenttool__msg { flex-basis: 100%; color: var(--ink-2); }
.accenttool__msg:empty { display: none; }
.accenttool__msg.is-ok { color: #1c6b3c; }
.accenttool__msg.is-error { color: #b3261e; }
@media (max-width: 640px) {
  .accenttool { bottom: 4.25rem; } /* 手机上让开右下角的“编辑此页” */
}

@media print {
  .accenttool { display: none !important; }
  .nav, .tools, .footer__links, .editlink, .filter, .skip { display: none !important; }
  body { font-size: 11pt; }
  .main { padding: 1.5rem 0; }
  a { text-decoration: none; }
}
