/* Self-hosted, subset @font-face declarations. No font CDN.
   Outfit instanced at 400/500/600/700/900; JetBrains Mono Regular 400.
   woff2 files live in packages/design-system/fonts/ and are regenerated by
   fonts/_source/subset.py. Each app copies them to a served /fonts/ path and
   references this stylesheet (or its own copy of these rules). */

@font-face {
  font-family: "Outfit";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/outfit-regular.woff2") format("woff2");
}
@font-face {
  font-family: "Outfit";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/fonts/outfit-medium.woff2") format("woff2");
}
@font-face {
  font-family: "Outfit";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/outfit-semibold.woff2") format("woff2");
}
@font-face {
  font-family: "Outfit";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/fonts/outfit-bold.woff2") format("woff2");
}
@font-face {
  font-family: "Outfit";
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url("/fonts/outfit-black.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/jetbrains-mono-regular.woff2") format("woff2");
}

/* Theme-agnostic tokens: type scale, spacing, radii, layout.
   Color tokens live in themes/chelis.css and themes/cproof.css and set the
   --c-* custom properties that components reference. */

:root {
  /* type families */
  --font-display: "Outfit", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", monospace;

  /* type scale (16px base) */
  --fs-display: 3.5rem;
  --fs-h1: 2.5rem;
  --fs-h2: 1.875rem;
  --fs-h3: 1.375rem;
  --fs-body: 1rem;
  --fs-small: 0.875rem;
  --fs-mono-label: 0.8125rem;

  --lh-display: 1.15;
  --lh-body: 1.6;

  --tracking-label: 0.08em;

  /* spacing (8px base) */
  --s-1: 8px;
  --s-2: 16px;
  --s-3: 24px;
  --s-4: 32px;
  --s-6: 48px;
  --s-8: 64px;
  --s-12: 96px;

  /* layout */
  --max-width: 1140px;
  --rhythm: 96px;
  --radius: 10px;
  --radius-sm: 6px;
}

@media (max-width: 720px) {
  :root {
    --fs-display: 2.5rem;
    --fs-h1: 2rem;
    --fs-h2: 1.5rem;
    --rhythm: 64px;
  }
}

/* C Proof theme: abyssal, cold, instrument. Light weight discipline (institutional, calm).
   Lower saturation, generous whitespace. Color is punctuation, not decoration.
   Apply via <html data-theme="cproof"> or by importing on the cproof app root. */

[data-theme="cproof"],
:root.theme-cproof {
  --c-bg: #0a1422;
  --c-surface: #121e30;
  --c-text: #e6edf5;
  --c-text-muted: #8595ab;
  --c-primary: #4fb0d9;
  --c-primary-mid: #2e8fbc;
  --c-accent: #3fbf8f;
  --c-verified: #3fbf8f;
  --c-border: #1e2e45;

  /* Product-led editorial field. Dark remains the default; this mid-tone steel
     surface is reserved for deliberate rhythm changes and offset imagery. */
  --c-steel-field: #1d3b52;
  --c-steel-plate: #2b5870;
  --c-steel-text-muted: #a8b6c8;

  /* Contextual paper: evidence, reports, and choices. The primary brand field
     remains dark; paper is not a generic frame around dark product imagery. */
  --c-paper-bg: #eef3f8;
  --c-paper-surface: #ffffff;
  --c-paper-border: #c9d6e4;
  --c-paper-text: #16233a;
  --c-paper-text-muted: #495a73;
  --c-paper-primary: #1a6e9c;
  --c-paper-primary-mid: #14587e;
  --c-paper-accent: #1b7a57;
  --c-paper-verified: #1b7a57;
  --c-paper-break: #b24430;
  --c-paper-sampled: #8a6210;
  --c-paper-qualified: #64722d;

  /* syntax palette (mirrors highlight.cproof in src/palette.ts; keep the two in
     step). Used where code is colored by CSS rather than Shiki: the Sail book. */
  --hl-bg: #0e1a2b;
  --hl-text: #e6edf5;
  --hl-keyword: #4fb0d9;
  --hl-type: #9ccbe3;
  --hl-number: #b7c3f2;
  --hl-string: #a9cfc6;
  --hl-comment: #8595ab;
  --hl-punct: #a8b6c8;

  /* weight discipline: SemiBold display, Medium headings, Regular body */
  --w-wordmark: 600;
  --w-display: 600;
  --w-heading: 500;
  --w-body: 400;

  color-scheme: dark;
}

