/* Cacophony Documentation — Nord Palette
 *
 * bd-0e2372: align with crates/caco-web/static/style.css design tokens.
 * Sourced from the gap inventory in docs/audits/bd-90d4d3-github-pages-vs-webapp-design.md.
 * Webapp tokens are the source of truth; if you tweak something here it must
 * trace back to a corresponding webapp value (or be flagged as docs-only). */
/* Self-hosted fonts (same origin; see docs/fonts/README.txt). The family
 * names match entries already in the shared --font-sans / --font-mono stacks,
 * so the tokens stay identical to caco-web. */
@font-face {
  font-family: 'Inter Variable';
  src: url('fonts/inter-var-latin.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: optional;
}
@font-face {
  font-family: 'FiraCode Nerd Font Mono';
  src: url('fonts/fira-code-latin.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: optional;
}

:root {
  color-scheme: dark;

  /* ── Nord palette (shared with webapp verbatim) ───────────── */
  --nord0: #2e3440;
  --nord1: #3b4252;
  --nord2: #434c5e;
  --nord3: #4c566a;
  --nord4: #d8dee9;
  --nord5: #e5e9f0;
  --nord6: #eceff4;
  --nord7: #8fbcbb;
  --nord8: #88c0d0;
  --nord9: #81a1c1;
  --nord10: #5e81ac;
  --nord11: #bf616a;
  --nord12: #d08770;
  --nord13: #ebcb8b;
  --nord14: #a3be8c;
  --nord15: #b48ead;

  /* ── Semantic surfaces (parity with webapp) ───────────────── */
  --bg-primary: #080A12;
  --bg-secondary: #0D1322;
  --bg-tertiary: #11182b;
  --bg-elev: var(--nord1);
  --bg-hover: rgba(136, 192, 208, 0.06);
  --bg-active: rgba(136, 192, 208, 0.12);
  --bg-glass: rgba(20, 27, 43, 0.88);

  --border: rgba(216, 222, 233, 0.06);
  --border-strong: rgba(216, 222, 233, 0.12);
  --border-subtle: rgba(216, 222, 233, 0.03);
  --border-focus: var(--nord8);
  --border-glow: rgba(136, 192, 208, 0.25);

  --text-primary: var(--nord6);
  --text-secondary: var(--nord4);
  --text-muted: #a8b3c8;
  --text-dim: #9aa6bd;
  --text-faint: #434c5e;

  --accent: var(--nord8);
  --accent-hover: var(--nord7);
  --accent-dim: var(--nord10);
  --accent-soft: rgba(136, 192, 208, 0.14);

  --success: var(--nord14);
  --success-soft: rgba(163, 190, 140, 0.10);
  --warning: var(--nord13);
  --warning-soft: rgba(235, 203, 139, 0.10);
  --error: var(--nord11);
  --error-soft: rgba(191, 97, 106, 0.10);
  --bg-terminal: #1c1f26;
  --info: var(--nord8);
  --info-soft: rgba(136, 192, 208, 0.10);
  --purple: var(--nord15);
  --purple-badge-bg: color-mix(in srgb, var(--purple) 12%, var(--bg-secondary));
  --orange: var(--nord12);
  --orange-soft: rgba(208, 135, 112, 0.10);

  /* ── Layout / layers / typography (parity with webapp) ────── */
  --z-base: 1;
  --z-sticky: 100;
  --z-dropdown: 200;
  --z-overlay: 1000;
  --z-modal: 1100;
  --z-toast: 2000;
  --z-tooltip: 3000;
  --sidebar-width: 240px;
  --topbar-height: 52px;
  --font-mono: 'FiraCode Nerd Font Mono', 'Fira Code', 'SFMono-Regular', Consolas, monospace;
  --font-sans: 'Manrope', 'Inter Variable', 'Avenir Next', Inter, system-ui, sans-serif;

  /* ── Spacing / radii / shadows / transitions (webapp parity) */
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.24);
  --shadow: 0 4px 12px rgba(0,0,0,0.3), 0 1px 3px rgba(0,0,0,0.18);
  --shadow-lg: 0 16px 56px rgba(0,0,0,0.55), 0 6px 16px rgba(0,0,0,0.35);
  --shadow-glow: 0 0 30px rgba(136, 192, 208, 0.15);
  --shadow-inset: inset 0 1px 0 rgba(255,255,255,0.03);

  --transition: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --transition: 0s;
    --transition-slow: 0s;
    --transition-spring: 0s;
  }
}

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

html {
  scroll-behavior: smooth;
  width: 100%;
  max-width: 100%;
  /* clip, not hidden: hidden makes body a scroll container and silently
     disables the sticky sidebar. */
  overflow-x: clip;
}
body {
  background: var(--bg-primary);
  background-image:
    radial-gradient(ellipse 80% 60% at 8% 5%, rgba(94, 129, 172, 0.07) 0%, transparent 50%),
    radial-gradient(ellipse 60% 50% at 92% 90%, rgba(180, 142, 173, 0.05) 0%, transparent 50%),
    radial-gradient(ellipse 100% 40% at 50% 105%, rgba(143, 188, 187, 0.04) 0%, transparent 50%);
  background-attachment: fixed;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  line-height: 1.6;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'cv11', 'ss01';
  font-optical-sizing: auto;
}

::selection {
  background: rgba(136, 192, 208, 0.28);
  color: var(--text-primary);
}

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(216, 222, 233, 0.10) transparent;
}
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(216, 222, 233, 0.08);
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(216, 222, 233, 0.18);
  background-clip: padding-box;
}

