/* grainvm.com — Field Manual
   Paper-first documentation. Logo mineral palette (sand + mint).
   Reading measure, book-like hierarchy, terminal as craft tool.
   No film-grain overlays, no dual-blob SaaS glows. */

:root,
[data-theme="light"] {
  --bg: #f4efe4;
  --bg-elev: #fbf8f1;
  --bg-soft: #ebe4d4;
  --border: #d9d0bc;
  --border-strong: #c4b89e;
  --text: #1a1814;
  --muted: #5a554a;
  --faint: #8a8374;
  --brand: #0d8f64;
  --brand-dim: #0a7351;
  --brand-soft: rgba(13, 143, 100, 0.1);
  --brand-ink: #043528;
  --sand: #a67c2e;
  --sand-dim: #8a6624;
  --sand-soft: rgba(166, 124, 46, 0.12);
  --accent: #a67c2e;
  --danger: #b83a3a;
  --code-bg: #ebe5d6;
  --code-border: #d4cbb5;
  --shadow: 0 1px 0 rgba(26, 24, 20, 0.04), 0 12px 32px rgba(26, 24, 20, 0.06);
  --radius: 4px;
  --radius-lg: 6px;
  --font: "IBM Plex Sans", "Helvetica Neue", system-ui, sans-serif;
  --display: "Newsreader", "Iowan Old Style", "Palatino Linotype", Palatino, serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --measure: 42rem;
  --header-h: 3.5rem;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #121410;
  --bg-elev: #1a1c17;
  --bg-soft: #23261f;
  --border: #32362c;
  --border-strong: #454a3d;
  --text: #ebe6d8;
  --muted: #a39e8e;
  --faint: #6f6a5c;
  --brand: #3ddea8;
  --brand-dim: #2bb890;
  --brand-soft: rgba(61, 222, 168, 0.12);
  --brand-ink: #042018;
  --sand: #d4b06a;
  --sand-dim: #b8954a;
  --sand-soft: rgba(212, 176, 106, 0.12);
  --accent: #d4b06a;
  --danger: #e07070;
  --code-bg: #0e100c;
  --code-border: #2a2e26;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.2), 0 16px 40px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16.5px;
  line-height: 1.65;
  color: var(--text);
  background-color: var(--bg);
  /* Quiet paper field — single soft wash, no multi-blob glows */
  background-image:
    linear-gradient(
      180deg,
      color-mix(in srgb, var(--sand-soft) 55%, transparent) 0,
      transparent 18rem
    );
  background-repeat: no-repeat;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--brand);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.16em;
  transition: color 0.12s ease;
}

a:hover {
  color: var(--sand);
}

a:focus-visible,
button:focus-visible,
.tab:focus-visible,
.theme-toggle:focus-visible,
.search-open:focus-visible,
.demo-ctrl:focus-visible,
.demo-input:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.wrap {
  width: min(1120px, calc(100% - 2rem));
  margin-inline: auto;
}

.muted {
  color: var(--muted);
}

.faint {
  color: var(--faint);
}

