/* tty — a terminal-flavoured Jekyll theme for the DevOps Wiki.
   Palettes are CSS variables switched with <html data-palette="...">. */

/* ---------- palettes ---------- */
:root,
[data-palette="phosphor"] {
  --bg: #0b0f0c; --bg-alt: #111813; --bg-raised: #152019; --fg: #c9f5cc; --muted: #6f8f74;
  --accent: #39ff88; --accent-2: #b4ff6b; --border: #1f3326; --code-bg: #0e1510; --mark: #39ff8833;
  --link: #7dffb3; --err: #ff6b6b; --glow: 0 0 6px #39ff8866;
  --k: #7dffb3; --s: #e6db74; --c: #5b7d61; --n: #ffb86c; --f: #8be9fd; --v: #c3e88d; --t: #b4ff6b;
  color-scheme: dark;
}
[data-palette="amber"] {
  --bg: #120d05; --bg-alt: #1a1309; --bg-raised: #21180b; --fg: #ffd59a; --muted: #a17c48;
  --accent: #ffb000; --accent-2: #ff7a1a; --border: #3a2a12; --code-bg: #160f06; --mark: #ffb00033;
  --link: #ffc94d; --err: #ff6b4a; --glow: 0 0 6px #ffb00066;
  --k: #ffd27a; --s: #f5e6b8; --c: #806640; --n: #ff8c42; --f: #ffe0a3; --v: #ffc15e; --t: #ffb000;
  color-scheme: dark;
}
[data-palette="dracula"] {
  --bg: #282a36; --bg-alt: #21222c; --bg-raised: #2f3241; --fg: #f8f8f2; --muted: #8792bd;
  --accent: #bd93f9; --accent-2: #ff79c6; --border: #44475a; --code-bg: #1e1f29; --mark: #bd93f944;
  --link: #8be9fd; --err: #ff5555; --glow: none;
  --k: #ff79c6; --s: #f1fa8c; --c: #6272a4; --n: #bd93f9; --f: #50fa7b; --v: #8be9fd; --t: #ffb86c;
  color-scheme: dark;
}
[data-palette="nord"] {
  --bg: #2e3440; --bg-alt: #292e39; --bg-raised: #3b4252; --fg: #e5e9f0; --muted: #919cae;
  --accent: #88c0d0; --accent-2: #b691af; --border: #434c5e; --code-bg: #272c36; --mark: #88c0d044;
  --link: #8fbcbb; --err: #ce898c; --glow: none;
  --k: #81a1c1; --s: #a3be8c; --c: #6d7a94; --n: #b48ead; --f: #88c0d0; --v: #8fbcbb; --t: #ebcb8b;
  color-scheme: dark;
}
[data-palette="gruvbox"] {
  --bg: #282828; --bg-alt: #1d2021; --bg-raised: #32302f; --fg: #ebdbb2; --muted: #a89984;
  --accent: #fabd2f; --accent-2: #fe8019; --border: #3c3836; --code-bg: #1d2021; --mark: #fabd2f33;
  --link: #8ec07c; --err: #fb5643; --glow: none;
  --k: #fb4934; --s: #b8bb26; --c: #928374; --n: #d3869b; --f: #8ec07c; --v: #83a598; --t: #fabd2f;
  color-scheme: dark;
}
[data-palette="paper"] {
  --bg: #fbfaf7; --bg-alt: #f2f0ea; --bg-raised: #ffffff; --fg: #1f2328; --muted: #686c73;
  --accent: #0b7a55; --accent-2: #a95600; --border: #dcd8ce; --code-bg: #f3f1eb; --mark: #0b7a5522;
  --link: #0a5fb4; --err: #c2261d; --glow: none;
  --k: #a626a4; --s: #377a33; --c: #848994; --n: #936501; --f: #2769d9; --v: #0b769e; --t: #a95600;
  color-scheme: light;
}

