/* ==========================================================================
   CANARY — documentation design system

   Direction: scientific-report restraint. A serif display face against a
   neutral UI sans, hairline rules instead of shadows, and a single accent.
   Crimson is reserved for one thing only — the zero. Everything is driven by
   tokens, so light and dark are the same page with a different palette.
   ========================================================================== */

:root {
  color-scheme: light;

  /* Surfaces — warm neutrals, not blue-grey */
  --bg-page: #fdfdfc;
  --bg-surface: #ffffff;
  --bg-subtle: #f7f6f4;
  --bg-muted: #efeeeb;
  --bg-inset: #faf9f7;
  --bg-code: #1c1b19;
  --bg-code-header: #141312;

  /* Type */
  --text-heading: #1a1917;
  --text-body: #45433f;
  --text-muted: #6f6c66;
  --text-dim: #94918a;
  --text-inverse: #fdfdfc;
  --text-code: #e8e6e1;

  /* Rules */
  --border-hairline: #e7e5e0;
  --border-subtle: #ddd9d2;
  --border-medium: #c8c3ba;
  --border-strong: #8f8b83;

  /* Accents — one warm, one alarm, one affirm */
  --accent: #7c4a12;
  --accent-soft: #f5ede1;
  --accent-line: #dcc19a;

  --crimson: #9f2c25;
  --crimson-soft: #fbeceb;
  --crimson-line: #e8bcb8;

  --emerald: #2c6444;
  --emerald-soft: #eaf2ec;
  --emerald-line: #b8d3c2;

  --ink: #1a1917;

  /* Type stacks */
  --font-display: 'Newsreader', ui-serif, Georgia, 'Times New Roman', serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'Fira Code', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Metrics */
  --header-height: 60px;
  --sidebar-width: 232px;
  --container-max: 1180px;
  --radius-xs: 3px;
  --radius-sm: 5px;
  --radius-md: 7px;
  --radius-lg: 10px;

  --shadow-sm: 0 1px 2px rgba(26, 25, 23, 0.04);
  --shadow-card: 0 1px 3px rgba(26, 25, 23, 0.05);
  --shadow-pop: 0 8px 28px -12px rgba(26, 25, 23, 0.18);

  --transition-fast: 120ms ease;
  --transition-normal: 200ms ease;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;

    --bg-page: #14130f;
    --bg-surface: #1a1916;
    --bg-subtle: #201f1b;
    --bg-muted: #292722;
    --bg-inset: #1d1c18;
    --bg-code: #0d0c0a;
    --bg-code-header: #131210;

    --text-heading: #f3f1ec;
    --text-body: #c6c2b9;
    --text-muted: #948f85;
    --text-dim: #6e695f;
    --text-inverse: #14130f;
    --text-code: #ddd9d1;

    --border-hairline: #2b2925;
    --border-subtle: #38352f;
    --border-medium: #4b4740;
    --border-strong: #6e695f;

    --accent: #d8a566;
    --accent-soft: #2a2318;
    --accent-line: #5c4a2c;

    --crimson: #e08b83;
    --crimson-soft: #2c1a18;
    --crimson-line: #5e3330;

    --emerald: #86bd9c;
    --emerald-soft: #17221b;
    --emerald-line: #2f4a38;

    --ink: #f3f1ec;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.45);
    --shadow-pop: 0 10px 30px -12px rgba(0, 0, 0, 0.7);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg-page: #14130f;
  --bg-surface: #1a1916;
  --bg-subtle: #201f1b;
  --bg-muted: #292722;
  --bg-inset: #1d1c18;
  --bg-code: #0d0c0a;
  --bg-code-header: #131210;

  --text-heading: #f3f1ec;
  --text-body: #c6c2b9;
  --text-muted: #948f85;
  --text-dim: #6e695f;
  --text-inverse: #14130f;
  --text-code: #ddd9d1;

  --border-hairline: #2b2925;
  --border-subtle: #38352f;
  --border-medium: #4b4740;
  --border-strong: #6e695f;

  --accent: #d8a566;
  --accent-soft: #2a2318;
  --accent-line: #5c4a2c;

  --crimson: #e08b83;
  --crimson-soft: #2c1a18;
  --crimson-line: #5e3330;

  --emerald: #86bd9c;
  --emerald-soft: #17221b;
  --emerald-line: #2f4a38;

  --ink: #f3f1ec;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.45);
  --shadow-pop: 0 10px 30px -12px rgba(0, 0, 0, 0.7);
}

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

