:root {
  --page-width: 900px;
  --text: #222;
  --muted: #666;
  --line: #e5e5e5;
  --link: #2457a7;
  --background: #fff;
  --soft-background: #f6f7f8;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--background);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.85;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  width: min(calc(100% - 40px), var(--page-width));
  margin: 0 auto;
}

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

a:hover,
a:focus-visible {
  text-decoration: underline;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.site-name {
  color: var(--text);
  font-weight: 700;
  white-space: nowrap;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 22px;
  font-size: 14px;
}

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

.site-nav a[aria-current="page"] {
  color: var(--text);
  font-weight: 600;
}

.article {
  padding-top: 72px;
  padding-bottom: 80px;
}

.breadcrumb {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 14px;
}

.article-header {
  padding-bottom: 42px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 14px;
}

h1,
h2,
h3 {
  color: #111;
  line-height: 1.35;
}

h1 {
  margin: 0 0 20px;
  font-size: clamp(32px, 7vw, 48px);
  letter-spacing: -0.03em;
}

h2 {
  margin: 0 0 18px;
  font-size: clamp(24px, 5vw, 30px);
}

h3 {
  margin: 30px 0 12px;
  font-size: 19px;
}

.lead {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  font-size: 18px;
}

.toc {
  margin: 38px 0 12px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--line);
}

.toc strong {
  display: block;
  margin-bottom: 10px;
}

.toc ol,
.toc ul {
  margin: 0;
  padding-left: 24px;
  columns: 2;
  column-gap: 48px;
}

.toc li {
  break-inside: avoid;
  margin: 5px 0;
}

section {
  padding: 46px 0;
  border-bottom: 1px solid var(--line);
}

section:last-child {
  border-bottom: 0;
}

p {
  margin: 0 0 18px;
}

p:last-child {
  margin-bottom: 0;
}

ul,
ol {
  padding-left: 24px;
}

li + li {
  margin-top: 6px;
}

figure {
  margin: 28px 0;
}

figcaption {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

pre {
  margin: 26px 0;
  padding: 20px;
  overflow-x: auto;
  color: #222;
  background: var(--soft-background);
  border: 1px solid var(--line);
  border-radius: 4px;
  font: 14px/1.7 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  white-space: pre;
  -webkit-overflow-scrolling: touch;
}

code {
  font-family: inherit;
}

p code,
li code,
td code {
  padding: 1px 5px;
  background: var(--soft-background);
  border: 1px solid var(--line);
  border-radius: 3px;
  font-size: 0.92em;
}

table {
  width: 100%;
  margin: 26px 0;
  border-collapse: collapse;
  font-size: 15px;
}

th,
td {
  padding: 12px 14px;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--soft-background);
  font-weight: 600;
}

.article-index {
  margin: 0;
  padding: 0;
  list-style: none;
}

.article-index li {
  padding: 19px 0;
  border-top: 1px solid var(--line);
}

.article-index li:last-child {
  border-bottom: 1px solid var(--line);
}

.article-index a {
  display: inline-block;
  margin-bottom: 3px;
  font-size: 18px;
  font-weight: 600;
}

.article-index p {
  margin: 0;
  color: var(--muted);
}

.note {
  margin: 26px 0;
  padding: 16px 18px;
  background: var(--soft-background);
  border-left: 3px solid var(--line);
}

.references ul {
  margin-bottom: 0;
}

.references li {
  overflow-wrap: anywhere;
}

.article-nav {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding-top: 34px;
  font-size: 14px;
}

.article-nav a:last-child {
  margin-left: auto;
  text-align: right;
}

.site-footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

.footer-inner {
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

@media (max-width: 720px) {
  html {
    scroll-padding-top: 64px;
  }

  .wrap {
    width: min(calc(100% - 28px), var(--page-width));
  }

  .header-inner {
    min-height: 56px;
  }

  .site-nav {
    display: none;
  }

  .article {
    padding-top: 48px;
    padding-bottom: 52px;
  }

  .breadcrumb {
    margin-bottom: 18px;
  }

  .article-header {
    padding-bottom: 32px;
  }

  .lead {
    font-size: 16px;
  }

  .toc {
    margin-top: 30px;
  }

  .toc ol,
  .toc ul {
    columns: 1;
  }

  section {
    padding: 36px 0;
  }

  pre {
    margin: 22px -2px;
    padding: 16px;
    font-size: 13px;
  }

  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  .article-nav {
    flex-direction: column;
    gap: 10px;
  }

  .article-nav a:last-child {
    margin-left: 0;
    text-align: left;
  }

  .footer-inner {
    min-height: 100px;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    text-align: center;
  }
}

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