[data-palette="tokyo-night"] {
  --bg: #1a1b26; --bg-alt: #16161e; --bg-raised: #24283b; --fg: #c0caf5; --muted: #7a83ad;
  --accent: #7aa2f7; --accent-2: #bb9af7; --border: #2f334d; --code-bg: #16161e; --mark: #7aa2f744;
  --link: #7dcfff; --err: #f7768e; --glow: none;
  --k: #bb9af7; --s: #9ece6a; --c: #636c99; --n: #ff9e64; --f: #7aa2f7; --v: #7dcfff; --t: #e0af68;
  color-scheme: dark;
}
[data-palette="catppuccin"] {
  --bg: #1e1e2e; --bg-alt: #181825; --bg-raised: #313244; --fg: #cdd6f4; --muted: #9399b2;
  --accent: #cba6f7; --accent-2: #fab387; --border: #383a4f; --code-bg: #181825; --mark: #cba6f744;
  --link: #89b4fa; --err: #f38ba8; --glow: none;
  --k: #cba6f7; --s: #a6e3a1; --c: #7f849c; --n: #fab387; --f: #89b4fa; --v: #94e2d5; --t: #f9e2af;
  color-scheme: dark;
}
[data-palette="one-dark"] {
  --bg: #282c34; --bg-alt: #21252b; --bg-raised: #2c313a; --fg: #abb2bf; --muted: #8e959f;
  --accent: #61afef; --accent-2: #c678dd; --border: #3e4451; --code-bg: #21252b; --mark: #61afef33;
  --link: #56b6c2; --err: #e17079; --glow: none;
  --k: #c678dd; --s: #98c379; --c: #6b717d; --n: #d19a66; --f: #61afef; --v: #e06c75; --t: #e5c07b;
  color-scheme: dark;
}
[data-palette="rose-pine"] {
  --bg: #191724; --bg-alt: #1f1d2e; --bg-raised: #26233a; --fg: #e0def4; --muted: #908caa;
  --accent: #ebbcba; --accent-2: #c4a7e7; --border: #403d52; --code-bg: #1f1d2e; --mark: #ebbcba33;
  --link: #9ccfd8; --err: #eb6f92; --glow: none;
  --k: #c4a7e7; --s: #f6c177; --c: #6e6a86; --n: #ebbcba; --f: #9ccfd8; --v: #ebbcba; --t: #f6c177;
  color-scheme: dark;
}
[data-palette="solarized"] {
  --bg: #fdf6e3; --bg-alt: #eee8d5; --bg-raised: #fffbee; --fg: #4f5f66; --muted: #5f6a70;
  --accent: #1b6ca8; --accent-2: #b3420f; --border: #ddd6c1; --code-bg: #f5eedb; --mark: #268bd222;
  --link: #1c7c75; --err: #c42b28; --glow: none;
  --k: #637000; --s: #1b7871; --c: #788c8c; --n: #b52f73; --f: #1c6fac; --v: #886700; --t: #b8440f;
  color-scheme: light;
}
[data-palette="github-light"] {
  --bg: #ffffff; --bg-alt: #f6f8fa; --bg-raised: #ffffff; --fg: #1f2328; --muted: #59636e;
  --accent: #0969da; --accent-2: #8250df; --border: #d1d9e0; --code-bg: #f6f8fa; --mark: #0969da1f;
  --link: #0969da; --err: #cf222e; --glow: none;
  --k: #cf222e; --s: #0a3069; --c: #6e7781; --n: #0550ae; --f: #8250df; --v: #953800; --t: #116329;
  color-scheme: light;
}
[data-palette="one-light"] {
  --bg: #fafafa; --bg-alt: #f0f0f1; --bg-raised: #ffffff; --fg: #383a42; --muted: #696c77;
  --accent: #1860f2; --accent-2: #a626a4; --border: #dbdbdc; --code-bg: #f0f0f1; --mark: #4078f222;
  --link: #0178ad; --err: #d73024; --glow: none;
  --k: #a626a4; --s: #387a37; --c: #888997; --n: #8e6201; --f: #1860f2; --v: #cf2e22; --t: #8f6301;
  color-scheme: light;
}
[data-palette="latte"] {
  --bg: #eff1f5; --bg-alt: #e6e9ef; --bg-raised: #f8f9fb; --fg: #4c4f69; --muted: #646779;
  --accent: #8534ef; --accent-2: #b84201; --border: #ccd0da; --code-bg: #e6e9ef; --mark: #8839ef22;
  --link: #1460f5; --err: #d20f39; --glow: none;
  --k: #8534ef; --s: #2d7821; --c: #808399; --n: #b84201; --f: #0a5af5; --v: #0f7277; --t: #8f5e10;
  color-scheme: light;
}
[data-palette="gruvbox-light"] {
  --bg: #fbf1c7; --bg-alt: #f2e5bc; --bg-raised: #f9f5d7; --fg: #3c3836; --muted: #70645c;
  --accent: #af3a03; --accent-2: #076678; --border: #d5c4a1; --code-bg: #f2e5bc; --mark: #af3a0322;
  --link: #076678; --err: #9d0006; --glow: none;
  --k: #9d0006; --s: #6a680c; --c: #908071; --n: #8f3f71; --f: #3a6f50; --v: #076678; --t: #885b0f;
  color-scheme: light;
}
[data-palette="rose-pine-dawn"] {
  --bg: #faf4ed; --bg-alt: #fffaf3; --bg-raised: #f2e9e1; --fg: #575279; --muted: #716d8c;
  --accent: #c63e3a; --accent-2: #7b659b; --border: #dfdad9; --code-bg: #f2e9e1; --mark: #d7827e22;
  --link: #286983; --err: #aa546b; --glow: none;
  --k: #755f92; --s: #915b10; --c: #89849b; --n: #bb3a36; --f: #3e707b; --v: #286983; --t: #915b10;
  color-scheme: light;
}
/* greys */
[data-palette="graphite"] {
  --bg: #1c1c1c; --bg-alt: #161616; --bg-raised: #262626; --fg: #d4d4d4; --muted: #8f8f8f;
  --accent: #ececec; --accent-2: #b0b0b0; --border: #333333; --code-bg: #141414; --mark: #ffffff1f;
  --link: #d0d0d0; --err: #ff7b72; --glow: none;
  --k: #f0f0f0; --s: #b8b8b8; --c: #727272; --n: #d6d6d6; --f: #ffffff; --v: #c4c4c4; --t: #a9a9a9;
  color-scheme: dark;
}
[data-palette="slate"] {
  --bg: #1e232a; --bg-alt: #181c22; --bg-raised: #272d36; --fg: #cfd6df; --muted: #8b96a5;
  --accent: #9fb3c8; --accent-2: #c9b48f; --border: #333b46; --code-bg: #171b21; --mark: #9fb3c833;
  --link: #a9c1d9; --err: #f08080; --glow: none;
  --k: #a9c1d9; --s: #c5ceb6; --c: #6b7685; --n: #d4b483; --f: #b8c7d9; --v: #9fb3c8; --t: #c9b8a0;
  color-scheme: dark;
}
[data-palette="silver"] {
  --bg: #f2f2f2; --bg-alt: #e8e8e8; --bg-raised: #fafafa; --fg: #222222; --muted: #5c5c5c;
  --accent: #3a3a3a; --accent-2: #686868; --border: #d0d0d0; --code-bg: #e9e9e9; --mark: #00000014;
  --link: #2b2b2b; --err: #b3261e; --glow: none;
  --k: #303030; --s: #4a4a4a; --c: #7d7d7d; --n: #555555; --f: #1a1a1a; --v: #444444; --t: #5e5e5e;
  color-scheme: light;
}
/* Claude colours: terracotta on cream, and on warm charcoal */
[data-palette="claude"] {
  --bg: #faf9f5; --bg-alt: #f0eee6; --bg-raised: #ffffff; --fg: #3d3929; --muted: #6b6457;
  --accent: #a95336; --accent-2: #b24b29; --border: #e3dfd3; --code-bg: #f3f1ea; --mark: #d9775722;
  --link: #b5532f; --err: #b3261e; --glow: none;
  --k: #a95336; --s: #587738; --c: #8a8478; --n: #9a5a2d; --f: #7d5a8c; --v: #a0522d; --t: #866a1e;
  color-scheme: light;
}
[data-palette="claude-dark"] {
  --bg: #262624; --bg-alt: #1f1e1d; --bg-raised: #30302e; --fg: #e8e6dc; --muted: #a39e93;
  --accent: #d97757; --accent-2: #e8a07f; --border: #3a3936; --code-bg: #1f1e1d; --mark: #d9775733;
  --link: #e8a07f; --err: #ff8a80; --glow: none;
  --k: #d97757; --s: #a8c38a; --c: #7b776d; --n: #e8b27f; --f: #cfc3a3; --v: #e8a07f; --t: #e5c07b;
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 64px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  --page-max: 1800px;                       /* article pages */
  --home-max: 1600px;                       /* home page */
  --page-pad: clamp(16px, 3vw, 40px);
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font: 14px/1.5 var(--mono);
  font-variant-ligatures: none;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--link); text-decoration: underline dotted; text-underline-offset: 3px; }