html {
  font-family: var(--font-sans);
  background-color: var(--bg-page);
  color: var(--text-body);
  line-height: 1.65;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 16px);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body { min-height: 100vh; background-color: var(--bg-page); }

[hidden] { display: none !important; }

h1, h2, h3, h4, h5, h6 {
  color: var(--text-heading);
  line-height: 1.22;
  letter-spacing: -0.011em;
}

h1, h2 { font-family: var(--font-display); font-weight: 500; }
h3, h4, h5, h6 { font-weight: 600; }

p { font-size: 0.9375rem; line-height: 1.72; }
p + p { margin-top: 0.85rem; }

a { color: var(--text-heading); text-decoration: underline; text-decoration-color: var(--border-medium); text-underline-offset: 2px; transition: text-decoration-color var(--transition-fast); }
a:hover { text-decoration-color: var(--accent); }

code, pre { font-family: var(--font-mono); font-size: 0.855em; }

:where(p, li, td, .feature-desc, .callout-body) > code {
  background-color: var(--bg-muted);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-xs);
  padding: 0.08em 0.34em;
  color: var(--text-heading);
  white-space: nowrap;
}

::selection { background-color: var(--accent-soft); color: var(--text-heading); }

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

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background-color: color-mix(in srgb, var(--bg-page) 88%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--border-hairline);
}

.header-container {
  max-width: var(--container-max);
  height: 100%;
  margin: 0 auto;
  padding: 0 1.75rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

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

.brand-logo { border-radius: var(--radius-xs); object-fit: cover; }

.brand-tag {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 500;
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  padding: 0.05rem 0.3rem;
  letter-spacing: 0;
}

.search-wrapper { position: relative; flex: 1; max-width: 300px; }

.search-input {
  width: 100%;
  height: 32px;
  padding: 0 2rem 0 2rem;
  font-family: inherit;
  font-size: 0.8125rem;
  color: var(--text-body);
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition-fast), background-color var(--transition-fast);
}

.search-input::placeholder { color: var(--text-dim); }
.search-input:focus { outline: none; border-color: var(--border-medium); background-color: var(--bg-surface); }
.search-input:focus + .search-kbd { opacity: 0; }

.search-icon {
  position: absolute;
  left: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  width: 13px;
  height: 13px;
  color: var(--text-dim);
  pointer-events: none;
}

.search-kbd {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--text-dim);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  padding: 0 0.28rem;
  line-height: 1.35;
  pointer-events: none;
  transition: opacity var(--transition-fast);
}

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

.nav-link {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition-fast);
  white-space: nowrap;
}

.nav-link:hover, .nav-link.active { color: var(--text-heading); }

.header-actions { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color var(--transition-fast), background-color var(--transition-fast);
}

.btn-icon:hover { color: var(--text-heading); background-color: var(--bg-subtle); }

.icon-moon { display: none; }
:root[data-theme="dark"] .icon-sun { display: none; }
:root[data-theme="dark"] .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: none; }
  :root:not([data-theme="light"]) .icon-moon { display: block; }
  :root[data-theme="light"] .icon-sun { display: block; }
  :root[data-theme="light"] .icon-moon { display: none; }
}

.btn-github {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  height: 30px;
  padding: 0 0.7rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-heading);
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: border-color var(--transition-fast), background-color var(--transition-fast);
}

.btn-github:hover { border-color: var(--border-medium); background-color: var(--bg-subtle); }
.github-icon { width: 14px; height: 14px; fill: currentColor; }

.mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */
.hero-section {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 4.5rem 1.75rem 3.5rem;
  border-bottom: 1px solid var(--border-hairline);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 3.5rem;
  align-items: start;
}

.hero-text-col { min-width: 0; }

