/*
 * Nodus design tokens.
 *
 * Light is the default. The reader can explicitly choose dark using the
 * shared appearance switch. color-scheme keeps native form controls and
 * scrollbars in the selected theme.
 *
 * The token NAMES are the compatibility surface. Nine stylesheets and ~1,600
 * var() references across docs, console and the investor deck read
 * these, so the names below are held stable and only their values change. That
 * is what lets one file give the whole site a dark theme.
 *
 * The neutrals are neutral. They were warm (the stone ramp) and read editorial;
 * the reference products all sit on a grey with no cast, which is what makes
 * their one saturated colour legible as information rather than as styling.
 *
 * --accent is the ACTION colour and it is the inverted pair: near-white on
 * dark, near-black on light. It is not a hue. --signal is the one saturated
 * colour and it means live, selected, or healthy -- the router's decision, a
 * running workload, a copy that succeeded. Those were the same token until
 * 2026-09-04, which meant "clickable" and "healthy" could not be told apart,
 * and the primary button was wearing the status colour.
 */

:root {
  color-scheme: light;

  /* --- Surfaces (neutral) ----------------------------------------------- */
  --bg: #ffffff;
  --bg-elev: #fafafa;
  --bg-deep: #f2f2f2;
  --surface: #ffffff;
  --surface-2: #f7f7f7;

  /* --- Ink -------------------------------------------------------------- */
  --fg: #0a0a0a;
  --fg-soft: #404040;
  --fg-dim: #666666;
  --fg-faint: #8f8f8f;

  /* --- Lines ------------------------------------------------------------ */
  --line: #ebebeb;
  --line-strong: #d4d4d4;

  /* --- Action (the inverted pair, not a hue) ---------------------------- */
  --accent: #0a0a0a;
  --accent-fg: #ffffff;
  --accent-bg: #f7f7f7;
  --accent-line: #d4d4d4;

  /* --- Signal: live, selected, healthy. The only saturated colour. ------ */
  --signal: #15803d;
  --signal-bg: #f0fdf4;
  --signal-line: #bbf7d0;

  /* --- Semantic state --------------------------------------------------- */
  --ok: #15803d;
  --danger: #b91c1c;

  /* Code keywords need a hue of their own: --accent is now the same value
     as --fg, so a keyword styled with it is invisible against a function. */
  --code-kw: #7c3aed;
  --code-str: #0369a1;
  --code-num: #b45309;

  --focus: #0a0a0a;

  --inverse-bg: #0a0a0a;
  --inverse-fg: #fafafa;

  /* Borders carry the structure here, so shadows stay almost invisible.
     A soft grey drop under every card is the look this is moving away from. */
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.04);
  --shadow: 0 1px 2px rgb(0 0 0 / 0.05);
  --shadow-lg: 0 8px 24px -6px rgb(0 0 0 / 0.10);

  /* --- Type ------------------------------------------------------------- */
  --font-sans: "Inter", "Inter Variable", -apple-system, BlinkMacSystemFont,
    "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", "JetBrains Mono", "Menlo", "Consolas", monospace;
  --font-serif: "Iowan Old Style", "Charter", "Georgia", "Cambria", "Times New Roman", serif;
  --font: var(--font-sans);

  --text-xs: 0.75rem;
  --text-sm: 0.8125rem;
  --text-base: 0.9375rem;
  --text-lg: 1.125rem;
  --text-xl: 1.375rem;
  --text-3xl: clamp(1.875rem, 1.4rem + 1.9vw, 2.5rem);
  --text-4xl: clamp(2.5rem, 1.6rem + 3.8vw, 4rem);

  /* Was `normal`, which made every reference to it a no-op. Interface text
     gets a hair of negative tracking; display type gets a lot, which is most
     of why a large Inter headline reads as drawn rather than as typed. */
  --tracking-tight: -0.011em;
  --tracking-display: -0.04em;

  --leading-tight: 1;

  --weight-medium: 450;
  /* "semibold" is 500 here, which is what both reference products set their
     display headings to. 600 read as heavier than anything on either site. */
  --weight-semibold: 500;

  /* --- Space and shape -------------------------------------------------- */
  --page-inline: clamp(1.25rem, 4vw, 2.5rem);
  --max-prose: 44rem;
  --max-wide: 74rem;

  /* One small radius doing nearly all the work, and a slightly larger one for
     things that hold other things. Four escalating radii read as four levels
     of importance that the content does not actually have. */
  --radius-sm: 4px;
  --radius: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0a0a0a;
    --bg-elev: #111111;
    --bg-deep: #161616;
    --surface: #111111;
    --surface-2: #181818;

    --fg: #ededed;
    --fg-soft: #a1a1a1;
    --fg-dim: #7d7d7d;
    --fg-faint: #565656;

    --line: #242424;
    --line-strong: #343434;

    --accent: #ededed;
    --accent-fg: #0a0a0a;
    --accent-bg: #161616;
    --accent-line: #343434;

    --signal: #4ade80;
    --signal-bg: #0d1a12;
    --signal-line: #1f4d33;

    --ok: #4ade80;
    --danger: #f87171;

    --code-kw: #c4b5fd;
    --code-str: #7dd3fc;
    --code-num: #fdba74;

    --focus: #ededed;

    --inverse-bg: #fafafa;
    --inverse-fg: #0a0a0a;

    /* Dark surfaces separate by border, not by shadow. A drop shadow on a
       #111 card over a #0a0a0a page is invisible at best and muddy at worst. */
    --shadow-sm: none;
    --shadow: none;
    --shadow-lg: 0 16px 40px -12px rgb(0 0 0 / 0.6);
}