/* ── Header ───────────────────────────────────────────── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px) saturate(1.05);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
  text-decoration: none;
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.brand:hover {
  color: var(--text);
}

.brand-logo {
  width: 1.55rem;
  height: 1.55rem;
  display: block;
  border-radius: 3px;
}

.brand-name {
  font-size: 1.2rem;
  font-optical-sizing: auto;
}

.nav-main {
  display: none;
  gap: 0.15rem 0.15rem;
  margin-left: 0.25rem;
  align-items: center;
}

.nav-main a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.35rem 0.55rem;
  border-radius: var(--radius);
}

.nav-main a:hover {
  color: var(--text);
  background: var(--bg-soft);
}

.nav-main a[aria-current="page"] {
  color: var(--text);
  background: var(--bg-soft);
}

.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.theme-toggle {
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text);
  border-radius: var(--radius);
  width: 2.2rem;
  height: 2.2rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 0.95rem;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.theme-toggle:hover {
  border-color: var(--border-strong);
  background: var(--bg-soft);
}

[data-theme="dark"] .theme-icon-sun,
[data-theme="light"] .theme-icon-moon,
:root:not([data-theme]) .theme-icon-moon {
  display: none;
}

/* When no data-theme and prefers dark, show sun (to switch to light) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .theme-icon-sun {
    display: none;
  }
  :root:not([data-theme]) .theme-icon-moon {
    display: inline;
  }
}

/* ── Buttons ──────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border-radius: var(--radius);
  padding: 0.6rem 1.05rem;
  font-weight: 600;
  font-size: 0.9rem;
  font-family: var(--font);
  border: 1px solid transparent;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
  line-height: 1.2;
}

.btn-sm {
  padding: 0.38rem 0.75rem;
  font-size: 0.84rem;
}

.btn-primary {
  background: var(--brand);
  color: var(--brand-ink);
  border-color: color-mix(in srgb, var(--brand) 70%, #000);
}

.btn-primary:hover {
  color: var(--brand-ink);
  background: color-mix(in srgb, var(--brand) 90%, white);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text);
}

.btn-ghost:hover {
  background: var(--bg-soft);
  color: var(--text);
  border-color: var(--border-strong);
}

/* ── Home hero ────────────────────────────────────────── */

.hero {
  padding: 3.5rem 0 2.25rem;
}

.hero-grid {
  display: grid;
  gap: 2.5rem;
  align-items: start;
}

@media (min-width: 900px) {
  .nav-main {
    display: flex;
  }
  .hero-grid {
    grid-template-columns: 1.1fr 0.9fr;
    gap: 3rem;
    align-items: end;
  }
}

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--sand);
  margin: 0 0 1rem;
}

.hero-kicker::before {
  content: "";
  width: 1.25rem;
  height: 1px;
  background: var(--sand);
}

.hero h1 {
  font-family: var(--display);
  font-size: clamp(2.35rem, 5vw, 3.35rem);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.03em;
  margin: 0 0 1rem;
  font-optical-sizing: auto;
  max-width: 14ch;
}

.hero h1 .hero-line2 {
  font-style: italic;
  font-weight: 500;
  color: color-mix(in srgb, var(--text) 55%, var(--brand));
}

.hero-lead {
  font-size: 1.08rem;
  color: var(--muted);
  max-width: 32rem;
  margin: 0 0 1.5rem;
  line-height: 1.7;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-bottom: 1.25rem;
}

.hero-meta {
  font-size: 0.8rem;
  color: var(--faint);
  font-family: var(--mono);
  letter-spacing: -0.01em;
  margin: 0;
  line-height: 1.5;
}

/* ── Install card ─────────────────────────────────────── */

.install-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.install-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-soft);
}

.install-card-head h2 {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 600;
  font-family: var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0.7rem 1rem 0;
}

.tab {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  border-radius: var(--radius);
  padding: 0.32rem 0.7rem;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
}

.tab.active {
  color: var(--text);
  background: var(--bg-soft);
  border-color: var(--border);
}

.panel {
  padding: 0.9rem 1rem 1.1rem;
}

.panel[hidden] {
  display: none !important;
}

.code-block {
  position: relative;
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.6;
  overflow-x: auto;
  color: var(--text);
  margin: 0;
}

.code-block code {
  font: inherit;
  color: inherit;
  background: none;
  padding: 0;
  white-space: inherit;
}

.install-code {
  white-space: pre;
  tab-size: 2;
  font-size: 0.76rem;
  line-height: 1.65;
}

.install-code .line {
  display: block;
  white-space: pre;
}

.code-block .prompt {
  color: var(--brand);
  user-select: none;
  -webkit-user-select: none;
  font-weight: 500;
}

.code-block .faint {
  color: var(--faint);
}

.copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--muted);
  border-radius: var(--radius);
  padding: 0.22rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 600;
  font-family: var(--mono);
  letter-spacing: 0.02em;
  cursor: pointer;
}

.install-card-head .copy-btn {
  position: static;
}

.copy-btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.panel-note {
  margin: 0.7rem 0 0;
  font-size: 0.84rem;
  color: var(--muted);
  line-height: 1.55;
}

/* ── Sections ─────────────────────────────────────────── */

.section {
  padding: 2.75rem 0;
}

.section-rule {
  border-top: 1px solid var(--border);
}

.section-title {
  font-family: var(--display);
  font-size: clamp(1.45rem, 2.4vw, 1.8rem);
  font-weight: 600;
  letter-spacing: -0.025em;
  margin: 0 0 0.4rem;
  font-optical-sizing: auto;
  line-height: 1.2;
}

.section-lead {
  color: var(--muted);
  margin: 0 0 1.5rem;
  max-width: 36rem;
  line-height: 1.7;
}

/* ── Paths (goal-first navigation) ────────────────────── */

.paths {
  display: grid;
  gap: 0.75rem;
}

@media (min-width: 720px) {
  .paths {
    grid-template-columns: repeat(3, 1fr);
  }
}

.path {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.15rem 1.15rem 1.1rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
  min-height: 100%;
}

.path:hover {
  border-color: color-mix(in srgb, var(--brand) 40%, var(--border));
  box-shadow: var(--shadow);
  color: inherit;
}

.path-num {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--sand);
}

.path h3 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}

.path p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
  flex: 1;
}

.path-cmd {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--brand);
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: var(--radius);
  padding: 0.4rem 0.55rem;
  margin: 0;
}

.path-go {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--brand);
  margin-top: 0.15rem;
}

.path:hover .path-go {
  color: var(--sand);
}

/* ── Steps ────────────────────────────────────────────── */

.steps {
  display: grid;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-elev);
}

@media (min-width: 800px) {
  .steps {
    grid-template-columns: repeat(3, 1fr);
  }
}

.step {
  padding: 1.25rem 1.3rem 1.35rem;
  border-bottom: 1px solid var(--border);
}

@media (min-width: 800px) {
  .step {
    border-bottom: 0;
    border-right: 1px solid var(--border);
  }
  .step:last-child {
    border-right: 0;
  }
}

.step:last-child {
  border-bottom: 0;
}

.step-num {
  display: inline-block;
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--brand);
  margin-bottom: 0.55rem;
}

.step h3 {
  margin: 0 0 0.35rem;
  font-size: 1.02rem;
  font-family: var(--display);
  font-weight: 600;
}

.step p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.step code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: 3px;
  padding: 0.05rem 0.3rem;
}

/* ── Command strip ────────────────────────────────────── */

.cmd-strip {
  margin-top: 1.15rem;
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.15rem;
  font-family: var(--mono);
  font-size: 0.84rem;
  line-height: 1.7;
  overflow-x: auto;
}

.cmd-strip .prompt {
  color: var(--brand);
  user-select: none;
  font-weight: 500;
}

/* ── Spec list (features without card spam) ───────────── */

.spec-list {
  display: grid;
  gap: 0;
  border-top: 1px solid var(--border);
  margin: 0;
  padding: 0;
}

@media (min-width: 720px) {
  .spec-list {
    grid-template-columns: 1fr 1fr;
  }
}

.spec-item {
  display: grid;
  grid-template-columns: minmax(7rem, 9.5rem) 1fr;
  gap: 0.75rem 1.25rem;
  padding: 0.95rem 0;
  border-bottom: 1px solid var(--border);
  margin: 0;
}

@media (min-width: 720px) {
  .spec-item:nth-child(odd) {
    padding-right: 1.5rem;
  }
  .spec-item:nth-child(even) {
    padding-left: 1.5rem;
    border-left: 1px solid var(--border);
  }
}

