/* ==========================================================================
   NUGAWIKI — visual system imported from Hwaro's alder example
   (hwaro init --scaffold github:hahwul/hwaro-examples/examples/alder)
   and adapted from a fixed rack inventory to Notion-driven categories/tags.
   Near-black green-tinted terminal, monospace headings, dotted ASCII rules.
   ========================================================================== */

:root {
  /* Palette (manifest-assigned) */
  --bg: #0f1411;
  --surface: #171f1a;
  --surface-2: #1d2621;
  --fg: #dce4dd;
  --muted: #8fa294;
  --accent: #3ecf7a;
  --accent-fg: #08130c;
  --border: color-mix(in srgb, var(--fg) 14%, transparent);
  --border-strong: color-mix(in srgb, var(--fg) 26%, transparent);
  color-scheme: dark;

  /* Type */
  --font-display: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --font-text: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --text-xs: clamp(0.72rem, 0.7rem + 0.1vw, 0.78rem);
  --text-sm: clamp(0.84rem, 0.81rem + 0.15vw, 0.9rem);
  --text-base: clamp(1rem, 0.96rem + 0.15vw, 1.05rem);
  --text-lg: clamp(1.12rem, 1.04rem + 0.35vw, 1.3rem);
  --text-xl: clamp(1.35rem, 1.15rem + 0.9vw, 1.85rem);
  --text-2xl: clamp(1.7rem, 1.4rem + 1.4vw, 2.3rem);
  --text-hero: clamp(2rem, 1.55rem + 2.2vw, 3.1rem);

  /* Space (4/8 scale) */
  --space-1: .25rem;
  --space-2: .5rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --space-5: 2.5rem;
  --space-6: 4rem;
  --space-7: 6rem;

  --radius-sm: 2px;
  --radius-md: 4px;
  --radius-lg: 6px;

  --sidebar-w: 268px;
  --toc-w: 200px;
  --topbar-h: 56px;
}

/* ---- Reset ------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; overflow-x: hidden; }
body {
  font-family: var(--font-text);
  font-size: var(--text-base);
  line-height: 1.65;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
ul[class], ol[class] { list-style: none; padding: 0; }
img, svg { display: block; max-width: 100%; }
input, button { font: inherit; color: inherit; }
button { background: none; border: none; cursor: pointer; }
a { color: inherit; }
::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); color: var(--fg); }

/* ---- Utilities ----------------------------------------------------------- */

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

.skip-link {
  position: absolute; top: -100px; left: var(--space-3);
  background: var(--accent); color: var(--accent-fg);
  padding: .6rem 1rem; border-radius: var(--radius-sm);
  font-family: var(--font-display); font-weight: 600; font-size: var(--text-sm);
  z-index: 1000; text-decoration: none;
  transition: top .15s ease-out;
}
.skip-link:focus { top: var(--space-3); }

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

.prompt-glyph { color: var(--accent); font-family: var(--font-mono); font-weight: 600; }
.prompt-sep { color: var(--muted); font-family: var(--font-mono); }

/* ---- Topic-path label ------------------------------------------------------ */

.topic-path {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--accent);
  letter-spacing: .02em;
  margin-bottom: var(--space-2);
}

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

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.22;
  color: var(--fg);
  text-wrap: balance;
  scroll-margin-top: calc(var(--topbar-h) + var(--space-4));
}
h1 { font-size: var(--text-2xl); letter-spacing: -0.01em; margin-bottom: var(--space-3); }
h2 { font-size: var(--text-xl); margin: var(--space-6) 0 var(--space-3); letter-spacing: -0.005em; }
h3 { font-size: var(--text-lg); margin: var(--space-5) 0 var(--space-2); }
h4 {
  font-size: var(--text-sm); margin: var(--space-4) 0 var(--space-2);
  text-transform: uppercase; letter-spacing: .08em; color: var(--muted);
}

/* ---- Heading anchor links (copy-link buttons) --------------------------------- */