.hero-badge-row { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1.5rem; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-hairline);
  border-radius: 100px;
  padding: 0.18rem 0.6rem;
}

.badge::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background-color: var(--accent);
  flex-shrink: 0;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 4.2vw, 3.05rem);
  font-weight: 400;
  line-height: 1.14;
  letter-spacing: -0.02em;
  color: var(--text-heading);
  margin-bottom: 1.25rem;
  text-wrap: balance;
}

.hero-title .highlight-amber { color: var(--accent); font-style: italic; }
.hero-title .highlight-red { color: var(--crimson); font-style: italic; }

.hero-subtitle {
  font-size: 1.0125rem;
  line-height: 1.68;
  color: var(--text-body);
  max-width: 34rem;
  margin-bottom: 1.9rem;
}

.hero-subtitle em { font-style: italic; color: var(--text-heading); }
.hero-subtitle .stat-amber { color: var(--accent); font-weight: 600; font-variant-numeric: tabular-nums; }
.hero-subtitle .stat-crimson { color: var(--crimson); font-weight: 600; font-variant-numeric: tabular-nums; }

.hero-cta-group { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-bottom: 1.9rem; }

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 1.05rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--bg-page);
  background-color: var(--ink);
  border: 1px solid var(--ink);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.btn-primary:hover { opacity: 0.86; transform: translateY(-1px); }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 1.05rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-heading);
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: border-color var(--transition-fast), background-color var(--transition-fast);
}

.btn-secondary:hover { border-color: var(--border-medium); background-color: var(--bg-subtle); }

.clone-terminal-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background-color: var(--bg-code);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  padding: 0.7rem 0.7rem 0.7rem 0.9rem;
  max-width: 40rem;
  overflow: hidden;
}

.clone-code {
  font-family: var(--font-mono);
  font-size: 0.775rem;
  color: var(--text-code);
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
}

.clone-code::-webkit-scrollbar { display: none; }
.clone-code .cmd-prompt { color: var(--accent); margin-right: 0.6rem; user-select: none; }

.btn-copy-sm {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.28rem 0.55rem;
  font-family: var(--font-sans);
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--text-dim);
  background-color: transparent;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-xs);
  cursor: pointer;
  flex-shrink: 0;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.btn-copy-sm:hover { color: var(--text-heading); border-color: var(--border-strong); }
.clone-terminal-box .btn-copy-sm, .code-block .btn-copy-sm { color: #94918a; border-color: #3a3833; }
.clone-terminal-box .btn-copy-sm:hover, .code-block .btn-copy-sm:hover { color: #f3f1ec; border-color: #5c584f; }
.btn-copy-sm.copied { color: var(--emerald) !important; border-color: var(--emerald) !important; }

/* Spotlight card */
.hero-visual-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.6rem;
  box-shadow: var(--shadow-card);
}

.card-header-tag {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
}

.spotlight-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 500;
  margin-bottom: 1.25rem;
  letter-spacing: -0.012em;
}

.metric-comparison-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin-bottom: 1.25rem; }

.metric-box { padding: 0.9rem; border: 1px solid var(--border-hairline); border-radius: var(--radius-md); background-color: var(--bg-inset); }
.metric-box.success { border-color: var(--accent-line); background-color: var(--accent-soft); }
.metric-box.danger { border-color: var(--crimson-line); background-color: var(--crimson-soft); }

.metric-box-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.metric-number {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.03em;
  margin-bottom: 0.4rem;
  font-variant-numeric: tabular-nums;
}

.metric-number.highlight-amber { color: var(--accent); }
.metric-number.highlight-crimson { color: var(--crimson); }

.metric-box-caption { font-size: 0.7rem; line-height: 1.5; color: var(--text-muted); }

.spread-visual { border-top: 1px solid var(--border-hairline); padding-top: 1.1rem; }

.spread-header {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.spread-header strong { color: var(--text-heading); font-variant-numeric: tabular-nums; }
.spread-header .is-crimson { color: var(--crimson); }
.spread-frac { font-family: var(--font-mono); font-size: 0.6875rem; color: var(--text-dim); }

.spread-bar-track { height: 5px; background-color: var(--bg-muted); border-radius: 100px; overflow: hidden; }

.spread-bar-fill {
  height: 100%;
  width: 66.7%;
  border-radius: 100px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--crimson) 100%);
}