.spec-item dt {
  margin: 0;
  font-family: var(--display);
  font-weight: 600;
  font-size: 0.98rem;
  letter-spacing: -0.01em;
  color: var(--text);
}

.spec-item dd {
  margin: 0;
  color: var(--muted);
  font-size: 0.93rem;
  line-height: 1.55;
}

.spec-item code {
  font-family: var(--mono);
  font-size: 0.86em;
  color: var(--brand);
}

/* ── Workloads ────────────────────────────────────────── */

.section-workloads {
  background: color-mix(in srgb, var(--bg-soft) 65%, var(--bg));
  border-block: 1px solid var(--border);
}

.workloads {
  display: grid;
  gap: 1rem;
}

@media (min-width: 900px) {
  .workloads {
    grid-template-columns: 1fr 1fr;
  }
}

.workload {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.2rem 1.25rem 1.1rem;
  box-shadow: var(--shadow);
}

.workload-label {
  margin: 0 0 0.3rem;
  font-size: 0.7rem;
  font-weight: 600;
  font-family: var(--mono);
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--sand);
}

.workload-head h3 {
  margin: 0;
  font-size: 1.15rem;
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.workload-head h3 code {
  font-size: 0.86em;
  color: var(--brand);
  font-weight: 500;
}

.workload-lead {
  margin: 0;
  color: var(--muted);
  font-size: 0.93rem;
  line-height: 1.55;
}

.workload .code-block {
  flex: 1;
}

.workload-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.copy-btn-inline {
  position: static;
}

/* ── Map (Diátaxis) ───────────────────────────────────── */

.doc-map {
  display: grid;
  gap: 0.75rem;
}

@media (min-width: 800px) {
  .doc-map {
    grid-template-columns: repeat(4, 1fr);
  }
}

.map-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.15rem 1.1rem 1.2rem;
  background: var(--bg-elev);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-height: 100%;
}

.map-card .map-kind {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--faint);
  margin: 0;
}

.map-card h3 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.map-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
  flex: 1;
}

.map-card a {
  font-size: 0.86rem;
  font-weight: 600;
  text-decoration: none;
  margin-top: 0.25rem;
}

.map-card a + a {
  margin-top: 0.15rem;
}

.map-card a:hover {
  text-decoration: underline;
}

/* ── CTA band ─────────────────────────────────────────── */

.cta-band {
  margin: 1rem 0 3rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem 1.6rem;
  background: var(--bg-elev);
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.cta-band::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--sand), var(--brand));
}

.cta-band h2 {
  margin: 0 0 0.25rem;
  font-size: 1.35rem;
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.cta-band p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

/* ── Docs layout ──────────────────────────────────────── */

.docs-shell {
  display: grid;
  gap: 1.25rem;
  padding: 1.5rem 0 3.5rem;
  align-items: start;
}

@media (min-width: 960px) {
  .docs-shell {
    grid-template-columns: 15.5rem minmax(0, 1fr);
    gap: 2.5rem;
  }
}

.docs-sidebar {
  position: sticky;
  top: calc(var(--header-h) + 1rem);
  max-height: calc(100vh - var(--header-h) - 2rem);
  overflow: auto;
  padding: 0.15rem 0 1rem;
  scrollbar-width: thin;
}

/* Mobile: collapsible nav */
.docs-nav-toggle {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text);
  border-radius: var(--radius);
  padding: 0.65rem 0.85rem;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 0.75rem;
}

.docs-nav-toggle-meta {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--faint);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

@media (min-width: 960px) {
  .docs-nav-toggle {
    display: none;
  }
}

.docs-sidebar-inner {
  display: none;
}

.docs-sidebar-inner.is-open {
  display: block;
}

@media (min-width: 960px) {
  .docs-sidebar-inner {
    display: block;
  }
}

.sidebar-group + .sidebar-group {
  margin-top: 1.35rem;
}