.heading-anchor {
  margin-left: .5em;
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: .8em;
  color: var(--muted);
  opacity: .3;
  text-decoration: none;
  transition: opacity .15s ease-out, color .15s ease-out;
}
.heading-anchor:hover, .heading-anchor:focus-visible { opacity: 1; color: var(--accent); }

.copy-toast {
  position: fixed;
  left: 50%;
  bottom: var(--space-5);
  transform: translateX(-50%) translateY(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: .5rem;
  background: var(--surface);
  border: 1px dashed var(--accent);
  border-radius: var(--radius-md);
  padding: .6rem 1rem;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--fg);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease-out, transform .18s ease-out;
}
.copy-toast.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); }

.prose > *:first-child { margin-top: 0; }

p { margin: 1em 0; text-wrap: pretty; color: var(--fg); max-width: 68ch; }
.prose ul, .prose ol { margin: 1em 0; padding-left: 1.4em; max-width: 68ch; }
.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }
.prose li { margin: .4em 0; }
.prose li::marker { color: var(--accent); }
.prose strong { color: var(--fg); font-weight: 700; }
.prose hr { border: none; border-top: 1px dashed var(--border); margin: var(--space-6) 0; }

a { text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent); text-underline-offset: 3px; }
.prose a, .doc-dek a { color: var(--accent); text-decoration: underline; transition: color .15s ease-out, text-decoration-color .15s ease-out; }
.prose a:hover, .doc-dek a:hover { text-decoration-color: currentColor; }

.prose blockquote {
  border-left: 2px dashed var(--border-strong);
  padding-left: var(--space-3);
  margin: 1.4em 0;
  color: var(--muted);
}

/* ---- Code blocks: lifted surface, dashed outline ---------------------------- */

code {
  font-family: var(--font-mono);
  font-size: .875em;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: .1em .35em;
  border-radius: var(--radius-sm);
}

pre {
  position: relative;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  margin: 1.5em 0;
  overflow-x: auto;
  line-height: 1.6;
}
pre code {
  display: block;
  background: transparent;
  border: none;
  padding: 0;
  font-size: var(--text-sm);
  color: var(--fg);
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}
/* highlight.js theme ships its own .hljs background — flatten it so the
   code doesn't render as a second, differently-colored box inside <pre>. */
pre code.hljs { background: transparent; }

/* ~/.env settings: default is wrap=on, line-numbers=off (see site.js) */
html.code-wrap-off pre code { white-space: pre; word-break: normal; overflow-wrap: normal; }

/* Each source line is its own flex row (number + content), set by site.js.
   A wrapped long line only grows its own row, so numbers on later rows
   never drift — no dependency on matching visual vs. logical line counts. */
.code-line-row { display: flex; align-items: flex-start; }
.code-line-no {
  display: none;
  flex-shrink: 0;
  width: var(--code-line-no-width, 2ch);
  margin-right: var(--space-3);
  padding-right: var(--space-2);
  border-right: 1px dashed var(--border);
  text-align: right;
  color: var(--muted);
  opacity: .55;
  user-select: none;
}
.code-line { flex: 1; min-width: 0; }
html.code-linenumbers-on .code-line-no { display: inline-block; }

.code-copy-btn {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--muted);
  opacity: .35;
  cursor: pointer;
  transition: opacity .15s ease-out, color .15s ease-out, border-color .15s ease-out, background-color .15s ease-out;
}
.code-copy-btn svg { width: 15px; height: 15px; }
.code-copy-btn:hover, .code-copy-btn:focus-visible {
  opacity: 1;
  color: var(--accent);
  border-color: var(--border-strong);
  background: var(--surface-2);
}

/* ---- Tables: ruled like a fixed-width report -------------------------------- */

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.6em 0;
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}
.prose th, .prose td {
  text-align: left;
  padding: .55rem .8rem;
  border-bottom: 1px dotted var(--border-strong);
}
.prose thead th {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  border-bottom: 1px dashed var(--border-strong);
}
.prose tr:last-child td { border-bottom: 1px dashed var(--border-strong); }
.prose td code, .prose th code { white-space: nowrap; }