.spread-caption { font-size: 0.75rem; line-height: 1.55; color: var(--text-muted); margin-top: 0.55rem; }
.spread-caption strong { color: var(--text-heading); }

.card-footnote {
  margin-top: 1.1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border-hairline);
  font-size: 0.7rem;
  color: var(--text-dim);
}

.card-footnote code { font-size: 0.9em; color: var(--text-muted); }

/* --------------------------------------------------------------------------
   Docs layout
   -------------------------------------------------------------------------- */
.docs-container {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  gap: 3.5rem;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 3rem 1.75rem 5rem;
  align-items: start;
}

.docs-sidebar { position: sticky; top: calc(var(--header-height) + 2rem); max-height: calc(100vh - var(--header-height) - 4rem); overflow-y: auto; }

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

.sidebar-title {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-dim);
  margin-bottom: 0.6rem;
}

.sidebar-list { list-style: none; border-left: 1px solid var(--border-hairline); }

.sidebar-link {
  display: block;
  padding: 0.28rem 0 0.28rem 0.85rem;
  margin-left: -1px;
  border-left: 1px solid transparent;
  font-size: 0.8125rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.sidebar-link:hover { color: var(--text-heading); }
.sidebar-link.active { color: var(--text-heading); font-weight: 500; border-left-color: var(--accent); }

.docs-content { min-width: 0; max-width: 46rem; }

.search-empty { color: var(--text-muted); font-style: italic; padding: 2rem 0; }

.doc-section { padding-bottom: 3.75rem; margin-bottom: 3.75rem; border-bottom: 1px solid var(--border-hairline); }
.doc-section:last-of-type { border-bottom: none; margin-bottom: 0; }
.doc-section { scroll-margin-top: calc(var(--header-height) + 24px); }

.section-tag {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--accent);
  margin-bottom: 0.6rem;
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.85rem;
  font-weight: 500;
  letter-spacing: -0.019em;
  margin-bottom: 0.9rem;
  text-wrap: balance;
}

.section-intro { font-size: 1rem; line-height: 1.72; color: var(--text-body); margin-bottom: 1.6rem; }

.sub-title { font-size: 1.0625rem; font-weight: 600; margin: 2.25rem 0 0.75rem; letter-spacing: -0.01em; }

.section-close { margin-top: 1.5rem; color: var(--text-body); }

.table-note { font-size: 0.8125rem; color: var(--text-muted); margin-top: 0.7rem; }

.disclosure-line {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-hairline);
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   Callouts
   -------------------------------------------------------------------------- */
.callout {
  display: flex;
  gap: 0.75rem;
  padding: 0.95rem 1.1rem;
  border: 1px solid var(--border-subtle);
  border-left-width: 2px;
  border-radius: var(--radius-sm);
  background-color: var(--bg-inset);
  margin: 1.6rem 0;
}

.callout-icon { width: 16px; height: 16px; flex-shrink: 0; margin-top: 0.16rem; color: var(--text-muted); }
.callout-body { font-size: 0.875rem; line-height: 1.65; color: var(--text-body); }
.callout-body strong { color: var(--text-heading); font-weight: 600; }

.callout-warning { border-left-color: var(--accent); background-color: var(--accent-soft); }
.callout-warning .callout-icon { color: var(--accent); }

.callout-info { border-left-color: var(--emerald); background-color: var(--emerald-soft); }
.callout-info .callout-icon { color: var(--emerald); }

.callout-note { border-left-color: var(--border-strong); }
.callout-note .callout-icon { color: var(--text-muted); }

/* --------------------------------------------------------------------------
   Cards
   -------------------------------------------------------------------------- */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(248px, 1fr)); gap: 1rem; margin: 1.5rem 0; }

.feature-card {
  padding: 1.15rem;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast);
}

.feature-card:hover { border-color: var(--border-subtle); }

.feature-icon-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-sm);
  background-color: var(--bg-subtle);
  color: var(--accent);
  margin-bottom: 0.8rem;
}

