/*
 * The whole look of docs.hungrit.com.
 *
 * The accent ramp, the surfaces and the text ramp are the product's own values,
 * copied from `site/src/styles/tokens.css`, which took them from
 * `client/crates/jc-ui/src/theme.rs`. A creator who reads a page and then opens
 * the editor should not feel they changed products.
 */

:root {
  --bg: #0b0817;
  --bg-deep: #070511;
  --panel: #16122a;
  --panel-hi: #1b1633;
  --raised: rgba(255, 255, 255, 0.028);
  --raised-hover: rgba(255, 255, 255, 0.055);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);

  --brand-cyan: #6ae2fb;
  --brand-violet: #5c3cf8;
  --brand-magenta: #e068fb;
  --brand-grad: linear-gradient(100deg, var(--brand-cyan) 0%, var(--brand-violet) 46%, var(--brand-magenta) 100%);

  --accent: #8b5cf6;
  --accent-hi: #a78bfa;
  --accent-deep: #5e49c8;
  --accent-soft: rgba(139, 92, 246, 0.13);
  --accent-line: rgba(139, 92, 246, 0.34);
  --success: #4ade80;
  --warn: #fbbf24;
  --danger: #fb7185;

  --text: #ffffff;
  --text-dim: #c3c7d1;
  --text-faint: #8a8f9e;

  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 18px;

  --topbar-h: 62px;
  --side-w: 300px;
  --outline-w: 268px;
  --measure: 824px;

  --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* code colours */
  --t-kw: #c295ff;
  --t-fn: #7fd8f7;
  --t-str: #9ee6a8;
  --t-num: #f4b57a;
  --t-cst: #f4b57a;
  --t-com: #6a6f85;
  --t-dir: #7c839c;
  --t-op: #8f96ad;
  --t-punc: #9aa0b8;
  --t-var: #e4e6f2;
  --t-key: #e0b6ff;
  --t-flag: #f4b57a;
}

[data-theme="light"] {
  --bg: #fbfaff;
  --bg-deep: #f2f0fa;
  --panel: #ffffff;
  --panel-hi: #f6f4fd;
  --raised: rgba(20, 12, 45, 0.03);
  --raised-hover: rgba(20, 12, 45, 0.06);
  --border: rgba(24, 16, 54, 0.10);
  --border-strong: rgba(24, 16, 54, 0.20);

  --accent: #6d3fe0;
  --accent-hi: #5a2fd0;
  --accent-soft: rgba(109, 63, 224, 0.10);
  --accent-line: rgba(109, 63, 224, 0.28);

  --text: #14102a;
  --text-dim: #4a4763;
  --text-faint: #726f8a;

  --t-kw: #7c3aed;
  --t-fn: #0e7490;
  --t-str: #147a4a;
  --t-num: #b45309;
  --t-cst: #b45309;
  --t-com: #7c7a90;
  --t-dir: #7c7a90;
  --t-op: #5b5875;
  --t-punc: #6b6885;
  --t-var: #22203a;
  --t-key: #7c3aed;
  --t-flag: #b45309;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--topbar-h) + 20px); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text-dim);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-hi); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--accent); color: #fff; padding: 10px 16px; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

:focus-visible { outline: 2px solid var(--accent-hi); outline-offset: 2px; border-radius: 4px; }

/* ---------------------------------------------------------------- topbar */

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 18px;
  height: var(--topbar-h);
  padding: 0 22px;
  background: color-mix(in srgb, var(--bg-deep) 88%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex; align-items: center; gap: 11px;
  color: var(--text); font-weight: 650; font-size: 16.5px; letter-spacing: -0.01em;
  width: calc(var(--side-w) - 44px); flex: none;
}
.brand:hover { text-decoration: none; }
.brand img { display: block; }

.menu-btn {
  display: none; align-items: center; justify-content: center;
  width: 34px; height: 34px; flex: none;
  background: none; border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text-dim); cursor: pointer;
}
.menu-btn svg { width: 18px; height: 18px; }

