/* DNS 手册 — one stylesheet for every page. */

:root {
  --paper: #fafaf8;
  --surface: #ffffff;
  --sunken: #f2f3f1;
  --ink: #1b2127;
  --ink-soft: #3b444d;
  --muted: #66707a;
  --rule: #e5e7e4;
  --rule-strong: #d0d4d0;
  --accent: #17706a;
  --accent-ink: #0f514c;
  --accent-wash: #e5f2ef;
  --accent-soft: #c9e4df;
  --ochre: #94631a;
  --ochre-wash: #f7efdc;
  --brick: #a13d2d;
  --brick-wash: #f8e7e2;
  --mark: #fbe6a2;
  --code-bg: #f4f5f3;
  --focus: #17706a;
  --shadow-sm: 0 1px 2px rgba(20, 28, 34, .05);
  --shadow: 0 1px 2px rgba(20, 28, 34, .04), 0 4px 14px rgba(20, 28, 34, .06);
  --shadow-lg: 0 12px 36px rgba(20, 28, 34, .12);
  --radius: 8px;
  --radius-sm: 5px;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans SC", "Helvetica Neue", Arial, sans-serif;
  --serif: var(--sans);
  --mono: "JetBrains Mono", "Cascadia Mono", "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  --topbar: 60px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #121518;
    --surface: #171b1f;
    --sunken: #0e1013;
    --ink: #e6e9ec;
    --ink-soft: #c3c9cf;
    --muted: #8e97a0;
    --rule: #252a30;
    --rule-strong: #343a42;
    --accent: #5cc0b3;
    --accent-ink: #8ad5cb;
    --accent-wash: #15302d;
    --accent-soft: #1f4641;
    --ochre: #d6a75f;
    --ochre-wash: #2c2619;
    --brick: #e08c76;
    --brick-wash: #33211c;
    --mark: #5a4b1d;
    --code-bg: #1b1f24;
    --focus: #5cc0b3;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow: 0 1px 2px rgba(0, 0, 0, .25), 0 6px 18px rgba(0, 0, 0, .25);
    --shadow-lg: 0 14px 40px rgba(0, 0, 0, .45);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --paper: #121518;
  --surface: #171b1f;
  --sunken: #0e1013;
  --ink: #e6e9ec;
  --ink-soft: #c3c9cf;
  --muted: #8e97a0;
  --rule: #252a30;
  --rule-strong: #343a42;
  --accent: #5cc0b3;
  --accent-ink: #8ad5cb;
  --accent-wash: #15302d;
  --accent-soft: #1f4641;
  --ochre: #d6a75f;
  --ochre-wash: #2c2619;
  --brick: #e08c76;
  --brick-wash: #33211c;
  --mark: #5a4b1d;
  --code-bg: #1b1f24;
  --focus: #5cc0b3;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 1px 2px rgba(0, 0, 0, .25), 0 6px 18px rgba(0, 0, 0, .25);
  --shadow-lg: 0 14px 40px rgba(0, 0, 0, .45);
  color-scheme: dark;
}

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

html {
  background: var(--paper);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--topbar) + 18px);
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.8 var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-wrap: break-word;
}

::selection { background: var(--accent-soft); }

a { color: var(--accent); text-decoration: none; transition: color .15s; }
article a, .lede a { text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-ink); }
article a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 3px; }

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

.skip {
  position: absolute; left: 12px; top: -48px; z-index: 40;
  padding: 8px 14px; background: var(--ink); color: var(--paper);
  border-radius: var(--radius-sm); text-decoration: none;
}
.skip:focus { top: 10px; color: var(--paper); }

svg.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

/* ------------------------------------------------------------ top bar */

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 16px;
  height: var(--topbar); padding: 0 24px;
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--rule);
}

.brand {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--ink); text-decoration: none;
  font-size: 17px; font-weight: 700; letter-spacing: .01em;
  white-space: nowrap;
}
.brand:hover { color: var(--ink); }
.brand svg {
  width: 30px; height: 30px; padding: 4px;
  border-radius: 8px; background: var(--accent-wash); color: var(--accent-ink);
}
.brand small {
  font-size: 12px; font-weight: 500; color: var(--muted); letter-spacing: 0;
  padding-left: 10px; margin-left: 2px; border-left: 1px solid var(--rule-strong);
}