.sidebar-group h3 {
  margin: 0 0 0.4rem;
  font-size: 0.68rem;
  font-family: var(--mono);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--faint);
}

.sidebar-group ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar-group a {
  display: block;
  padding: 0.28rem 0.5rem;
  border-radius: var(--radius);
  color: var(--muted);
  text-decoration: none;
  font-size: 0.88rem;
  border-left: 2px solid transparent;
  margin-left: 0;
}

.sidebar-group a:hover {
  color: var(--text);
  background: var(--bg-soft);
}

.sidebar-group a.active,
.sidebar-group a[aria-current="page"] {
  color: var(--text);
  background: var(--brand-soft);
  border-left-color: var(--brand);
  font-weight: 500;
}

/* Open page — not a floating card */
.docs-content {
  min-width: 0;
  max-width: calc(var(--measure) + 4rem);
  padding: 0.25rem 0 1rem;
}

.prose h1 {
  margin: 0 0 0.55rem;
  font-family: var(--display);
  font-size: clamp(1.7rem, 3vw, 2.15rem);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.15;
  font-optical-sizing: auto;
}

.prose .lead {
  color: var(--muted);
  font-size: 1.08rem;
  margin: 0 0 1.75rem;
  line-height: 1.7;
  max-width: var(--measure);
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.prose h2 {
  margin: 2.1rem 0 0.65rem;
  font-family: var(--display);
  font-size: 1.28rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
  scroll-margin-top: calc(var(--header-h) + 1rem);
}

.prose h3 {
  margin: 1.45rem 0 0.45rem;
  font-size: 1.02rem;
  font-weight: 600;
  font-family: var(--font);
  scroll-margin-top: calc(var(--header-h) + 1rem);
}

.prose p,
.prose li {
  color: var(--text);
  max-width: var(--measure);
}

.prose p {
  margin: 0 0 1rem;
}

.prose ul,
.prose ol {
  margin: 0 0 1rem;
  padding-left: 1.2rem;
  max-width: var(--measure);
}

.prose li + li {
  margin-top: 0.28rem;
}

.prose code,
.prose pre {
  font-family: var(--mono);
}

.prose :not(pre) > code {
  font-size: 0.86em;
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: 3px;
  padding: 0.08rem 0.32rem;
}

.prose pre {
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  overflow-x: auto;
  font-size: 0.83rem;
  line-height: 1.55;
  margin: 0 0 1.15rem;
  max-width: 100%;
}

.prose pre code {
  background: none;
  border: 0;
  padding: 0;
  font-size: inherit;
}

.prose table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  margin: 0 0 1.25rem;
  font-size: 0.9rem;
}

.prose th,
.prose td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.65rem;
  text-align: left;
  vertical-align: top;
}

.prose th {
  background: var(--bg-soft);
  font-weight: 600;
  font-size: 0.84rem;
}

.prose blockquote {
  margin: 0 0 1.15rem;
  padding: 0.65rem 1rem;
  border-left: 3px solid var(--sand);
  background: var(--sand-soft);
  color: var(--muted);
  border-radius: 0 var(--radius) var(--radius) 0;
  max-width: var(--measure);
}

.prose hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 1.75rem 0;
  max-width: var(--measure);
}

.prose .callout {
  border: 1px solid var(--border);
  background: var(--bg-soft);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  margin: 0 0 1.15rem;
  max-width: var(--measure);
}

.prose .callout strong {
  color: var(--brand);
}

/* On-this-page (injected) */
.docs-toc {
  margin: 0 0 1.75rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elev);
  max-width: var(--measure);
}

.docs-toc-label {
  margin: 0 0 0.45rem;
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
}

.docs-toc ol {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.88rem;
}

.docs-toc li {
  margin: 0.2rem 0;
  max-width: none;
}

.docs-toc a {
  text-decoration: none;
  color: var(--muted);
}

.docs-toc a:hover {
  color: var(--brand);
}

