:root {
  color-scheme: light;
  --page: #f8f9fa;
  --surface: #ffffff;
  --surface-subtle: #f8f9fa;
  --ink: #202122;
  --muted: #54595d;
  --faint: #72777d;
  --line: #a2a9b1;
  --line-soft: #c8ccd1;
  --link: #3366cc;
  --link-hover: #202f77;
  --accent: #36c;
  --accent-soft: #eaecf0;
  --success: #14866d;
  --warning-bg: #fef6e7;
  --warning-line: #f2c779;
  --serif: Georgia, "Noto Serif SC", "Songti SC", SimSun, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  --reading-font: var(--sans);
  --header-offset: 82px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; background: var(--page); }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--page);
  font-family: var(--sans);
  line-height: 1.6;
}

body.night-mode {
  color-scheme: dark;
  --page: #202122;
  --surface: #27292d;
  --surface-subtle: #303236;
  --ink: #eaecf0;
  --muted: #c8ccd1;
  --faint: #a2a9b1;
  --line: #72777d;
  --line-soft: #54595d;
  --link: #8cb4ff;
  --link-hover: #b6ccff;
  --accent: #7aa6f7;
  --accent-soft: #3b3d41;
  --success: #6ad6b7;
  --warning-bg: #3d3321;
  --warning-line: #9c762f;
}

body.serif-reading { --reading-font: var(--serif); }

button, input { font: inherit; }

button { cursor: pointer; }

a { color: var(--link); text-decoration: none; }

a:hover { color: var(--link-hover); text-decoration: underline; }

a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  z-index: 20;
  top: 8px;
  left: 8px;
  padding: 8px 12px;
  background: var(--ink);
  color: var(--surface);
  transform: translateY(-140%);
}

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

.site-header {
  position: sticky;
  z-index: 10;
  top: 0;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(260px, 640px) minmax(140px, 1fr);
  align-items: center;
  min-height: 58px;
  gap: 16px;
  padding: 7px 24px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--surface);
}

.site-identity, .header-actions, .wordmark, .login-link, .article-topline, .article-title-row, .dialog-heading, .join-band {
  display: flex;
  align-items: center;
}

.site-identity { gap: 10px; min-width: 0; }

.icon-button {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  flex: 0 0 auto;
  padding: 0;
  color: var(--ink);
  border: 1px solid transparent;
  border-radius: 2px;
  background: transparent;
}

.icon-button:hover { border-color: var(--line-soft); background: var(--surface-subtle); }

.icon-button svg, .nav-link svg, .login-link svg, .search-form svg, .article-notice svg, .topic-item svg, .toc-feedback svg, .join-link svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.8;
}

.wordmark { gap: 9px; min-width: 0; color: var(--ink); }
.wordmark:hover { color: var(--ink); text-decoration: none; }

.wordmark-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--ink);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}

.wordmark-copy { display: grid; min-width: 0; line-height: 1.05; }
.wordmark-copy strong { font-family: var(--serif); font-size: 19px; font-weight: 700; white-space: nowrap; }
.wordmark-copy small { margin-top: 3px; color: var(--muted); font-size: 9px; letter-spacing: 1.1px; }

.search-form {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  min-height: 34px;
  padding-left: 9px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--surface);
}

.search-form > svg { color: var(--faint); width: 17px; height: 17px; }
.search-form input { min-width: 0; height: 32px; padding: 0 10px; color: var(--ink); border: 0; outline: 0; background: transparent; }
.search-form input::placeholder { color: var(--faint); }

.search-clear, .search-submit {
  display: grid;
  width: 34px;
  height: 32px;
  place-items: center;
  color: var(--ink);
  border: 0;
  border-left: 1px solid var(--line-soft);
  border-radius: 0;
  background: var(--surface-subtle);
}

.search-clear { border-left: 0; background: transparent; }
.search-clear[hidden] { display: none; }
.search-clear:hover, .search-submit:hover { color: var(--link); background: var(--accent-soft); }

.header-actions { justify-content: flex-end; gap: 3px; }

.login-link { gap: 6px; min-height: 34px; padding: 0 7px; font-size: 14px; white-space: nowrap; }
.login-link:hover { text-decoration: none; background: var(--surface-subtle); }

