/* Scruple documentation site — self-contained, no external dependencies. */

:root {
  color-scheme: dark;
  --bg: #070b0e;
  --bg-elev: #0b1116;
  --panel: #0e161c;
  --panel-2: #121d24;
  --panel-3: #16242c;
  --border: #1d2d36;
  --border-strong: #2a404b;
  --text: #dbe7ed;
  --text-soft: #b7c8d1;
  --muted: #8197a2;
  --faint: #5d707a;
  --accent: #3ddc97;
  --accent-strong: #21c47d;
  --accent-soft: rgba(61, 220, 151, 0.12);
  --accent-2: #38cfe8;
  --accent-2-soft: rgba(56, 207, 232, 0.12);
  --warn: #f5c451;
  --warn-soft: rgba(245, 196, 81, 0.12);
  --danger: #f87b7b;
  --danger-soft: rgba(248, 123, 123, 0.12);
  --purple: #b9a0ff;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --sidebar-w: 286px;
  --toc-w: 230px;
  --topbar-h: 58px;
  --radius: 12px;
  --radius-sm: 8px;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f8f7;
  --bg-elev: #ffffff;
  --panel: #ffffff;
  --panel-2: #f0f5f3;
  --panel-3: #e7efec;
  --border: #d7e3df;
  --border-strong: #b8ccc5;
  --text: #14272d;
  --text-soft: #2c444b;
  --muted: #5d7379;
  --faint: #7c9096;
  --accent: #0d8f62;
  --accent-strong: #0a7550;
  --accent-soft: rgba(13, 143, 98, 0.1);
  --accent-2: #0b7f96;
  --accent-2-soft: rgba(11, 127, 150, 0.1);
  --warn: #a36a00;
  --warn-soft: rgba(163, 106, 0, 0.1);
  --danger: #b33a3a;
  --danger-soft: rgba(179, 58, 58, 0.09);
  --purple: #6b4fc4;
  --shadow: 0 18px 40px rgba(18, 40, 46, 0.08);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--topbar-h) + 18px);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15.5px;
  line-height: 1.72;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(900px 500px at 12% -8%, rgba(61, 220, 151, 0.07), transparent 60%),
    radial-gradient(800px 450px at 92% 0%, rgba(56, 207, 232, 0.055), transparent 60%);
}

html[data-theme="light"] body::before {
  background:
    radial-gradient(900px 500px at 12% -8%, rgba(13, 143, 98, 0.06), transparent 60%),
    radial-gradient(800px 450px at 92% 0%, rgba(11, 127, 150, 0.05), transparent 60%);
}

a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

code, kbd, pre, samp { font-family: var(--mono); }

kbd {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--panel-2);
  color: var(--text-soft);
  font-size: 0.82em;
  line-height: 1.4;
}

::selection { background: rgba(61, 220, 151, 0.28); color: var(--text); }

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 200;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--accent);
  color: #04120b;
  font-weight: 700;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 10px; }

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

.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--topbar-h);
  z-index: 80;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  background: color-mix(in srgb, var(--bg-elev) 88%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--text);
  font-weight: 750;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand .sigil {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(145deg, var(--accent), var(--accent-2));
  color: #04120b;
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 800;
  box-shadow: 0 0 22px rgba(61, 220, 151, 0.24);
}
.brand small {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.78rem;
  padding-left: 2px;
  border-left: 1px solid var(--border);
  margin-left: 2px;
  padding-left: 10px;
}

.topbar-spacer { flex: 1 1 auto; }

.topbar-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.topbar-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 30px;
  padding: 0 9px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 600;
  white-space: nowrap;
}

.topbar-link span {
  color: var(--accent);
  font-size: 0.68rem;
}

.topbar-link:hover {
  border-color: var(--border);
  background: var(--panel-2);
  color: var(--text);
  text-decoration: none;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--panel);
  color: var(--text-soft);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.icon-btn:hover { border-color: var(--border-strong); color: var(--text); background: var(--panel-2); }
.icon-btn svg { width: 17px; height: 17px; }