.feature-icon-wrapper svg { width: 15px; height: 15px; }

.feature-num {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 0.55rem;
}

.feature-title { font-size: 0.9375rem; font-weight: 600; margin-bottom: 0.45rem; letter-spacing: -0.008em; }
.feature-desc { font-size: 0.8375rem; line-height: 1.62; color: var(--text-muted); }

/* --------------------------------------------------------------------------
   Findings list
   -------------------------------------------------------------------------- */
.finding-list { display: flex; flex-direction: column; gap: 1.75rem; margin: 1.75rem 0; }

.finding { display: grid; grid-template-columns: 2rem minmax(0, 1fr); gap: 1rem; align-items: start; }

.finding-num {
  font-family: var(--font-display);
  font-size: 1.5rem;
  line-height: 1;
  color: var(--accent);
  border-top: 2px solid var(--accent-line);
  padding-top: 0.5rem;
  font-variant-numeric: tabular-nums;
}

.finding-title { font-size: 1.05rem; font-weight: 600; margin-bottom: 0.5rem; letter-spacing: -0.011em; }
.finding-body p { color: var(--text-body); }
.finding-body .table-container { margin: 1rem 0; }

.finding-kicker {
  margin-top: 0.85rem;
  padding-left: 0.9rem;
  border-left: 2px solid var(--border-subtle);
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   Split panels — the negative result
   -------------------------------------------------------------------------- */
.split-panels { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 1.75rem 0; }

.split-panel {
  display: flex;
  flex-direction: column;
  padding: 1.25rem;
  border: 1px solid var(--border-hairline);
  border-top-width: 2px;
  border-radius: var(--radius-md);
  background-color: var(--bg-surface);
}

.split-panel.is-negative { border-top-color: var(--crimson); }
.split-panel.is-positive { border-top-color: var(--emerald); }

.split-panel-label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 0.7rem;
  min-height: 2.2em;
}

.split-panel p { font-size: 0.8625rem; line-height: 1.65; color: var(--text-muted); }
.split-panel-result { color: var(--text-body) !important; }
.split-panel-result strong { color: var(--text-heading); }

.split-panel-note {
  font-size: 0.8rem !important;
  padding-top: 0.7rem;
  margin-top: auto;
  border-top: 1px solid var(--border-hairline);
}

/* Pinned to the bottom so both panels' closing notes sit on one line. */

/* --------------------------------------------------------------------------
   Pull quote
   -------------------------------------------------------------------------- */
.pull-quote {
  margin: 2rem 0 0;
  padding: 1.25rem 0 1.25rem 1.5rem;
  border-left: 2px solid var(--accent);
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 400;
  font-style: italic;
  line-height: 1.45;
  color: var(--text-heading);
  letter-spacing: -0.012em;
}

.pull-quote cite {
  display: block;
  margin-top: 0.7rem;
  font-family: var(--font-sans);
  font-size: 0.8375rem;
  font-style: normal;
  font-weight: 400;
  line-height: 1.6;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */
.table-container {
  overflow-x: auto;
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  margin: 1.5rem 0;
  background-color: var(--bg-surface);
}

.data-table { width: 100%; border-collapse: collapse; font-size: 0.8375rem; }

.data-table th {
  text-align: left;
  padding: 0.6rem 0.9rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  background-color: var(--bg-subtle);
  border-bottom: 1px solid var(--border-hairline);
  white-space: nowrap;
}

.data-table td { padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--border-hairline); color: var(--text-body); vertical-align: top; }
.data-table td strong { color: var(--text-heading); font-weight: 600; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background-color: var(--bg-inset); }
.data-table .highlight-row td { background-color: var(--accent-soft); }
.data-table .highlight-row:hover td { background-color: var(--accent-soft); }

.table-compact td, .table-compact th { padding: 0.5rem 0.9rem; font-variant-numeric: tabular-nums; }

.pill-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  white-space: nowrap;
}