/* mdBook retains its reading layout; the company owns the visual treatment. */
html[data-theme="cproof"] {
  --mono-font: var(--font-mono);
  --bg: var(--c-bg);
  --fg: var(--c-text);
  --sidebar-bg: var(--c-surface);
  --sidebar-fg: var(--c-text);
  --sidebar-active: var(--c-primary);
  --sidebar-non-existant: var(--c-text-muted);
  --sidebar-spacer: var(--c-border);
  --sidebar-header-border-color: var(--c-border);
  --scrollbar: var(--c-text-muted);
  --icons: var(--c-text-muted);
  --icons-hover: var(--c-primary);
  --links: var(--c-primary);
  --inline-code-color: var(--c-text);
  --quote-bg: var(--c-surface);
  --quote-border: var(--c-border);
  --table-border-color: var(--c-border);
  --table-header-bg: var(--c-surface);
  --table-alternate-bg: var(--c-surface);
  --searchbar-bg: var(--c-surface);
  --searchbar-fg: var(--c-text);
  --searchbar-border-color: var(--c-border);
  --searchbar-shadow-color: transparent;
  --searchresults-header-fg: var(--c-text-muted);
  --searchresults-border-color: var(--c-border);
  --searchresults-li-bg: var(--c-surface);
  --search-mark-bg: var(--c-primary);
  --color-scheme: dark;
  color-scheme: dark;
}

body { font-family: var(--font-display); font-weight: var(--w-body); }
h1, h2, h3, h4 { font-weight: var(--w-heading); }
code, pre, .searchresults .teaser { font-family: var(--font-mono); }
pre { background: var(--hl-bg); border: 1px solid var(--c-border); border-radius: 6px; }
/* JetBrains Mono draws == and -> as ligatures through contextual alternates. */
code, pre, pre * { font-variant-ligatures: no-contextual; }
/* The upstream grammars emit standard highlight.js scopes; recolor them with
   the company code palette on the frame's own ground. */
html[data-theme="cproof"] pre .hljs { background: transparent; color: var(--hl-text); }
html[data-theme="cproof"] .hljs-keyword,
html[data-theme="cproof"] .hljs-selector-tag,
html[data-theme="cproof"] .hljs-meta,
html[data-theme="cproof"] .hljs-built_in { color: var(--hl-keyword); }
html[data-theme="cproof"] .hljs-title,
html[data-theme="cproof"] .hljs-type,
html[data-theme="cproof"] .hljs-class,
html[data-theme="cproof"] .hljs-name,
html[data-theme="cproof"] .hljs-section { color: var(--hl-type); }
html[data-theme="cproof"] .hljs-number,
html[data-theme="cproof"] .hljs-literal,
html[data-theme="cproof"] .hljs-symbol,
html[data-theme="cproof"] .hljs-bullet { color: var(--hl-number); }
html[data-theme="cproof"] .hljs-string,
html[data-theme="cproof"] .hljs-meta-string,
html[data-theme="cproof"] .hljs-regexp { color: var(--hl-string); }
html[data-theme="cproof"] .hljs-comment,
html[data-theme="cproof"] .hljs-quote { color: var(--hl-comment); font-style: italic; }
html[data-theme="cproof"] .hljs-attr,
html[data-theme="cproof"] .hljs-attribute,
html[data-theme="cproof"] .hljs-params,
html[data-theme="cproof"] .hljs-variable,
html[data-theme="cproof"] .hljs-template-variable,
html[data-theme="cproof"] .hljs-subst,
html[data-theme="cproof"] .hljs-function,
html[data-theme="cproof"] .hljs-tag { color: var(--hl-punct); }
html[data-theme="cproof"] .hljs-function .hljs-keyword { color: var(--hl-keyword); }
html[data-theme="cproof"] .hljs-function .hljs-title { color: var(--hl-type); }
html[data-theme="cproof"] .hljs-string .hljs-variable,
html[data-theme="cproof"] .hljs-string .hljs-subst { color: var(--hl-punct); }
/* book.js gives inline code the hljs class too; keep it on the surface. */
html[data-theme="cproof"] :not(pre) > code { background: var(--c-surface); border-radius: 3px; }
.content a { text-underline-offset: 0.18em; }
:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 3px; }
.menu-title { display: flex; align-items: center; justify-content: center; gap: 12px; }
.cproof-docs-brand { display: inline-flex; align-items: center; gap: 8px; color: var(--c-text); font-size: 17px; font-weight: var(--w-wordmark); text-decoration: none; }
.cproof-docs-brand img { width: 24px; height: 24px; }
.cproof-docs-title { padding-left: 12px; border-left: 1px solid var(--c-border); color: var(--c-text-muted); font-size: 16px; }
/* A single corporate theme; keep native elements available to mdBook's code. */
#mdbook-theme-toggle, #mdbook-theme-list { display: none; }
.cproof-noscript-toc { overflow-y: auto; height: 100%; }
@media (max-width: 420px) { .cproof-docs-brand img { display: none; } }