/* ── Footer ───────────────────────────────────────────── */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 2.5rem 0 1.5rem;
  margin-top: 0.5rem;
  background: color-mix(in srgb, var(--bg-soft) 40%, var(--bg));
}

.footer-inner {
  display: grid;
  gap: 1.75rem;
}

@media (min-width: 800px) {
  .footer-inner {
    grid-template-columns: 1.15fr 2fr;
  }
}

.footer-brand-blurb {
  margin: 0.55rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  max-width: 22rem;
  line-height: 1.55;
}

.footer-cols {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.footer-cols h4 {
  margin: 0 0 0.5rem;
  font-size: 0.68rem;
  font-family: var(--mono);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--faint);
}

.footer-cols a {
  display: block;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  margin-bottom: 0.28rem;
}

.footer-cols a:hover {
  color: var(--text);
}

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  justify-content: space-between;
  margin-top: 1.75rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.84rem;
}

/* ── Search ───────────────────────────────────────────── */

.search-open {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--muted);
  border-radius: var(--radius);
  padding: 0.32rem 0.55rem 0.32rem 0.65rem;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
}

.search-open:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.search-open-label {
  display: none;
}

@media (min-width: 720px) {
  .search-open-label {
    display: inline;
  }
}

.search-kbd {
  font-family: var(--mono);
  font-size: 0.68rem;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.05rem 0.28rem;
  color: var(--faint);
  background: var(--bg-soft);
}

.search-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(20, 18, 14, 0.4);
  backdrop-filter: blur(3px);
}

.search-panel {
  position: fixed;
  z-index: 60;
  left: 50%;
  top: min(16vh, 7rem);
  transform: translateX(-50%);
  width: min(540px, calc(100% - 1.5rem));
}

.search-panel-inner {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.search-input-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border);
}

.search-input-icon {
  color: var(--faint);
  font-size: 1.05rem;
}

.search-input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 1.02rem;
}

.search-results {
  max-height: min(50vh, 22rem);
  overflow: auto;
  padding: 0.35rem;
}

.search-hint,
.search-empty {
  margin: 0;
  padding: 1rem 0.85rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.search-hit {
  display: block;
  padding: 0.65rem 0.8rem;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
}

.search-hit:hover,
.search-hit.active {
  background: var(--bg-soft);
}

.search-section {
  display: block;
  font-size: 0.68rem;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--faint);
  margin-bottom: 0.12rem;
}

.search-hit-title {
  display: block;
  font-weight: 600;
  margin-bottom: 0.12rem;
}

.search-hit-desc {
  display: block;
  font-size: 0.86rem;
  color: var(--muted);
  line-height: 1.4;
}

.search-hit mark {
  background: var(--brand-soft);
  color: inherit;
  border-radius: 2px;
  padding: 0 0.12em;
}

body.search-open {
  overflow: hidden;
}

/* ── Interactive sandbox demo ─────────────────────────── */

.sandbox-demo {
  --term-bg: #0c0e0b;
  --term-bg-elev: #151813;
  --term-bar: #1e221c;
  --term-border: #2c322a;
  --term-text: #e0dccf;
  --term-dim: #7a7668;
  --term-green: #3ddea8;
  --term-cyan: #d4b06a;
  --term-amber: #d4b06a;
  --term-red: #e07070;
  margin: 0 0 1.5rem;
  border: 1px solid var(--term-border);
  border-radius: var(--radius-lg);
  background: var(--term-bg);
  box-shadow: var(--shadow);
  overflow: hidden;
  color: var(--term-text);
}

.demo-chrome {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 38px;
  padding: 0 0.85rem;
  background: var(--term-bar);
  border-bottom: 1px solid #12150f;
  user-select: none;
}

.demo-chrome-dots {
  display: flex;
  gap: 0.35rem;
  flex-shrink: 0;
}

.demo-chrome-dots span {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 999px;
  background: #3a4036;
}

