/* docs.css — same palette as the site, reading layout instead of a canvas */
:root {
  --bg: #141414;
  --win: #2a2a2a;
  --win-soft: #232323;
  --win-deep: #1c1c1c;
  --line: #4a4a4a;
  --line-soft: #333333;
  --fg: #cccccc;
  --fg-strong: #ffffff;
  --muted: #8a8a8a;
  --dim: #6b6b6b;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue',
    Arial, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
  --radius: 6px;
  color-scheme: dark;
}

:root[data-theme='light'] {
  --bg: #ebebeb;
  --win: #d5d5d5;
  --win-soft: #dedede;
  --win-deep: #e3e3e3;
  --line: #b5b5b5;
  --line-soft: #c6c6c6;
  --fg: #333333;
  --fg-strong: #111111;
  --muted: #6a6a6a;
  --dim: #8a8a8a;
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

/* ---------- top bar ---------- */
.doc-top {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 56px;
  padding: 0 clamp(16px, 4vw, 28px);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-soft);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand svg { width: 26px; height: 26px; fill: var(--fg); flex: none; }

.brand b {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--fg-strong);
}

.brand span { font-size: 13px; color: var(--dim); }

.doc-top nav { display: flex; align-items: center; gap: 18px; font-size: 13px; }
.doc-top nav a { color: var(--muted); text-decoration: none; }
.doc-top nav a:hover { color: var(--fg-strong); }

.theme-dot {
  width: 14px;
  height: 14px;
  padding: 0;
  border: 0;
  background: var(--fg);
  cursor: pointer;
}
.theme-dot:hover { background: var(--fg-strong); }

/* ---------- shell ---------- */
.shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: clamp(24px, 5vw, 64px);
  max-width: 1180px;
  margin: 0 auto;
  padding: 36px clamp(16px, 4vw, 28px) 80px;
}

.side {
  position: sticky;
  top: 88px;
  align-self: start;
  font-size: 13px;
  max-height: calc(100vh - 110px);
  overflow: auto;
}

.side-home {
  display: block;
  padding: 5px 0;
  margin-bottom: 18px;
  color: var(--fg);
  text-decoration: none;
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: 10px;
}
.side-home.active { color: var(--fg-strong); }

.nav-section { margin-bottom: 20px; }

.nav-section p {
  margin: 0 0 6px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
}

.nav-section a {
  display: block;
  padding: 4px 0 4px 10px;
  color: var(--muted);
  text-decoration: none;
  border-left: 1px solid var(--line-soft);
}

.nav-section a:hover { color: var(--fg-strong); }
.nav-section a.active { color: var(--fg-strong); border-left-color: var(--fg); }

/* ---------- prose ---------- */
.main { min-width: 0; }

.prose { max-width: 72ch; }

.prose h1 {
  font-size: 34px;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 18px;
  color: var(--fg-strong);
}

.prose h2 {
  font-size: 21px;
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin: 42px 0 12px;
  padding-top: 18px;
  border-top: 1px solid var(--line-soft);
  color: var(--fg-strong);
}

.prose h3 {
  font-size: 16px;
  margin: 28px 0 8px;
  color: var(--fg-strong);
}

.prose p { margin: 0 0 14px; }

.prose ul, .prose ol { margin: 0 0 16px; padding-left: 22px; }
.prose li { margin: 4px 0; }

.prose a { color: var(--fg-strong); text-decoration: none; border-bottom: 1px solid var(--line); }
.prose a:hover { border-bottom-color: var(--fg); }

.prose code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--win-soft);
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  padding: 1px 5px;
  white-space: nowrap;
}

.prose pre {
  margin: 0 0 18px;
  padding: 14px 16px;
  background: var(--win-deep);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  overflow-x: auto;
  font-size: 12.5px;
  line-height: 1.75;
}

.prose pre code { background: none; border: 0; padding: 0; font-size: inherit; white-space: pre; }

.prose blockquote {
  margin: 0 0 18px;
  padding: 2px 0 2px 14px;
  border-left: 2px solid var(--line);
  color: var(--muted);
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 20px;
  font-size: 13.5px;
}

.prose th, .prose td {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
}

.prose th {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--dim);
  font-weight: 500;
}

.prose hr {
  border: 0;
  border-top: 1px solid var(--line-soft);
  margin: 32px 0;
}

/* ---------- pager ---------- */
.pager {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 56px;
  padding-top: 18px;
  border-top: 1px solid var(--line-soft);
  font-size: 14px;
}

.pager a {
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: var(--fg);
  text-decoration: none;
  max-width: 46%;
}
.pager a:hover { color: var(--fg-strong); }
.pager a span {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
}
.pager .next { text-align: right; margin-left: auto; }

/* ---------- narrow ---------- */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; gap: 28px; padding-top: 24px; }
  .side {
    position: static;
    max-height: none;
    border-bottom: 1px solid var(--line-soft);
    padding-bottom: 16px;
  }
  .nav-section { display: inline-block; margin: 0 22px 12px 0; vertical-align: top; }
  .nav-section a { border-left: 0; padding-left: 0; }
  .nav-section a.active { border-left: 0; }
  .prose h1 { font-size: 27px; }
  .prose h2 { font-size: 19px; }
}