/* ---- Shell / topbar ---------------------------------------------------------- */

.shell { min-height: 100vh; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: var(--space-3);
  height: var(--topbar-h);
  padding: 0 var(--space-4);
  background: var(--bg);
  border-bottom: 1px dashed var(--border-strong);
}

.brand {
  display: flex; align-items: center; gap: var(--space-2);
  text-decoration: none; color: var(--fg);
  font-family: var(--font-display); font-weight: 600;
  font-size: var(--text-lg); letter-spacing: -0.01em;
  margin-right: auto;
}
.brand-mark { width: 22px; height: 22px; color: var(--accent); flex-shrink: 0; }
.brand-cursor { color: var(--accent); animation: blink 1.1s steps(1) infinite; }

@keyframes blink { 50% { opacity: 0; } }

.nav-toggle {
  display: none;
  align-items: center; justify-content: center;
  width: 40px; height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--muted);
  transition: border-color .15s ease-out, color .15s ease-out;
}
.nav-toggle:hover { border-color: var(--border-strong); color: var(--fg); }
.nav-toggle svg { width: 16px; height: 16px; }

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

.docs-layout {
  flex: 1;
  display: flex;
  align-items: flex-start;
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
  min-width: 0;
}
/* On home, let the footer sit right after the content instead of being
   pinned to the viewport bottom by the flex-grow "sticky footer" pattern.
   The sidebar's own forced full-viewport height drives the row's height
   too, so it needs to shrink-to-fit here as well (still caps + scrolls
   internally if nav content ever grows past the viewport). */
.docs-layout--home { flex: 0 1 auto; }
.docs-layout--home .sidebar { height: auto; max-height: calc(100vh - var(--topbar-h)); }

.sidebar {
  position: sticky;
  top: var(--topbar-h);
  width: var(--sidebar-w);
  flex-shrink: 0;
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  border-right: 1px dashed var(--border-strong);
  scrollbar-width: thin;
}
.sidebar-inner { padding: var(--space-4) var(--space-4) var(--space-6); }

.palette-trigger {
  display: flex; align-items: center; gap: var(--space-2);
  width: 100%;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--muted);
  padding: .5rem .7rem;
  min-height: 40px;
  margin-bottom: var(--space-4);
  transition: border-color .15s ease-out, color .15s ease-out;
}
.palette-trigger:hover { border-color: var(--accent); color: var(--fg); }
.palette-trigger svg { width: 15px; height: 15px; flex-shrink: 0; }
.palette-trigger span { font-family: var(--font-mono); font-size: var(--text-sm); flex: 1; text-align: left; }
.palette-trigger kbd {
  font-family: var(--font-mono); font-size: var(--text-xs);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: .1rem .35rem; color: var(--muted);
}

.palette-trigger--top {
  width: auto; min-width: 148px; margin-bottom: 0;
}

.sidebar-home-link {
  display: block;
  text-decoration: none;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  padding: .4rem 0;
}
.sidebar-home-link:hover { color: var(--accent); }
.sidebar-home-link:first-of-type { color: var(--fg); font-weight: 600; }

.sidebar-heading {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  margin: var(--space-4) 0 var(--space-2);
  padding-top: var(--space-3);
  border-top: 1px dashed var(--border);
}

.sidebar-group { margin-bottom: var(--space-3); }
.sidebar-group-title {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  padding: .3rem 0;
}
.sidebar-links li { position: relative; }
.sidebar-links a {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  padding: .35rem .6rem .35rem .9rem;
  border-left: 2px dashed transparent;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  transition: color .15s ease-out, border-color .15s ease-out, background-color .15s ease-out;
}
.sidebar-links a:hover { color: var(--fg); background: var(--surface); }
.sidebar-links a[aria-current="page"] {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--surface);
  font-weight: 600;
}
.sidebar-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  color: var(--border-strong);
  margin-right: .6em;
  flex-shrink: 0;
}
.sidebar-links a[aria-current="page"] .sidebar-dot,
.sidebar-links a:hover .sidebar-dot { color: var(--accent); }