.pill-red { color: var(--crimson); background-color: var(--crimson-soft); border-color: var(--crimson-line); }
.pill-green { color: var(--emerald); background-color: var(--emerald-soft); border-color: var(--emerald-line); }
.pill-amber { color: var(--accent); background-color: var(--accent-soft); border-color: var(--accent-line); }
.pill-slate { color: var(--text-muted); background-color: var(--bg-muted); }

/* --------------------------------------------------------------------------
   Limits list
   -------------------------------------------------------------------------- */
.limits-list { list-style: none; margin: 1.5rem 0 0; display: flex; flex-direction: column; gap: 0.9rem; }

.limits-list li {
  position: relative;
  padding-left: 1.15rem;
  font-size: 0.9rem;
  line-height: 1.68;
  color: var(--text-body);
}

.limits-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.66em;
  width: 5px;
  height: 1px;
  background-color: var(--accent);
}

.limits-list strong { color: var(--text-heading); font-weight: 600; }

/* --------------------------------------------------------------------------
   Code blocks
   -------------------------------------------------------------------------- */
.code-block { border-radius: var(--radius-md); overflow: hidden; margin: 1.1rem 0; border: 1px solid var(--border-hairline); background-color: var(--bg-code); }

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0.7rem 0.5rem 0.9rem;
  background-color: var(--bg-code-header);
  border-bottom: 1px solid #2b2925;
}

.code-title { font-family: var(--font-mono); font-size: 0.6875rem; color: #948f85; letter-spacing: 0.02em; }

.code-content { padding: 0.9rem; overflow-x: auto; }
.code-content pre { margin: 0; }
.code-content code { font-size: 0.775rem; line-height: 1.65; color: var(--text-code); white-space: pre; }

/* --------------------------------------------------------------------------
   Case inspector
   -------------------------------------------------------------------------- */
.case-visualizer {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background-color: var(--bg-surface);
  padding: 1.25rem;
  margin-top: 1.5rem;
}

.case-nav-tabs {
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
  padding-bottom: 0.9rem;
  margin-bottom: 1.1rem;
  border-bottom: 1px solid var(--border-hairline);
  scrollbar-width: thin;
}

.case-tab {
  flex-shrink: 0;
  padding: 0.35rem 0.7rem;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  background-color: transparent;
  border: 1px solid var(--border-hairline);
  border-radius: 100px;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.case-tab:hover { color: var(--text-heading); border-color: var(--border-medium); }
.case-tab.active { color: var(--bg-page); background-color: var(--ink); border-color: var(--ink); }

.case-header { margin-bottom: 1rem; }
.case-title { font-family: var(--font-display); font-size: 1.15rem; font-weight: 500; margin-bottom: 0.2rem; letter-spacing: -0.012em; }
.case-meta { font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-dim); }

.case-context { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1.1rem; }

.case-context-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 0.3rem;
}

/* Long test node ids (tests/x.py::Class::test) have no break opportunity and
   would otherwise set a min-content width wider than a phone. */
.case-context-item { min-width: 0; }
.case-context-item p { font-size: 0.8125rem; line-height: 1.62; color: var(--text-muted); overflow-wrap: anywhere; }

.case-body { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }

.case-panel { border: 1px solid var(--border-hairline); border-radius: var(--radius-md); overflow: hidden; background-color: var(--bg-code); }

.case-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-height: 34px;
  padding: 0.45rem 0.7rem;
  background-color: var(--bg-code-header);
  border-bottom: 1px solid #2b2925;
  font-size: 0.6875rem;
  font-weight: 500;
  color: #948f85;
}

.case-panel-header .pill-tag { background-color: transparent; border-color: #3a3833; color: #6e695f; }

.case-panel-content { padding: 0.8rem; overflow-x: auto; max-height: 340px; overflow-y: auto; }
.case-panel-content pre { margin: 0; }
.case-panel-content code { font-size: 0.7rem; line-height: 1.6; color: var(--text-code); white-space: pre; }

.case-footer { margin-top: 1rem; padding-top: 0.9rem; border-top: 1px solid var(--border-hairline); }

.case-verdict { display: flex; align-items: baseline; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 0.5rem; }

.case-verdict-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}