.page-shell {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr) 210px;
  width: min(1560px, 100%);
  min-height: calc(100vh - 58px);
  margin: 0 auto;
}

.page-shell.nav-collapsed { grid-template-columns: 0 minmax(0, 1fr) 210px; }

.site-navigation {
  min-width: 0;
  padding: 26px 18px 36px 24px;
  border-right: 1px solid var(--line-soft);
  background: var(--surface);
  transition: opacity 160ms ease, transform 160ms ease, padding 160ms ease;
}

.page-shell.nav-collapsed .site-navigation {
  padding-right: 0;
  padding-left: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-20px);
}

.site-navigation nav + nav { margin-top: 28px; }
.nav-heading, .toc-title, .eyebrow { margin: 0 0 8px; color: var(--faint); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .7px; }

.nav-link {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 32px;
  gap: 9px;
  padding: 4px 7px;
  color: var(--ink);
  border: 0;
  text-align: left;
  font-family: inherit;
  font-size: 14px;
  background: transparent;
}

.nav-link svg { color: var(--faint); width: 16px; height: 16px; }
.nav-link:hover { color: var(--link); text-decoration: none; background: var(--surface-subtle); }
.nav-link.is-current { color: var(--link); font-weight: 600; background: var(--accent-soft); }

.nav-note { margin-top: 32px; padding-top: 18px; border-top: 1px solid var(--line-soft); font-size: 13px; }
.nav-note dl { margin: 0 0 10px; }
.nav-note dl div { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; }
.nav-note dt { color: var(--muted); }
.nav-note dd { margin: 0; font-variant-numeric: tabular-nums; }

.article-page { min-width: 0; padding: 26px clamp(22px, 4vw, 64px) 56px; background: var(--surface); }
.search-notice { margin-bottom: 16px; padding: 10px 12px; border-left: 3px solid var(--accent); background: var(--accent-soft); color: var(--muted); font-size: 14px; }
.search-results { max-width: 860px; margin: 0 0 24px; padding: 16px; border: 1px solid var(--line); background: var(--surface-subtle); font-family: var(--sans); scroll-margin-top: var(--header-offset); }
.article-body section[id], .join-band[id], .site-info-band [id] { scroll-margin-top: var(--header-offset); }
.search-results-heading { display: flex; align-items: start; justify-content: space-between; gap: 16px; }
.search-results-heading .eyebrow { margin-bottom: 3px; }
.search-results-heading h2 { margin: 0; color: var(--ink); font-family: var(--serif); font-size: 22px; font-weight: 600; line-height: 1.3; }
.search-results-heading .icon-button { flex: 0 0 auto; }
.search-summary { margin: 12px 0 10px; color: var(--muted); font-size: 14px; line-height: 1.55; }
.search-result-list { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line-soft); }
.search-result-list li { margin: 0; border-bottom: 1px solid var(--line-soft); }
.search-result-link { display: grid; gap: 5px; padding: 12px 4px; color: var(--ink); }
.search-result-link:hover { color: var(--ink); text-decoration: none; background: var(--surface); }
.search-result-link:focus-visible { outline-offset: -2px; }
.search-result-label { color: var(--link); font-size: 16px; font-weight: 600; }
.search-result-snippet { color: var(--muted); font-size: 14px; line-height: 1.55; }
.search-result-snippet mark { padding: 0 1px; color: var(--ink); background: #f8e7a8; }
body.night-mode .search-result-snippet mark { color: #202122; background: #f8e7a8; }
.search-empty { padding: 12px 4px; color: var(--muted); font-size: 14px; line-height: 1.55; }

.article-topline { justify-content: space-between; gap: 12px; min-height: 34px; }
.breadcrumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; color: var(--faint); font-size: 13px; }
.breadcrumbs span { color: var(--faint); }
.article-action { margin-right: -5px; }

.article-title-row { justify-content: space-between; gap: 20px; padding: 13px 0 14px; border-bottom: 1px solid var(--line); }
.article-title-row h1 { margin: 0; font-family: var(--serif); font-size: 35px; font-weight: 500; line-height: 1.18; }
.article-subtitle { margin: 3px 0 0; color: var(--muted); font-family: var(--serif); font-size: 15px; }
.article-status { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); }

