/* Self-hosted Google Fonts (SIL Open Font License 1.1), latin subset */
@font-face {
  font-family: 'Bricolage Grotesque';
  font-style: normal;
  font-weight: 500 700;
  font-stretch: 100%;
  font-display: swap;
  src: url(fonts/bricolage-grotesque-normal-500-700.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Hanken Grotesk';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/hanken-grotesk-italic-400.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Hanken Grotesk';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(fonts/hanken-grotesk-normal-400-700.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/ibm-plex-mono-normal-400.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(fonts/ibm-plex-mono-normal-500.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(fonts/ibm-plex-mono-normal-600.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/*
  Nightshade docs, v2. A field-guide take on a conventional docs layout:
  sticky header, grouped sidebar, ~72ch reading column, "On this page" rail.
  Identity: midnight violet and parchment, a calyx-and-stem rule above each
  section, specimen frames with crop marks around code and output, a herbarium
  label on rule pages. Dark values on :root; light under the two light guards.
*/
:root {
  color-scheme: dark;
  --bg: #0d0b16;
  --bg-raise: #141120;
  --bg-sunk: #0a0912;
  --bg-hover: #1c1829;
  --line: #262137;
  --line-strong: #3a3350;
  --fg: #ebe7f5;
  --fg-muted: #ada6c3;
  --fg-faint: #857e9f;
  --accent: #bca7f7;
  --accent-strong: #dacdfd;
  --accent-wash: rgba(188, 167, 247, 0.10);
  --leaf: #8fc4a1;
  --leaf-wash: rgba(143, 196, 161, 0.09);
  --berry: #1b1429;
  --berry-edge: #6e5aa0;
  --berry-shine: rgba(235, 231, 245, 0.75);
  --moon: rgba(188, 167, 247, 0.055);
  --moon-edge: rgba(188, 167, 247, 0.17);
  --code-bg: #0b0a13;
  --code-head: #110f1b;
  --flag: #f39ab3;
  --flag-wash: rgba(243, 154, 179, 0.10);
  --tok-cmd: #d6c9fb;
  --tok-flag: #8fc4a1;
  --tok-str: #e9c98a;
  --tok-key: #9fc3f0;
  --tok-num: #f0a98a;
  --tok-type: #c4b8e6;
  --tok-com: #7d7697;
  --sev-critical: #ff8f8f;
  --sev-high: #ffa874;
  --sev-medium: #efc66e;
  --sev-low: #93bbf2;
  --sev-info: #aaa4c0;
  --focus: #dacdfd;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 18px 40px -24px rgba(0, 0, 0, 0.8);
  --calyx: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpolygon fill='%238fc4a1' points='8,0.5 9.6,5.8 15.1,5.7 10.6,8.9 12.4,14.1 8,10.9 3.6,14.1 5.4,8.9 0.9,5.7 6.4,5.8'/%3E%3C/svg%3E");
  /* output panels stay night in both themes */
  --term-bg: #08070e;
  --term-bar: #110f1a;
  --term-line: #252034;
  --term-fg: #e4e0ef;
  --term-dim: #8a84a2;
  --term-amber: #efc66e;
  --term-lilac: #c7b5fa;
  --term-green: #8fc4a1;
  --term-red: #ff8f9f;

  --font-display: "Bricolage Grotesque", "Hanken Grotesk", ui-sans-serif, system-ui, sans-serif;
  --font-body: "Hanken Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --radius: 8px;
  --header-h: 60px;
  --sidebar-w: 248px;
  --gutter: max(16px, env(safe-area-inset-left, 0px));
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #f6f3ec; --bg-raise: #fffdf8; --bg-sunk: #efebe1; --bg-hover: #ece6da;
    --line: #e2dbcb; --line-strong: #cbc1ab;
    --fg: #1d1830; --fg-muted: #4b4560; --fg-faint: #6a6480;
    --accent: #5a3aa8; --accent-strong: #41257f; --accent-wash: rgba(90, 58, 168, 0.075);
    --leaf: #2e6e4c; --leaf-wash: rgba(46, 110, 76, 0.07);
    --berry: #2a2140; --berry-edge: #2a2140; --berry-shine: rgba(255, 255, 255, 0.8);
    --moon: rgba(90, 58, 168, 0.045); --moon-edge: rgba(90, 58, 168, 0.16);
    --code-bg: #fcfaf5; --code-head: #f2ede2;
    --flag: #b02a55; --flag-wash: rgba(176, 42, 85, 0.075);
    --tok-cmd: #5a3aa8; --tok-flag: #2e6e4c; --tok-str: #8a5a00; --tok-key: #1f5aa6; --tok-num: #a3431e; --tok-type: #6b4d9e; --tok-com: #6f6987;
    --sev-critical: #b3261e; --sev-high: #ad4e0c; --sev-medium: #866000; --sev-low: #2459a8; --sev-info: #5b5672;
    --focus: #5a3aa8;
    --shadow: 0 1px 2px rgba(29, 24, 48, 0.04), 0 12px 32px -20px rgba(29, 24, 48, 0.25);
    --calyx: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpolygon fill='%232e6e4c' points='8,0.5 9.6,5.8 15.1,5.7 10.6,8.9 12.4,14.1 8,10.9 3.6,14.1 5.4,8.9 0.9,5.7 6.4,5.8'/%3E%3C/svg%3E");
  }
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f3ec; --bg-raise: #fffdf8; --bg-sunk: #efebe1; --bg-hover: #ece6da;
  --line: #e2dbcb; --line-strong: #cbc1ab;
  --fg: #1d1830; --fg-muted: #4b4560; --fg-faint: #6a6480;
  --accent: #5a3aa8; --accent-strong: #41257f; --accent-wash: rgba(90, 58, 168, 0.075);
  --leaf: #2e6e4c; --leaf-wash: rgba(46, 110, 76, 0.07);
  --berry: #2a2140; --berry-edge: #2a2140; --berry-shine: rgba(255, 255, 255, 0.8);
  --moon: rgba(90, 58, 168, 0.045); --moon-edge: rgba(90, 58, 168, 0.16);
  --code-bg: #fcfaf5; --code-head: #f2ede2;
  --flag: #b02a55; --flag-wash: rgba(176, 42, 85, 0.075);
  --tok-cmd: #5a3aa8; --tok-flag: #2e6e4c; --tok-str: #8a5a00; --tok-key: #1f5aa6; --tok-num: #a3431e; --tok-type: #6b4d9e; --tok-com: #6f6987;
  --sev-critical: #b3261e; --sev-high: #ad4e0c; --sev-medium: #866000; --sev-low: #2459a8; --sev-info: #5b5672;
  --focus: #5a3aa8;
  --shadow: 0 1px 2px rgba(29, 24, 48, 0.04), 0 12px 32px -20px rgba(29, 24, 48, 0.25);
  --calyx: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpolygon fill='%232e6e4c' points='8,0.5 9.6,5.8 15.1,5.7 10.6,8.9 12.4,14.1 8,10.9 3.6,14.1 5.4,8.9 0.9,5.7 6.4,5.8'/%3E%3C/svg%3E");
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font-family: var(--font-body); font-size: 1.0625rem; line-height: 1.65;
  overflow-x: hidden; text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; }
[hidden] { display: none !important; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--accent-strong); text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--accent); color: var(--bg); }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; line-height: 1.18; letter-spacing: -0.015em; text-wrap: balance; margin: 0; }
h1 { font-size: clamp(2rem, 1.5rem + 1.8vw, 2.6rem); letter-spacing: -0.025em; }
h2 { font-size: clamp(1.35rem, 1.2rem + 0.6vw, 1.6rem); }
h3 { font-size: 1.18rem; letter-spacing: -0.005em; }
h4 { font-size: 1.02rem; font-family: var(--font-body); font-weight: 650; letter-spacing: 0; }
p { margin: 0; }
code, kbd, pre { font-family: var(--font-mono); }
:not(pre) > code { font-size: 0.86em; padding: 0.1em 0.34em; border-radius: 4px; background: var(--accent-wash); border: 1px solid var(--line); color: var(--fg); overflow-wrap: anywhere; }
a code { color: inherit; }
code.nb { white-space: nowrap; }
strong { font-weight: 650; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.no-js .js-only { display: none; }
.wrap { max-width: 1200px; margin-inline: auto; padding-inline: var(--gutter); }
.skip { position: absolute; left: 12px; top: -60px; z-index: 60; background: var(--accent); color: var(--bg); padding: 8px 14px; border-radius: 6px; font-weight: 600; text-decoration: none; }
.skip:focus { top: 12px; color: var(--bg); }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40; height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: saturate(1.2) blur(10px); -webkit-backdrop-filter: saturate(1.2) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-row { display: flex; align-items: center; gap: 20px; height: 100%; padding-inline: max(20px, var(--gutter)); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--fg); text-decoration: none; font-family: var(--font-display); font-weight: 650; font-size: 1.14rem; letter-spacing: -0.01em; flex: none; }
.brand:hover { color: var(--fg); }
.brand .mark { width: 28px; height: 28px; }
.brand .ver { font-family: var(--font-mono); font-weight: 500; font-size: 0.7rem; color: var(--fg-faint); border: 1px solid var(--line); border-radius: 999px; padding: 1px 7px; letter-spacing: 0.02em; }
.top-nav { margin-left: 8px; display: none; }
.top-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 2px; }
.top-nav a { display: block; padding: 6px 10px; border-radius: 6px; color: var(--fg-muted); text-decoration: none; font-size: 0.94rem; font-weight: 500; }
.top-nav a:hover { color: var(--fg); background: var(--bg-hover); }
.top-nav a[aria-current="page"] { color: var(--fg); box-shadow: inset 0 -2px 0 var(--accent); border-radius: 0; }
@media (min-width: 1180px) { .top-nav { display: block; } }
.header-tools { display: flex; align-items: center; gap: 6px; margin-left: auto; flex: none; }
.icon-btn, .search-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; min-width: 36px; padding: 0 9px;
  border: 1px solid var(--line); border-radius: 7px; background: transparent; color: var(--fg-muted);
  font: 500 0.9rem var(--font-body); text-decoration: none; cursor: pointer;
}
.icon-btn:hover, .search-btn:hover { color: var(--fg); background: var(--bg-hover); border-color: var(--line-strong); }
.icon-btn svg, .search-btn svg { width: 18px; height: 18px; flex: none; }
.search-btn { min-width: 220px; justify-content: flex-start; background: var(--bg-raise); color: var(--fg-faint); }
.search-btn kbd { margin-left: auto; font-size: 0.72rem; border: 1px solid var(--line); border-radius: 4px; padding: 0 6px; color: var(--fg-faint); }
.theme-toggle .i-sun { display: none; }
:root[data-theme="light"] .theme-toggle .i-sun { display: block; }
:root[data-theme="light"] .theme-toggle .i-moon { display: none; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .theme-toggle .i-sun { display: block; }
  :root:not([data-theme="dark"]) .theme-toggle .i-moon { display: none; }
}
.menu-btn { display: none; }
@media (max-width: 1023px) {
  .menu-btn { display: inline-flex; }
  .search-btn { min-width: 36px; padding: 0 9px; }
  .search-btn .search-label, .search-btn kbd { display: none; }
}
@media (max-width: 420px) {
  .brand .ver { display: none; }
  .header-row { gap: 10px; }
}