.topnav { display: flex; align-items: center; gap: 2px; margin-left: 12px; }
.topnav a {
  position: relative; padding: 6px 11px; border-radius: 6px;
  color: var(--ink-soft); font-size: 14px; font-weight: 500; white-space: nowrap;
  transition: background-color .15s, color .15s;
}
.topnav a:hover { color: var(--ink); background: var(--sunken); }
.topnav a[aria-current] { color: var(--accent-ink); }
.topnav a[aria-current]::after {
  content: ""; position: absolute; left: 11px; right: 11px; bottom: -11px;
  height: 2px; border-radius: 2px; background: var(--accent);
}

.icon-btn, .theme-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 12px;
  border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--surface); color: var(--ink-soft);
  font: 500 13px/1 var(--sans); cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background-color .15s, border-color .15s, color .15s;
}
.icon-btn:hover, .theme-btn:hover { background: var(--sunken); border-color: var(--rule-strong); color: var(--ink); }
.icon-btn:active, .theme-btn:active { transform: translateY(1px); }
.nav-toggle { display: none; width: 36px; padding: 0; }
.theme-btn { flex: none; }

.search { position: relative; flex: 0 1 340px; margin-left: auto; }
.search > svg.icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; width: 16px; height: 16px; }
.search input {
  width: 100%; height: 36px; padding: 0 40px 0 34px;
  border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--sunken); color: var(--ink);
  font: 14px/1 var(--sans);
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.search input::placeholder { color: var(--muted); }
.search input:hover { border-color: var(--rule-strong); }
.search input:focus { outline: none; background: var(--surface); border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.search input::-webkit-search-cancel-button { display: none; }
.search-key {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  min-width: 22px; padding: 1px 6px; border: 1px solid var(--rule-strong); border-radius: 4px;
  color: var(--muted); background: var(--surface); font: 12px/1.4 var(--mono); text-align: center;
}
.search input:focus ~ .search-key { visibility: hidden; }

.search-results {
  position: absolute; left: 0; right: 0; top: calc(100% + 8px);
  min-width: min(440px, 92vw);
  max-height: min(70vh, 540px); overflow: auto;
  padding: 6px; margin: 0;
  background: var(--surface); border: 1px solid var(--rule-strong); border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  list-style: none;
}
.search-results[hidden] { display: none; }
.search-results a {
  display: block; padding: 9px 11px; border-radius: 6px;
  color: var(--ink); text-decoration: none; line-height: 1.45;
}
.search-results a .r-title { display: block; font-weight: 600; font-size: 14px; }
.search-results a .r-page { display: block; color: var(--muted); font-size: 12px; margin-top: 1px; }
.search-results a .r-text { display: block; color: var(--ink-soft); font-size: 13px; margin-top: 3px; }
.search-results a[aria-selected="true"], .search-results a:hover { background: var(--accent-wash); }
.search-results mark { background: var(--mark); color: inherit; border-radius: 2px; padding: 0 1px; }
.search-results .r-empty { padding: 10px 12px; color: var(--muted); font-size: 14px; }
.search-results .r-hint { padding: 6px 10px 2px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--rule); margin-top: 4px; }

/* ------------------------------------------------------------ layout */

.layout {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr) 232px;
  max-width: 1400px; margin: 0 auto;
}

.sidebar {
  position: sticky; top: var(--topbar); align-self: start;
  height: calc(100vh - var(--topbar)); overflow-y: auto;
  padding: 28px 16px 48px 24px;
  font-size: 14.5px;
  scrollbar-width: thin;
}
.sidebar h2 {
  margin: 24px 0 6px; padding: 0 12px;
  font: 600 12px/1.4 var(--sans); letter-spacing: .06em; color: var(--muted);
}
.sidebar h2:first-child { margin-top: 0; }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar li { margin: 0; }
.sidebar a {
  display: block; padding: 6px 12px; margin: 1px 0;
  color: var(--ink-soft); text-decoration: none; border-radius: 6px;
  line-height: 1.5;
  transition: background-color .12s, color .12s;
}
.sidebar a:hover { background: var(--sunken); color: var(--ink); }
.sidebar a[aria-current="page"] {
  color: var(--accent-ink); background: var(--accent-wash); font-weight: 600;
}

.content { min-width: 0; padding: 36px 56px 40px; border-left: 1px solid var(--rule); }
article { max-width: 780px; }