.article-tabs { display: flex; min-height: 42px; align-items: stretch; overflow-x: auto; border-bottom: 1px solid var(--line-soft); }
.tab { display: inline-flex; align-items: center; flex: 0 0 auto; padding: 0 10px; color: var(--link); border: 0; border-bottom: 2px solid transparent; background: transparent; font-size: 14px; }
.tab:hover { background: var(--surface-subtle); }
.tab.is-active { color: var(--ink); border-bottom-color: var(--ink); font-weight: 600; }
.tab-spacer { flex: 1 1 auto; min-width: 12px; }

.article-body { max-width: 100%; padding-top: 22px; font-family: var(--reading-font); font-size: 16px; line-height: 1.75; }
.article-body p { margin: 0 0 16px; }
.article-body .lead { max-width: 820px; font-size: 18px; line-height: 1.8; }
.article-body h2 { clear: both; margin: 35px 0 14px; padding-bottom: 6px; border-bottom: 1px solid var(--line); font-family: var(--serif); font-size: 25px; font-weight: 500; line-height: 1.3; }
.article-body h2::before { display: block; height: 72px; margin-top: -72px; content: ""; visibility: hidden; }
.article-body h3 { clear: both; margin: 28px 0 10px; color: var(--ink); font-family: var(--serif); font-size: 20px; font-weight: 600; line-height: 1.35; }
.article-body h3::before { display: block; height: 72px; margin-top: -72px; content: ""; visibility: hidden; }
.reference { margin-left: 2px; font-family: var(--sans); font-size: 11px; line-height: 1; white-space: nowrap; }
.reference a { text-decoration: none; }
.reference a:hover { text-decoration: underline; }

.infobox {
  float: right;
  width: min(320px, 43%);
  margin: 0 0 20px 28px;
  border: 1px solid var(--line);
  background: var(--surface-subtle);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.45;
}