.search-trigger {
  display: flex;
  align-items: center;
  gap: 9px;
  width: min(360px, 34vw);
  height: 36px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--panel);
  color: var(--muted);
  font-size: 0.88rem;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.search-trigger:hover { border-color: var(--border-strong); background: var(--panel-2); }
.search-trigger svg { width: 15px; height: 15px; flex: 0 0 auto; }
.search-trigger span { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-trigger kbd { flex: 0 0 auto; font-size: 0.72rem; }

.hamburger { display: none; }

.version-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 27px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.version-pill .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--warn);
  box-shadow: 0 0 8px var(--warn);
}

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

.layout {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  min-height: calc(100vh - var(--topbar-h));
  padding-top: var(--topbar-h);
}

.sidebar {
  position: fixed;
  top: var(--topbar-h);
  bottom: 0;
  left: 0;
  z-index: 60;
  width: var(--sidebar-w);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 20px 14px 40px 18px;
  border-right: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-elev) 72%, transparent);
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; }

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px 12px;
  color: var(--faint);
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.sidebar-head .close-btn { display: none; }

.nav-group { margin: 0 0 18px; }
.nav-label {
  margin: 0 0 6px;
  padding: 0 10px;
  color: var(--faint);
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}
.nav-list { display: flex; flex-direction: column; gap: 1px; margin: 0; padding: 0; list-style: none; }
.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: 7px;
  color: var(--text-soft);
  font-size: 0.88rem;
  line-height: 1.35;
}
.nav-link:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.nav-link.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 650;
}
.nav-link.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 2px;
  border-radius: 2px;
  background: var(--accent);
}
.nav-link .num {
  width: 18px;
  flex: 0 0 auto;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 0.68rem;
  text-align: right;
}
.nav-link.active .num { color: var(--accent); }

.sidebar-foot {
  margin-top: 26px;
  padding: 14px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel);
}
.sidebar-foot p { margin: 0 0 8px; color: var(--muted); font-size: 0.76rem; line-height: 1.5; }
.sidebar-foot p:last-child { margin-bottom: 0; }
.sidebar-foot strong { color: var(--text-soft); }
.sidebar-foot a { font-size: 0.76rem; }
.sidebar-links { display: flex; flex-direction: column; gap: 2px; }

.main {
  flex: 1 1 auto;
  min-width: 0;
  margin-left: var(--sidebar-w);
  padding: 34px 40px 80px;
}

.content-wrap {
  display: flex;
  align-items: flex-start;
  gap: 44px;
  max-width: 1220px;
  margin: 0 auto;
}

.article {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 860px;
}

.toc {
  position: sticky;
  top: calc(var(--topbar-h) + 34px);
  width: var(--toc-w);
  flex: 0 0 var(--toc-w);
  max-height: calc(100vh - var(--topbar-h) - 60px);
  overflow-y: auto;
  padding: 4px 0 20px 18px;
  border-left: 1px solid var(--border);
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
.toc-title {
  margin: 0 0 10px;
  color: var(--faint);
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}
.toc-list { margin: 0; padding: 0; list-style: none; }
.toc-list li { margin: 0; }
.toc-list a {
  display: block;
  padding: 4px 0 4px 9px;
  border-left: 2px solid transparent;
  color: var(--muted);
  font-size: 0.79rem;
  line-height: 1.42;
}
.toc-list a:hover { color: var(--text); text-decoration: none; }
.toc-list a.active { color: var(--accent); border-left-color: var(--accent); }
.toc-list .depth-3 a { padding-left: 20px; font-size: 0.75rem; color: var(--faint); }
.toc-list .depth-3 a.active { color: var(--accent); }

/* ---------------------------------------------------------------- article */

.page-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.page-kicker::before { content: ""; width: 18px; height: 1px; background: var(--accent); }

.article h1 {
  margin: 0 0 14px;
  color: var(--text);
  font-size: clamp(2rem, 3.4vw, 2.75rem);
  line-height: 1.12;
  letter-spacing: -0.035em;
  font-weight: 800;
}

.page-lead {
  margin: 0 0 24px;
  color: var(--text-soft);
  font-size: 1.06rem;
  line-height: 1.68;
}

.article h2 {
  margin: 46px 0 14px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  color: var(--text);
  font-size: 1.42rem;
  line-height: 1.28;
  letter-spacing: -0.018em;
  font-weight: 750;
}

.article h3 {
  margin: 30px 0 10px;
  color: var(--text);
  font-size: 1.08rem;
  line-height: 1.35;
  letter-spacing: -0.008em;
  font-weight: 700;
}

.article h4 {
  margin: 22px 0 8px;
  color: var(--text-soft);
  font-size: 0.94rem;
  font-weight: 700;
}

.heading-anchor {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin-left: 6px;
  border-radius: 5px;
  color: var(--faint);
  font-size: 0.75rem;
  vertical-align: middle;
  opacity: 0;
  transition: opacity 0.15s ease, color 0.15s ease;
}
h2:hover .heading-anchor,
h3:hover .heading-anchor,
.heading-anchor:focus { opacity: 1; }
.heading-anchor:hover { color: var(--accent); text-decoration: none; }

.article p { margin: 0 0 15px; color: var(--text-soft); }
.article strong { color: var(--text); font-weight: 680; }
.article em { color: var(--text); }

.article ul,
.article ol {
  margin: 0 0 18px;
  padding-left: 24px;
  color: var(--text-soft);
}
.article li { margin: 4px 0; }
.article li > ul,
.article li > ol { margin: 5px 0 4px; }
.article li::marker { color: var(--accent); }

.article hr {
  margin: 36px 0;
  border: 0;
  border-top: 1px solid var(--border);
}

.article blockquote {
  margin: 20px 0;
  padding: 13px 16px;
  border-left: 3px solid var(--accent-2);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--accent-2-soft);
  color: var(--text-soft);
}
.article blockquote p:last-child { margin-bottom: 0; }