/* ---- Layout ---- */
.page {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  position: sticky;
  top: 0;
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  background:
    radial-gradient(circle at top left, rgba(136, 192, 208, 0.06), transparent 18rem),
    linear-gradient(180deg, rgba(22, 27, 34, 0.90) 0%, rgba(15, 19, 24, 0.94) 100%);
  border-right: 1px solid var(--border);
  box-shadow: var(--shadow), var(--shadow-inset);
  backdrop-filter: blur(18px) saturate(1.25);
  -webkit-backdrop-filter: blur(18px) saturate(1.25);
  padding: 1.5rem 0;
  flex-shrink: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
.sidebar::after {
  content: "";
  position: absolute;
  top: 0;
  right: -1px;
  width: 1px;
  height: 100%;
  background: linear-gradient(180deg, transparent, var(--border-glow), transparent);
  pointer-events: none;
}
.sidebar .logo {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: 0 1.25rem 1rem;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  border-bottom: 1px solid var(--border);
  margin-bottom: .75rem;
  position: relative;
}
.sidebar .logo::after {
  content: "";
  position: absolute;
  left: 1.25rem;
  right: 1.25rem;
  bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-glow), transparent);
}
.logo-mark {
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--nord8) 0%, var(--nord10) 50%, var(--nord15) 100%);
  box-shadow:
    0 0 16px rgba(136, 192, 208, 0.35),
    0 2px 4px rgba(0, 0, 0, 0.40),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  flex: 0 0 auto;
  position: relative;
  animation: logoGlow 4s ease-in-out infinite alternate;
}
.logo-mark::before {
  content: "";
  position: absolute;
  inset: 26% 16% 28%;
  background: repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.72) 0 1.5px, transparent 1.5px 25%);
}
.logo-mark::after {
  content: "";
  position: absolute;
  left: 30%;
  top: 50%;
  width: 36%;
  height: 27%;
  border-radius: 50%;
  background: #fff;
  transform: rotate(-22deg);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
}
@keyframes logoGlow {
  from { box-shadow: 0 0 16px rgba(136, 192, 208, 0.35), 0 2px 4px rgba(0, 0, 0, 0.40), inset 0 1px 0 rgba(255, 255, 255, 0.15); }
  to { box-shadow: 0 0 22px rgba(136, 192, 208, 0.50), 0 2px 4px rgba(0, 0, 0, 0.40), inset 0 1px 0 rgba(255, 255, 255, 0.15); }
}
@media (prefers-reduced-motion: reduce) {
  .logo-mark { animation: none; }
}
.sidebar .logo .logo-accent { color: var(--accent); }

.sidebar nav {
  padding: 0 .65rem;
}
.sidebar nav a {
  display: flex;
  align-items: center;
  min-height: 1.85rem;
  margin: 1px 0;
  padding: .3rem .65rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: .9rem;
  border-radius: var(--radius);
  transition: background var(--transition), color var(--transition), box-shadow var(--transition), border-color var(--transition);
  border-left: 3px solid transparent;
  position: relative;
  overflow: hidden;
}
.sidebar nav a::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 20% 50%, rgba(136, 192, 208, 0.10), transparent 55%);
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
}
.sidebar nav a:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.sidebar nav a:hover::before,
.sidebar nav a.active::before,
.sidebar nav a[aria-current="page"]::before {
  opacity: 1;
}
.sidebar nav a:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 1px;
  background: var(--bg-hover);
}
.sidebar nav a.active,
.sidebar nav a[aria-current="page"] {
  border-left-color: var(--accent);
  color: var(--accent);
  background: linear-gradient(90deg, var(--bg-active), transparent 85%);
  box-shadow: inset 0 0 0 1px var(--border-subtle);
}
.sidebar nav .section-title {
  padding: .95rem .65rem .25rem;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  font-weight: 600;
}

.content {
  flex: 1;
  min-width: 0;
  width: 100%;
  max-width: 54rem;
  padding: 2.5rem 3rem 4rem;
}

.content-wide {
  max-width: 72rem;
}

/* Skip-link for keyboard users (parity with webapp). Visually hidden
   until focused; jumps to <main> / <main class="content">.
   Keep the hidden state clipped to a 1px fixed box rather than translating a
   full banner above the viewport, matching caco-web's mobile-overflow fix. */
.skip-link {
  position: fixed;
  inset-block-start: max(0.25rem, env(safe-area-inset-top));
  inset-inline-start: max(0.25rem, env(safe-area-inset-left));
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  background: var(--accent);
  color: var(--bg-primary);
  border-radius: var(--radius);
  font-weight: 600;
  text-decoration: none;
  box-shadow: var(--shadow);
  z-index: var(--z-tooltip);
}
.skip-link:focus,
.skip-link:focus-visible {
  width: auto;
  height: auto;
  padding: .5rem 1rem;
  overflow: visible;
  clip: auto;
  clip-path: none;
  white-space: normal;
  outline: 2px solid var(--bg-primary);
  outline-offset: 2px;
  box-shadow: var(--shadow), 0 0 0 4px var(--border-focus);
}

/* ---- Typography ---- */
h1 {
  font-size: 2.15rem;
  font-weight: 720;
  line-height: 1.12;
  color: var(--text-primary);
  margin-bottom: 1rem;
  padding-bottom: .65rem;
  letter-spacing: -0.03em;
  position: relative;
  text-wrap: balance;
}
h1::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 4.5rem;
  height: 2px;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--accent), var(--purple), transparent);
  box-shadow: var(--shadow-glow);
}
h2 {
  font-size: 1.45rem;
  font-weight: 680;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-top: 2.75rem;
  margin-bottom: .8rem;
  scroll-margin-top: 1rem;
}
h3 {
  font-size: 1.1rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: #c9d6e8;
  margin-top: 1.9rem;
  margin-bottom: .5rem;
  scroll-margin-top: 1rem;
}
h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
  margin-top: 1.25rem;
  margin-bottom: .4rem;
}

