/* Datajure website theme. One stylesheet; no build step. */

/* ---------- Tokens ---------- */

:root {
  --bg: #ffffff;
  --bg-soft: #f6f8fa;
  --surface: #ffffff;
  --text: #1c2430;
  --text-strong: #0b1220;
  --muted: #5a6573;
  --border: #e3e8ee;
  --border-strong: #cfd7e1;
  --accent: #0d7d72;
  --accent-strong: #095e56;
  --accent-soft: #e5f4f1;
  --accent-2: #c2700c;
  --accent-2-soft: #fdf1e1;
  --code-bg: #f6f8fa;
  --code-text: #1c2430;
  --inline-code-bg: #eef2f6;
  --output-bg: #fbfaf6;
  --output-border: #ebe5d6;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 16px rgba(16, 24, 40, .06);
  --shadow-lg: 0 20px 50px rgba(3, 20, 30, .35);
  --hero-bg: radial-gradient(1200px 500px at 85% -10%, #12756b 0%, rgba(18, 117, 107, 0) 60%),
             linear-gradient(160deg, #0a1922 0%, #0c2a2c 60%, #0d3533 100%);
  --hero-text: #e8f1f1;
  --hero-muted: #a9c3c2;

  /* syntax */
  --hl-comment: #6a7685;
  --hl-keyword: #0d7d72;
  --hl-name: #3550c8;
  --hl-string: #a3510c;
  --hl-number: #9b2c8f;
  --hl-meta: #c2700c;

  --radius: 10px;
  --radius-sm: 6px;
  --content-width: 780px;
  --page-width: 1240px;
  --topbar-h: 60px;

  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1117;
    --bg-soft: #121821;
    --surface: #151c26;
    --text: #d9e1ea;
    --text-strong: #f3f7fb;
    --muted: #93a0ae;
    --border: #232d3a;
    --border-strong: #324051;
    --accent: #3fd0bf;
    --accent-strong: #79e6d9;
    --accent-soft: rgba(63, 208, 191, .12);
    --accent-2: #f0a74a;
    --accent-2-soft: rgba(240, 167, 74, .12);
    --code-bg: #121922;
    --code-text: #d9e1ea;
    --inline-code-bg: #1b2430;
    --output-bg: #10161d;
    --output-border: #2a3340;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    --hl-comment: #7d8a99;
    --hl-keyword: #4fd6c5;
    --hl-name: #8ab4ff;
    --hl-string: #f0b37a;
    --hl-number: #e29be0;
    --hl-meta: #f0a74a;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0d1117;
  --bg-soft: #121821;
  --surface: #151c26;
  --text: #d9e1ea;
  --text-strong: #f3f7fb;
  --muted: #93a0ae;
  --border: #232d3a;
  --border-strong: #324051;
  --accent: #3fd0bf;
  --accent-strong: #79e6d9;
  --accent-soft: rgba(63, 208, 191, .12);
  --accent-2: #f0a74a;
  --accent-2-soft: rgba(240, 167, 74, .12);
  --code-bg: #121922;
  --code-text: #d9e1ea;
  --inline-code-bg: #1b2430;
  --output-bg: #10161d;
  --output-border: #2a3340;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
  --hl-comment: #7d8a99;
  --hl-keyword: #4fd6c5;
  --hl-name: #8ab4ff;
  --hl-string: #f0b37a;
  --hl-number: #e29be0;
  --hl-meta: #f0a74a;
  color-scheme: dark;
}

/* ---------- Base ---------- */

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16.5px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main { flex: 1 0 auto; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent-strong); }

img { max-width: 100%; }

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

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.skip-link {
  position: absolute; left: -999px; top: 8px; z-index: 100;
  background: var(--surface); padding: 8px 12px; border-radius: var(--radius-sm);
}
.skip-link:focus { left: 8px; }

/* No ligatures: Clojure's -> and >= must look like what you type. */
code, pre, kbd { font-family: var(--mono); font-size: .88em; font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0; }

/* ---------- Top bar ---------- */

.topbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.is-home .topbar { background: rgba(10, 25, 34, .82); border-bottom-color: rgba(255, 255, 255, .08); }

.topbar-inner {
  max-width: var(--page-width); margin: 0 auto; padding: 0 24px;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 28px;
}

.brand {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--text-strong); text-decoration: none;
  font-weight: 800; font-size: 19px; letter-spacing: -.01em;
}
.brand:hover { color: var(--text-strong); }
.is-home .brand, .is-home .brand:hover { color: #fff; }
.brand-mark { width: 30px; height: 30px; flex: none; }
.bm-bg { fill: #0d7d72; }
.bm-head { fill: #ffffff; opacity: .95; }
.bm-cell { fill: #ffffff; opacity: .45; }
.bm-hot { fill: #f3b25e; }

.mainnav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; }
.mainnav a {
  display: block; padding: 6px 12px; border-radius: 8px;
  color: var(--muted); text-decoration: none; font-weight: 500; font-size: 15px;
  white-space: nowrap;
}
.mainnav a:hover { color: var(--text-strong); background: var(--bg-soft); }
.mainnav a.active { color: var(--accent); background: var(--accent-soft); }
.is-home .mainnav a { color: #b9cfd0; }
.is-home .mainnav a:hover { color: #fff; background: rgba(255, 255, 255, .08); }

.topbar-actions { margin-left: auto; display: flex; gap: 4px; }
.icon-btn {
  display: inline-grid; place-items: center;
  width: 38px; height: 38px; border-radius: 8px;
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { color: var(--text-strong); background: var(--bg-soft); }
.is-home .icon-btn { color: #b9cfd0; }
.is-home .icon-btn:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.icon-btn svg.i-fill { fill: currentColor; stroke: none; }

.i-moon { display: none; }
:root[data-theme="dark"] .i-sun { display: none; }
:root[data-theme="dark"] .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: none; }
  :root:not([data-theme="light"]) .i-moon { display: block; }
}

/* ---------- Home: hero ---------- */

.hero {
  background: var(--hero-bg);
  color: var(--hero-text);
  margin-top: calc(-1 * var(--topbar-h));
  padding: calc(var(--topbar-h) + 72px) 24px 88px;
  overflow: hidden;
}
.hero-inner {
  max-width: var(--page-width); margin: 0 auto;
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 56px; align-items: center;
}
.eyebrow {
  margin: 0 0 18px; font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: #7fe0d3;
}
.hero h1 {
  margin: 0 0 20px; color: #fff;
  font-size: clamp(34px, 4.6vw, 54px); line-height: 1.08; letter-spacing: -.025em; font-weight: 800;
}
.hero h1 .accent {
  background: linear-gradient(90deg, #5ee3d2, #f3b25e);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-lead { font-size: 18.5px; line-height: 1.65; color: var(--hero-muted); max-width: 560px; margin: 0 0 32px; }
.hero-lead code { color: #fff; background: rgba(255, 255, 255, .1); padding: 2px 6px; border-radius: 5px; }

.cta { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 28px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 20px; border-radius: 10px; font-weight: 600; font-size: 15.5px;
  text-decoration: none; transition: transform .12s ease, background .12s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: #3fd0bf; color: #062420; }
.btn-primary:hover { background: #63ddcf; color: #062420; }
.btn-ghost { color: #e8f1f1; border: 1px solid rgba(255, 255, 255, .22); }
.btn-ghost:hover { color: #fff; background: rgba(255, 255, 255, .07); }

.badges { display: flex; gap: 8px; flex-wrap: wrap; }
.badges img { height: 20px; display: block; }

.window {
  background: #0b141b; border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 14px; box-shadow: var(--shadow-lg); overflow: hidden;
}
.window-bar {
  display: flex; align-items: center; gap: 7px; padding: 11px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, .07); background: rgba(255, 255, 255, .03);
}
.window-bar span { width: 11px; height: 11px; border-radius: 50%; background: #2c3a45; }
.window-bar span:nth-child(1) { background: #ef6b5e; }
.window-bar span:nth-child(2) { background: #f3be4f; }
.window-bar span:nth-child(3) { background: #5fc76a; }
.window-bar em { margin-left: auto; font-style: normal; font-size: 12px; color: #6f8590; font-family: var(--mono); }

.hero-code.hero-code {
  margin: 0; padding: 20px 22px; background: transparent; border: 0; border-radius: 0;
  font-size: 14px; line-height: 1.7; color: #dfe9ee;
  overflow-x: auto;
}
.hero-code code { font-size: inherit; }
.hero-code .hljs-comment { color: #6f8a93; }
.hero-code .hljs-symbol { color: #5ee3d2; }
.hero-code .hljs-name, .hero-code .hljs-title { color: #9ec0ff; }
.hero-code .hljs-number { color: #f0a0e8; }
.hero-code .hljs-string { color: #f3b780; }

.window-out { border-top: 1px dashed rgba(255, 255, 255, .12); padding: 14px 22px 18px; }
.out-label {
  display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: #f3b25e; margin-bottom: 8px;
}
.mini-result { border-collapse: collapse; font-family: var(--mono); font-size: 13.5px; color: #dfe9ee; }
.mini-result th { text-align: left; font-weight: 500; color: #7fe0d3; padding: 4px 22px 6px 0; border-bottom: 1px solid rgba(255, 255, 255, .12); }
.mini-result td { padding: 5px 22px 3px 0; }
.mini-result td:not(:first-child), .mini-result th:not(:first-child) { text-align: right; }

/* ---------- Home: features ---------- */

.features { padding: 64px 24px 16px; }
.features-inner {
  max-width: var(--page-width); margin: 0 auto;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px;
}
.feature {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 24px 24px 20px; box-shadow: var(--shadow);
}
.feature h3 { margin: 14px 0 6px; font-size: 17px; color: var(--text-strong); letter-spacing: -.01em; }
.feature p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.6; }
.feature-icon {
  width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
}
.feature-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.feature:nth-child(even) .feature-icon { background: var(--accent-2-soft); color: var(--accent-2); }

.home-body { max-width: 900px; margin: 0 auto; padding: 32px 24px 24px; }
.home-body .prose { max-width: none; }

/* ---------- Doc pages ---------- */

.page-hero { border-bottom: 1px solid var(--border); background: var(--bg-soft); }
.page-hero-inner { max-width: var(--page-width); margin: 0 auto; padding: 44px 24px 36px; }
.page-hero h1 {
  margin: 0; font-size: clamp(30px, 3.6vw, 42px); line-height: 1.15; letter-spacing: -.022em;
  color: var(--text-strong); font-weight: 800;
}
.page-lead { margin: 12px 0 0; max-width: 720px; font-size: 18px; color: var(--muted); line-height: 1.6; }

.doc-layout {
  max-width: var(--page-width); margin: 0 auto; padding: 36px 24px 48px;
}
.doc-layout.has-toc {
  display: grid; grid-template-columns: minmax(0, var(--content-width)) 250px; gap: 64px;
  justify-content: center; align-items: start;
}
.doc-layout.has-toc .prose { grid-column: 1; grid-row: 1; }
.toc-side { grid-column: 2; grid-row: 1; position: sticky; top: calc(var(--topbar-h) + 24px); max-height: calc(100vh - var(--topbar-h) - 48px); overflow-y: auto; }

.toc-box summary {
  list-style: none; cursor: default;
  font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
  margin-bottom: 10px;
}
.toc-box summary::-webkit-details-marker { display: none; }
.toc-side ul { list-style: none; margin: 0; padding: 0; }
.toc-side ul ul { padding-left: 12px; }
.toc-side li { margin: 0; }
.toc-side a {
  display: block; padding: 4px 0 4px 12px; border-left: 2px solid var(--border);
  color: var(--muted); text-decoration: none; font-size: 14px; line-height: 1.45;
}
.toc-side a:hover { color: var(--text-strong); }
.toc-side a.active { color: var(--accent); border-left-color: var(--accent); font-weight: 500; }
.toc-side code { font-size: .9em; background: none; padding: 0; }

/* ---------- Prose ---------- */

.prose { max-width: var(--content-width); min-width: 0; }
.prose > :first-child { margin-top: 0; }

.prose h2, .prose h3, .prose h4 { color: var(--text-strong); letter-spacing: -.015em; line-height: 1.3; position: relative; }
.prose h2 { font-size: 27px; font-weight: 750; margin: 56px 0 14px; padding-top: 24px; border-top: 1px solid var(--border); }
.prose > h2:first-child, .prose > p:first-child + h2 { border-top: 0; padding-top: 0; }
.prose h3 { font-size: 20px; font-weight: 700; margin: 36px 0 10px; }
.prose h4 { font-size: 17px; margin: 28px 0 8px; }
.prose h2 code, .prose h3 code { font-size: .86em; }

.heading-anchor {
  position: absolute; left: -1.1em; padding-right: .3em; text-decoration: none;
  color: var(--border-strong); opacity: 0; transition: opacity .1s;
}
.prose h2:hover .heading-anchor, .prose h3:hover .heading-anchor, .heading-anchor:focus { opacity: 1; }
.heading-anchor:hover { color: var(--accent); }

.prose p, .prose ul, .prose ol { margin: 0 0 18px; }
.prose li { margin: 4px 0; }
.prose li > ul, .prose li > ol { margin: 4px 0 0; }
.prose strong { color: var(--text-strong); font-weight: 650; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 40px 0; }

.prose :not(pre) > code {
  background: var(--inline-code-bg); color: var(--text-strong);
  padding: .14em .38em; border-radius: 5px; font-size: .86em; white-space: nowrap;
}
.prose a code { color: inherit; }

/* Callouts: a blockquote starting with **Note:** or **Tip:** */
.prose blockquote {
  margin: 24px 0; padding: 14px 18px 14px 18px;
  background: var(--accent-soft); border-left: 4px solid var(--accent); border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text);
}
.prose blockquote p:last-child { margin-bottom: 0; }
.prose blockquote.callout-warning { background: var(--accent-2-soft); border-left-color: var(--accent-2); }

/* ---------- Code ---------- */

.prose pre {
  position: relative;
  margin: 18px 0 22px; padding: 16px 18px;
  background: var(--code-bg); color: var(--code-text);
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow-x: auto; line-height: 1.6; font-size: 14.5px;
  tab-size: 2;
}
.prose pre code { font-size: inherit; background: none; padding: 0; white-space: pre; display: block; }

/* Output blocks (```text) */
.prose pre:has(> code.text) {
  background: var(--output-bg); border-color: var(--output-border); border-style: dashed;
  padding-top: 32px; font-size: 13.5px; line-height: 1.5;
}
.prose pre:has(> code.text)::before {
  content: "Output"; position: absolute; top: 9px; left: 18px;
  font-family: var(--font); font-size: 10.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--accent-2);
}
/* An output directly after its code joins it visually */
.prose pre:has(> code:not(.text)):has(+ pre > code.text) { margin-bottom: 0; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.prose pre:has(> code:not(.text)) + pre:has(> code.text) { margin-top: 0; border-top: 1px dashed var(--output-border); border-top-left-radius: 0; border-top-right-radius: 0; }

.copy-btn {
  position: absolute; top: 8px; right: 8px;
  font: 600 11.5px/1 var(--font); letter-spacing: .02em;
  padding: 6px 9px; border-radius: 6px; cursor: pointer;
  color: var(--muted); background: var(--surface); border: 1px solid var(--border);
  opacity: 0; transition: opacity .12s;
}
.prose pre:hover .copy-btn, .copy-btn:focus { opacity: 1; }
.copy-btn:hover { color: var(--text-strong); border-color: var(--border-strong); }
.copy-btn.copied { color: var(--accent); }
@media (hover: none) { .copy-btn { display: none; } }

.hljs-comment, .hljs-quote { color: var(--hl-comment); font-style: italic; }
.hljs-symbol, .hljs-keyword, .hljs-selector-tag, .hljs-literal { color: var(--hl-keyword); }
.hljs-name, .hljs-title, .hljs-built_in, .hljs-section { color: var(--hl-name); }
.hljs-string, .hljs-regexp, .hljs-attr { color: var(--hl-string); }
.hljs-number { color: var(--hl-number); }
.hljs-meta, .hljs-variable, .hljs-template-variable { color: var(--hl-meta); }

/* ---------- Tables ---------- */

.table-wrap { overflow-x: auto; margin: 18px 0 24px; border: 1px solid var(--border); border-radius: var(--radius); }
.prose table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.5; }
.prose th {
  text-align: left; font-weight: 650; color: var(--text-strong);
  background: var(--bg-soft); border-bottom: 1px solid var(--border);
  padding: 10px 14px;
}
.prose td { padding: 9px 14px; border-top: 1px solid var(--border); vertical-align: top; }
.prose tbody tr:first-child td { border-top: 0; }
.prose td code { white-space: normal; }
.prose td:first-child code { white-space: nowrap; }

/* ---------- Diagrams ---------- */

/* :by x :set/:agg grid */
.grid4 { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr); gap: 10px; margin: 22px 0 26px; font-size: 14.5px; }
.grid4 .g-head { font-weight: 650; color: var(--muted); font-size: 13px; text-align: center; align-self: end; padding-bottom: 2px; }
.grid4 .g-row { font-weight: 650; color: var(--muted); font-size: 13px; text-align: right; align-self: center; padding-right: 4px; }
.grid4 .g-row code, .grid4 .g-head code { white-space: nowrap; }
.g-cell {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 14px 12px; box-shadow: var(--shadow);
}
.g-cell strong { display: block; color: var(--text-strong); font-size: 15px; margin-bottom: 2px; }
.g-cell span.g-desc { display: block; color: var(--muted); font-size: 13.5px; line-height: 1.45; margin-top: 10px; }
.g-shape { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.g-arrow { color: var(--muted); font-size: 18px; }
.mt { display: inline-grid; grid-template-columns: repeat(var(--cols, 2), 14px); gap: 3px; }
.mt i { display: block; width: 14px; height: 9px; border-radius: 2px; background: var(--border-strong); }
.mt i.a { background: #0d7d72; opacity: .8; }
.mt i.b { background: #c2700c; opacity: .8; }
.mt i.n { background: transparent; border: 1.5px solid var(--accent); }
.mt i.na { background: #0d7d72; outline: 2px solid var(--accent-soft); }
.mt i.nb { background: #c2700c; outline: 2px solid var(--accent-2-soft); }

/* evaluation-order flow */
.flow { list-style: none; padding: 0; margin: 22px 0 26px; display: flex; flex-wrap: wrap; gap: 8px; counter-reset: step; }
.flow li {
  counter-increment: step;
  flex: 1 1 120px; position: relative;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 12px 10px; margin: 0; box-shadow: var(--shadow);
}
.flow li::before {
  content: counter(step); position: absolute; top: -9px; left: 10px;
  width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: var(--bg); font-size: 11.5px; font-weight: 700;
}
.flow li code { display: inline-block; font-weight: 600; }
.flow li span { display: block; color: var(--muted); font-size: 13.5px; line-height: 1.4; margin-top: 4px; }

/* Link cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin: 20px 0 28px; }
.cards a.card {
  display: block; padding: 16px 18px; border-radius: 12px; text-decoration: none;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
  transition: border-color .12s, transform .12s;
}
.cards a.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.cards a.card strong { display: block; color: var(--text-strong); font-size: 16px; margin-bottom: 4px; }
.cards a.card span { display: block; color: var(--muted); font-size: 14.5px; line-height: 1.5; }
.cards a.card strong::after { content: " \2192"; color: var(--accent); }

/* ---------- Pager ---------- */

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 56px; padding-top: 28px; border-top: 1px solid var(--border); }
.pager-link {
  display: block; padding: 14px 18px; border: 1px solid var(--border); border-radius: 12px;
  text-decoration: none; transition: border-color .12s;
}
.pager-link:hover { border-color: var(--accent); }
.pager-link.next { text-align: right; grid-column: 2; }
.pager-label { display: block; font-size: 13px; color: var(--muted); }
.pager-title { display: block; font-weight: 650; color: var(--text-strong); font-size: 16px; }

/* ---------- Footer ---------- */

.site-footer { border-top: 1px solid var(--border); background: var(--bg-soft); margin-top: 40px; }
.footer-inner {
  max-width: var(--page-width); margin: 0 auto; padding: 32px 24px 36px;
  display: grid; grid-template-columns: 1fr auto; gap: 12px 32px; font-size: 14.5px; color: var(--muted);
}
.footer-brand strong { color: var(--text-strong); display: block; font-size: 16px; }
.footer-links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 20px; align-self: center; }
.footer-links a, .footer-legal a { color: var(--muted); }
.footer-links a:hover, .footer-legal a:hover { color: var(--accent); }
.footer-legal { grid-column: 1 / -1; margin: 6px 0 0; font-size: 13px; }

/* ---------- Simple pages (archives, tags, 404) ---------- */

.simple-page { max-width: var(--content-width); margin: 0 auto; padding: 48px 24px; }

/* ---------- Responsive ---------- */

@media (max-width: 1080px) {
  .doc-layout.has-toc { display: block; }
  .toc-side { position: static; max-height: none; margin-bottom: 28px; }
  .toc-box { border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-soft); padding: 12px 16px; }
  .toc-box summary { cursor: pointer; margin: 0; }
  .toc-box[open] summary { margin-bottom: 10px; }
  .toc-box summary::after { content: " +"; }
  .toc-box[open] summary::after { content: " \2212"; }
  .hero-inner { grid-template-columns: minmax(0, 1fr); gap: 44px; }
  .features-inner { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  body { font-size: 16px; }
  .topbar-inner { flex-wrap: wrap; height: auto; padding: 10px 16px 0; gap: 0; }
  .brand { height: 40px; }
  .mainnav { order: 3; width: 100%; overflow-x: auto; margin: 6px -16px 0; padding: 0 12px 8px; width: calc(100% + 32px); scrollbar-width: none; }
  .mainnav::-webkit-scrollbar { display: none; }
  .mainnav a { padding: 6px 10px; font-size: 14.5px; }
  html { scroll-padding-top: 120px; }
  .hero { margin-top: -105px; padding: 140px 16px 56px; }
  .hero-lead { font-size: 17px; }
  .hero-code.hero-code { font-size: 12.5px; padding: 16px; }
  .window-out { padding: 12px 16px 14px; }
  .features { padding: 40px 16px 8px; }
  .features-inner { grid-template-columns: 1fr; gap: 14px; }
  .home-body, .doc-layout, .page-hero-inner, .footer-inner, .simple-page { padding-left: 16px; padding-right: 16px; }
  .page-hero-inner { padding-top: 32px; padding-bottom: 26px; }
  .doc-layout { padding-top: 24px; }
  .prose h2 { font-size: 23px; margin-top: 44px; }
  .prose h3 { font-size: 18.5px; }
  .prose pre { font-size: 13px; padding: 14px; margin-left: -4px; margin-right: -4px; }
  .prose pre:has(> code.text) { font-size: 12.5px; padding-top: 30px; }
  .heading-anchor { display: none; }
  .grid4 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .grid4 .g-row, .grid4 .g-corner { display: none; }
  .grid4 .g-head { display: none; }
  .g-cell .g-tag { display: block; }
  .pager { grid-template-columns: 1fr; }
  .pager-link.next { grid-column: 1; }
  .footer-inner { grid-template-columns: 1fr; }
}

.g-tag { display: none; font-family: var(--mono); font-size: 12px; color: var(--accent); margin-bottom: 4px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