.demo-chrome-dots span:nth-child(1) {
  background: #c45c4a;
}
.demo-chrome-dots span:nth-child(2) {
  background: #c4a04a;
}
.demo-chrome-dots span:nth-child(3) {
  background: #4a9b6a;
}

.demo-scenarios {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.6rem 0.85rem 0;
  background: var(--term-bg-elev);
  border-bottom: 1px solid var(--term-border);
}

.demo-scenario-tab {
  border: 1px solid var(--term-border);
  background: transparent;
  color: var(--term-dim);
  border-radius: var(--radius);
  padding: 0.28rem 0.7rem;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.demo-scenario-tab:hover {
  color: var(--term-text);
  border-color: #4a5244;
}

.demo-scenario-tab.active {
  color: var(--term-green);
  background: rgba(61, 222, 168, 0.1);
  border-color: rgba(61, 222, 168, 0.35);
}

.demo-blurb {
  margin: 0;
  padding: 0.4rem 0.95rem 0.6rem;
  font-size: 0.8rem;
  color: var(--term-dim);
  background: var(--term-bg-elev);
  border-bottom: 1px solid var(--term-border);
  font-family: var(--font);
}

.demo-chrome-title {
  flex: 1;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  color: rgba(224, 220, 207, 0.55);
  text-align: center;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.demo-btn {
  border: 0;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(224, 220, 207, 0.7);
  border-radius: 3px;
  width: 1.7rem;
  height: 1.45rem;
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
}

.demo-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.demo-body {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  min-height: 300px;
}

@media (min-width: 800px) {
  .demo-body {
    grid-template-columns: minmax(0, 1fr) 210px;
  }
}

.demo-sidebar {
  padding: 0.8rem 0.85rem 1rem;
  border-top: 1px solid var(--term-border);
  background: var(--term-bg-elev);
}

@media (min-width: 800px) {
  .demo-sidebar {
    border-top: 0;
    border-left: 1px solid var(--term-border);
  }
}

.demo-sidebar-label {
  margin: 0 0 0.45rem;
  font-family: var(--mono);
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--term-dim);
  font-weight: 600;
}

.demo-steps {
  list-style: none;
  margin: 0 0 0.8rem;
  padding: 0;
}

.demo-steps li {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  padding: 0.32rem 0.25rem;
  border-radius: 3px;
  font-size: 0.78rem;
  line-height: 1.35;
  color: var(--term-dim);
  font-family: var(--mono);
}

.demo-steps li.current {
  background: rgba(61, 222, 168, 0.1);
  color: var(--term-text);
  font-weight: 600;
}

.demo-steps li.done {
  color: rgba(122, 118, 104, 0.9);
}

.demo-steps li.done .demo-step-idx::after {
  content: "✓";
  font-size: 0.62rem;
}

.demo-steps li.done .demo-step-idx {
  font-size: 0;
  color: var(--term-green);
  border-color: rgba(61, 222, 168, 0.4);
}

.demo-step-idx {
  display: inline-grid;
  place-items: center;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 700;
  background: transparent;
  border: 1px solid #3a4036;
  color: var(--term-dim);
  flex-shrink: 0;
  margin-top: 0.05rem;
}

.demo-steps li.current .demo-step-idx {
  background: var(--term-green);
  border-color: transparent;
  color: #042018;
}

.demo-hint {
  margin: 0 0 0.7rem;
  font-size: 0.76rem;
  line-height: 1.45;
  color: #a39e8e;
  min-height: 2.4em;
  font-family: var(--font);
}

.demo-hint a {
  color: var(--term-green);
  font-weight: 600;
}

.demo-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.7rem;
}

.demo-ctrl {
  border-radius: var(--radius);
  padding: 0.32rem 0.7rem;
  font-family: var(--font);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
}

.demo-ctrl-ghost {
  background: transparent;
  border-color: #3a4036;
  color: #a39e8e;
}

.demo-ctrl-ghost:hover {
  color: #fff;
  border-color: #5a6254;
}