main.content > h1:first-child + p {
  max-width: 46rem;
  color: var(--text-secondary);
  font-size: 1.08rem;
  line-height: 1.6;
  margin-bottom: 1.35rem;
}

p { margin-bottom: 1rem; }
a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: rgba(136, 192, 208, 0.35);
  text-underline-offset: .16em;
  transition: color var(--transition), text-decoration-color var(--transition);
}
a:hover { color: var(--accent-hover); text-decoration-color: var(--accent-hover); }
a:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
  border-radius: 2px;
}

ul, ol { margin: 0 0 1rem 1.5rem; }
li { margin-bottom: .35rem; }
li code { font-size: .85em; }

strong { color: var(--text-primary); }
em { color: var(--text-secondary); }

hr {
  border: none;
  border-top: 1px solid var(--border-strong);
  margin: 2rem 0;
}

/* ---- Code ---- */
code {
  font-family: var(--font-mono);
  background: rgba(136, 192, 208, 0.08);
  color: var(--nord7);
  padding: .15em .35em;
  border-radius: 4px;
  font-size: .88em;
  border: 1px solid rgba(136, 192, 208, 0.16);
  overflow-wrap: anywhere;
}

kbd {
  display: inline-block;
  min-width: 1.5em;
  padding: .05em .4em;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: .82em;
  text-align: center;
}

pre {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-left: 3px solid var(--nord9);
  border-radius: var(--radius);
  padding: 12px 14px;
  overflow-x: auto;
  margin-bottom: 1.25rem;
  line-height: 1.55;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02), 0 1px 3px rgba(0, 0, 0, 0.20);
}
pre {
  scrollbar-width: thin;
  scrollbar-color: rgba(136, 192, 208, 0.3) transparent;
}
/* site.js marks code that runs past the edge until it is scrolled to the end. */
pre[data-scroll-more] {
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 3.5rem), rgba(0, 0, 0, 0.18));
          mask-image: linear-gradient(90deg, #000 calc(100% - 3.5rem), rgba(0, 0, 0, 0.18));
}
pre code {
  background: none;
  padding: 0;
  color: var(--text-secondary);
  font-size: .85rem;
  border: none;
  white-space: pre;
  overflow-wrap: normal;
}
.syntax-yaml .yaml-key { color: var(--nord8); font-weight: 600; }
.syntax-yaml .yaml-comment { color: var(--text-muted); font-style: italic; }
.syntax-yaml .yaml-string { color: var(--nord14); }
.syntax-yaml .yaml-number { color: var(--nord15); }
.syntax-yaml .yaml-bool,
.syntax-yaml .yaml-null { color: var(--nord13); font-weight: 600; }
.syntax-yaml .yaml-anchor { color: var(--nord12); }


/* ---- Buttons (aligned with caco-web .btn ramp) ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.1px;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}
.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, transparent 50%);
  pointer-events: none;
}
.btn:hover {
  background: var(--bg-elev);
  border-color: rgba(216, 222, 233, 0.2);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  transform: translateY(-1px);
}
.btn:active {
  box-shadow: none;
  transform: scale(0.96) translateY(0);
  transition-duration: 0.06s;
}
.btn:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }
.btn-sm { padding: 5px 10px; font-size: 11.5px; }
.btn-primary,
.btn-accent {
  background: linear-gradient(135deg, var(--nord9), var(--nord10));
  color: var(--nord6);
  border-color: var(--nord9);
  box-shadow: 0 2px 8px rgba(94, 129, 172, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.btn-primary:hover,
.btn-accent:hover {
  filter: brightness(1.06);
  border-color: var(--nord9);
  box-shadow: 0 4px 14px rgba(94, 129, 172, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  color: var(--nord6);
}

/* ---- Cards ---- */
.card {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  box-shadow: var(--shadow-sm), var(--shadow-inset);
  backdrop-filter: blur(10px) saturate(1.1);
  -webkit-backdrop-filter: blur(10px) saturate(1.1);
}
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 140% 120% at 90% -30%, rgba(136, 192, 208, 0.06) 0%, transparent 55%);
  opacity: 0;
  transition: opacity var(--transition-slow);
  pointer-events: none;
}
.card:hover {
  border-color: var(--border-glow);
  box-shadow: var(--shadow), 0 0 20px rgba(136, 192, 208, 0.06);
}
.card:hover::before { opacity: 1; }
.card h2,
.card h3 {
  display: flex;
  font-size: 1.1rem;
  align-items: center;
  gap: .5rem;
  margin-top: 0;
  color: var(--accent);
}
.card h2::before,
.card h3::before {
  content: "";
  width: .22rem;
  height: 1.05em;
  border-radius: var(--radius-pill);
  background: linear-gradient(180deg, var(--accent), var(--nord15));
  box-shadow: 0 0 10px rgba(136, 192, 208, 0.25);
  flex: 0 0 auto;
}
.card p:last-child { margin-bottom: 0; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.wallpaper-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  margin: 1.5rem 0 2rem;
}
.wallpaper-stage {
  position: relative;
  overflow: hidden;
  margin: 0;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, rgba(136, 192, 208, 0.08), rgba(180, 142, 173, 0.08));
  box-shadow: var(--shadow-lg), var(--shadow-inset);
}
.wallpaper-stage img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.wallpaper-stage figcaption {
  position: absolute;
  inset: auto 1rem 1rem 1rem;
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: rgba(15, 19, 24, 0.76);
  color: var(--text-primary);
  backdrop-filter: blur(14px) saturate(1.15);
  -webkit-backdrop-filter: blur(14px) saturate(1.15);
}
.wallpaper-controls {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
  align-items: center;
}
.wallpaper-sidecar {
  display: grid;
  grid-template-columns: minmax(14rem, auto) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}