.article :not(pre) > code {
  padding: 2px 5px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--panel-2);
  color: var(--accent);
  font-size: 0.86em;
  white-space: normal;
  overflow-wrap: anywhere;
}

/* ---------------------------------------------------------------- tables */

.table-wrap {
  margin: 0 0 22px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel);
}
.article table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
  line-height: 1.55;
}
.article th {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border-strong);
  background: var(--panel-2);
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}
.article td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-soft);
  vertical-align: top;
}
.article tr:last-child td { border-bottom: 0; }
.article tbody tr:hover td { background: var(--panel-2); }
.article td code { white-space: normal; }
.article td > code { white-space: nowrap; overflow-wrap: normal; }
.article th:first-child { border-top-left-radius: var(--radius-sm); }

/* ---------------------------------------------------------------- callouts */

.callout {
  position: relative;
  margin: 22px 0;
  padding: 14px 16px 14px 46px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--text-soft);
}
.callout::before {
  position: absolute;
  left: 15px;
  top: 14px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 800;
}
.callout p:last-child { margin-bottom: 0; }
.callout-title {
  display: block;
  margin-bottom: 4px;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 750;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.callout.note { border-color: rgba(56, 207, 232, 0.35); background: var(--accent-2-soft); }
.callout.note::before { content: "i"; background: var(--accent-2); color: #041217; }
.callout.tip { border-color: rgba(61, 220, 151, 0.35); background: var(--accent-soft); }
.callout.tip::before { content: "✓"; background: var(--accent); color: #04120b; }
.callout.warn { border-color: rgba(245, 196, 81, 0.4); background: var(--warn-soft); }
.callout.warn::before { content: "!"; background: var(--warn); color: #1b1300; }
.callout.danger { border-color: rgba(248, 123, 123, 0.4); background: var(--danger-soft); }
.callout.danger::before { content: "×"; background: var(--danger); color: #1c0606; }

/* ---------------------------------------------------------------- code blocks */

.code-block {
  position: relative;
  margin: 18px 0 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #05090c;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}
html[data-theme="light"] .code-block { background: #0d1720; }

.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 8px 6px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.025);
  color: #8197a2;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.code-head .lang { color: #3ddc97; }
.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 5px;
  background: transparent;
  color: #a9bcc5;
  font-family: var(--sans);
  font-size: 0.7rem;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.copy-btn:hover { border-color: rgba(61, 220, 151, 0.45); color: #3ddc97; background: rgba(61, 220, 151, 0.07); }
.copy-btn.copied { border-color: #3ddc97; color: #3ddc97; }

.code-block pre {
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
  color: #d3e2e8;
  font-size: 0.82rem;
  line-height: 1.62;
  tab-size: 2;
}
.code-block code { font-family: var(--mono); }
.code-block pre::-webkit-scrollbar { height: 8px; }
.code-block pre::-webkit-scrollbar-thumb { background: #2a404b; border-radius: 8px; }

/* ---------------------------------------------------------------- cards & grids */

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 22px 0;
}
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.card {
  display: block;
  padding: 16px 17px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--text-soft);
  transition: border-color 0.16s ease, transform 0.16s ease, background 0.16s ease;
}
a.card:hover {
  border-color: var(--border-strong);
  background: var(--panel-2);
  text-decoration: none;
  transform: translateY(-1px);
}
.card h3, .card h4 {
  margin: 0 0 6px;
  color: var(--text);
  font-size: 0.96rem;
  font-weight: 700;
}
.card p { margin: 0; font-size: 0.84rem; line-height: 1.55; color: var(--muted); }
.card .tag {
  display: inline-block;
  margin-bottom: 8px;
  padding: 1px 7px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin: 22px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--border);
}
.stat {
  padding: 14px;
  background: var(--panel);
}
.stat .v { color: var(--accent); font-family: var(--mono); font-size: 1.05rem; font-weight: 700; }
.stat .l { margin-top: 3px; color: var(--muted); font-size: 0.7rem; letter-spacing: 0.05em; text-transform: uppercase; }

/* ---------------------------------------------------------------- hero */

.hero {
  position: relative;
  margin: 0 0 34px;
  padding: 44px 40px 38px;
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(61, 220, 151, 0.11), transparent 42%),
    linear-gradient(315deg, rgba(56, 207, 232, 0.09), transparent 45%),
    var(--panel);
  box-shadow: var(--shadow);
}
.hero::after {
  content: "℈";
  position: absolute;
  right: 30px;
  top: -14px;
  color: rgba(61, 220, 151, 0.09);
  font-family: var(--mono);
  font-size: 210px;
  font-weight: 800;
  line-height: 1;
  pointer-events: none;
}
.hero > * { position: relative; z-index: 1; }
.hero h1 {
  max-width: 720px;
  margin: 0 0 14px;
  font-size: clamp(2.3rem, 4.4vw, 3.5rem);
  line-height: 1.04;
  letter-spacing: -0.045em;
}
.hero h1 .accent { color: var(--accent); }
.hero p.lead {
  max-width: 640px;
  margin: 0 0 24px;
  color: var(--text-soft);
  font-size: 1.08rem;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 26px; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 40px;
  padding: 0 16px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 650;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
.btn:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-1px); }
.btn.primary { border-color: transparent; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #04120b; }
.btn.primary:hover { filter: brightness(1.06); }
.btn svg { width: 15px; height: 15px; }

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  color: var(--muted);
  font-size: 0.78rem;
}
.hero-meta span { display: inline-flex; align-items: center; gap: 6px; }
.hero-meta .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }

/* ---------------------------------------------------------------- page nav */

.page-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 46px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}
.page-nav a {
  display: block;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--text-soft);
  font-size: 0.84rem;
}
.page-nav a:hover { border-color: var(--border-strong); text-decoration: none; background: var(--panel-2); }
.page-nav .dir { display: block; margin-bottom: 3px; color: var(--faint); font-size: 0.66rem; letter-spacing: 0.1em; text-transform: uppercase; }
.page-nav .next { text-align: right; }
.page-nav .next .dir { text-align: right; }

.doc-footer {
  margin-top: 38px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  color: var(--faint);
  font-size: 0.76rem;
}
.doc-footer p { margin: 0 0 6px; color: var(--faint); }
.doc-footer a { color: var(--muted); }
.doc-footer-links { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-bottom: 8px !important; }

/* ---------------------------------------------------------------- search modal */

.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 18px 18px;
  background: rgba(3, 7, 10, 0.72);
  backdrop-filter: blur(5px);
}
.search-overlay.open { display: flex; }
.search-panel {
  width: min(680px, 100%);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: var(--bg-elev);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.search-field {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
}
.search-field svg { width: 17px; height: 17px; color: var(--muted); flex: 0 0 auto; }
.search-field input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-family: var(--sans);
  font-size: 1rem;
  outline: none;
}
.search-field kbd { font-size: 0.7rem; }
.search-results { max-height: min(56vh, 520px); overflow-y: auto; padding: 6px; }
.search-empty { padding: 22px 16px; color: var(--muted); font-size: 0.88rem; text-align: center; }
.search-result {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text-soft);
}
.search-result:hover, .search-result.selected { background: var(--panel-2); text-decoration: none; }
.search-result .sr-title { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 0.9rem; font-weight: 650; }
.search-result .sr-title .badge { padding: 0 6px; border: 1px solid var(--border-strong); border-radius: 999px; color: var(--accent); font-family: var(--mono); font-size: 0.62rem; text-transform: uppercase; }
.search-result .sr-section { color: var(--accent-2); font-size: 0.74rem; }
.search-result .sr-snippet { margin-top: 2px; color: var(--muted); font-size: 0.78rem; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.search-hint { padding: 8px 14px; border-top: 1px solid var(--border); color: var(--faint); font-size: 0.7rem; }

/* ---------------------------------------------------------------- misc */

.pill-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 18px; }
.pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.68rem;
}
.pill.green { border-color: rgba(61, 220, 151, 0.35); color: var(--accent); }
.pill.cyan { border-color: rgba(56, 207, 232, 0.35); color: var(--accent-2); }