.crumbs { display: flex; flex-wrap: wrap; align-items: center; font-size: 13px; color: var(--muted); margin-bottom: 18px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.crumbs span[aria-hidden] { margin: 0 8px; color: var(--rule-strong); }

h1, h2, h3, h4 { font-family: var(--sans); color: var(--ink); line-height: 1.35; font-weight: 700; letter-spacing: -.005em; }
h1 { font-size: 34px; margin: 0 0 12px; letter-spacing: -.015em; }
h2 { font-size: 23px; margin: 52px 0 14px; padding-top: 22px; border-top: 1px solid var(--rule); }
article > h2:first-of-type { border-top: 0; padding-top: 0; margin-top: 40px; }
h3 { font-size: 18px; margin: 34px 0 8px; font-weight: 650; }
h4 { font-size: 16px; margin: 24px 0 6px; font-weight: 650; }
h2 .anchor, h3 .anchor {
  margin-left: 8px; color: var(--rule-strong); text-decoration: none;
  font-weight: 400; opacity: 0; transition: opacity .12s;
}
h2:hover .anchor, h3:hover .anchor, .anchor:focus-visible { opacity: 1; }
.anchor:hover { color: var(--accent); }

.lede { font-size: 18px; line-height: 1.75; color: var(--ink-soft); margin: 4px 0 14px; }
.meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px;
  font-size: 13px; color: var(--muted); margin: 0 0 30px; padding-bottom: 20px; border-bottom: 1px solid var(--rule);
}

p { margin: 0 0 16px; }
ul, ol { margin: 0 0 18px; padding-left: 1.4em; }
li { margin: 5px 0; }
li::marker { color: var(--muted); }
li > ul, li > ol { margin: 4px 0 6px; }
strong { font-weight: 650; color: var(--ink); }
hr { border: 0; border-top: 1px solid var(--rule); margin: 40px 0; }
abbr[title] { text-decoration: underline dotted; text-underline-offset: 3px; cursor: help; }

code, kbd, samp { font-family: var(--mono); font-size: .86em; }
:not(pre) > code {
  padding: 2px 6px; border-radius: 5px;
  background: var(--code-bg); color: var(--ink);
  border: 1px solid var(--rule);
}
kbd {
  padding: 1px 6px; border: 1px solid var(--rule-strong); border-bottom-width: 2px;
  border-radius: 4px; background: var(--surface); font-size: .82em;
}

.code {
  position: relative; margin: 0 0 20px;
  border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--code-bg); overflow: hidden;
}
.code .code-label {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 8px 6px 14px; border-bottom: 1px solid var(--rule);
  background: color-mix(in srgb, var(--sunken) 70%, var(--code-bg));
  font: 500 12px/1.4 var(--sans); color: var(--muted);
}
pre {
  margin: 0; padding: 14px 16px; overflow-x: auto;
  font: 13.5px/1.65 var(--mono); color: var(--ink); tab-size: 4;
}
pre code { font-size: inherit; }
pre .c { color: var(--muted); }
pre .p { color: var(--accent); user-select: none; }
pre .h { background: var(--mark); border-radius: 2px; }
.copy-btn {
  display: inline-flex; align-items: center; gap: 5px;
  height: 26px; padding: 0 9px;
  border: 1px solid transparent; border-radius: 5px;
  background: transparent; color: var(--muted);
  font: 12px/1 var(--sans); cursor: pointer;
  transition: background-color .12s, color .12s, border-color .12s;
}
.copy-btn svg.icon { width: 14px; height: 14px; }
.copy-btn:hover { background: var(--surface); border-color: var(--rule); color: var(--ink); }
.copy-btn.done { color: var(--accent); }

/* Notes and figures */

.note, .warn, .aside {
  position: relative;
  margin: 0 0 20px; padding: 14px 18px 14px 20px;
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--rule));
  border-radius: var(--radius);
  background: var(--accent-wash);
}
.note::before, .warn::before, .aside::before {
  content: ""; position: absolute; left: -1px; top: 12px; bottom: 12px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--accent);
}
.warn { border-color: color-mix(in srgb, var(--brick) 24%, var(--rule)); background: var(--brick-wash); }
.warn::before { background: var(--brick); }
.aside { border-color: color-mix(in srgb, var(--ochre) 24%, var(--rule)); background: var(--ochre-wash); }
.aside::before { background: var(--ochre); }
.note p:last-child, .warn p:last-child, .aside p:last-child { margin-bottom: 0; }
.note .label, .warn .label, .aside .label { display: block; font-weight: 650; font-size: 13.5px; margin-bottom: 2px; }