.search-trigger {
  display: flex; align-items: center; gap: 10px;
  width: 100%; max-width: 452px; height: 38px; padding: 0 10px 0 12px;
  background: var(--raised); border: 1px solid var(--border); border-radius: var(--radius-lg);
  color: var(--text-faint); font: inherit; font-size: 13.5px; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.search-trigger:hover { border-color: var(--border-strong); background: var(--raised-hover); }
.search-trigger svg { width: 16px; height: 16px; flex: none; opacity: .8; }
.search-text { flex: 1; text-align: left; }
.search-kbd, kbd {
  font-family: var(--font); font-size: 11px; line-height: 1.6;
  padding: 1px 7px; border: 1px solid var(--border); border-radius: 5px;
  background: var(--raised); color: var(--text-faint);
}

.topnav { display: flex; align-items: center; gap: 26px; margin-left: auto; }
.topnav-link {
  position: relative; color: var(--text-dim); font-size: 14px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 5px; height: var(--topbar-h);
}
.topnav-link:hover { color: var(--text); text-decoration: none; }
.topnav-link svg { width: 12px; height: 12px; opacity: .7; }
.topnav-link.active { color: var(--accent-hi); }
.topnav-link.active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px;
  height: 2px; background: var(--accent); border-radius: 2px 2px 0 0;
}

.theme-toggle {
  display: flex; align-items: center; gap: 4px; flex: none;
  height: 34px; padding: 0 9px;
  background: var(--raised); border: 1px solid var(--border); border-radius: 999px;
  color: var(--text-dim); cursor: pointer;
}
.theme-toggle:hover { background: var(--raised-hover); color: var(--text); }
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .icon-chev { width: 13px; opacity: .55; }
.icon-sun { display: none; }
[data-theme="light"] .icon-sun { display: block; }
[data-theme="light"] .icon-moon { display: none; }

/* ----------------------------------------------------------------- shell */

.shell {
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr) var(--outline-w);
  align-items: start;
  max-width: 1660px; margin: 0 auto;
}

/* --------------------------------------------------------------- sidebar */

.sidebar {
  position: sticky; top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  display: flex; flex-direction: column;
  border-right: 1px solid var(--border);
  padding: 22px 14px 14px 18px;
}
.sidenav { flex: 1; overflow-y: auto; padding-right: 6px; scrollbar-width: thin; }
.sidenav::-webkit-scrollbar { width: 6px; }
.sidenav::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }

.side-group + .side-group { margin-top: 24px; }
.side-title {
  display: flex; align-items: center; gap: 9px;
  margin: 0 0 8px; padding: 0 10px;
  font-size: 11px; font-weight: 650; letter-spacing: .09em; text-transform: uppercase;
  color: var(--text-faint);
}
.side-title.page {
  font-size: 14.5px; font-weight: 620; letter-spacing: -0.01em; text-transform: none;
  color: var(--text);
}
.side-title .ico { width: 17px; height: 17px; flex: none; color: var(--accent-hi); opacity: .9; }
.sidenav ul { list-style: none; margin: 0; padding: 0; }

.side-link {
  display: block; padding: 6px 12px; margin: 1px 0;
  border-radius: var(--radius);
  color: var(--text-dim); font-size: 14px; line-height: 1.5;
}
.side-link:hover { background: var(--raised); color: var(--text); text-decoration: none; }
.side-link.active {
  background: var(--accent-soft); color: var(--accent-hi); font-weight: 600;
}

.side-card {
  display: flex; align-items: center; gap: 11px; flex: none;
  margin-top: 14px; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--raised);
}
.side-card:hover { border-color: var(--accent-line); text-decoration: none; }
.side-card span { display: flex; flex-direction: column; line-height: 1.35; }
.side-card strong { color: var(--text); font-size: 14px; font-weight: 620; }
.side-card em { color: var(--text-faint); font-size: 12px; font-style: normal; }

/* --------------------------------------------------------------- content */

.content { min-width: 0; padding: 34px 56px 80px; }
.doc { max-width: var(--measure); }

.crumbs {
  display: flex; align-items: center; gap: 9px;
  font-size: 13px; color: var(--text-faint); margin-bottom: 22px;
}
.crumbs a { color: var(--text-faint); }
.crumbs a:hover { color: var(--text-dim); }
.crumb-sep { opacity: .5; }
.crumb-here { color: var(--accent-hi); }