.infobox-title { padding: 8px 12px; color: var(--ink); background: var(--accent-soft); font-family: var(--serif); font-size: 18px; font-weight: 600; text-align: center; }
.infobox figure { margin: 0; padding: 12px 12px 7px; }
.infobox img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: contain; border: 1px solid var(--line-soft); background: #fff; }
.infobox figcaption { margin-top: 7px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.infobox dl { margin: 0; }
.infobox dl div { display: grid; grid-template-columns: 86px minmax(0, 1fr); border-top: 1px solid var(--line-soft); }
.infobox dt, .infobox dd { padding: 7px 9px; }
.infobox dt { color: var(--muted); font-weight: 600; }
.infobox dd { margin: 0; }

.article-notice { display: flex; max-width: 820px; gap: 10px; margin: 20px 0 25px; padding: 11px 13px; border: 1px solid var(--warning-line); background: var(--warning-bg); color: var(--ink); font-family: var(--sans); font-size: 14px; line-height: 1.55; }
.article-notice svg { flex: 0 0 auto; margin-top: 3px; color: #906300; }

blockquote { max-width: 760px; margin: 24px 0; padding: 12px 18px; border-left: 3px solid var(--line); color: var(--muted); font-family: var(--serif); }
blockquote cite { display: block; margin-top: 8px; color: var(--faint); font-family: var(--sans); font-size: 13px; font-style: normal; }

.timeline-list { max-width: 820px; margin: 20px 0 4px; border-left: 2px solid var(--line-soft); font-family: var(--sans); }
.timeline-list > div { display: grid; grid-template-columns: 74px minmax(0, 1fr); gap: 15px; padding: 0 0 18px 17px; }
.timeline-list > div:last-child { padding-bottom: 0; }
.timeline-list time { color: var(--ink); font-family: var(--serif); font-size: 20px; font-weight: 600; line-height: 1.45; }
.timeline-list p { margin: 0; }

.topic-list { max-width: 820px; border-top: 1px solid var(--line-soft); }
.topic-item { display: grid; grid-template-columns: 28px minmax(0, 1fr) 20px; align-items: center; gap: 8px; min-height: 70px; padding: 12px 9px; border-bottom: 1px solid var(--line-soft); color: var(--ink); font-family: var(--sans); }
.topic-item:hover { color: var(--ink); text-decoration: none; background: var(--surface-subtle); }
.topic-item > svg:first-child { color: var(--accent); }
.topic-item > svg:last-child { color: var(--faint); width: 16px; height: 16px; }
.topic-item span { display: grid; }
.topic-item strong { font-size: 15px; }
.topic-item small { color: var(--muted); font-size: 13px; }

.official-intro { max-width: 820px; color: var(--muted); font-size: 14px; }
.official-grid { display: grid; max-width: 820px; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; font-family: var(--sans); }
.official-item { display: grid; grid-template-columns: 22px minmax(0, 1fr) 18px; align-items: start; gap: 10px; min-height: 112px; padding: 14px; border: 1px solid var(--line-soft); color: var(--ink); background: var(--surface); }
.official-item:hover { color: var(--ink); text-decoration: none; border-color: var(--line); background: var(--surface-subtle); }
.official-item > svg:first-child { width: 20px; height: 20px; color: var(--accent); }
.official-item > svg:last-child { width: 16px; height: 16px; color: var(--faint); }
.official-item span { display: grid; gap: 4px; }
.official-item strong { color: var(--link); font-size: 16px; }
.official-item small { color: var(--muted); font-size: 13px; line-height: 1.5; }

.reference-list { max-width: 820px; padding-left: 25px; color: var(--muted); font-family: var(--sans); font-size: 14px; }
.reference-list li + li { margin-top: 7px; }

.related-grid { display: grid; max-width: 820px; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; font-family: var(--sans); }
.related-grid a { display: grid; min-height: 132px; align-content: start; gap: 5px; padding: 14px; border: 1px solid var(--line-soft); color: var(--ink); background: var(--surface); }
.related-grid a:hover { color: var(--ink); text-decoration: none; border-color: var(--line); background: var(--surface-subtle); }
.related-grid span { color: var(--faint); font-size: 12px; }
.related-grid strong { color: var(--link); font-size: 16px; }
.related-grid small { color: var(--muted); font-size: 13px; line-height: 1.5; }

.join-band { justify-content: space-between; gap: 24px; margin-top: 54px; padding: 20px 0; border-top: 2px solid var(--ink); border-bottom: 1px solid var(--line-soft); font-family: var(--sans); }
.join-band h2 { margin: 0; font-family: var(--serif); font-size: 23px; font-weight: 500; line-height: 1.3; }
.join-band .eyebrow { margin-bottom: 4px; }
.join-link { display: inline-flex; align-items: center; flex: 0 0 auto; gap: 5px; font-size: 14px; white-space: nowrap; }
.join-link svg { width: 16px; height: 16px; }

.site-info-band {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  margin-top: 32px;
  padding-top: 22px;
  border-top: 1px solid var(--line-soft);
  font-family: var(--sans);
}
.site-info-band h2 { margin: 0 0 7px; font-family: var(--serif); font-size: 20px; font-weight: 500; line-height: 1.3; }
.site-info-band p:last-child { max-width: 430px; margin: 0; color: var(--muted); font-size: 14px; line-height: 1.65; }

.table-of-contents { align-self: start; position: sticky; top: var(--header-offset); margin: 26px 22px 0 0; padding: 0 0 18px 16px; border-left: 1px solid var(--line-soft); font-size: 14px; }
.table-of-contents nav { display: grid; gap: 2px; }
.table-of-contents nav a { display: block; padding: 4px 0; color: var(--muted); }
.table-of-contents nav a:hover { color: var(--link); text-decoration: none; }
.table-of-contents nav a.is-current { color: var(--link); font-weight: 600; }
.toc-feedback { display: inline-flex; align-items: center; gap: 6px; margin-top: 18px; color: var(--muted); font-size: 13px; }
.toc-feedback svg { width: 15px; height: 15px; }

.site-footer { display: flex; justify-content: space-between; gap: 20px; padding: 18px 24px 28px; border-top: 1px solid var(--line-soft); color: var(--muted); background: var(--page); font-size: 13px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 14px; }

.appearance-dialog { width: min(420px, calc(100vw - 32px)); padding: 0; color: var(--ink); border: 1px solid var(--line); border-radius: 2px; background: var(--surface); box-shadow: 0 18px 54px rgba(0, 0, 0, .25); }
.appearance-dialog::backdrop { background: rgba(32, 33, 34, .35); }
.appearance-dialog form { padding: 20px; }
.dialog-heading { justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.dialog-heading h2 { margin: 0; font-family: var(--serif); font-size: 25px; font-weight: 500; }
.dialog-heading .eyebrow { margin-bottom: 2px; }
.preference-row { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 13px 0; border-top: 1px solid var(--line-soft); cursor: pointer; }
.preference-row span { display: grid; }
.preference-row strong { font-size: 15px; }
.preference-row small { color: var(--muted); font-size: 13px; }
.preference-row input { width: 18px; height: 18px; accent-color: var(--accent); }
.font-options { display: grid; gap: 9px; margin: 0; padding: 13px 0 0; border: 0; border-top: 1px solid var(--line-soft); }
.font-options legend { padding: 0; margin-bottom: 5px; font-weight: 600; font-size: 15px; }
.font-options label { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.font-options input { accent-color: var(--accent); }

.nav-scrim { display: none; }
.nav-scrim[hidden] { display: none; }

@media (max-width: 1110px) {
  .page-shell, .page-shell.nav-collapsed { grid-template-columns: 208px minmax(0, 1fr); }
  .table-of-contents { display: none; }
  .page-shell.nav-collapsed { grid-template-columns: 0 minmax(0, 1fr); }
}

@media (max-width: 760px) {
  :root { --header-offset: 112px; }
  .site-header { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 7px 12px; }
  .search-form { grid-column: 1 / -1; grid-row: 2; }
  .header-actions .login-link span { display: none; }
  .header-actions { gap: 0; }
  .wordmark-copy small { display: none; }
  .wordmark-copy strong { font-size: 18px; }
  .page-shell, .page-shell.nav-collapsed { display: block; min-height: calc(100vh - 100px); }
  .site-navigation, .page-shell.nav-collapsed .site-navigation {
    position: fixed;
    z-index: 12;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(280px, calc(100vw - 56px));
    padding: 76px 18px 30px 20px;
    overflow-y: auto;
    border-right: 1px solid var(--line);
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-105%);
  }
  body.nav-open .site-navigation { transform: translateX(0); }
  .nav-scrim { position: fixed; z-index: 11; inset: 0; display: block; border: 0; background: rgba(0, 0, 0, .36); }
  .article-page { padding: 18px 18px 44px; }
  .article-title-row h1 { font-size: 30px; }
  .article-status { display: none; }
  .article-tabs { margin: 0 -18px; padding: 0 8px; }
  .article-body { font-size: 16px; }
  .article-body .lead { font-size: 17px; }
  .search-results { margin-bottom: 20px; padding: 14px; }
  .search-results-heading h2 { font-size: 20px; }
  .timeline-list > div { grid-template-columns: 58px minmax(0, 1fr); gap: 11px; padding-left: 13px; }
  .timeline-list time { font-size: 18px; }
  .infobox { float: none; width: 100%; max-width: 390px; margin: 0 auto 22px; }
  .official-grid { grid-template-columns: 1fr; }
  .related-grid { grid-template-columns: 1fr; }
  .related-grid a { min-height: 104px; }
  .join-band { display: grid; gap: 14px; }
  .site-info-band { grid-template-columns: 1fr; gap: 20px; }
  .site-footer { display: grid; gap: 8px; padding: 18px; }
}

@media (max-width: 430px) {
  .site-header { min-height: 102px; }
  .wordmark-mark { width: 31px; height: 31px; font-size: 12px; }
  .article-page { padding-right: 14px; padding-left: 14px; }
  .article-tabs { margin-right: -14px; margin-left: -14px; }
  .tab { padding-right: 8px; padding-left: 8px; font-size: 13px; }
  .topic-item { grid-template-columns: 25px minmax(0, 1fr) 17px; }
}