figure { margin: 6px 0 24px; }
figcaption { font-size: 13px; color: var(--muted); margin-top: 8px; }

.table-wrap {
  margin: 0 0 22px; overflow-x: auto;
  border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow-sm);
}
table { border-collapse: collapse; width: 100%; font-size: 14.5px; line-height: 1.6; }
th, td { text-align: left; vertical-align: top; padding: 10px 14px; border-bottom: 1px solid var(--rule); }
thead th { font-weight: 600; font-size: 12.5px; letter-spacing: .02em; color: var(--muted); background: var(--sunken); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background-color .12s; }
tbody tr:hover td { background: color-mix(in srgb, var(--accent-wash) 50%, transparent); }
td code { white-space: nowrap; }
td.num, th.num { font-variant-numeric: tabular-nums; white-space: nowrap; }

.filter {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 0 0 12px;
}
.filter input {
  flex: 0 1 300px; height: 36px; padding: 0 12px;
  border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); font: 14px var(--sans);
}
.filter input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.filter .count { font-size: 13px; color: var(--muted); }
tr.filtered-out { display: none; }

dl.terms dt { font-weight: 650; margin-top: 16px; }
dl.terms dd { margin: 2px 0 0 0; color: var(--ink-soft); }

.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 28px; }
.path-list { list-style: none; padding: 0; margin: 0 0 22px; display: grid; gap: 10px; }
.path-list li {
  margin: 0; padding: 14px 18px;
  border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s;
}
.path-list li:hover { border-color: var(--accent-soft); box-shadow: var(--shadow); }
.path-list .who { display: block; font-weight: 650; }
.path-list .route { display: block; color: var(--ink-soft); font-size: 15px; }

.changes { list-style: none; padding: 0; margin: 0 0 22px; position: relative; }
.changes li {
  position: relative; display: grid; grid-template-columns: 104px 1fr; gap: 14px;
  padding: 10px 0 10px 18px; margin: 0;
  border-left: 1px solid var(--rule);
}
.changes li::before {
  content: ""; position: absolute; left: -5px; top: 19px; width: 9px; height: 9px;
  border-radius: 50%; background: var(--surface); border: 2px solid var(--accent);
}
.changes time { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 14px; }

/* Tools */