.wallpaper-sidecar .card { margin: 0; }
.wallpaper-filmstrip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 6.5rem;
  gap: 0.65rem;
  overflow-x: auto;
  padding-bottom: 0.4rem;
}
.wallpaper-thumb {
  position: relative;
  min-height: 3.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  cursor: pointer;
  overflow: hidden;
  padding: 0;
  font: 700 0.78rem/1 var(--font-mono);
  transition: transform var(--transition), border-color var(--transition), background var(--transition), color var(--transition);
}
.wallpaper-thumb img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}
.wallpaper-thumb span {
  position: absolute;
  right: 0.35rem;
  bottom: 0.35rem;
  padding: 0.18rem 0.28rem;
  border-radius: var(--radius);
  background: rgba(15, 19, 24, 0.76);
  color: var(--text-primary);
}
.wallpaper-thumb:hover,
.wallpaper-thumb:focus-visible {
  border-color: var(--border-glow);
  background: var(--bg-hover);
  color: var(--text-primary);
}
.wallpaper-thumb[aria-current="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.wallpaper-hero:fullscreen {
  grid-template-columns: minmax(0, 1fr) minmax(18rem, 24rem);
  gap: 1rem;
  align-items: stretch;
  width: 100vw;
  height: 100vh;
  margin: 0;
  padding: 1rem;
  background: var(--bg-primary);
}
.wallpaper-hero:fullscreen .wallpaper-stage {
  aspect-ratio: auto;
  height: calc(100vh - 2rem);
}
.wallpaper-hero:fullscreen .wallpaper-sidecar { grid-template-columns: 1fr; }
.wallpaper-hero:fullscreen .wallpaper-filmstrip {
  grid-auto-flow: row;
  grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr));
}
.wallpaper-hero:fullscreen .wallpaper-sidecar {
  max-height: calc(100vh - 2rem);
  overflow: auto;
}
@media (max-width: 900px) {
  .wallpaper-sidecar { grid-template-columns: 1fr; }
}

/* ---- Tables ---- */
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.25rem;
  font-size: .9rem;
  background: var(--bg-glass);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-inset);
}
@media (max-width: 760px) {
  table {
    display: block;
    overflow-x: auto;
    max-width: 100%;
  }
  td,
  th {
    white-space: normal;
    overflow-wrap: anywhere;
  }
  td code {
    white-space: normal;
    overflow-wrap: anywhere;
  }
}
th {
  text-align: left;
  background: rgba(59, 66, 82, 0.58);
  color: var(--text-muted);
  padding: .6rem .75rem;
  border-bottom: 1px solid var(--border-strong);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}
td {
  padding: .5rem .75rem;
  border-bottom: 1px solid var(--border);
}
/* Command-style first columns: keep flags readable instead of one per line. */
@media (min-width: 761px) {
  td:first-child:has(> code:only-child) { min-width: 15rem; }
}
tbody tr:nth-child(even) td { background: rgba(0, 0, 0, 0.04); }
tr:hover td {
  background: var(--bg-hover);
  box-shadow: inset 3px 0 0 var(--accent-dim);
}
tr:last-child td { border-bottom: none; }
.schema-table td,
.schema-table th { vertical-align: top; }
.schema-path {
  font-family: var(--font-mono);
  min-width: 18rem;
}
.schema-path code { white-space: normal; }
.schema-depth-1 { padding-left: 1.25rem; }
.schema-depth-2 { padding-left: 2.25rem; }
.schema-depth-3 { padding-left: 3.25rem; }
.schema-depth-4 { padding-left: 4.25rem; }
.schema-depth-5 { padding-left: 5.25rem; }
.schema-depth-6 { padding-left: 6.25rem; }
.schema-depth-7 { padding-left: 7.25rem; }
.schema-branch {
  color: var(--text-muted);
  user-select: none;
}
.schema-section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: .7rem;
  margin: 1rem 0 1.5rem;
}
.schema-section-card {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  padding: .75rem .85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-glass);
  text-decoration: none;
  box-shadow: var(--shadow-inset);
}
.schema-section-card:hover {
  border-color: var(--border-glow);
  background: var(--bg-hover);
  text-decoration: none;
}
.schema-section-card strong { color: var(--accent); font-family: var(--font-mono); }
.schema-section-card span { color: var(--text-muted); font-size: .82rem; }

/* ---- Badges (parity with webapp accent-soft idiom) ---- */
.badge {
  display: inline-block;
  padding: .15em .55em;
  border-radius: var(--radius-pill);
  font-size: .78rem;
  font-weight: 600;
  font-family: var(--font-mono);
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(136, 192, 208, 0.18);
  letter-spacing: 0.03em;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}
.badge-frost  { background: var(--accent-soft);  color: var(--accent); }
.badge-blue   { background: var(--info-soft);    color: var(--info); }
.badge-green  { background: var(--success-soft); color: var(--success); }
.badge-red    { background: var(--error-soft);   color: var(--error); }
.badge-yellow { background: var(--warning-soft); color: var(--warning); }
.badge-purple { background: var(--purple-badge-bg);  color: var(--purple); }

/* ---- Callouts ---- */
blockquote,
.callout {
  border-left: 4px solid var(--accent);
  background: var(--bg-secondary);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm), var(--shadow-inset);
}
blockquote {
  color: var(--text-secondary);
  background: rgba(136, 192, 208, 0.08);
}
blockquote p:last-child { margin-bottom: 0; }
.callout-warn  { border-left-color: var(--warning); background: var(--warning-soft); }
.callout-error { border-left-color: var(--error);   background: var(--error-soft); }
.callout-ok    { border-left-color: var(--success); background: var(--success-soft); }
.callout-info  { border-left-color: var(--info);    background: var(--info-soft); }
.callout > strong:first-child { display: block; margin-bottom: .25rem; }
.callout > :last-child { margin-bottom: 0; }
.callout > p, .callout > ul { margin-top: 0; margin-bottom: .6rem; }