.sidebar-divider { border: none; border-top: 1px dashed var(--border); margin: var(--space-3) 0; }

.docs-main { flex: 1; min-width: 0; padding: var(--space-6) var(--space-5) var(--space-7); }
.docs-main--home { padding-top: var(--space-5); padding-bottom: var(--space-4); }

/* ---- Article / TOC columns ---------------------------------------------------- */

.doc-columns { display: flex; gap: var(--space-6); align-items: flex-start; min-width: 0; }
.doc-article { max-width: 68ch; flex: 1; min-width: 0; }
.doc-article--section { max-width: 68ch; }

.doc-dek { font-size: var(--text-lg); color: var(--muted); margin-bottom: var(--space-3); max-width: 62ch; }

.doc-meta {
  display: flex; flex-wrap: wrap; gap: var(--space-3);
  align-items: center;
  font-family: var(--font-mono); font-size: var(--text-xs);
  color: var(--muted); text-transform: uppercase; letter-spacing: .05em;
  padding-bottom: var(--space-4);
  border-bottom: 1px dashed var(--border);
  margin-bottom: var(--space-4);
}
.docs-main--home .doc-meta { border-bottom: none; padding-bottom: 0; }
.doc-meta-sep { opacity: .5; }
.doc-tags { display: flex; gap: .4rem; flex-wrap: wrap; }
.tag-chip {
  display: inline-block;
  text-decoration: none;
  color: var(--accent);
  border: 1px dashed color-mix(in srgb, var(--accent) 40%, var(--border));
  border-radius: 999px;
  padding: .1rem .55rem;
  font-size: var(--text-xs);
  letter-spacing: .02em;
  transition: background-color .15s ease-out, color .15s ease-out;
}
.tag-chip:hover { background: var(--accent); color: var(--accent-fg); border-style: solid; }

.chip-row { display: flex; flex-wrap: wrap; gap: .5rem; margin: var(--space-3) 0; }

/* ---- ~/.env settings page ------------------------------------------------------------- */

.env-settings { display: flex; flex-direction: column; margin-top: var(--space-4); max-width: 68ch; }
.env-setting-row {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
  padding: var(--space-4) 0;
  border-top: 1px dashed var(--border);
}
.env-setting-label { display: flex; flex-direction: column; gap: .25rem; }
.env-setting-title { font-family: var(--font-display); font-weight: 600; color: var(--fg); }
.env-setting-desc { font-size: var(--text-sm); color: var(--muted); }

.env-toggle { flex-shrink: 0; background: none; border: none; padding: 0; cursor: pointer; }
.env-toggle-track {
  display: block;
  width: 40px; height: 22px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  position: relative;
  transition: border-color .15s ease-out, background-color .15s ease-out;
}
.env-toggle-thumb {
  position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform .15s ease-out, background-color .15s ease-out;
}
.env-toggle.is-on .env-toggle-track { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 18%, var(--surface)); }
.env-toggle.is-on .env-toggle-thumb { transform: translateX(18px); background: var(--accent); }

.doc-external-link {
  margin-top: var(--space-5);
  padding-top: var(--space-3);
  border-top: 1px dashed var(--border-strong);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--muted);
}
.doc-external-link a { color: var(--accent); }

.doc-toc {
  width: var(--toc-w);
  flex-shrink: 0;
  position: sticky;
  top: calc(var(--topbar-h) + var(--space-4));
  font-size: var(--text-sm);
  border-left: 1px dashed var(--border-strong);
  padding-left: var(--space-3);
}
.doc-toc-title {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  margin-bottom: var(--space-2);
}
.doc-toc ul { list-style: none; padding: 0; margin: 0; }
.doc-toc li { margin: .35rem 0; }
.doc-toc a { text-decoration: none; color: var(--muted); display: block; }
.doc-toc a:hover { color: var(--accent); }

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