.tool {
  margin: 8px 0 26px; padding: 18px 20px 20px;
  border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow);
}
.tool > h3:first-child, .tool > h4:first-child { margin-top: 0; }
.tool .row { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; margin-bottom: 12px; }
.tool label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.tool label.check { flex-direction: row; align-items: center; gap: 7px; color: var(--ink-soft); font-size: 14px; padding-bottom: 6px; }
.tool input[type="text"], .tool input[type="number"], .tool input[type="password"], .tool select, .tool textarea {
  height: 36px; padding: 0 10px;
  border: 1px solid var(--rule-strong); border-radius: 6px;
  background: var(--paper); color: var(--ink); font: 14px var(--mono);
}
.tool textarea { height: auto; min-height: 80px; padding: 8px 10px; width: 100%; resize: vertical; line-height: 1.5; }
.tool input:focus, .tool select:focus, .tool textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.tool input[aria-invalid="true"], .tool textarea[aria-invalid="true"] { border-color: var(--brick); }
.tool input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 16px;
  border: 1px solid var(--accent); border-radius: var(--radius);
  background: var(--accent); color: #fff;
  font: 600 14px/1 var(--sans); cursor: pointer; text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: background-color .15s, border-color .15s, box-shadow .15s, color .15s;
}
:root[data-theme="dark"] .btn { color: #0c1a18; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn { color: #0c1a18; } }
.btn:hover { background: var(--accent-ink); border-color: var(--accent-ink); color: #fff; }
:root[data-theme="dark"] .btn:hover { color: #0c1a18; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn:hover { color: #0c1a18; } }
.btn:active { transform: translateY(1px); }
.btn.quiet, .btn.quiet:hover { background: var(--surface); color: var(--ink); border-color: var(--rule-strong); }
.btn.quiet:hover { background: var(--sunken); }
.btn[disabled] { opacity: .45; cursor: default; transform: none; }
.btn.lg { height: 44px; padding: 0 20px; font-size: 15px; }
.tool .out { margin-top: 4px; }
.tool .out dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; font-size: 14px; }
.tool .out dt { color: var(--muted); }
.tool .out dd { margin: 0; font-family: var(--mono); font-size: 13.5px; word-break: break-all; }
.tool .status { min-height: 1.5em; font-size: 13.5px; color: var(--muted); margin: 6px 0 0; }
.tool .status.error { color: var(--brick); }
.tool .status.ok { color: var(--accent); }

.stepper .diagram { width: 100%; height: auto; display: block; margin: 4px 0 10px; }
.stepper .diagram .node rect { fill: var(--paper); stroke: var(--rule-strong); stroke-width: 1.2; }
.stepper .diagram .node text { fill: var(--ink); font: 13px var(--sans); }
.stepper .diagram .node .sub { fill: var(--muted); font-size: 11px; }
.stepper .diagram .node.on rect { stroke: var(--accent); stroke-width: 2; fill: var(--accent-wash); }
.stepper .diagram .edge { stroke: var(--rule-strong); stroke-width: 1.4; fill: none; marker-end: url(#arrow-dim); }
.stepper .diagram .edge.on { stroke: var(--accent); stroke-width: 2.2; marker-end: url(#arrow-on); }
.stepper .diagram .edge.done { stroke: var(--muted); }
.stepper .diagram marker path { stroke: none; }
.stepper .diagram #arrow-dim path { fill: var(--rule-strong); }
.stepper .diagram #arrow-on path { fill: var(--accent); }
.stepper .diagram .tag { fill: var(--muted); font: 11px var(--mono); }
.stepper .diagram .tag.on { fill: var(--accent-ink); font-weight: 600; }
.stepper .controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.stepper .counter { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.stepper .explain { margin: 12px 0 0; padding: 12px 16px; background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); min-height: 5.5em; }
.stepper .explain p { margin: 0 0 6px; }
.stepper .explain p:last-child { margin: 0; }

.bits { font: 13px/1.45 var(--mono); overflow-x: auto; }

/* ------------------------------------------------------------ toc and pager */

.toc {
  position: sticky; top: var(--topbar); align-self: start;
  max-height: calc(100vh - var(--topbar)); overflow-y: auto;
  padding: 36px 24px 32px 8px; font-size: 13px;
}
.toc-title { font-weight: 650; color: var(--ink); font-size: 13px; margin: 0 0 10px; }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--rule); }
.toc li { margin: 0; }
.toc a {
  display: block; padding: 4px 0 4px 14px; margin-left: -1px;
  border-left: 2px solid transparent;
  color: var(--muted); text-decoration: none; line-height: 1.5;
}
.toc li.l3 a { padding-left: 26px; }
.toc a:hover { color: var(--ink); }
.toc a.active { color: var(--accent-ink); border-left-color: var(--accent); font-weight: 500; }

.pager {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
  max-width: 780px; margin: 60px 0 0;
}
.pager a {
  display: block; padding: 14px 18px;
  border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); text-decoration: none; font-weight: 600;
  box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s, color .15s;
}
.pager a:hover { border-color: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow); }
.pager .dir { display: block; font-size: 12px; font-weight: 500; color: var(--muted); margin-bottom: 2px; }
.pager .prev .dir::before { content: "← "; }
.pager .next .dir::after { content: " →"; }
.pager .next { text-align: right; grid-column: 2; }

/* ------------------------------------------------------------ footer */

.site-foot {
  max-width: 780px; margin-top: 64px; padding-top: 28px;
  border-top: 1px solid var(--rule);
  font-size: 13.5px; color: var(--muted);
}
.site-foot a { color: var(--muted); }
.site-foot a:hover { color: var(--accent); }
.foot-cols { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 24px; }
.foot-brand .brand { font-size: 15px; margin-bottom: 8px; }
.foot-brand .brand svg { width: 26px; height: 26px; padding: 3px; }
.foot-brand p { margin: 0; line-height: 1.7; max-width: 30em; }
.foot-title { margin: 0 0 8px; font-size: 13px; font-weight: 650; color: var(--ink); }
.foot-cols ul { list-style: none; margin: 0; padding: 0; }
.foot-cols li { margin: 0 0 5px; }
.foot-bottom {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 18px;
  margin-top: 26px; padding: 16px 0 6px; border-top: 1px solid var(--rule);
  font-size: 12.5px;
}

.scrim { position: fixed; inset: var(--topbar) 0 0 0; z-index: 18; background: rgba(12, 16, 20, .38); }
.scrim[hidden] { display: none; }

/* ------------------------------------------------------------ home */

.home .layout { grid-template-columns: minmax(0, 1fr); max-width: none; }
.home .sidebar, .home .toc { display: none; }
.home .content { border-left: 0; padding: 0 0 40px; }
.home article, .home .site-foot { max-width: 1120px; margin-left: auto; margin-right: auto; padding-left: 32px; padding-right: 32px; }
.home .site-foot { padding-left: 32px; padding-right: 32px; box-sizing: border-box; border-top: 0; }
.home .site-foot .foot-cols, .home .site-foot .foot-bottom { border-color: var(--rule); }
.home .site-foot::before { content: ""; display: block; border-top: 1px solid var(--rule); margin-bottom: 28px; }
.home .site-foot { padding-top: 0; }

.hero {
  position: relative; overflow: hidden;
  border-bottom: 1px solid var(--rule);
  background:
    radial-gradient(900px 360px at 85% -10%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%),
    radial-gradient(700px 300px at -10% 110%, color-mix(in srgb, var(--ochre) 9%, transparent), transparent 70%),
    var(--paper);
}
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(color-mix(in srgb, var(--ink) 9%, transparent) 1px, transparent 1px);
  background-size: 22px 22px;
  -webkit-mask-image: linear-gradient(180deg, rgba(0,0,0,.7), transparent 85%);
  mask-image: linear-gradient(180deg, rgba(0,0,0,.7), transparent 85%);
}
.hero-inner {
  position: relative; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 48px; align-items: center;
  max-width: 1120px; margin: 0 auto; padding: 76px 32px 72px;
}
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 12px 4px 8px; margin-bottom: 18px;
  border: 1px solid var(--rule); border-radius: 999px;
  background: var(--surface); box-shadow: var(--shadow-sm);
  font-size: 13px; color: var(--ink-soft);
}
.eyebrow b { padding: 1px 8px; border-radius: 999px; background: var(--accent-wash); color: var(--accent-ink); font-size: 12px; font-weight: 600; }
.hero h1 { font-size: 44px; line-height: 1.2; letter-spacing: -.02em; margin: 0 0 18px; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero .lede { font-size: 18px; max-width: 34em; margin-bottom: 28px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.hero-search {
  display: inline-flex; align-items: center; gap: 10px;
  height: 44px; padding: 0 12px 0 14px; min-width: 240px;
  border: 1px solid var(--rule-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--muted); box-shadow: var(--shadow-sm);
  font: 14px var(--sans); cursor: text;
  transition: border-color .15s, box-shadow .15s;
}
.hero-search:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.hero-search kbd { margin-left: auto; font-size: 12px; color: var(--muted); }
.hero-art {
  position: relative; padding: 22px;
  border: 1px solid var(--rule); border-radius: 14px;
  background: var(--surface); box-shadow: var(--shadow-lg);
}
.hero-art .win { display: flex; gap: 6px; margin-bottom: 14px; }
.hero-art .win i { width: 10px; height: 10px; border-radius: 50%; background: var(--rule-strong); }
.hero-art pre { padding: 0; font-size: 12.5px; line-height: 1.75; white-space: pre; overflow: hidden; }
.hero-art .k { color: var(--accent); }
.hero-art .v { color: var(--ochre); }
.hero-art .c { color: var(--muted); }
.hero-art .badge {
  position: absolute; right: -14px; bottom: -16px;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--rule); box-shadow: var(--shadow);
  font-size: 12.5px; color: var(--ink-soft);
}
.hero-art .badge .dot { width: 8px; height: 8px; border-radius: 50%; background: #2fa36b; box-shadow: 0 0 0 3px color-mix(in srgb, #2fa36b 25%, transparent); }

.stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  max-width: 1120px; margin: -1px auto 0; padding: 0 32px;
}
.stats div { padding: 22px 0 22px; border-right: 1px solid var(--rule); text-align: center; }
.stats div:last-child { border-right: 0; }
.stats b { display: block; font-size: 26px; line-height: 1.2; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.stats span { font-size: 13px; color: var(--muted); }
.stats-band { border-bottom: 1px solid var(--rule); background: var(--surface); }

.home article { padding-top: 12px; }
.home article > h2 { border-top: 0; padding-top: 0; margin-top: 64px; font-size: 26px; }
.section-lede { margin: -6px 0 22px; color: var(--muted); }

.topics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 0 0 8px; }
.topic {
  display: flex; flex-direction: column;
  padding: 20px 22px 18px;
  border: 1px solid var(--rule); border-radius: 12px;
  background: var(--surface); box-shadow: var(--shadow-sm);
  transition: border-color .18s, box-shadow .18s, transform .18s;
}
.topic:hover { border-color: var(--accent-soft); box-shadow: var(--shadow); transform: translateY(-2px); }
.topic .t-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; margin-bottom: 12px; border-radius: 10px;
  background: var(--accent-wash); color: var(--accent-ink);
}
.topic .t-icon svg.icon { width: 20px; height: 20px; }
.topic h3 { margin: 0 0 4px; font-size: 17px; }
.topic p { margin: 0 0 12px; color: var(--muted); font-size: 14px; line-height: 1.65; }
.topic ul { list-style: none; margin: auto 0 0; padding: 12px 0 0; border-top: 1px dashed var(--rule); display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 14px; }
.topic li { margin: 0; }
.topic ul a { text-decoration: none; font-weight: 500; }
.topic ul a:hover { text-decoration: underline; }
.topic.wide { grid-column: span 2; }