/* ---------- shell: sidebar + content ---------- */
.shell { display: grid; grid-template-columns: minmax(0, 1fr); }
.sidebar { font-size: 0.95rem; }
.sidebar-inner { padding: 28px 20px 40px 24px; display: grid; gap: 26px; }
.nav-label { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--fg-faint); margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.nav-label::before { content: ""; width: 9px; height: 9px; background: var(--calyx) center / contain no-repeat; }
.sidebar ul { list-style: none; margin: 0; padding: 0 0 0 4px; display: grid; gap: 1px; border-left: 1px solid var(--line); }
.sidebar a { display: block; padding: 5px 12px; margin-left: -1px; border-left: 2px solid transparent; color: var(--fg-muted); text-decoration: none; line-height: 1.4; }
.sidebar a:hover { color: var(--fg); border-left-color: var(--line-strong); }
.sidebar a[aria-current="page"] { color: var(--fg); font-weight: 600; border-left-color: var(--accent); background: linear-gradient(90deg, var(--accent-wash), transparent 80%); }
@media (min-width: 1024px) {
  .shell { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .sidebar { position: sticky; top: var(--header-h); height: calc(100vh - var(--header-h)); overflow-y: auto; border-right: 1px solid var(--line); }
  .home-shell { grid-template-columns: minmax(0, 1fr); }
  .home-shell > .sidebar { display: none; }
}
@media (max-width: 1023px) {
  .js .sidebar { display: none; }
  .js .sidebar.open {
    display: block; position: fixed; z-index: 35; inset: var(--header-h) 0 0 0; overflow-y: auto;
    background: var(--bg); border-top: 1px solid var(--line);
  }
  .js .sidebar.open .sidebar-inner { max-width: 520px; padding: 20px var(--gutter) 48px; }
  .sidebar a { padding: 9px 12px; font-size: 1rem; }
  /* without JavaScript the navigation follows the content */
  .no-js .shell { display: flex; flex-direction: column; }
  .no-js .sidebar { order: 2; border-top: 1px solid var(--line); }
}

/* ---------- document ---------- */
.doc-main { display: grid; grid-template-columns: minmax(0, 1fr); gap: 56px; padding: 40px max(20px, var(--gutter)) 80px; min-width: 0; }
@media (min-width: 1024px) { .doc-main { padding: 44px 48px 88px; } }
@media (min-width: 1300px) { .doc-main { grid-template-columns: minmax(0, 46rem) 210px; justify-content: start; } }
@media (min-width: 1300px) { .wide .doc-main { grid-template-columns: minmax(0, 1120px); } .wide .toc { display: none !important; } }
.doc { min-width: 0; }
.doc-head { display: grid; gap: 14px; padding-bottom: 26px; margin-bottom: 10px; border-bottom: 1px solid var(--line); }
.doc-head > * { max-width: 48rem; }
.eyebrow { font-family: var(--font-mono); font-size: 0.74rem; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; color: var(--leaf); }
.lede { color: var(--fg-muted); font-size: 1.14rem; max-width: 62ch; }
.rule-title { font-family: var(--font-mono); font-weight: 600; font-size: clamp(1.45rem, 1.1rem + 1.6vw, 2.1rem); letter-spacing: -0.02em; overflow-wrap: anywhere; }
.crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 8px; font-size: 0.86rem; color: var(--fg-faint); }
.crumbs li + li::before { content: "/"; margin-right: 8px; color: var(--line-strong); }
.crumbs a { color: var(--fg-muted); text-decoration: none; }
.crumbs a:hover { color: var(--fg); text-decoration: underline; }
.crumbs [aria-current] { font-family: var(--font-mono); font-size: 0.82rem; overflow-wrap: anywhere; }
.page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg-raise); font-family: var(--font-mono); font-size: 0.74rem; color: var(--fg-muted); white-space: nowrap; text-decoration: none; }
.chip-rel { color: var(--leaf); border-color: color-mix(in srgb, var(--leaf) 35%, transparent); }
a.chip-ex { color: var(--accent); }
a.chip-ex:hover { border-color: var(--accent); }
.act { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 11px; border-radius: 6px; border: 1px solid var(--line); background: transparent; color: var(--fg-muted); font: 500 0.84rem var(--font-body); text-decoration: none; cursor: pointer; }
.act:hover { color: var(--fg); background: var(--bg-hover); border-color: var(--line-strong); }
.act svg { width: 16px; height: 16px; }
.act.done { color: var(--leaf); border-color: var(--leaf); }