.doc-pager {
  display: flex; justify-content: space-between; gap: var(--space-3);
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  border-top: 1px dashed var(--border-strong);
}
.doc-pager-link {
  display: flex; flex-direction: column; gap: .2rem;
  text-decoration: none;
  color: var(--fg);
  font-family: var(--font-mono); font-size: var(--text-sm);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  padding: .6rem .9rem;
  max-width: 48%;
  transition: border-color .15s ease-out;
}
.doc-pager-link:hover { border-color: var(--accent); }
.doc-pager-link span { font-family: var(--font-text); font-size: var(--text-xs); color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.doc-pager-next { margin-left: auto; text-align: right; align-items: flex-end; }

/* ---- Section / taxonomy index list --------------------------------------------------- */

.doc-index { list-style: none; padding: 0; margin: var(--space-4) 0 0; }
.doc-index li { border-top: 1px dotted var(--border-strong); }
.doc-index li:last-child { border-bottom: 1px dotted var(--border-strong); }
.doc-index a {
  display: flex; align-items: baseline; gap: var(--space-3);
  text-decoration: none; padding: var(--space-3) .5rem;
  border-radius: var(--radius-sm);
  transition: background-color .15s ease-out;
}
.doc-index a:hover { background: var(--surface); }
.doc-index-host {
  font-family: var(--font-mono); color: var(--accent); font-size: var(--text-sm);
  flex-shrink: 0; width: 7em;
}
.doc-index-body { display: flex; flex-direction: column; gap: .2rem; flex: 1; }
.doc-index-title { font-family: var(--font-display); color: var(--fg); font-size: var(--text-base); font-weight: 600; }
.doc-index-desc { color: var(--muted); font-size: var(--text-sm); }
.doc-index-meta { display: flex; align-items: center; gap: var(--space-2); flex-shrink: 0; }
.doc-index-tags { display: flex; gap: .3rem; flex-wrap: wrap; justify-content: flex-end; }
.tag-chip-mini {
  font-family: var(--font-mono);
  color: var(--muted);
  font-size: var(--text-xs);
  border: 1px dashed var(--border);
  border-radius: 999px;
  padding: 0 .45rem;
  white-space: nowrap;
}
.doc-index-watts { font-family: var(--font-mono); color: var(--muted); font-size: var(--text-xs); flex-shrink: 0; }
.doc-index-empty { color: var(--muted); font-size: var(--text-sm); margin: var(--space-4) .5rem; }

/* ---- Section tag filter bar ------------------------------------------------------------ */

.tag-filter-bar { display: flex; flex-wrap: wrap; gap: .4rem; margin: var(--space-3) 0 var(--space-2); }
.tag-filter-chip {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  background: none;
  color: var(--muted);
  border: 1px dashed var(--border-strong);
  border-radius: 999px;
  padding: .15rem .65rem;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: .02em;
  transition: background-color .15s ease-out, color .15s ease-out, border-color .15s ease-out;
}
.tag-filter-chip:hover { border-color: var(--accent); color: var(--accent); }
.tag-filter-chip.is-active {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: var(--accent);
  border-style: solid;
}

/* ---- Taxonomy term list ---------------------------------------------------------------- */

.term-list { list-style: none; padding: 0; margin: var(--space-4) 0 0; max-width: 68ch; }
.term-row {
  display: flex; align-items: baseline; gap: var(--space-2);
  padding: .7rem 0;
  border-top: 1px dotted var(--border-strong);
}
.term-row:last-child { border-bottom: 1px dotted var(--border-strong); }
.term-link { text-decoration: none; color: var(--accent); font-family: var(--font-display); font-size: var(--text-base); }
.term-link:hover { text-decoration: underline; }
.term-rule { flex: 1; border-bottom: 1px dotted var(--border-strong); margin-bottom: .35em; }
.term-count { color: var(--muted); font-size: var(--text-sm); white-space: nowrap; font-family: var(--font-mono); }
.term-back { margin-top: var(--space-4); }
.term-back a { color: var(--muted); text-decoration: none; }
.term-back a:hover { color: var(--accent); }

/* ---- Home: terminal hero (signature-adjacent, sets up the spec strip) ------------------ */

.terminal-block {
  margin: 0 0 var(--space-5);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
  max-width: 68ch;
}
.terminal-block-bar {
  display: flex; gap: .4rem;
  padding: .55rem var(--space-4);
  border-bottom: 1px dashed var(--border-strong);
  background: var(--surface-2);
}
.terminal-block-bar span {
  width: 9px; height: 9px; border-radius: 50%;
  border: 1px solid var(--muted);
}
.terminal-block-body {
  padding: var(--space-4);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: 1.75;
  overflow-x: auto;
}
.term-line { margin: 0; white-space: pre-wrap; }
.term-line--cmd { color: var(--fg); margin-top: .65em; }
.term-line--cmd:first-child { margin-top: 0; }
.term-line--out { color: var(--muted); }
.term-line--err { color: var(--fg); font-weight: 600; }
.term-cursor { color: var(--accent); animation: blink 1.1s steps(1) infinite; }

.terminal-block--error { max-width: 100%; margin: var(--space-4) 0; }

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

.hero-title {
  font-size: var(--text-hero);
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-3);
}