/* hero */
/* The art floats so the opening paragraphs sit beside it, not under it. */
.hero { display: block; margin: 0 0 34px; }
.hero-text { min-width: 0; }
.hero h1 {
  margin: 0 0 12px; font-size: 54px; line-height: 1.05; letter-spacing: -0.035em;
  font-weight: 720; color: var(--text);
}
.hero-lede { margin: 0; font-size: 19px; line-height: 1.55; color: var(--text-faint); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px; border-radius: var(--radius-lg);
  font-size: 14.5px; font-weight: 600; border: 1px solid transparent;
}
.btn:hover { text-decoration: none; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hi); }
.btn.ghost { border-color: var(--border-strong); color: var(--text); background: var(--raised); }
.btn.ghost:hover { background: var(--raised-hover); }

.hero-art {
  position: relative; float: right; width: 340px; height: 210px;
  margin: -8px 0 10px 32px;
  display: flex; align-items: center; justify-content: center;
}
.hero-art svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-art img { position: relative; filter: drop-shadow(0 0 26px rgba(139, 92, 246, .5)); }
.hero-words {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 6px; margin: 0;
  font-size: 10px; letter-spacing: .34em; text-transform: uppercase;
  color: var(--text-faint);
}

/* ------------------------------------------------------------- typography */

.doc h1 {
  margin: 0 0 16px; font-size: 40px; line-height: 1.15; letter-spacing: -0.03em;
  font-weight: 700; color: var(--text);
}
.doc h2 {
  clear: both; margin: 54px 0 18px;
  font-size: 25px; line-height: 1.3; letter-spacing: -0.02em; font-weight: 660; color: var(--text);
}
.doc h3 {
  margin: 38px 0 12px; font-size: 18.5px; letter-spacing: -0.01em;
  font-weight: 640; color: var(--text);
}
.doc h4 { margin: 28px 0 10px; font-size: 15.5px; font-weight: 640; color: var(--text); }
.doc h1 + p, .doc h2 + p, .doc h3 + p { margin-top: 0; }

.anchor {
  margin-left: 10px; color: var(--text-faint); opacity: 0;
  font-weight: 400; transition: opacity .12s;
}
h2:hover .anchor, h3:hover .anchor, h4:hover .anchor { opacity: .6; }
.anchor:hover { opacity: 1 !important; text-decoration: none; }

.doc p { margin: 16px 0; }
.doc strong { color: var(--text); font-weight: 640; }
.md-rule { border: 0; border-top: 1px solid var(--border); margin: 44px 0; }

.md-list { margin: 16px 0; padding-left: 22px; }
.md-list li { margin: 7px 0; }
.md-list li::marker { color: var(--accent); }
ul.md-list { list-style: none; padding-left: 4px; }
ul.md-list > li { position: relative; padding-left: 20px; }
ul.md-list > li::before {
  content: ""; position: absolute; left: 4px; top: 11px;
  width: 5px; height: 5px; border-radius: 50%; background: var(--accent);
}
ul.md-list ul.md-list { margin: 7px 0; }

blockquote {
  margin: 20px 0; padding: 2px 0 2px 18px;
  border-left: 2px solid var(--accent-line); color: var(--text-faint);
}
blockquote p { margin: 8px 0; }

:not(pre) > code {
  font-family: var(--mono); font-size: 0.875em;
  padding: 2px 6px; border-radius: 5px;
  background: var(--raised); border: 1px solid var(--border);
  color: var(--accent-hi); white-space: nowrap;
}
a code { color: inherit; }

/* ------------------------------------------------------------ code blocks */

.code-block {
  margin: 22px 0; border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--panel); overflow: hidden;
}
.code-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 10px 7px 14px;
  background: var(--panel-hi); border-bottom: 1px solid var(--border);
}
.code-lang {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 550; color: var(--text-faint); letter-spacing: .01em;
}
.code-lang svg { width: 13px; height: 13px; opacity: .8; }
.copy-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: var(--radius-sm);
  background: none; border: 1px solid transparent;
  color: var(--text-faint); font: inherit; font-size: 12px; cursor: pointer;
}
.copy-btn:hover { background: var(--raised-hover); color: var(--text); border-color: var(--border); }
.copy-btn svg { width: 13px; height: 13px; }
.copy-btn.done { color: var(--success); }