/* ---- CI Badges ---- */
.ci-badges {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: 1rem;
}
.ci-badges a:not(.btn) { line-height: 0; }
.ci-badges .btn { line-height: 1.2; }
.ci-badges img { height: 20px; }

/* ---- Hero ---- */
.doc-hero {
  position: relative;
  margin: 0 0 2.25rem;
  padding: 0 0 1.75rem;
  border-bottom: 1px solid var(--border-strong);
}
.doc-hero::before {
  /* The site's stave motif, faint, behind the heading. */
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -.5rem;
  height: 49px;
  background: repeating-linear-gradient(180deg, rgba(136, 192, 208, 0.10) 0 1px, transparent 1px 12px);
  -webkit-mask-image: linear-gradient(90deg, #000, transparent 70%);
  mask-image: linear-gradient(90deg, #000, transparent 70%);
  pointer-events: none;
}
.doc-hero > * { position: relative; }
.doc-hero h1 { margin-top: 0; }
.hero-tagline {
  font-size: 1.2rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}
.hero-callouts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .75rem;
  margin: 1rem 0 0;
}
.hero-callout {
  padding: .1rem 0 .1rem .95rem;
  border-left: 2px solid var(--accent-dim);
}
.hero-callout strong {
  display: block;
  color: var(--text-primary);
  margin-bottom: .22rem;
}
.hero-callout span {
  color: var(--text-secondary);
  font-size: .93rem;
  line-height: 1.45;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  margin: 1rem 0 0;
}

.section-kicker {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  margin-bottom: 0.35rem;
  text-transform: uppercase;
}
.section-kicker + h2 {
  margin-top: 0;
}

.platform-showcase {
  margin: 2rem 0 2.5rem;
}
.platform-shot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1rem;
  margin-top: 1.25rem;
}
.platform-shot {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--bg-glass);
  box-shadow: var(--shadow-sm), var(--shadow-inset);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: transform var(--transition-slow), border-color var(--transition), box-shadow var(--transition-slow);
}
@media (hover: hover) {
  .platform-shot:hover {
    transform: translateY(-3px);
    border-color: var(--border-glow);
    box-shadow: var(--shadow-lg), 0 0 22px rgba(136, 192, 208, 0.12);
  }
}
.platform-shot--wide {
  grid-column: span 2;
}
.platform-shot img {
  width: 100%;
  /* bd-a630d2: pin a single rendered height across wide, default, and phone
   * platform-shot variants so the screenshots under the hero image read at
   * a consistent visual scale on the GitHub page. Variant rules below keep
   * their object-fit/padding semantics but inherit this height. */
  height: 18rem;
  aspect-ratio: auto;
  object-fit: contain;
  object-position: top center;
  padding: .5rem;
  background: var(--bg-secondary);
}
.platform-shot--wide img {
  height: 18rem;
  aspect-ratio: auto;
  object-fit: cover;
  padding: 0;
}
.platform-shot figcaption {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.85rem 1rem 1rem;
  border-top: 1px solid var(--border);
}
.platform-shot figcaption strong {
  color: var(--text-primary);
}
.platform-shot figcaption span {
  color: var(--text-secondary);
  font-size: 0.86rem;
}

/* ---- Diagrams (inline SVG) ---- */
.phone-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin: 0 0 2.5rem;
}
.phone-strip img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 20px;
  border: 5px solid #1a2030;
  outline: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
}
.phone-strip figcaption {
  grid-column: 1 / -1;
  font-size: .82rem;
  color: var(--text-muted);
}
@media (max-width: 768px) {
  .phone-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.watch-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem;
  margin: -1rem 0 2.5rem;
}
.watch-strip img {
  width: min(28%, 190px);
  height: auto;
  border: 9px solid #1a2030;
  border-radius: 50%;
  outline: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
}
.watch-strip figcaption { flex-basis: 100%; text-align: center; font-size: .82rem; color: var(--text-muted); }

/* Diagrams are pre-rendered SVG from scripts/docs-diagrams; wide ones scroll on phones. */
.diagram {
  margin: 1.5rem 0 1.75rem;
  overflow-x: auto;
  border-radius: var(--radius-lg);
  background: #0b1020;
  border: 1px solid var(--border-strong);
}
.diagram a { display: block; }
.diagram img { display: block; width: 100%; height: auto; min-width: 680px; }
.diagram figcaption {
  position: sticky; left: 0;
  padding: .65rem 1.1rem .75rem;
  border-top: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: .88rem;
  line-height: 1.5;
}
.diagram figcaption strong { color: var(--text-primary); font-weight: 650; margin-right: .35rem; }
.diagram:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }
@media (min-width: 900px) {
  .content .diagram { margin-left: -1.5rem; margin-right: -1.5rem; }
}
@media (min-width: 1440px) {
  .content .diagram { margin-left: -4.5rem; margin-right: -4.5rem; }
}
@media (min-width: 1680px) {
  .content .diagram { margin-left: -6rem; margin-right: -6rem; }
}

/* ---- Worked examples ----
 * One code frame everywhere. Transcripts colour spans inside an ordinary <pre>:
 * .p a command (the "$ " is drawn, not copied), .o output, .c a comment, and
 * .g/.y/.r/.a/.v for success, attention, failure, accent and agent values. */