/*
 * The investor deck and memo hardcode 37 light-mode hex values across
 * pitch.css. Rather than port a surface that is not part of the product site,
 * those pages opt out of the dark theme entirely and keep the light tokens.
 */
:root:has(body.theme-light),
body.theme-light {
  color-scheme: light;
  --bg: #ecece8;
  --bg-elev: #e3e3de;
  --bg-deep: #d8d8d2;
  --surface: #f3f3ef;
  --surface-2: #e3e3de;
  --fg: #0d0d0c;
  --fg-soft: #2a2a26;
  --fg-dim: #6a6a63;
  --fg-faint: #8e8e85;
  --line: #c8c8c1;
  --line-strong: #8a8a82;
  --focus: #0a0a0a;
  --ok: #1a4d3a;
  --danger: #6b1d1d;
  --inverse-bg: #0d0d0c;
  --inverse-fg: #ecece8;
  --font: var(--font-serif);

  /*
   * These have to be restated, not inherited. This block wins over the dark
   * theme selector, but only for the properties it names -- so when the chosen
   * theme is dark, an unnamed token keeps its DARK value. --accent is near-white
   * in dark, and near-white on this block's #ecece8 page is an invisible
   * button. Anything added to the dark block above belongs here too.
   */
  --accent: #0d0d0c;
  --accent-fg: #ecece8;
  --accent-bg: #e3e3de;
  --accent-line: #8a8a82;
  --signal: #1a4d3a;
  --signal-bg: #e6ece8;
  --signal-line: #a8bdb2;
  --code-kw: #5b21b6;
  --code-str: #075985;
  --code-num: #92400e;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.04);
  --shadow: 0 1px 2px rgb(0 0 0 / 0.05);
  --shadow-lg: 0 8px 24px -6px rgb(0 0 0 / 0.10);
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--fg);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-synthesis-weight: none;
}

body.theme-light {
  font-family: var(--font-serif);
  font-size: 1.0625rem;
}

::selection {
  background: var(--fg);
  color: var(--bg);
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--inverse-bg);
  color: var(--inverse-fg);
  text-decoration: none;
  z-index: 100;
}

.skip:focus {
  left: 0.5rem;
  top: 0.5rem;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  transition: color 120ms ease, text-decoration-color 120ms ease;
}

a:hover {
  text-decoration-color: var(--fg-dim);
}

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