.prose { display: grid; gap: 18px; min-width: 0; }
.prose > p, .prose > ul, .prose > ol, .prose > h3, .prose > h4, .prose > blockquote, .rule-doc > p, .rule-doc > ul { max-width: 48rem; }
.prose > h2, .case > h2 {
  margin-top: 34px; padding-top: 26px;
  background: var(--calyx) 0 0 / 14px 14px no-repeat, linear-gradient(var(--line), var(--line)) 22px 7px / 100% 1px no-repeat;
}
.prose > h3 { margin-top: 10px; }
.prose ul, .prose ol { margin: 0; padding-left: 1.25em; display: grid; gap: 8px; }
.prose li::marker { color: var(--fg-faint); }
.prose blockquote { margin: 0; padding: 4px 0 4px 18px; border-left: 2px solid var(--accent); color: var(--fg-muted); }
a.anchor { color: var(--fg-faint); text-decoration: none; margin-left: 8px; opacity: 0; font-weight: 400; }
h2:hover a.anchor, h3:hover a.anchor, h4:hover a.anchor, a.anchor:focus-visible { opacity: 1; }
.caption, figcaption, .source-note { color: var(--fg-faint); font-size: 0.88rem; line-height: 1.5; }
.note { color: var(--fg-muted); font-size: 0.95rem; }