.case-verdict-value { font-family: var(--font-mono); font-size: 0.8125rem; font-weight: 500; }
.case-verdict-value.is-red { color: var(--crimson); }
.case-verdict-value.is-amber { color: var(--accent); }
.case-verdict-value.is-green { color: var(--emerald); }

.case-lesson { font-size: 0.8625rem; line-height: 1.65; color: var(--text-body); }
/* The longest trajectory filename (baseline__protego_redos__canary.md) has no
   break opportunity and overflows a phone viewport without this. */
.case-source { margin-top: 0.7rem; font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-dim); overflow-wrap: anywhere; }
.case-source a { color: var(--text-muted); overflow-wrap: anywhere; }

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.site-footer { border-top: 1px solid var(--border-hairline); background-color: var(--bg-subtle); }

.footer-container { max-width: var(--container-max); margin: 0 auto; padding: 3rem 1.75rem 2rem; }

.footer-top { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 3rem; padding-bottom: 2.25rem; }

.footer-brand-row { display: flex; align-items: center; gap: 0.55rem; margin-bottom: 0.6rem; }
.footer-brand-row strong { font-family: var(--font-display); font-size: 1.0625rem; font-weight: 600; color: var(--text-heading); }
.footer-logo { border-radius: var(--radius-xs); object-fit: cover; }

.footer-desc { font-size: 0.8375rem; line-height: 1.65; color: var(--text-muted); max-width: 30rem; }

.footer-links-group { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }

.footer-col-title {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-bottom: 0.7rem;
}

.footer-links { list-style: none; display: flex; flex-direction: column; gap: 0.42rem; }

.footer-link { font-size: 0.8125rem; color: var(--text-muted); text-decoration: none; transition: color var(--transition-fast); }
.footer-link:hover { color: var(--text-heading); }

.footer-bottom {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-hairline);
  font-size: 0.775rem;
  color: var(--text-dim);
}

.footer-bottom a { color: var(--text-muted); }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1080px) {
  /* minmax(0, 1fr), not 1fr: the nowrap clone command sets a wide min-content
     size and would otherwise stretch the column past the viewport. */
  .hero-grid { grid-template-columns: minmax(0, 1fr); gap: 2.5rem; }
  .hero-subtitle { max-width: none; }
  .docs-container { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .docs-sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    width: 260px;
    max-height: none;
    padding: 1.5rem;
    background-color: var(--bg-page);
    border-right: 1px solid var(--border-hairline);
    transform: translateX(-100%);
    transition: transform var(--transition-normal);
    z-index: 90;
    overflow-y: auto;
  }
  .docs-sidebar.mobile-open { transform: translateX(0); box-shadow: var(--shadow-pop); }
  .docs-content { max-width: none; }
  .header-nav { display: none; }
  .mobile-menu-btn { display: inline-flex; }
}

@media (max-width: 820px) {
  .case-body, .case-context, .split-panels, .metric-comparison-grid { grid-template-columns: minmax(0, 1fr); }
  .footer-top { grid-template-columns: minmax(0, 1fr); gap: 2rem; }
}

@media (max-width: 640px) {
  .header-container, .hero-section, .docs-container, .footer-container { padding-left: 1.1rem; padding-right: 1.1rem; }
  .search-wrapper { display: none; }
  .hero-section { padding-top: 3rem; }
  .finding { grid-template-columns: 1fr; gap: 0.5rem; }
  .finding-num { border-top: none; padding-top: 0; }
  .footer-links-group { grid-template-columns: 1fr; gap: 1.5rem; }
  .btn-github span { display: none; }
}

/* --------------------------------------------------------------------------
   Motion & print
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

@media print {
  .site-header, .docs-sidebar, .hero-cta-group, .clone-terminal-box, .btn-copy-sm, .case-nav-tabs { display: none !important; }
  .docs-container { grid-template-columns: 1fr; }
  .doc-section { break-inside: avoid; border-bottom: 1px solid #ddd; }
  a::after { content: " (" attr(href) ")"; font-size: 0.7em; color: #666; }
  .code-block, .case-panel { background: #fff !important; border: 1px solid #ccc; }
  .code-content code, .case-panel-content code { color: #000 !important; }
}