.split { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 40px; }
.split > div > h2 { margin-top: 64px; }

/* ------------------------------------------------------------ narrow screens */

@media (max-width: 1240px) {
  .layout { grid-template-columns: 248px minmax(0, 1fr); }
  .toc { display: none; }
  .content { padding: 32px 44px 40px; }
}

@media (max-width: 1080px) {
  .topnav { display: none; }
  .hero-inner { grid-template-columns: 1fr; padding: 60px 32px 56px; }
  .hero-art { display: none; }
  .topics { grid-template-columns: repeat(2, 1fr); }
  .topic.wide { grid-column: span 2; }
  .split { grid-template-columns: 1fr; gap: 0; }
}

@media (max-width: 860px) {
  :root { --topbar: 56px; }
  .layout { display: block; }
  .nav-toggle { display: inline-flex; }
  .topbar { padding: 0 12px; gap: 10px; }
  .brand small { display: none; }
  .search { margin-left: 4px; flex: 1 1 auto; }
  .search-key { display: none; }
  .theme-btn span { display: none; }
  .theme-btn { width: 36px; padding: 0; margin-left: 0; }
  .sidebar, .home .sidebar {
    display: block;
    position: fixed; top: var(--topbar); left: 0; bottom: 0; z-index: 20;
    width: min(300px, 86vw); height: auto;
    background: var(--paper); border-right: 1px solid var(--rule-strong);
    box-shadow: var(--shadow-lg);
    transform: translateX(-102%); transition: transform .2s ease-out;
    visibility: hidden;
  }
  body.nav-open .sidebar { transform: none; visibility: visible; }
  .content { padding: 24px 18px 32px; border-left: 0; }
  h1 { font-size: 28px; }
  h2 { font-size: 21px; margin-top: 42px; }
  .lede { font-size: 16.5px; }
  .pager { grid-template-columns: 1fr; }
  .pager .next { grid-column: 1; }
  .changes li { grid-template-columns: 1fr; gap: 0; }
  .foot-cols { grid-template-columns: 1fr 1fr; }
  .foot-brand { grid-column: 1 / -1; }
  .home article, .home .site-foot { padding-left: 18px; padding-right: 18px; }
  .hero-inner { padding: 44px 18px 40px; }
  .hero h1 { font-size: 32px; }
  .hero .lede { font-size: 16.5px; }
  .hero-search { min-width: 0; flex: 1 1 100%; }
  .stats { grid-template-columns: repeat(2, 1fr); padding: 0 18px; }
  .stats div:nth-child(2) { border-right: 0; }
  .stats div:nth-child(-n+2) { border-bottom: 1px solid var(--rule); }
  .topics { grid-template-columns: 1fr; }
  .topic.wide { grid-column: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .topic:hover { transform: none; }
}

@media print {
  .topbar, .sidebar, .toc, .pager, .copy-btn, .tool, .scrim, .hero-art, .site-foot { display: none !important; }
  .layout { display: block; }
  .content { padding: 0; border: 0; }
  a { color: inherit; }
}