.toc { position: sticky; top: calc(var(--header-h) + 32px); align-self: start; display: none; font-size: 0.88rem; max-height: calc(100vh - var(--header-h) - 64px); overflow-y: auto; }
@media (min-width: 1300px) { .toc { display: block; } }
.toc-label { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--fg-faint); margin-bottom: 10px; }
.toc ul { list-style: none; margin: 0; padding: 0 0 0 12px; border-left: 1px solid var(--line); display: grid; gap: 7px; }
.toc a { color: var(--fg-muted); text-decoration: none; line-height: 1.35; display: block; }
.toc a:hover, .toc a.active { color: var(--fg); }
.toc a.active { box-shadow: -13px 0 0 -11px var(--accent); }

.related { display: flex; flex-wrap: wrap; gap: 8px 10px; margin-top: 14px; padding-top: 22px; border-top: 1px solid var(--line); }
.related a { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line); text-decoration: none; color: var(--fg-muted); font-size: 0.92rem; }
.related a:hover { color: var(--fg); border-color: var(--line-strong); background: var(--bg-hover); }
.related a::after { content: "\2197"; font-size: 0.8em; color: var(--fg-faint); }
.related a.internal::after { content: "\2192"; }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 56px; }
.pager a { display: grid; gap: 2px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--fg); background: var(--bg-raise); min-width: 0; overflow-wrap: anywhere; }
.pager a:hover { border-color: var(--line-strong); color: var(--fg); }
.pager span { font-size: 0.78rem; color: var(--fg-faint); font-family: var(--font-mono); letter-spacing: 0.04em; }
.pager .next { text-align: right; grid-column: 2; }
@media (max-width: 560px) { .pager { grid-template-columns: 1fr; } .pager .next { grid-column: 1; } }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-raise); max-width: 100%; }
@media (max-width: 640px) { .table-wrap table:has(th:nth-child(3)) td:first-child { min-width: 11rem; } }
table { border-collapse: collapse; width: 100%; font-size: 0.93rem; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-family: var(--font-mono); font-weight: 500; color: var(--fg-faint); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; background: var(--code-head); white-space: nowrap; }
th.num, td.num { text-align: right; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td code { white-space: nowrap; }
details.more { border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-raise); }
details.more > summary { cursor: pointer; padding: 12px 16px; font-weight: 600; color: var(--fg); list-style-position: inside; }
details.more[open] > summary { border-bottom: 1px solid var(--line); }
details.more > p { padding: 12px 16px 0; color: var(--fg-muted); font-size: 0.93rem; }
details.more .table-wrap { border: 0; border-radius: 0; margin-top: 8px; }