.code-body { overflow-x: auto; }
.code-block pre { margin: 0; padding: 14px 18px; }
.code-block code {
  display: block; counter-reset: codeline;
  font-family: var(--mono); font-size: 12.9px; line-height: 1.65;
  color: var(--t-var); white-space: pre;
}
.code-block .line { display: block; position: relative; padding-left: 3.1em; }
.code-block .line::before {
  counter-increment: codeline; content: counter(codeline);
  position: absolute; left: 0; width: 2.1em; text-align: right;
  color: var(--text-faint); opacity: .42; user-select: none;
}

.t-kw { color: var(--t-kw); }
.t-fn { color: var(--t-fn); }
.t-str { color: var(--t-str); }
.t-num { color: var(--t-num); }
.t-cst { color: var(--t-cst); }
.t-com { color: var(--t-com); font-style: italic; }
.t-dir { color: var(--t-dir); }
.t-op { color: var(--t-op); }
.t-punc { color: var(--t-punc); }
.t-var { color: var(--t-var); }
.t-key { color: var(--t-key); }
.t-flag { color: var(--t-flag); }

/* ----------------------------------------------------------------- tables */

.table-wrap { margin: 22px 0; overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); }
.md-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.md-table th {
  padding: 11px 16px; text-align: left; font-weight: 600; font-size: 12.5px;
  letter-spacing: .04em; text-transform: uppercase; color: var(--text-faint);
  background: var(--panel-hi); border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.md-table td { padding: 11px 16px; border-top: 1px solid var(--border); vertical-align: top; }
.md-table tbody tr:first-child td { border-top: 0; }
.md-table tbody tr:hover { background: var(--raised); }
.md-table code { white-space: nowrap; }
/* More specific than `.md-table th`, which would otherwise win. */
.md-table .ta-left { text-align: left; }
.md-table .ta-center { text-align: center; }
.md-table .ta-right { text-align: right; }

.nav-table td:first-child { white-space: nowrap; font-weight: 550; }
.arrow-col { width: 34px; text-align: right; }
.row-arrow { color: var(--text-faint); opacity: .45; transition: opacity .15s, transform .15s; display: inline-block; }
.nav-table tr:hover .row-arrow { opacity: 1; color: var(--accent-hi); transform: translateX(3px); }

/* --------------------------------------------------------------- callouts */

.callout {
  margin: 22px 0; padding: 14px 18px;
  border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: var(--radius); background: var(--raised);
}
.callout > :first-child { margin-top: 0; }
.callout > :last-child { margin-bottom: 0; }
.callout-title { margin: 0 0 6px; font-weight: 640; color: var(--text); font-size: 14.5px; }
.callout-warning { border-left-color: var(--warn); }
.callout-warning .callout-title { color: var(--warn); }
.callout-danger { border-left-color: var(--danger); }
.callout-danger .callout-title { color: var(--danger); }
.callout-note { border-left-color: var(--text-faint); }

/* ----------------------------------------------------------------- pager */

.pager {
  display: flex; gap: 16px; max-width: var(--measure);
  margin-top: 64px; padding-top: 26px; border-top: 1px solid var(--border);
}
.pager-gap { flex: 1; }
.pager-link {
  flex: 1; display: flex; flex-direction: column; gap: 3px;
  padding: 14px 18px; border: 1px solid var(--border); border-radius: var(--radius-lg);
}
.pager-link:hover { border-color: var(--accent-line); background: var(--raised); text-decoration: none; }
.pager-link.next { text-align: right; }
.pager-label { font-size: 12px; color: var(--text-faint); }
.pager-title { font-size: 14.5px; font-weight: 600; color: var(--accent-hi); }

.doc-footer {
  max-width: var(--measure); margin-top: 40px;
  display: flex; justify-content: space-between; gap: 16px;
  font-size: 12.5px; color: var(--text-faint);
}
.doc-footer p { margin: 0; }

/* --------------------------------------------------------------- outline */

.outline {
  position: sticky; top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h)); overflow-y: auto;
  padding: 34px 24px 40px 8px; scrollbar-width: thin;
}
.outline-title {
  margin: 0 0 12px; font-size: 13px; font-weight: 640; color: var(--text);
}
.outline-nav ul { list-style: none; margin: 0; padding: 0; }
.outline-nav li { position: relative; }
.outline-nav a {
  display: block; padding: 5px 10px; border-left: 2px solid transparent;
  font-size: 13px; line-height: 1.45; color: var(--text-faint);
}
.outline-nav a:hover { color: var(--text); text-decoration: none; }
.outline-nav a.active { color: var(--accent-hi); border-left-color: var(--accent); }
.outline-nav ul ul { margin-left: 12px; }
.out-item > ul { overflow: hidden; }
.out-item.collapsed > ul { display: none; }
.out-chev {
  position: absolute; left: -14px; top: 5px;
  width: 16px; height: 16px; padding: 0; display: flex; align-items: center; justify-content: center;
  background: none; border: 0; color: var(--text-faint); cursor: pointer;
}
.out-chev svg { width: 13px; height: 13px; transition: transform .15s; }
.out-item.collapsed .out-chev svg { transform: rotate(-90deg); }

