/**
 * tokens.css — this site's own design-token layer.
 *
 * Every component in lab-shared.css (and each page's own <style>) reads
 * `--dd-*` tokens from here, or DRUIDS `--ui-*` semantics directly, instead
 * of hardcoding values. The `--dd-*` names predate DRUIDS: they used to alias
 * Web Awesome, and now alias DRUIDS semantics, so swapping the underlying
 * system means editing this one file.
 *
 * Load order: druids-tokens.css → tokens-dark-hc.css → this file →
 * lab-shared.css. DRUIDS has to come first so its variables exist to alias.
 *
 * Theme: dark is `<html class="theme-dark theme-dark-hc">`, light is no
 * class. DRUIDS redefines its own variables under those classes, and every
 * alias here resolves on <html> itself, so nothing below needs a per-theme
 * override except the logo color.
 */

:root {
  /* --- Surfaces & lines -------------------------------------------------- */
  --dd-surface: var(--ui-background);
  --dd-surface-page: var(--ui-background-secondary);
  --dd-surface-sunken: var(--ui-background-secondary);
  --dd-surface-code: var(--tag-background);
  --dd-color-border: var(--ui-border);
  --dd-color-form-border: var(--form-border);

  /* --- Text -------------------------------------------------------------- */
  --dd-color-text: var(--ui-text);
  --dd-color-muted: var(--ui-text-secondary);
  --dd-color-subtle: var(--ui-text-tertiary);

  /* --- Interaction (blue — never purple) ---------------------------------- */
  --dd-color-primary: var(--ui-interaction-primary);
  --dd-color-primary-fill: var(--ui-interaction-primary);
  --dd-color-primary-contrast: var(--ui-interaction-primary-contrast);
  --dd-color-primary-soft: var(--ui-interaction-secondary);
  --dd-color-on-primary: var(--ui-text-knockout);

  /* --- Brand ------------------------------------------------------------- */
  /* The only literal colors allowed anywhere: the logo mark. Purple is for
     the logo, never for actions. */
  --dd-logo: #632ca6;

  /* --- Type -------------------------------------------------------------- */
  --dd-font: var(--font-family-base);
  --dd-font-mono: var(--font-family-monospace);
  --dd-text-xs: var(--font-size-xs);   /* 11px — eyebrows, badges, tags */
  --dd-text-s: var(--font-size-sm);    /* 12px — mono, secondary UI      */
  --dd-text-m: var(--font-size-md);    /* 13px — body                    */
  --dd-text-l: var(--font-size-lg);    /* 15px — card titles             */
  --dd-text-xl: var(--font-size-xl);   /* 18px — section titles          */
  --dd-text-xxl: var(--font-size-xxl); /* 23px — page H2                 */
  --dd-text-body: var(--font-size-md);
  --dd-measure: 76ch;

  /* --- Density & shape ----------------------------------------------------- */
  --dd-control-height: var(--height-md);    /* 28px */
  --dd-control-height-sm: var(--height-sm); /* 24px */
  --dd-chip-height: var(--height-xs);       /* 20px */
  --dd-radius: var(--border-radius);        /* 4px: controls, tags, pills */
  --dd-radius-lg: var(--border-radius-lg);  /* 8px: cards */
  /* Kept so old rules still resolve; nothing in this system is pill-shaped. */
  --dd-radius-pill: var(--border-radius);

  /* --- Shell geometry ---------------------------------------------------- */
  --dd-rail-width: 72px;
  --dd-header-height: 48px;
  --dd-status-height: 26px;

  /* --- Elevation & motion ------------------------------------------------ */
  /* Borders, not shadows. Kept as names so older rules degrade to nothing. */
  --dd-shadow-s: none;
  --dd-shadow-m: none;
  --dd-ease: cubic-bezier(0.2, 0, 0, 1);
  --dd-speed-fast: 120ms;
  --dd-speed: 200ms;

  /* --- Semantic hue pairs ------------------------------------------------ */
  /* Older components (and the ReactFlow diagram) pick a hue by name. Each
     name now maps onto one of the five DRUIDS status families or the
     interaction / AI colors, so they follow the theme for free. */
  --dd-red-fill: var(--ui-status-danger-soft);
  --dd-red-on: var(--ui-status-danger-contrast);
  --dd-red-border: var(--ui-status-danger);
  --dd-orange-fill: var(--ui-status-warning-soft);
  --dd-orange-on: var(--ui-status-warning-contrast);
  --dd-orange-border: var(--ui-status-warning);
  --dd-yellow-fill: var(--ui-status-warning-soft);
  --dd-yellow-on: var(--ui-status-warning-contrast);
  --dd-yellow-border: var(--ui-status-warning);
  --dd-green-fill: var(--ui-status-success-soft);
  --dd-green-on: var(--ui-status-success-contrast);
  --dd-green-border: var(--ui-status-success);
  --dd-blue-fill: var(--ui-interaction-secondary);
  --dd-blue-on: var(--ui-interaction-primary-contrast);
  --dd-blue-border: var(--ui-interaction-primary);
  --dd-cyan-fill: var(--ui-interaction-secondary);
  --dd-cyan-on: var(--ui-interaction-primary-contrast);
  --dd-cyan-border: var(--ui-interaction-primary);
  --dd-indigo-fill: var(--ui-ai-background-primary);
  --dd-indigo-on: var(--ui-ai-primary);
  --dd-indigo-border: var(--ui-ai-primary);
  --dd-purple-fill: var(--ui-status-in-progress-soft);
  --dd-purple-on: var(--ui-status-in-progress-contrast);
  --dd-purple-border: var(--ui-status-in-progress);
  --dd-pink-fill: var(--ui-status-in-progress-soft);
  --dd-pink-on: var(--ui-status-in-progress-contrast);
  --dd-pink-border: var(--ui-status-in-progress);
  --dd-gray-fill: var(--ui-status-other-soft);
  --dd-gray-on: var(--ui-text-secondary);
  --dd-gray-border: var(--ui-status-other);
}

.theme-dark {
  --dd-logo: #ffffff;
}