/* ---------- code: specimen frames with crop marks ---------- */
.code, .terminal { margin: 0; min-width: 0; }
.frame { position: relative; border: 1px solid var(--line-strong); border-radius: 6px; }
.terminal > .frame { border-color: var(--term-line); }
.frame::before, .frame::after { content: ""; position: absolute; width: 11px; height: 11px; pointer-events: none; }
.frame::before { top: -6px; left: -6px; border-top: 1.5px solid var(--accent); border-left: 1.5px solid var(--accent); }
.frame::after { bottom: -6px; right: -6px; border-bottom: 1.5px solid var(--accent); border-right: 1.5px solid var(--accent); }
.frame > :first-child { border-radius: 5px 5px 0 0; }
.frame > pre { border-radius: 0 0 5px 5px; }
.code-head { display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 10px; background: var(--code-head); border-bottom: 1px solid var(--line); min-width: 0; }
.code-tag { font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--fg-faint); border: 1px solid var(--line-strong); border-radius: 3px; padding: 0 6px; flex: none; }
.code-name { font-family: var(--font-mono); font-size: 0.8rem; color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.code-note { font-family: var(--font-mono); font-size: 0.72rem; color: var(--flag); white-space: nowrap; }
.code-note.is-quiet { color: var(--fg-faint); }
.code-head .copy-btn { margin-left: auto; }
@media (max-width: 520px) { .code-head { flex-wrap: wrap; row-gap: 4px; } .code-name { flex: 1 1 auto; } }
.code pre { margin: 0; padding: 12px 0; overflow-x: auto; font-size: 0.84rem; line-height: 1.7; color: var(--fg); tab-size: 2; background: var(--code-bg); }
.code pre code { font-family: inherit; white-space: pre; display: inline-block; min-width: 100%; }
.code .line { display: inline-block; min-width: 100%; padding: 0 16px; }
.code.numbered .line::before { content: attr(data-n); display: inline-block; width: 2.4ch; margin-right: 2ch; text-align: right; color: var(--fg-faint); opacity: 0.8; user-select: none; -webkit-user-select: none; }
.code .line.is-flagged { background: var(--flag-wash); box-shadow: inset 3px 0 0 var(--flag); }
.code .line.is-flagged::before { color: var(--flag); opacity: 1; font-weight: 600; }
.code .line.is-changed { background: var(--accent-wash); box-shadow: inset 3px 0 0 var(--accent); }
.code .line.is-changed::before { color: var(--accent); opacity: 1; }
.code figcaption, .terminal figcaption { padding: 10px 2px 0; }
.copy-btn { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 9px; font: 500 0.78rem var(--font-body); color: var(--fg-muted); background: transparent; border: 1px solid var(--line); border-radius: 5px; cursor: pointer; flex: none; }
.copy-btn:hover { color: var(--fg); border-color: var(--line-strong); background: var(--bg-hover); }
.copy-btn svg { width: 13px; height: 13px; }
.copy-btn.done { color: var(--leaf); border-color: var(--leaf); }
.no-js .copy-btn { display: none; }
.tok-cmd { color: var(--tok-cmd); font-weight: 500; }
.tok-flag { color: var(--tok-flag); }
.tok-str { color: var(--tok-str); }
.tok-key { color: var(--tok-key); }
.tok-num { color: var(--tok-num); }
.tok-type { color: var(--tok-type); }
.tok-com { color: var(--tok-com); font-style: italic; }

/* ---------- output panels ---------- */
.terminal { color: var(--term-fg); }
.terminal pre { background: var(--term-bg); }
.term-bar { display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 10px; background: var(--term-bar) !important; border-bottom: 1px solid var(--term-line); min-width: 0; }
.term-dots { display: none; }
.term-title { font-family: var(--font-mono); font-size: 0.8rem; color: var(--term-fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.term-title::before { content: "Output"; font-size: 0.66rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--term-dim); border: 1px solid #3a3350; border-radius: 3px; padding: 0 6px; margin-right: 10px; }
.exit { font-family: var(--font-mono); font-size: 0.72rem; padding: 0 7px; border-radius: 999px; border: 1px solid #3a3350; color: var(--term-dim); white-space: nowrap; }
.exit-1 { color: var(--term-amber); border-color: rgba(239, 198, 110, 0.45); }
.exit-2 { color: var(--term-red); border-color: rgba(255, 143, 159, 0.45); }
.terminal .copy-btn { margin-left: auto; color: var(--term-dim); border-color: var(--term-line); }
.terminal .copy-btn:hover { color: var(--term-fg); background: rgba(255, 255, 255, 0.04); border-color: #3a3350; }
.terminal pre { margin: 0; padding: 14px 16px 16px; overflow-x: auto; font-size: 0.82rem; line-height: 1.7; }
.terminal pre code { white-space: pre-wrap; overflow-wrap: anywhere; font-family: inherit; }
.terminal figcaption { color: var(--fg-faint); }
.t-prompt { color: var(--term-dim); user-select: none; }
.t-cmd { color: var(--term-lilac); }
.t-sev { font-weight: 600; letter-spacing: 0.05em; color: var(--term-amber); }
.t-sev-high, .t-sev-critical { color: #ffa874; }
.t-sev-low { color: #93bbf2; }
.t-sev-info { color: var(--term-dim); }
.t-title { color: var(--term-fg); font-weight: 600; }
.t-rule { color: var(--term-lilac); }
.t-loc { color: var(--term-dim); text-decoration: underline; text-decoration-color: #3a3350; text-underline-offset: 3px; }
.t-gutter { color: var(--term-dim); }
.t-caret { color: var(--term-red); font-weight: 600; }
.t-dim, .t-key { color: var(--term-dim); }
.t-ok { color: var(--term-green); }
.t-strong { color: var(--term-amber); font-weight: 600; }
.t-zero { color: var(--term-fg); font-weight: 600; }

/* ---------- pairs: code beside output ---------- */
.pair { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; align-items: start; }
@media (min-width: 1100px) { .pair { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; } .pair > .code { position: sticky; top: calc(var(--header-h) + 20px); } .shell:not(.wide) .doc .pair { grid-template-columns: minmax(0, 1fr); } .shell:not(.wide) .doc .pair > .code { position: static; } }

/* ---------- examples ---------- */
.case-index { list-style: none; margin: 4px 0 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); border-top: 1px solid var(--line); }
@media (min-width: 760px) { .case-index { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 28px; } }
.case-index a { display: grid; grid-template-columns: 2.4rem minmax(0, 1fr) auto; grid-template-areas: "no title sev" "no rule sev"; gap: 0 10px; padding: 11px 2px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--fg); align-items: start; }
.case-index a:hover .ci-title { color: var(--accent); }
.ci-no { grid-area: no; font-family: var(--font-mono); font-size: 0.8rem; color: var(--leaf); padding-top: 3px; }
.ci-title { grid-area: title; font-weight: 600; line-height: 1.35; }
.ci-rule { grid-area: rule; font-family: var(--font-mono); font-size: 0.78rem; color: var(--fg-faint); overflow-wrap: anywhere; }
.case-index .sev { grid-area: sev; margin-top: 2px; }
.case { display: grid; gap: 16px; min-width: 0; }
.case > h2 { margin-top: 44px; }
.case > h2::before { content: attr(data-no); display: block; font-family: var(--font-mono); font-size: 0.72rem; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; color: var(--leaf); margin-bottom: 8px; }
.case > h3 { margin-top: 8px; font-size: 1.02rem; font-family: var(--font-mono); font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--fg-muted); }
.case > p { max-width: 48rem; }
.case-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.case-meta .rule-link { font-weight: 500; }
.tag-synth { display: inline-flex; align-items: center; padding: 1px 9px; border-radius: 3px; border: 1px dashed var(--fg-faint); font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--fg-muted); white-space: nowrap; }
.case-scenario { font-size: 1.06rem; color: var(--fg); }
.lookalike { border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-raise); }
.lookalike > summary { cursor: pointer; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 14px; align-items: baseline; padding: 12px 16px; list-style: none; }
.lookalike > summary::-webkit-details-marker { display: none; }
.lookalike > summary h3 { font-size: 1.02rem; font-family: var(--font-mono); font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--fg-muted); display: inline-flex; gap: 10px; align-items: center; }
.lookalike > summary h3::before { content: "+"; color: var(--accent); font-weight: 600; width: 1ch; }
.lookalike[open] > summary h3::before { content: "\2212"; }
.lookalike > summary span { color: var(--fg-muted); font-size: 0.95rem; }
.lookalike > .pair { padding: 4px 16px 18px; }
.provenance { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-sunk); font-size: 0.9rem; }
@media (min-width: 900px) { .provenance { grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.7fr) minmax(0, 1fr); } }
.prov-label { font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--fg-faint); margin-bottom: 6px; }
.provenance ul { margin: 0; padding-left: 1.1em; display: grid; gap: 4px; }
.provenance ul.files { list-style: none; padding: 0; font-family: var(--font-mono); font-size: 0.82rem; }
.provenance .code pre { font-size: 0.76rem; padding: 8px 0; }
.provenance .code .line { padding: 0 12px; }