.aside-card {
  margin-top: 26px; padding: 16px;
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--raised);
}
.aside-ico {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; margin-bottom: 10px;
  border-radius: var(--radius); background: var(--accent-soft); color: var(--accent-hi);
}
.aside-ico .ico { width: 17px; height: 17px; }
.aside-title { margin: 0 0 5px; font-size: 14px; font-weight: 640; color: var(--text); }
.aside-text { margin: 0 0 14px; font-size: 12.8px; line-height: 1.55; color: var(--text-faint); }
.aside-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px; border-radius: var(--radius);
  background: var(--accent); color: #fff; font-size: 13px; font-weight: 600;
}
.aside-btn:hover { background: var(--accent-hi); text-decoration: none; }

/* ------------------------------------------------------------------ home */

[data-layout="home"] .shell { grid-template-columns: minmax(0, 1fr); }
[data-layout="home"] .sidebar,
[data-layout="home"] .outline { display: none; }
[data-layout="home"] .content { padding: 46px 32px 90px; }
[data-layout="home"] .doc { max-width: 1100px; margin: 0 auto; }
[data-layout="home"] .hero { display: flex; align-items: center; gap: 44px; min-height: 320px; }
[data-layout="home"] .hero-text { flex: 1; }
[data-layout="home"] .hero-art { float: none; margin: 0; flex: none; }
[data-layout="home"] .hero h1 { font-size: 66px; }
[data-layout="home"] .hero-art { width: 420px; height: 260px; }
[data-layout="home"] .doc-footer, [data-layout="home"] .pager { max-width: 1100px; margin-inline: auto; }

.cards { clear: both; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin: 30px 0; }
.card {
  display: block; padding: 20px; border: 1px solid var(--border);
  border-radius: var(--radius-lg); background: var(--raised);
}
.card:hover { border-color: var(--accent-line); text-decoration: none; }
.card h3 { margin: 0 0 8px; font-size: 16.5px; color: var(--text); }
.card p { margin: 0; font-size: 13.8px; color: var(--text-faint); }
.card-go { display: inline-block; margin-top: 12px; font-size: 13px; color: var(--accent-hi); font-weight: 600; }

/* ------------------------------------------------------- navigation */

/*
 * Clicking a link swaps the article instead of reloading the document, so the
 * only feedback left to give is for a fetch slow enough to notice. It appears
 * after 140 ms and never for an instant one.
 */
.nav-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  height: 2px; background: var(--brand-grad);
  transform: scaleX(0); transform-origin: 0 50%;
  opacity: 0; pointer-events: none;
}
.nav-bar.busy {
  opacity: 1;
  animation: nav-crawl 8s cubic-bezier(0.1, 0.8, 0.2, 1) forwards;
}
@keyframes nav-crawl {
  0%   { transform: scaleX(0); }
  40%  { transform: scaleX(0.7); }
  100% { transform: scaleX(0.96); }
}