.hero-title--home {
  font-size: clamp(1.75rem, 1.4rem + 1.8vw, 2.7rem);
  margin-bottom: var(--space-2);
}
.hero-lede { font-size: var(--text-lg); color: var(--muted); max-width: 58ch; margin-bottom: var(--space-5); }
.prose--home { max-width: 68ch; }

/* ---- Home: inventory cards ----------------------------------------------------------------- */

.inventory-grid { margin-top: var(--space-6); }
.section-kicker {
  max-width: none;
  font-family: var(--font-mono); font-size: var(--text-xs);
  text-transform: uppercase; letter-spacing: .08em; color: var(--muted);
  margin-bottom: var(--space-3); padding-bottom: var(--space-2);
  border-bottom: 1px dashed var(--border-strong);
}
.inv-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: var(--space-4);
}
.inv-card {
  display: flex; flex-direction: column; gap: .4rem;
  text-decoration: none;
  color: var(--fg);
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  transition: border-color .15s ease-out, border-style .15s ease-out;
}
.inv-card:hover { border-color: var(--accent); border-style: solid; }
.inv-card-top { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-2); }
.inv-card-host { font-family: var(--font-display); font-weight: 600; color: var(--fg); font-size: var(--text-base); }
.inv-card-kind { font-family: var(--font-mono); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }
.inv-card-role { color: var(--muted); font-size: var(--text-sm); }
.inv-card-desc { color: var(--muted); font-size: var(--text-sm); }
/* ---- Admonitions — GitHub-style > [!NOTE] blocks (notion-sync callouts) --------------------- */

.admonition {
  margin: 1.5rem 0;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: var(--space-3) var(--space-4);
  max-width: 68ch;
}
.admonition-title {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: .35rem;
}
.admonition-note, .admonition-important { border-color: color-mix(in srgb, var(--accent) 45%, var(--border-strong)); }
.admonition-note .admonition-title, .admonition-important .admonition-title { color: var(--accent); }

.admonition-tip { border-color: color-mix(in srgb, var(--accent) 45%, var(--border-strong)); }
.admonition-tip .admonition-title { color: var(--accent); }