/* ---------- rule pages: herbarium label ---------- */
.specimen-card { position: relative; border: 1px solid var(--line-strong); border-radius: 4px; background: var(--bg-raise); padding: 18px 20px 20px; box-shadow: inset 0 0 0 4px var(--bg-raise), inset 0 0 0 5px var(--line); overflow: hidden; }
.card-label { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--fg-faint); margin: 2px 92px 14px 0; }
.specimen-card dl { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 20px; }
@media (min-width: 700px) { .specimen-card dl { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.specimen-card dl > div { display: grid; gap: 3px; border-top: 1px dotted var(--line-strong); padding-top: 8px; min-width: 0; }
.specimen-card dl > div.wide { grid-column: 1 / -1; }
.specimen-card dt { font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--fg-faint); }
.specimen-card dd { margin: 0; font-weight: 550; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.specimen-card dd code { font-size: 0.78rem; font-weight: 400; }
.card-seal { position: absolute; top: 10px; right: 12px; width: 78px; height: 78px; color: var(--accent); opacity: 0.55; transform: rotate(-8deg); }
.rule-doc { display: grid; gap: 16px; min-width: 0; }
.rule-doc h3 { margin-top: 12px; }
.rule-doc h4 { margin-top: 4px; color: var(--fg-muted); }

/* ---------- severity ---------- */
.sev { display: inline-flex; align-items: center; gap: 6px; padding: 1px 8px 1px 7px; border-radius: 999px; font-family: var(--font-mono); font-size: 0.7rem; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--sev-c); border: 1px solid color-mix(in srgb, var(--sev-c) 40%, transparent); background: color-mix(in srgb, var(--sev-c) 9%, transparent); white-space: nowrap; }
.sev::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--sev-c); }
.sev-critical { --sev-c: var(--sev-critical); }
.sev-high { --sev-c: var(--sev-high); }
.sev-medium { --sev-c: var(--sev-medium); }
.sev-low { --sev-c: var(--sev-low); }
.sev-info { --sev-c: var(--sev-info); }
.sevs { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.rule-link { font-family: var(--font-mono); font-size: 0.84rem; overflow-wrap: anywhere; }

/* ---------- rules index ---------- */
.rules-tools { display: grid; gap: 12px; padding: 16px; margin-top: 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-raise); }
.rules-tools .row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 700px) { .rules-tools .row { grid-template-columns: minmax(0, 1fr); } }
.field { display: grid; gap: 5px; min-width: 0; }
.field label, .rule-jump label { font-size: 0.72rem; font-family: var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--fg-faint); }
.field input, .field select, .rule-jump input { width: 100%; min-width: 0; height: 40px; padding: 0 12px; border-radius: 7px; border: 1px solid var(--line-strong); background: var(--bg); color: var(--fg); font: 400 0.98rem var(--font-body); }
.field input::placeholder, .rule-jump input::placeholder { color: var(--fg-faint); }
.search-wrap { position: relative; }
.search-wrap kbd { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); font-size: 0.72rem; color: var(--fg-faint); border: 1px solid var(--line); border-radius: 4px; padding: 0 6px; }
.rules-status { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; font-size: 0.92rem; color: var(--fg-muted); }
.link-btn { background: none; border: 0; padding: 2px 0; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 0.18em; }
.rule-group { display: grid; gap: 4px; min-width: 0; }
.rule-group > h2 { margin-top: 30px; padding-top: 26px; background: var(--calyx) 0 0 / 14px 14px no-repeat, linear-gradient(var(--line), var(--line)) 22px 7px / 100% 1px no-repeat; }
.rule-group > h3 { margin-top: 18px; color: var(--fg-muted); font-size: 1.06rem; }
.rule-group .group-note { color: var(--fg-muted); font-size: 0.95rem; }
.prose ul.rule-list { list-style: none; margin: 8px 0 0; padding: 0; display: block; border-top: 1px solid var(--line); max-width: none; }
.rule { display: grid; gap: 6px; padding: 14px 2px; border-bottom: 1px solid var(--line); }
.rule-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.rule-top .rule-link { font-size: 0.93rem; font-weight: 500; margin-right: auto; }
.rule-desc { color: var(--fg-muted); font-size: 0.97rem; }
.rule-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.empty { padding: 28px 0; color: var(--fg-muted); }