/* The swap itself, where the browser supports it. Content only: the topbar
   and the sidebar are the same elements before and after, so animating the
   whole page would make the furniture flicker for no reason. */
@view-transition { navigation: none; }
::view-transition-old(root) { animation: vt-out .12s ease both; }
::view-transition-new(root) { animation: vt-in .16s ease both; }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; transform: translateY(4px); } }

@media (prefers-reduced-motion: reduce) {
  .nav-bar.busy { animation: none; transform: scaleX(0.6); }
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
}

/* ---------------------------------------------------------------- search */

.search-modal {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: flex-start; justify-content: center; padding-top: 12vh;
  background: rgba(5, 3, 14, 0.66); backdrop-filter: blur(3px);
}
.search-modal[hidden] { display: none; }
.search-panel {
  width: min(680px, 92vw); max-height: 72vh; display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl); overflow: hidden;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .55);
}
.search-field { display: flex; align-items: center; gap: 11px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.search-field svg { width: 17px; height: 17px; color: var(--text-faint); flex: none; }
.search-field input {
  flex: 1; background: none; border: 0; outline: none;
  color: var(--text); font: inherit; font-size: 15.5px;
}
.search-results { overflow-y: auto; padding: 8px; }
.search-hit {
  display: block; padding: 10px 12px; border-radius: var(--radius);
  border: 1px solid transparent;
}
.search-hit:hover, .search-hit.sel { background: var(--accent-soft); border-color: var(--accent-line); text-decoration: none; }
.search-hit .hit-sec { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--accent-hi); }
.search-hit .hit-title { display: block; font-size: 14.5px; font-weight: 600; color: var(--text); margin: 2px 0; }
.search-hit .hit-text { display: block; font-size: 12.8px; color: var(--text-faint); line-height: 1.5; }
.search-hit mark { background: rgba(139, 92, 246, .28); color: var(--text); border-radius: 3px; padding: 0 2px; }
.search-empty { padding: 26px 16px; text-align: center; color: var(--text-faint); font-size: 14px; }
.search-foot {
  display: flex; gap: 18px; padding: 10px 16px; border-top: 1px solid var(--border);
  font-size: 11.5px; color: var(--text-faint);
}
.search-foot span { display: inline-flex; align-items: center; gap: 5px; }

.scrim { position: fixed; inset: var(--topbar-h) 0 0; background: rgba(5,3,14,.6); z-index: 30; }
.scrim[hidden] { display: none; }

/* ------------------------------------------------------------ responsive */

@media (max-width: 1400px) { :root { --side-w: 274px; } .content { padding: 34px 40px 80px; } }

@media (max-width: 1180px) {
  .shell { grid-template-columns: var(--side-w) minmax(0, 1fr); }
  .outline { display: none; }
}

@media (max-width: 900px) {
  .menu-btn { display: flex; }
  .brand { width: auto; }
  .brand span { display: none; }
  .topnav { gap: 16px; }
  .topnav-link { font-size: 13px; }
  .search-trigger { max-width: none; }
  .search-text, .search-kbd { display: none; }
  .search-trigger { width: 38px; padding: 0; justify-content: center; flex: none; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; top: var(--topbar-h); left: 0; z-index: 35;
    width: 290px; background: var(--bg-deep);
    transform: translateX(-104%); transition: transform .2s ease;
  }
  body.nav-open .sidebar { transform: none; }
  .content { padding: 26px 20px 70px; }
  .hero-art { float: none; width: 100%; max-width: 320px; margin: 0 0 18px; }
  .hero h1, [data-layout="home"] .hero h1 { font-size: 38px; }
  .doc h1 { font-size: 30px; }
  .doc h2 { font-size: 21px; margin-top: 42px; }
  .pager { flex-direction: column; }
}

@media (max-width: 560px) {
  .topnav .topnav-link:nth-child(n+4) { display: none; }
}

@media print {
  .topbar, .sidebar, .outline, .pager, .search-modal { display: none; }
  .shell { grid-template-columns: 1fr; }
  body { background: #fff; color: #000; }
}
