:root {
  --ink: #202124;
  --muted: #5f6368;
  --paper: #fff;
  --wash: #f6f4ef;
  --line: #d9d5cc;
  --link: #165a96;
  --measure: 780px;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

body.article-page {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Georgia, "Times New Roman", "Noto Serif CJK SC", "Songti SC", SimSun, serif;
  font-size: 18px;
  line-height: 1.72;
  text-rendering: optimizeLegibility;
}

a { color: var(--link); text-underline-offset: 0.14em; }
a:hover, a:focus { text-decoration-thickness: 2px; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
}

.skip-link:focus {
  left: 1rem;
  top: 0.75rem;
  z-index: 10;
  padding: 0.5rem 0.75rem;
  background: var(--paper);
  border: 2px solid var(--link);
}

.site-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  width: min(calc(100% - 2rem), 1080px);
  margin: 0 auto;
  padding: 1.15rem 0;
  border-bottom: 1px solid var(--line);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans CJK SC", sans-serif;
  font-size: 0.94rem;
}

.site-name { color: var(--ink); font-weight: 700; text-decoration: none; }
.language-switch { font-weight: 650; }

main { width: min(calc(100% - 2rem), 1080px); margin: 0 auto; }

.scholarly-article { padding: 3.5rem 0 5rem; }

.article-header,
.toc,
.article-text > section,
.article-text > h3,
.article-text > p,
.article-text > .equation,
.article-text > figure {
  width: min(100%, var(--measure));
  margin-left: auto;
  margin-right: auto;
}

.article-kicker {
  margin: 0 0 0.65rem;
  color: var(--muted);
  font: 700 0.82rem/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans CJK SC", sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.article-header h1 {
  margin: 0;
  font-size: clamp(2.1rem, 5.2vw, 4.25rem);
  line-height: 1.04;
  letter-spacing: -0.025em;
}

html[lang="zh-CN"] .article-header h1 {
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.byline { margin: 1.6rem 0 0.5rem; }
.publication-citation { margin: 0; color: var(--muted); }
.suggested-citation { margin: 0.65rem 0 0; color: var(--muted); font-size: 0.9rem; }

.resource-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1rem;
  margin-top: 1.5rem;
  padding: 1rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans CJK SC", sans-serif;
  font-size: 0.92rem;
}

.toc {
  margin-top: 2.5rem;
  padding: 1.25rem 1.5rem;
  background: var(--wash);
  border-radius: 4px;
}

.toc h2 { margin: 0 0 0.5rem; font-size: 1rem; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
.toc ol { margin: 0; padding-left: 1.3rem; columns: 2; column-gap: 2rem; }
.toc li { break-inside: avoid; margin: 0.2rem 0; }

.article-text { margin-top: 3.5rem; }
.article-text section { margin-top: 3.4rem; }
.article-text section:first-child { margin-top: 0; }
.article-text h2 { margin: 0 0 1.25rem; font-size: 2rem; line-height: 1.2; }
.article-text h3 { margin-top: 2.5rem; font-size: 1.38rem; line-height: 1.3; }
.article-text p { margin-top: 0; margin-bottom: 1.18rem; text-align: left; hyphens: none; }
.article-text .keywords { color: var(--muted); }
.article-text .publication-note { color: var(--muted); font-size: 0.95rem; }

.note-ref { font-size: 0.72em; line-height: 0; }
.note-ref a { text-decoration: none; }

.equation {
  margin-top: 2rem;
  margin-bottom: 2rem;
  padding: 1rem;
  overflow-x: auto;
  border: 1px solid var(--line);
  background: #fbfbfa;
  text-align: center;
  white-space: nowrap;
  font-family: "Times New Roman", serif;
}

.article-figure { margin-top: 2.5rem; margin-bottom: 2.5rem; }
.figure-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; align-items: center; }
.figure-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.figure-panel img { display: block; width: 100%; height: auto; }
.article-figure figcaption { margin-top: 0.8rem; color: var(--muted); font-size: 0.93rem; }
.figure-source { display: block; margin-top: 0.25rem; }

.endnotes {
  margin-top: 4rem !important;
  padding-top: 2rem;
  border-top: 2px solid var(--ink);
}

.endnotes ol { padding-left: 2.2rem; }
.endnotes li { margin: 0 0 0.9rem; font-size: 0.86rem; line-height: 1.55; }
.note-label { font-weight: 700; }
.note-back { text-decoration: none; }

.article-footer {
  width: min(calc(100% - 2rem), 1080px);
  margin: 0 auto;
  padding: 1.5rem 0 3rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans CJK SC", sans-serif;
  font-size: 0.9rem;
}

@media (max-width: 680px) {
  body.article-page { font-size: 17px; line-height: 1.68; }
  .site-bar { align-items: flex-start; }
  .scholarly-article { padding-top: 2.2rem; }
  .article-header h1 { font-size: 2.35rem; }
  .toc ol { columns: 1; }
  .article-text { margin-top: 2.6rem; }
  .article-text section { margin-top: 2.7rem; }
  .article-text h2 { font-size: 1.65rem; }
  .figure-grid, .figure-grid-4 { grid-template-columns: 1fr; }
  .resource-links { display: grid; }
}

@media print {
  .site-bar, .resource-links, .toc, .article-footer, .skip-link { display: none; }
  main, .scholarly-article, .article-header, .article-text > section { width: 100%; max-width: none; }
  body.article-page { font-size: 11pt; }
  a { color: inherit; text-decoration: none; }
}