.admonition-warning, .admonition-caution { border-color: color-mix(in srgb, #e0a53e 55%, var(--border-strong)); }
.admonition-warning .admonition-title, .admonition-caution .admonition-title { color: #e0a53e; }

/* ---- AdSense slot -------------------------------------------------------------------------- */

.ad-slot { margin: var(--space-6) 0; max-width: 68ch; }

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

.site-footer {
  border-top: 1px dashed var(--border-strong);
  padding: var(--space-5);
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
  color: var(--muted);
  font-size: var(--text-sm);
}
.site-footer p { margin: .3em 0; color: var(--muted); font-family: var(--font-mono); }
.site-footer a { color: inherit; }
.site-footer-meta { font-size: var(--text-xs); }
.site-footer-meta a:hover { color: var(--accent); }

.footer-icon-link {
  display: inline-flex;
  vertical-align: middle;
  margin-left: .4rem;
  color: var(--muted);
  transition: color .15s ease-out;
}
.footer-icon-link:hover { color: var(--accent); }
.footer-icon { width: 15px; height: 15px; fill: currentColor; }

/* ---- Command palette --------------------------------------------------------------------------- */

.palette {
  position: fixed; inset: 0; z-index: 100;
  display: flex; justify-content: center;
  padding: 12vh var(--space-3) var(--space-3);
}
.palette[hidden] { display: none; }
.palette-backdrop {
  position: absolute; inset: 0;
  background: color-mix(in srgb, black 70%, transparent);
}
.palette-panel {
  position: relative;
  width: min(560px, 100%);
  max-height: 70vh;
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 20px 60px color-mix(in srgb, black 55%, transparent);
}
.palette-field {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px dashed var(--border-strong);
}
.palette-input {
  flex: 1; background: transparent; border: none; color: var(--fg);
  font-family: var(--font-mono); font-size: var(--text-base);
}
.palette-input::placeholder { color: var(--muted); }
.palette-input:focus { outline: none; }
.palette-esc {
  font-family: var(--font-mono); font-size: var(--text-xs); color: var(--muted);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: .1rem .4rem;
}
.palette-results { list-style: none; margin: 0; padding: var(--space-2); overflow-y: auto; }
.palette-result { border-radius: var(--radius-md); }
.palette-result a {
  display: block; width: 100%; text-align: left;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  text-decoration: none; color: var(--fg);
  border-left: 3px solid transparent;
}
.palette-result[aria-selected="true"] a {
  background: var(--surface-2);
  border-left-color: var(--accent);
}
.palette-result-family { display: block; font-family: var(--font-mono); font-size: var(--text-xs); color: var(--accent); margin-bottom: .15rem; text-transform: uppercase; letter-spacing: .05em; }
.palette-result-title { font-family: var(--font-display); font-size: var(--text-sm); }
.palette-empty { padding: var(--space-5) var(--space-4); text-align: center; color: var(--muted); font-size: var(--text-sm); }

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

@media (max-width: 1150px) {
  .doc-columns { flex-direction: column; align-items: stretch; }
  .doc-toc {
    width: 100%;
    position: static;
    border-left: none;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-4);
    order: -1;
    margin-bottom: var(--space-4);
    background: var(--surface);
  }
  .doc-article, .doc-article--section { max-width: 68ch; }
}

@media (max-width: 900px) {
  .nav-toggle { display: flex; }
  .sidebar-backdrop {
    position: fixed;
    inset: var(--topbar-h) 0 0 0;
    background: color-mix(in srgb, black 60%, transparent);
    z-index: 25;
  }
  .sidebar-backdrop[hidden] { display: none; }
  .sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    width: min(85vw, 320px);
    height: calc(100vh - var(--topbar-h));
    background: var(--bg);
    transform: translateX(-100%);
    transition: transform .2s ease-out;
    z-index: 30;
    border-right: 1px solid var(--border-strong);
  }
  .sidebar.is-open { transform: translateX(0); }
  .docs-main { padding: var(--space-5) var(--space-4) var(--space-6); }
}

@media (max-width: 640px) {
  .palette-trigger--top span, .palette-trigger--top kbd { display: none; }
  .palette-trigger--top { min-width: 0; padding: .5rem; }
}

@media (max-width: 600px) {
  .topbar { padding: 0 var(--space-3); }
  .doc-pager { flex-direction: column; }
  .doc-pager-link { max-width: 100%; }
  .doc-pager-next { margin-left: 0; text-align: left; align-items: flex-start; }
  .inv-cards { grid-template-columns: 1fr; }
  .doc-index a { flex-direction: column; gap: .2rem; }
  .doc-index-host { width: auto; }
  .spec-row { grid-template-columns: 6ch 1fr; }
}

/* ---- Motion ------------------------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