.method-badge {
  display: inline-block;
  padding: 1px 7px;
  border: 1px solid rgba(61, 220, 151, 0.4);
  border-radius: 5px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 650;
}
.required { color: var(--danger); font-weight: 700; }
.optional { color: var(--muted); font-weight: 500; }

details {
  margin: 14px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel);
}
summary {
  padding: 10px 14px;
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 650;
  cursor: pointer;
  user-select: none;
}
summary:hover { color: var(--accent); }
details[open] summary { border-bottom: 1px solid var(--border); }
details > div { padding: 12px 14px; }
details p:last-child { margin-bottom: 0; }

.article img { max-width: 100%; border-radius: var(--radius-sm); }

/* ---------------------------------------------------------------- responsive */

@media (max-width: 1180px) {
  .toc { display: none; }
  .content-wrap { max-width: 900px; }
}

@media (max-width: 900px) {
  .hamburger { display: inline-grid; }
  .search-trigger { width: 36px; padding: 0; justify-content: center; }
  .search-trigger span, .search-trigger kbd { display: none; }
  .version-pill { display: none; }
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    width: min(320px, 86vw);
    z-index: 110;
    background: var(--bg-elev);
    box-shadow: var(--shadow);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-head .close-btn { display: inline-grid; }
  .sidebar-scrim {
    display: none;
    position: fixed;
    inset: var(--topbar-h) 0 0 0;
    z-index: 105;
    background: rgba(3, 7, 10, 0.55);
  }
  .sidebar-scrim.open { display: block; }
  .main { margin-left: 0; padding: 24px 20px 70px; }
  .hero { padding: 30px 24px 26px; }
  .hero::after { font-size: 150px; right: 16px; }
  .grid, .grid.three { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page-nav { grid-template-columns: 1fr; }
  .page-nav .next { text-align: left; }
}

@media (max-width: 560px) {
  body { font-size: 15px; }
  .topbar-links { display: none; }
  .brand small { display: none; }
  .article h1 { font-size: 1.9rem; }
  .hero h1 { font-size: 2.15rem; }
  .hero-actions .btn { width: 100%; justify-content: center; }
  .stat-grid { grid-template-columns: 1fr; }
  .article table { font-size: 0.8rem; }
  .article th, .article td { padding: 7px 9px; }
}

@media print {
  .topbar, .sidebar, .toc, .page-nav, .search-overlay, .copy-btn { display: none !important; }
  .main { margin: 0; padding: 0; }
  body { background: #fff; color: #111; }
  .code-block { background: #f4f6f7; }
  .code-block pre { color: #111; }
}