pre .p { color: #f2f5f9; }
pre .p::before { content: "$ "; color: var(--accent); font-weight: 700; user-select: none; }
pre .o { color: #8d98ad; }
pre .c { color: var(--text-dim); font-style: italic; }
pre .g { color: var(--success); }
pre .y { color: var(--warning); }
pre .r { color: var(--error); }
pre .a { color: var(--accent); }
pre .v { color: var(--purple); }

/* Numbered how-to steps on a rail: <ol class="steps"><li><h3>…</h3>…</li></ol> */
ol.steps {
  list-style: none;
  margin: 1.5rem 0 2.25rem;
  padding: 0;
  counter-reset: step;
}
ol.steps > li {
  position: relative;
  counter-increment: step;
  margin: 0;
  padding: 0 0 1.75rem 3.1rem;
}
ol.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: -.15rem;
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  border: 1px solid var(--accent);
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font: 700 .85rem/1 var(--font-mono);
}
ol.steps > li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: calc(1rem - .5px);
  top: 2.15rem;
  bottom: .35rem;
  width: 1px;
  background: linear-gradient(var(--border-glow), var(--border-strong));
}
ol.steps > li > h3,
ol.steps > li > h4 { margin-top: 0; margin-bottom: .45rem; color: var(--text-primary); }
ol.steps > li > :last-child { margin-bottom: 0; }
@media (max-width: 640px) {
  /* Phones: the number sits beside the step title and the content takes the full width. */
  ol.steps > li { padding-left: 0; }
  ol.steps > li::after { display: none; }
  ol.steps > li::before { width: 1.75rem; height: 1.75rem; top: -.1rem; font-size: .78rem; }
  ol.steps > li > h3,
  ol.steps > li > h4 { padding-left: 2.4rem; min-height: 1.75rem; }
}