a:hover { color: var(--accent); text-decoration-style: solid; }
::selection { background: var(--accent); color: var(--bg); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dim { color: var(--muted); }
.prompt-sign { color: var(--accent); }
kbd {
  font: inherit; font-size: 0.78em;
  border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px;
  padding: 0 0.35em; color: var(--muted); background: var(--bg-alt);
}
.skip { position: absolute; left: -9999px; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
.skip:focus { left: 12px; top: 12px; z-index: 100; background: var(--bg-raised); padding: 6px 10px; }

.cursor {
  display: inline-block; width: 0.6em; height: 1.1em; margin-left: 0.25em;
  vertical-align: -0.18em; background: var(--accent); box-shadow: var(--glow);
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .cursor { animation: none; } }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  height: 52px; padding: 0 16px;
  background: color-mix(in srgb, var(--bg-alt) 92%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 800; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand:hover { color: inherit; }
.brand-user { color: var(--accent); text-shadow: var(--glow); }
.brand-host { color: var(--accent-2); }
.brand-path { color: var(--link); }
.topnav { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.icon-btn, .search-open, .palette select {
  font: inherit; font-size: 13px; color: var(--fg);
  background: var(--bg-raised); border: 1px solid var(--border); border-radius: 6px;
  padding: 4px 10px; cursor: pointer;
}
.icon-btn:hover, .search-open:hover { border-color: var(--accent); }
.search-open { display: inline-flex; align-items: center; gap: 8px; }
.palette { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.gh { font-size: 13px; }
.nav-toggle { display: none; font-size: 18px; line-height: 1; padding: 2px 10px; }

/* ---------- article layout: article list | text ---------- */
.shell {
  flex: 1;
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 var(--page-pad);
}
.sidebar { position: relative; }
.sidebar-inner {
  position: sticky; top: 52px;
  max-height: calc(100vh - 52px);
  overflow-y: auto;
  padding: 18px 14px 40px;
  scrollbar-width: thin;
}
.sidebar { border-right: 1px solid var(--border); border-left: 1px solid var(--border); background: var(--bg-alt); }
.filter {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--border); border-radius: 6px; padding: 4px 8px;
  background: var(--bg); margin-bottom: 14px; font-size: 13px;
}
.filter input, .search-prompt input, .term-line input {
  flex: 1; min-width: 0; font: inherit; color: var(--fg);
  background: transparent; border: 0; outline: 0;
}
.nav-cat { margin-bottom: 6px; }
.nav-cat summary {
  cursor: pointer; list-style: none; display: flex; justify-content: space-between;
  padding: 3px 6px; border-radius: 4px; font-weight: 600;
}
.nav-cat summary::-webkit-details-marker { display: none; }
.nav-cat summary::before { content: "▸"; color: var(--muted); margin-right: 6px; transition: transform .15s; }
.nav-cat[open] summary::before { transform: rotate(90deg); }
.nav-cat summary:hover { background: var(--bg-raised); }
.dir { color: var(--accent-2); margin-right: auto; }
.count { color: var(--muted); font-weight: 400; font-size: 12px; }
.nav-cat ul { list-style: none; margin: 4px 0 10px; padding: 0 0 0 14px; border-left: 1px dashed var(--border); }
.nav-cat li a {
  display: block; padding: 3px 8px; font-size: 13px; line-height: 1.45;
  color: var(--fg); text-decoration: none; border-radius: 4px;
}
.nav-cat li a:hover { background: var(--bg-raised); color: var(--accent); }
.nav-cat li a[aria-current="page"] { background: var(--mark); color: var(--accent); }
.nav-cat li a[aria-current="page"]::before { content: "> "; }
.nav-cat li[hidden] { display: none; }

.main { min-width: 0; padding: 24px clamp(16px, 2vw, 32px) 60px; }
.article { max-width: none; }
.cmdline { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.article-head h1 {
  font-size: clamp(1.45rem, 2.3vw, 1.95rem); line-height: 1.25; margin: 0 0 10px;
  color: var(--accent); text-shadow: var(--glow);
}
.meta { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--muted); font-size: 13px; margin: 0 0 26px; }
.meta > * + *::before { content: "· "; color: var(--border); }
.tag {
  color: var(--bg); background: var(--accent); text-decoration: none;
  padding: 0 8px; border-radius: 3px; font-weight: 600;
}
.tag:hover { color: var(--bg); background: var(--accent-2); }

/* ---------- cover (inlined and recoloured by _plugins/themed_covers.rb) ---------- */
.cover { width: 100%; margin: 0 0 28px; }
.cover-svg { display: block; width: 100%; height: auto; }

/* ---------- article text ---------- */
/* Running text in a proportional font: monospace gives every space a full
   character cell, which reads as wide gaps between words. Headings, code and
   the terminal-style chrome stay monospace. */
.prose {
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.45;
  letter-spacing: normal;
  word-spacing: normal;
}
.prose :is(h2, h3, h4) { font-family: var(--mono); }
.prose > :first-child { margin-top: 0; }
.prose h2, .prose h3, .prose h4 { line-height: 1.3; margin: 1.8em 0 0.6em; color: var(--fg); }
.prose h2 { font-size: 1.22rem; padding-bottom: 6px; border-bottom: 1px dashed var(--border); }
.prose h3 { font-size: 1.03rem; }
.prose h3 { color: var(--accent-2); }
.prose .anchor { margin-left: 8px; opacity: 0; text-decoration: none; color: var(--muted); }
.prose :is(h2, h3, h4):hover .anchor { opacity: 1; }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose table { margin: 0 0 0.8em; }
.prose li + li { margin-top: 0.1em; }
.prose ul { list-style: none; padding-left: 1.4em; }
.prose ul > li::before { content: "–"; color: var(--accent); display: inline-block; width: 1.4em; margin-left: -1.4em; }
.prose ul.task-list > li::before { content: none; }
.prose img { max-width: 100%; height: auto; border-radius: 6px; }
/* Diagram previews: at most 60% of the text column (and 520px tall);
   each one links to the full-size SVG. */
.prose a:has(> img) { display: block; max-width: 60%; margin: 0 auto; cursor: zoom-in; }
.prose a:has(> img) img { display: block; width: 100%; max-height: 520px; object-fit: contain; object-position: center top; }
@media (max-width: 900px) { .prose a:has(> img) { max-width: 100%; } }
.prose a:has(> img) { text-decoration: none; }
.prose hr { border: 0; border-top: 1px dashed var(--border); margin: 2em 0; }
.prose blockquote {
  margin-left: 0; padding: 8px 16px; color: var(--fg);
  background: var(--bg-alt); border-left: 3px solid var(--accent-2); border-radius: 0 6px 6px 0;
}
.prose blockquote > :last-child { margin-bottom: 0; }
.prose strong { color: var(--accent-2); }
.prose code {
  font-family: var(--mono); font-size: 0.86em; padding: 0.05em 0.35em; border-radius: 4px;
  background: var(--code-bg); border: 1px solid var(--border); color: var(--accent);
  overflow-wrap: anywhere;
}

/* tables */
.table-wrap { overflow-x: auto; margin: 0 0 1.4em; border: 1px solid var(--border); border-radius: 6px; }
.prose table { width: 100%; border-collapse: collapse; font-size: 13.5px; line-height: 1.4; margin: 0; }
.prose th, .prose td { padding: 5px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.prose th { background: var(--bg-alt); color: var(--accent); font-weight: 600; white-space: nowrap; }
.prose tr:last-child td { border-bottom: 0; }
.prose tbody tr:hover td { background: var(--bg-alt); }
.prose td code { white-space: nowrap; overflow-wrap: normal; }

/* code blocks */
.prose div.highlighter-rouge, .prose pre.highlight { position: relative; }
.prose div.highlighter-rouge { margin: 0 0 1.3em; }
.prose pre {
  margin: 0; padding: 14px 16px; overflow-x: auto;
  background: var(--code-bg); border: 1px solid var(--border); border-radius: 6px;
  font-family: var(--mono); font-size: 12.75px; line-height: 1.45; tab-size: 4;
}
.prose pre code { background: none; border: 0; padding: 0; color: var(--fg); font-size: 1em; overflow-wrap: normal; white-space: pre; }
.code-tools {
  position: absolute; top: 6px; right: 6px; display: flex; gap: 6px; align-items: center;
  font-size: 11px; opacity: 0.25; transition: opacity .15s;
}
div.highlighter-rouge:hover .code-tools, .code-tools:focus-within { opacity: 1; }
.code-lang { color: var(--muted); }
.copy-btn {
  font: inherit; color: var(--fg); background: var(--bg-raised); cursor: pointer;
  border: 1px solid var(--border); border-radius: 4px; padding: 1px 8px;
}
.copy-btn:hover { border-color: var(--accent); color: var(--accent); }
.copy-btn.done { color: var(--bg); background: var(--accent); border-color: var(--accent); }

/* Rouge tokens */
.highlight .c, .highlight .c1, .highlight .cm, .highlight .cs, .highlight .ch, .highlight .cp, .highlight .cpf { color: var(--c); font-style: italic; }
.highlight .k, .highlight .kd, .highlight .kn, .highlight .kr, .highlight .kc, .highlight .kt, .highlight .kp, .highlight .ow { color: var(--k); }
.highlight .s, .highlight .s1, .highlight .s2, .highlight .sb, .highlight .sc, .highlight .sd, .highlight .se, .highlight .sh, .highlight .si, .highlight .sx, .highlight .sr, .highlight .ss, .highlight .dl { color: var(--s); }
.highlight .m, .highlight .mi, .highlight .mf, .highlight .mh, .highlight .mo, .highlight .il, .highlight .mb { color: var(--n); }
.highlight .nf, .highlight .fm, .highlight .nb, .highlight .bp, .highlight .nc, .highlight .nn { color: var(--f); }
.highlight .nv, .highlight .vi, .highlight .vg, .highlight .vc, .highlight .na, .highlight .no { color: var(--v); }
.highlight .nt, .highlight .nl, .highlight .ne, .highlight .nd { color: var(--t); }
.highlight .o, .highlight .p { color: var(--fg); }
.highlight .gd { color: var(--err); }
.highlight .gi { color: var(--accent); }
.highlight .gh, .highlight .gu { color: var(--accent-2); font-weight: 600; }
.highlight .gp { color: var(--accent); user-select: none; }
.highlight .go { color: var(--muted); }
.highlight .err { color: inherit; background: none; }

/* pager */
.pager {
  display: flex; justify-content: space-between; gap: 16px; margin-top: 48px; padding-top: 18px;
  border-top: 1px dashed var(--border); font-size: 13.5px;
}
.pager a { max-width: 48%; text-decoration: none; }
.pager .next { text-align: right; margin-left: auto; }

/* ---------- terminal window (home, search, 404) ---------- */
.term, .search-window {
  background: var(--code-bg); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 20px 60px -20px #0009; overflow: hidden;
}
.win-bar {
  display: flex; align-items: center; gap: 12px; padding: 8px 12px;
  background: var(--bg-raised); border-bottom: 1px solid var(--border); font-size: 12px; color: var(--muted);
}
.win-title { flex: 1; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dots { display: inline-flex; gap: 6px; }
.dots i { width: 11px; height: 11px; border-radius: 50%; background: var(--border); }
.dots i:nth-child(1) { background: var(--err); }
.dots i:nth-child(2) { background: var(--accent-2); }
.dots i:nth-child(3) { background: var(--accent); }
.term-body { position: relative; padding: 14px 16px; font-size: 13.5px; line-height: 1.6; height: 380px; overflow-y: auto; }
.term-body::after { /* faint CRT scanlines */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(to bottom, transparent 0 2px, #0000000d 2px 3px);
}
/* no scanlines on the light palettes */
[data-palette="paper"] .term-body::after,
[data-palette="solarized"] .term-body::after,
[data-palette="github-light"] .term-body::after,
[data-palette="one-light"] .term-body::after,
[data-palette="latte"] .term-body::after,
[data-palette="gruvbox-light"] .term-body::after,
[data-palette="rose-pine-dawn"] .term-body::after,
[data-palette="silver"] .term-body::after,
[data-palette="claude"] .term-body::after { display: none; }
.term-out p, .term-body p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.term-out .err, .term-body .err { color: var(--err); }
.term-out .ok { color: var(--accent); }
.term-out .cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0 18px; }
.term-line { display: flex; gap: 8px; align-items: baseline; margin-top: 2px; }
.term-line .prompt { white-space: nowrap; font-weight: 600; }
.term-line input { caret-color: var(--accent); }

/* ---------- home ---------- */
.home { flex: 1; width: 100%; max-width: var(--home-max); margin: 0 auto; padding: 32px var(--page-pad) 60px; }
.hero { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 40px; align-items: center; margin-bottom: 56px; }
.hero-title { font-size: clamp(2rem, 4.5vw, 3.4rem); line-height: 1.1; margin: 0 0 16px; color: var(--accent); text-shadow: var(--glow); }
.hero-lead { font-size: 1.05rem; margin: 0 0 22px; }
.stats { list-style: none; padding: 0; margin: 0 0 18px; display: flex; flex-wrap: wrap; gap: 10px; }
.stats li { border: 1px solid var(--border); border-radius: 6px; padding: 6px 12px; background: var(--bg-alt); font-size: 13px; color: var(--muted); }
.stats b { color: var(--accent-2); font-size: 1.15rem; margin-right: 4px; }
.hint code { color: var(--accent); }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 18px; }
.cat {
  border: 1px solid var(--border); border-radius: 8px; background: var(--bg-alt);
  padding: 14px 16px 10px; scroll-margin-top: 70px;
}
.cat h2 { font-size: 1.05rem; margin: 0 0 8px; display: flex; justify-content: space-between; align-items: baseline; }
.cat h2 a { text-decoration: none; }
.cat ul { list-style: none; margin: 0; padding: 0; font-size: 13px; line-height: 1.5; }
.cat li { padding: 3px 0; border-top: 1px dashed var(--border); }
.cat li::before { content: "-rw-r--r-- "; color: var(--muted); font-size: 11px; }
.cat li a { color: var(--fg); text-decoration: none; }
.cat li a:hover { color: var(--accent); }

.notfound { flex: 1; max-width: 760px; margin: 60px auto; padding: 0 16px; width: 100%; }
.notfound .term-body { height: auto; }

/* ---------- search palette ---------- */
.search {
  position: fixed; inset: 0; z-index: 50; background: #000a;
  display: flex; justify-content: center; align-items: flex-start; padding: 10vh 16px 16px;
}
.search[hidden] { display: none; }
.search-window { width: min(820px, 100%); max-height: 78vh; display: flex; flex-direction: column; }
.search-prompt { display: flex; gap: 2px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 15px; }
.search-prompt input { caret-color: var(--accent); padding: 0 4px; }
.search-prompt input::-webkit-search-cancel-button { display: none; }
.search-results { list-style: none; margin: 0; padding: 6px; overflow-y: auto; flex: 1; }
.search-results li a { display: block; padding: 8px 10px; border-radius: 6px; text-decoration: none; color: var(--fg); }
.search-results li a .r-title { color: var(--accent); font-weight: 600; }
.search-results li a .r-url { color: var(--muted); font-size: 11.5px; margin-left: 8px; }
.search-results li a .r-ex { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.search-results li a mark { background: var(--mark); color: var(--accent-2); }
.search-results li.sel a, .search-results li a:hover { background: var(--bg-raised); }
.search-results .r-note { padding: 10px; color: var(--muted); font-size: 13px; }
.search-help { padding: 8px 14px; border-top: 1px solid var(--border); font-size: 11.5px; }

/* ---------- footer ---------- */
.footer {
  display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: center;
  padding: 16px; border-top: 1px solid var(--border); background: var(--bg-alt); font-size: 12px;
}

/* ---------- responsive ---------- */
@media (max-width: 1200px) {
  .shell { grid-template-columns: 280px minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .nav-toggle { display: inline-block; }
  .shell { grid-template-columns: minmax(0, 1fr); padding: 0; }
  .sidebar {
    position: fixed; top: 52px; bottom: 0; left: 0; z-index: 15; width: min(320px, 86vw);
    transform: translateX(-102%); transition: transform .2s ease; box-shadow: 10px 0 30px #0007;
  }
  body.nav-open .sidebar { transform: none; }
  .hero { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .hero-side { order: -1; }
  .term-body { height: 320px; }
}
@media (max-width: 640px) {
  body { font-size: 13px; }
  .search-open { padding: 4px 8px; }
  .search-open .dim, .search-open kbd, .palette .dim, .gh { display: none; }
  .brand { font-size: 13px; }
  .cat-grid { grid-template-columns: minmax(0, 1fr); }
  .main { padding: 20px 16px 48px; }
}