/* ---------- buttons ---------- */
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
.btn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 8px; font-weight: 600; font-size: 0.98rem; text-decoration: none; border: 1px solid var(--line-strong); color: var(--fg); background: var(--bg-raise); cursor: pointer; font-family: var(--font-body); }
.btn:hover { color: var(--fg); border-color: var(--fg-faint); }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-primary { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--bg); }
.btn-quiet { background: transparent; }
.more-link { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; text-decoration: none; }
.more-link svg { width: 16px; height: 16px; }
.more-link:hover { text-decoration: underline; }

/* ---------- home ---------- */
.hero { position: relative; border-bottom: 1px solid var(--line); overflow: hidden; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; align-items: center; padding-block: 56px 52px; }
@media (min-width: 900px) { .hero-grid { grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr); padding-block: 80px 68px; } }
.hero-copy { display: grid; gap: 22px; justify-items: start; position: relative; z-index: 1; }
.hero h1 { font-size: clamp(2.4rem, 1.6rem + 3.6vw, 4rem); max-width: 13ch; line-height: 1.02; letter-spacing: -0.035em; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero .lede { font-size: 1.16rem; max-width: 54ch; }
.hero-art { justify-self: end; width: min(100%, 420px); }
.hero-art svg { display: block; width: 100%; height: auto; }
@media (max-width: 899px) {
  .hero-art { justify-self: center; width: 160px; opacity: 0.9; }
  .hero-art text { display: none; }
  .hero .meta-line { flex-wrap: wrap; gap: 4px 16px; }
}
.meta-line { display: flex; flex-wrap: wrap; gap: 8px 18px; font-family: var(--font-mono); font-size: 0.78rem; color: var(--fg-faint); }
.meta-line span { display: inline-flex; align-items: center; gap: 7px; }
.meta-line span::before { content: ""; width: 9px; height: 9px; background: var(--calyx) center / contain no-repeat; }
.band { padding-block: 68px; border-bottom: 1px solid var(--line); }
.band:last-child { border-bottom: 0; }
.band-head { display: grid; gap: 12px; margin-bottom: 30px; max-width: 46rem; }
.band-head h2 { padding-top: 24px; background: var(--calyx) 0 0 / 14px 14px no-repeat, linear-gradient(var(--line), var(--line)) 22px 7px / 160px 1px no-repeat; }
.band-head p { color: var(--fg-muted); }
.wide-head { max-width: 52rem; }
.split { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; align-items: start; }
@media (min-width: 960px) { .split { grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: 56px; } }
.split .band-head { margin-bottom: 0; }
.stack { display: grid; gap: 16px; min-width: 0; }
.cases { display: grid; gap: 56px; }
.home-case { display: grid; gap: 14px; min-width: 0; }
.case-head { display: grid; gap: 6px; }
.case-no { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--leaf); }
.home-case h3 { font-size: 1.32rem; }
.case-foot { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; color: var(--fg-muted); font-size: 0.95rem; padding-top: 2px; }
.case-foot strong { color: var(--fg); }
.quiet-dot { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--accent); flex: none; align-self: flex-start; margin-top: 0.55em; }
.case-foot > span:not(.quiet-dot) { flex: 1 1 240px; min-width: 0; }
.after-cases { margin-top: 40px; }
.rule-jump { display: grid; gap: 6px; max-width: 34rem; margin-bottom: 26px; }
.rule-jump .search-wrap { display: flex; gap: 8px; }
.rule-jump .btn { min-height: 40px; height: 40px; }
.families { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
@media (min-width: 640px) { .families { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .families { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.families a { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "n name" "n text"; gap: 2px 14px; padding: 16px; height: 100%; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-raise); text-decoration: none; color: var(--fg); }
.families a:hover { border-color: var(--accent); }
.fam-n { grid-area: n; font-family: var(--font-display); font-size: 1.7rem; font-weight: 600; line-height: 1; color: var(--accent); min-width: 2ch; padding-top: 2px; }
.fam-name { grid-area: name; font-weight: 650; }
.fam-text { grid-area: text; color: var(--fg-muted); font-size: 0.92rem; line-height: 1.45; }
.ci-foot { margin-top: 28px; }
.exit-table td:first-child { font-family: var(--font-mono); width: 4rem; }
.stats { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
@media (min-width: 900px) { .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } .stat + .stat { border-left: 1px solid var(--line); } }
@media (max-width: 899px) { .stat + .stat { border-top: 1px solid var(--line); } }
.stat { display: grid; gap: 6px; align-content: start; padding: 22px 24px 22px 0; }
@media (min-width: 900px) { .stat + .stat { padding-left: 24px; } }
.stat-big { font-family: var(--font-display); font-size: clamp(2.2rem, 1.8rem + 1.6vw, 3rem); font-weight: 600; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.stat-label { font-weight: 650; }
.stat-ctx { color: var(--fg-muted); font-size: 0.93rem; line-height: 1.5; }
.stat-link { font-size: 0.93rem; }
.stats-note { margin-top: 14px; color: var(--fg-faint); font-size: 0.88rem; }
.ai-actions { display: grid; gap: 16px; }
.ai-files { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ai-files li { display: grid; gap: 2px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-raise); }
.ai-files span { font-size: 0.85rem; color: var(--fg-faint); }

/* ---------- search dialog ---------- */
.search-dialog { width: min(640px, calc(100vw - 32px)); max-height: min(560px, calc(100vh - 96px)); margin: 72px auto auto; padding: 0; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--bg-raise); color: var(--fg); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.6); overflow: hidden; }
.search-dialog[open] { display: flex; flex-direction: column; }
.search-dialog::backdrop { background: rgba(8, 6, 14, 0.55); backdrop-filter: blur(2px); }
.search-form { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.search-icon svg { width: 18px; height: 18px; color: var(--fg-faint); display: block; }
.search-form input { flex: 1; min-width: 0; height: 40px; border: 0; background: transparent; color: var(--fg); font: 400 1.05rem var(--font-body); outline: none; }
.search-close { font: 500 0.75rem var(--font-mono); color: var(--fg-faint); background: transparent; border: 1px solid var(--line); border-radius: 4px; padding: 2px 7px; cursor: pointer; }
.search-status { padding: 8px 16px 0; font-size: 0.82rem; color: var(--fg-faint); }
.search-results { list-style: none; margin: 0; padding: 6px; overflow-y: auto; }
.search-results a { display: grid; gap: 2px; padding: 9px 12px; border-radius: 6px; text-decoration: none; color: var(--fg); }
.search-results a[aria-selected="true"], .search-results a:hover { background: var(--accent-wash); }
.sr-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.sr-kind { font-family: var(--font-mono); font-size: 0.64rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--fg-faint); border: 1px solid var(--line); border-radius: 3px; padding: 0 5px; flex: none; }
.sr-title { font-weight: 600; overflow-wrap: anywhere; }
.sr-title.mono { font-family: var(--font-mono); font-size: 0.9rem; }
.sr-text { color: var(--fg-muted); font-size: 0.86rem; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sr-text mark { background: none; color: var(--accent); font-weight: 600; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 28px max(20px, var(--gutter)) 36px; color: var(--fg-faint); font-size: 0.9rem; background: var(--bg-sunk); }
.foot-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px 28px; max-width: 1200px; margin-inline: auto; }
.foot-brand { display: flex; align-items: center; gap: 14px; }
.foot-seal { width: 64px; height: 64px; color: var(--fg-faint); flex: none; }
.foot-name { color: var(--fg); font-weight: 600; }
.foot-links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.site-footer a { color: var(--fg-muted); }
.site-footer a:hover { color: var(--fg); }
@media (min-width: 1024px) { .shell:not(.home-shell) + .site-footer { padding-left: calc(var(--sidebar-w) + 48px); } .shell:not(.home-shell) + .site-footer .foot-row { margin-inline: 0; } }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
@media print { .site-header, .sidebar, .toc, .page-actions, .copy-btn, .site-footer { display: none !important; } .shell { display: block; } }

/* proof pack download */
.download-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-raise); padding: 18px 20px; margin-block: 18px 22px; display: grid; gap: 10px; }
.download-card > p, .download-card .dl-main { margin: 0; }
.dl-main { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.dl-main .btn svg { width: 18px; height: 18px; }
.dl-meta { font-size: 0.9rem; color: var(--fg-muted); }
.dl-sha { font-size: 0.85rem; color: var(--fg-muted); overflow-wrap: anywhere; }
.dl-sha code { overflow-wrap: anywhere; word-break: break-all; }
.download-card p:not(.dl-main):not(.dl-sha) { color: var(--fg-muted); font-size: 0.95rem; }

/* ---------- centered layout on wide screens ---------- */
/* Sidebar, content and on-page TOC form one group centered in the window; text stays left-aligned. */
:root { --shell-max: 1360px; }
@media (min-width: 1024px) {
  .shell:not(.home-shell) { max-width: var(--shell-max); margin-inline: auto; width: 100%; }
  .header-row { max-width: var(--shell-max); margin-inline: auto; }
  body:has(.home-shell) .header-row { max-width: 1200px; }
}
@media (min-width: 1400px) {
  .shell:not(.home-shell) > .sidebar { border-left: 1px solid var(--line); }
}