.demo-ctrl-primary {
  background: var(--term-green);
  color: #042018;
  border-color: transparent;
}

.demo-ctrl-primary:hover {
  filter: brightness(1.05);
}

.demo-footnote {
  margin: 0;
  font-size: 0.68rem;
  line-height: 1.45;
  color: var(--term-dim);
  font-family: var(--font);
}

.demo-footnote a {
  color: var(--term-cyan);
}

.demo-term-wrap {
  min-width: 0;
  background: var(--term-bg);
  position: relative;
}

.demo-term {
  position: relative;
  z-index: 1;
  min-height: 280px;
  max-height: 380px;
  overflow: auto;
  padding: 0.8rem 1rem 1rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.55;
  outline: none;
  color: var(--term-text);
  scrollbar-width: thin;
  scrollbar-color: #2c322a transparent;
}

.demo-line {
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--term-text);
}

.demo-line.dim {
  color: var(--term-dim);
}

.demo-line.ok {
  color: var(--term-green);
}

.demo-line.warn {
  color: var(--term-amber);
}

.demo-line.out {
  color: var(--term-text);
}

.demo-line.echo {
  color: #c8c2b0;
}

.demo-echo-prompt {
  color: var(--term-green);
  font-weight: 600;
}

.demo-input-line {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.1rem;
  position: relative;
}

.demo-prompt {
  color: var(--term-green);
  font-weight: 600;
  flex-shrink: 0;
  font-family: var(--mono);
}

.demo-prompt.is-guest {
  color: var(--term-cyan);
}

.demo-ghost {
  position: absolute;
  left: 0;
  margin-left: var(--ghost-pad, 1.1rem);
  color: rgba(122, 118, 104, 0.55);
  pointer-events: none;
  font-family: var(--mono);
  white-space: pre;
  overflow: hidden;
}

.demo-input {
  flex: 1;
  border: 0 !important;
  outline: none !important;
  box-shadow: none !important;
  background: transparent !important;
  color: var(--term-text);
  font-family: var(--mono);
  font-size: inherit;
  line-height: inherit;
  min-width: 0;
  padding: 0;
  margin: 0;
  caret-color: var(--term-green);
  -webkit-appearance: none;
  appearance: none;
}

.demo-input:focus {
  outline: none !important;
  box-shadow: none !important;
}

.demo-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.demo-section-head h2 {
  margin: 0;
}

.home-demo {
  padding: 0 0 0.5rem;
  scroll-margin-top: 5.5rem;
}

#demo,
#demo-section,
#install,
#workloads,
#paths {
  scroll-margin-top: 5.5rem;
}

.docs-content .sandbox-demo-embed {
  margin: 0 0 1.5rem;
}

.docs-content .sandbox-demo {
  margin: 0;
}

.docs-content .demo-term {
  max-height: 320px;
  min-height: 240px;
}

/* Rouge syntax (light-friendly defaults) */
.highlight {
  background: transparent;
}

.highlight .c,
.highlight .c1,
.highlight .cm {
  color: var(--faint);
  font-style: italic;
}

.highlight .k,
.highlight .kd,
.highlight .kn {
  color: var(--brand-dim);
  font-weight: 500;
}

[data-theme="dark"] .highlight .k,
[data-theme="dark"] .highlight .kd,
[data-theme="dark"] .highlight .kn {
  color: var(--brand);
}

.highlight .s,
.highlight .s1,
.highlight .s2,
.highlight .dl {
  color: var(--sand-dim);
}

[data-theme="dark"] .highlight .s,
[data-theme="dark"] .highlight .s1,
[data-theme="dark"] .highlight .s2 {
  color: var(--sand);
}

.highlight .mi,
.highlight .mf {
  color: var(--sand);
}

.highlight .nx,
.highlight .nv {
  color: var(--text);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .btn,
  .theme-toggle,
  a,
  .path {
    transition: none;
  }
}