/* Identifier anatomy: segments of a structured name with what each part is. */
.anatomy {
  margin: 1.25rem 0 1.75rem;
  padding: 1.1rem 1.25rem 1rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--bg-secondary);
  overflow-x: auto;
}
.anatomy__row {
  display: flex;
  align-items: flex-start;
  gap: .15rem;
  width: max-content;
  font-family: var(--font-mono);
  font-size: 1.12rem;
}
.anatomy__seg {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  padding-top: .1rem;
}
.anatomy__seg > b {
  padding: 0 .1rem .3rem;
  border-bottom: 2px solid var(--seg, var(--accent));
  color: var(--seg, var(--accent));
  font-weight: 600;
}
.anatomy__seg > small {
  font-family: var(--font-sans);
  font-size: .74rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.anatomy__sep { color: var(--text-dim); padding: .1rem .1rem 0; }
.anatomy__row + .anatomy__row { margin-top: 1.25rem; }
.anatomy figcaption { margin-top: .9rem; color: var(--text-secondary); font-size: .88rem; }
.anatomy figcaption code { font-size: .85em; }
.seg-accent { --seg: var(--accent); }
.seg-blue { --seg: var(--nord9); }
.seg-purple { --seg: var(--purple); }
.seg-green { --seg: var(--success); }
.seg-yellow { --seg: var(--warning); }
.seg-orange { --seg: var(--orange); }

/* Diagram colour key: <ul class="key"><li class="k-control">…</li></ul> */
.key {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem 1.25rem;
  list-style: none;
  margin: .5rem 0 1.5rem;
  padding: 0;
  font-size: .84rem;
  color: var(--text-secondary);
}
.key li { display: flex; align-items: center; gap: .45rem; margin: 0; }
.key li::before {
  content: "";
  width: .85rem;
  height: .85rem;
  border-radius: 3px;
  border: 1.5px solid var(--k);
  background: color-mix(in srgb, var(--k) 16%, transparent);
}
.k-control { --k: var(--accent); }
.k-surface { --k: var(--nord9); }
.k-agent { --k: var(--purple); }
.k-work { --k: var(--success); }
.k-trust { --k: var(--warning); }
.k-remote { --k: var(--orange); }
.k-fail { --k: var(--error); }
.k-file { --k: var(--nord3); }

/* Recipe index: number, goal and outcome, and the command that starts it. */
.recipe-index {
  list-style: none;
  margin: 1.5rem 0 2.25rem;
  padding: 0;
  border-top: 1px solid var(--border-strong);
}
.recipe-index li {
  display: grid;
  grid-template-columns: 2.25rem minmax(0, 1fr) minmax(0, 17.5rem);
  column-gap: 1rem;
  align-items: baseline;
  margin: 0;
  padding: .7rem .25rem;
  border-bottom: 1px solid var(--border);
}
.recipe-index li > span { font: 600 .8rem/1.4 var(--font-mono); color: var(--accent); }
.recipe-index li > a { font-weight: 650; color: var(--text-primary); text-decoration: none; }
.recipe-index li > a:hover { color: var(--accent); }
.recipe-index li > p { grid-column: 2; margin: .1rem 0 0; color: var(--text-muted); font-size: .9rem; }
.recipe-index li > code { grid-column: 3; grid-row: 1 / span 2; justify-self: start; align-self: center; white-space: nowrap; }
@media (max-width: 760px) {
  .recipe-index li { grid-template-columns: 2rem minmax(0, 1fr); }
  .recipe-index li > code { grid-column: 2; grid-row: auto; margin-top: .35rem; }
}
pre var { font-style: normal; color: var(--nord13); }

/* ---- On-page contents rail (built by site.js on long pages) ---- */
.doc-toc { display: none; }
@media (min-width: 1280px) {
  /* The rail is fixed and its column is reserved up front, so inserting it
     after load never moves the page. */
  body:not(.landing) .page { padding-right: 15rem; }
  body:not(.landing) .content { margin-inline: auto; }
  .doc-toc {
    display: block;
    position: fixed;
    top: 0;
    right: 0;
    width: 15rem;
    height: 100vh;
    overflow-y: auto;
    padding: 2.9rem 1.5rem 2rem 1rem;
    scrollbar-width: thin;
  }
}
.doc-toc-fab {
  position: fixed;
  right: max(1rem, env(safe-area-inset-right));
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: var(--z-sticky);
  display: flex;
  align-items: center;
  gap: .45rem;
  min-height: 44px;
  padding: .55rem 1rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: rgba(13, 19, 34, 0.94);
  color: var(--text-primary);
  font: 600 .85rem/1 var(--font-sans);
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.doc-toc-fab svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
@media (min-width: 1280px) { .doc-toc-fab { display: none; } }
.doc-toc-sheet {
  width: min(32rem, 100vw);
  max-width: 100vw;
  max-height: 72vh;
  margin: auto auto 0;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-bottom: 0;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  background: #0d1322;
  color: var(--text-secondary);
  box-shadow: var(--shadow-lg);
}
.doc-toc-sheet::backdrop { background: rgba(4, 6, 12, 0.6); }
.doc-toc-sheet .doc-toc {
  display: block;
  position: static;
  width: auto;
  height: auto;
  max-height: none;
  padding: 1.25rem 1.25rem calc(1.25rem + env(safe-area-inset-bottom));
}
.doc-toc-sheet .doc-toc { padding-top: 0; }
.doc-toc-sheet .doc-toc__title {
  position: sticky;
  top: 0;
  z-index: 1;
  margin: 0 -1.25rem .4rem;
  padding: 1.1rem 1.25rem .7rem;
  background: #0d1322;
  border-bottom: 1px solid var(--border);
}
.doc-toc-sheet .doc-toc a { padding-top: .5rem; padding-bottom: .5rem; font-size: .92rem; }
@media (max-width: 1279px) {
  body.has-toc .content { padding-bottom: 6rem; }
}

.doc-toc__title {
  margin: 0 0 .6rem;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.doc-toc a {
  display: block;
  padding: .28rem 0 .28rem .75rem;
  border-left: 1px solid var(--border-strong);
  font-size: .82rem;
  line-height: 1.35;
  color: var(--text-muted);
  text-decoration: none;
}
.doc-toc a:hover { color: var(--text-primary); }
.doc-toc a.doc-toc__sub { padding-left: 1.4rem; font-size: .78rem; }
.doc-toc a[aria-current] {
  color: var(--accent);
  font-weight: 600;
  border-left-color: var(--accent);
}

/* ---- Search trigger + palette (built by site.js) ---- */
.doc-search-trigger {
  display: flex;
  align-items: center;
  gap: .5rem;
  width: calc(100% - 1.3rem);
  margin: 0 .65rem .6rem;
  padding: .45rem .6rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: rgba(13, 19, 34, 0.7);
  color: var(--text-muted);
  font: 500 .85rem/1.2 var(--font-sans);
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
}
.doc-search-trigger:hover { border-color: var(--border-glow); color: var(--text-primary); }
.doc-search-trigger svg {
  width: 15px;
  height: 15px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
}
.doc-search-trigger kbd { margin-left: auto; min-width: 3.2em; font-size: .7rem; }
.doc-search {
  width: min(40rem, calc(100vw - 2rem));
  max-height: min(34rem, calc(100vh - 6rem));
  margin: 12vh auto auto;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: #0d1322;
  color: var(--text-secondary);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.doc-search[open] { display: flex; flex-direction: column; }
.doc-search::backdrop { background: rgba(4, 6, 12, 0.66); backdrop-filter: blur(3px); }
.doc-search__box {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--border-strong);
}
.doc-search__input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text-primary);
  font: 500 1.05rem/1.4 var(--font-sans);
}
.doc-search__input:focus-visible { outline: 0; }
.doc-search__box:focus-within { box-shadow: inset 0 -1px 0 var(--accent); }
.doc-search__input::-webkit-search-cancel-button { display: none; }
.doc-search__list { overflow-y: auto; padding: .4rem; }
.doc-search__item {
  display: block;
  padding: .55rem .7rem;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text-secondary);
}
.doc-search__item[aria-selected="true"] { background: var(--bg-active); color: var(--text-primary); }
.doc-search__row { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.doc-search__main { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.doc-search__snip {
  display: block;
  margin-top: .15rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .82rem;
  color: var(--text-muted);
}
.doc-search__snip mark { background: var(--accent-soft); color: var(--accent); border-radius: 3px; padding: 0 .1em; }
.doc-search__box svg { width: 17px; height: 17px; flex: none; fill: none; stroke: var(--text-muted); stroke-width: 1.6; stroke-linecap: round; }
.doc-search__meta { flex: none; font-size: .78rem; color: var(--text-muted); }
.doc-search__empty,
.doc-search__status { margin: 0; padding: .6rem 1.1rem; font-size: .82rem; color: var(--text-muted); }
.doc-search__status:empty { display: none; }
@media (max-width: 768px) {
  .doc-search-trigger {
    width: auto;
    margin: 0 0 0 .5rem;
    padding: .55rem;
    flex: none;
  }
  .doc-search-trigger span,
  .doc-search-trigger kbd { display: none; }
  .doc-search { margin-top: 1rem; }
  .doc-search__box kbd { display: none; }
}

/* Links into private repositories (marked by site.js). */
a.repo-private::after {
  content: "";
  display: inline-block;
  width: .72em;
  height: .72em;
  margin-left: .25em;
  vertical-align: -.02em;
  background: currentColor;
  opacity: .7;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4.5 7V5a3.5 3.5 0 0 1 7 0v2h.5a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1zm1.5 0h4V5a2 2 0 0 0-4 0z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4.5 7V5a3.5 3.5 0 0 1 7 0v2h.5a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1zm1.5 0h4V5a2 2 0 0 0-4 0z'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* ---- 404 ---- */
.not-found { padding: 3rem 0 1rem; }
.not-found__code {
  margin: 0;
  font-size: clamp(5rem, 14vw, 9rem);
  font-weight: 800;
  line-height: .9;
  letter-spacing: -0.06em;
  background: linear-gradient(120deg, #8fe3d6, #88c0d0 28%, #5e81ac 60%, #b48ead 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.not-found h1::after { display: none; }
main:focus { outline: none; }
.not-found__actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.5rem; }
.not-found__actions .btn { min-height: 2.6rem; padding: .6rem 1rem; font-size: .9rem; }

/* ---- Footer ---- */
.footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: .82rem;
  color: var(--text-muted);
}

.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;
}

/* ---- Focus Visible (a11y) ---- */
pre[data-scroll-focus]:focus-visible,
table[data-scroll-focus]:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}
:focus-visible {
  outline: 2px solid var(--nord8);
  outline-offset: 2px;
  border-radius: 2px;
}
.sidebar nav a:focus-visible {
  outline-offset: -2px;
}

/* ---- Responsive ---- */
/* Tablet: shrink sidebar, tighten content padding. */
@media (max-width: 1024px) {
  .sidebar { width: 220px; min-width: 220px; }
  .content { padding: 2rem 2rem 3rem; }
  .hero-callouts { grid-template-columns: 1fr; }
}

/* Mobile: stack sidebar above content, collapse to a horizontal bar of
   section titles + scrollable nav so users do not lose navigation. */
@media (max-width: 768px) {
  .platform-shot--wide { grid-column: span 1; }
  .page { flex-direction: column; }
  .sidebar {
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    width: 100%;
    min-width: 0;
    height: auto;
    max-height: none;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: .85rem 0;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
  }
  .sidebar nav {
    display: flex;
    flex-wrap: nowrap;
    gap: .35rem;
    padding: 0 1rem;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
  }
  /* One compact row: logo mark + scrollable section strip. */
  .sidebar {
    display: flex;
    align-items: center;
    padding: .4rem 0 .4rem .75rem;
  }
  .sidebar .logo {
    padding: 0;
    margin: 0;
    border: 0;
    font-size: 0;
    gap: 0;
  }
  .sidebar .logo::after { display: none; }
  .sidebar nav {
    flex: 1;
    min-width: 0;
    padding: 0 .75rem 0 .5rem;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 .6rem, #000 calc(100% - 1.6rem), transparent);
    mask-image: linear-gradient(90deg, transparent, #000 .6rem, #000 calc(100% - 1.6rem), transparent);
  }
  .sidebar nav a {
    min-height: 44px;
    margin: 0;
    flex: 0 0 auto;
    padding: .45rem .8rem;
    border-left: none;
    border-bottom: 2px solid transparent;
    border-radius: var(--radius);
  }
  .sidebar nav a.active,
  .sidebar nav a[aria-current="page"] {
    border-left: none;
    border-bottom-color: var(--accent);
  }
  .sidebar nav .section-title {
    display: none;
  }
  .hero-actions .btn {
    min-height: 44px;
    padding: 0.75rem 1rem;
  }
  .content { padding: 1.5rem 1.25rem 3rem; max-width: 100%; }
  h1 { font-size: 1.6rem; }
  pre { font-size: .8rem; }
}

/* Small phones: drop section titles and keep only links to save space. */
@media (max-width: 480px) {
  .sidebar nav .section-title { display: none; }
  .content { padding: 1rem .75rem 2rem; }
}

/* ---- Reduced Motion (a11y) ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .platform-shot:hover,
  .card:hover,
  .btn:hover,
  .sidebar nav a:hover {
    transform: none;
  }
}

/* ---- High Contrast / Forced Colors (a11y) ---- */
@media (forced-colors: active) {
  .sidebar { border-right: 1px solid CanvasText; border-bottom-color: CanvasText; }
  .sidebar nav a.active,
  .sidebar nav a[aria-current="page"] {
    color: Highlight;
    border-left-color: Highlight;
    border-bottom-color: Highlight;
  }
  .card, .callout, table, .badge, pre, code, .doc-hero, .platform-shot, .platform-shot figcaption, .diagram svg, .wallpaper-stage, .wallpaper-stage figcaption, .wallpaper-thumb {
    border: 1px solid CanvasText;
    box-shadow: none;
    background: Canvas;
  }
  .wallpaper-thumb:focus-visible,
  .wallpaper-thumb[aria-current="true"] {
    border-color: Highlight;
    color: Highlight;
    outline: 2px solid Highlight;
  }
  .footer { border-top-color: CanvasText; }
}

/* ---- Print ---- */
@media print {
  .sidebar, .skip-link, .doc-toc, .doc-toc-fab, .doc-search { display: none; }
  .page { display: block; }
  .content { max-width: 100%; padding: 0; color: #000; }
  body { background: #fff; color: #000; }
  .content p, .content li, .content td, .content th, .content dd, .content dt,
  .content h1, .content h2, .content h3, .content h4, .content strong, .content em,
  .content figcaption, .content span { color: #000 !important; }
  .content h1::after, .doc-hero::before { display: none; }
  table, th, td { background: #fff !important; box-shadow: none; }
  th { border-bottom: 1px solid #999; }
  td { border-bottom: 1px solid #ddd; }
  .card, .callout, blockquote { background: #fff; box-shadow: none; border-color: #999; }
  pre, code, pre code { background: #f4f4f4; color: #000; border: 1px solid #ccc; }
  pre span { color: #000 !important; }
  pre .p::before, pre var, .recipe-index li > a { color: #000 !important; }
  pre[data-scroll-more] { -webkit-mask-image: none; mask-image: none; }
  ol.steps > li::before { background: #fff; color: #000; border-color: #000; }
  .anatomy { background: #fff; border-color: #999; }
  pre code { border: 0; }
  a { color: #000; text-decoration: underline; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: .85em; }
  h1, h2, h3 { page-break-after: avoid; }
  pre, table { page-break-inside: avoid; }
  .diagram { background: #fff; border-color: #999; overflow: visible; page-break-inside: avoid; }
  .diagram img { min-width: 0; filter: invert(1) hue-rotate(180deg); }
}
