/*
 * tokens.css — ToroBio web design system (issue #4, Phase 0).
 *
 * Single source of truth for color, spacing, radius, typography and status
 * colors. Everything downstream (components.css, templates, later the
 * nest-ble-desktop back-port) references these variables, never raw hex.
 *
 * Light theme is authored on :root. The structure is dark-ready: a future
 * `:root[data-theme="dark"]` block overrides the same semantic tokens without
 * touching component CSS.
 */

:root {
  /* ---- Palette (raw ramps — reference via semantic tokens below) ---- */
  --c-blue-50:  #eef4ff;
  --c-blue-100: #dbe7ff;
  --c-blue-500: #2563eb;
  --c-blue-600: #1d4fd7;
  --c-blue-700: #1a44b8;

  --c-green-100: #dcfce7;
  --c-green-500: #22c55e;
  --c-green-600: #16a34a;

  --c-amber-100: #fef3c7;
  --c-amber-500: #f59e0b;
  --c-amber-600: #d97706;

  /* The one hue the four original states left free. `blocked` needs its own,
   * not a shade: amber-500 and amber-600 are one step apart and read as the
   * same dot at 10px, which put "paused" and "refused to run" in the same
   * colour — the exact distinction the fleet page exists to draw. */
  --c-violet-100: #ede9fe;
  --c-violet-400: #a78bfa;
  --c-violet-500: #7c3aed;

  --c-red-100: #fee2e2;
  --c-red-500: #dc2626;
  --c-red-600: #b91c1c;

  --c-gray-50:  #f4f5f7;
  --c-gray-100: #eceef1;
  --c-gray-200: #e5e7eb;
  --c-gray-300: #d1d5db;
  --c-gray-400: #9ca3af;
  --c-gray-500: #6b7280;
  --c-gray-600: #4b5563;
  --c-gray-700: #374151;
  --c-gray-900: #111827;
  --c-white:    #ffffff;

  /* ---- Semantic surfaces & text ---- */
  --surface-page:    var(--c-gray-50);
  --surface-card:    var(--c-white);
  --surface-sunken:  var(--c-gray-100);
  --surface-nav:     var(--c-white);

  --text-strong:  var(--c-gray-900);
  --text-body:    var(--c-gray-700);
  --text-muted:   var(--c-gray-500);
  --text-faint:   var(--c-gray-400);
  --text-onbrand: var(--c-white);

  --border:       var(--c-gray-200);
  --border-strong:var(--c-gray-300);

  /* ---- Brand ---- */
  --brand:        var(--c-blue-500);
  --brand-strong: var(--c-blue-600);
  --brand-soft:   var(--c-blue-50);
  --brand-ring:   rgba(37, 99, 235, 0.35);

  /* ---- Run-state status colors (running/paused/error/disconnected) ---- */
  --status-running:      var(--c-green-500);
  --status-running-soft: var(--c-green-100);
  --status-paused:       var(--c-amber-500);
  --status-paused-soft:  var(--c-amber-100);
  --status-error:        var(--c-red-500);
  --status-error-soft:   var(--c-red-100);
  /* `blocked`: asked to run, deliberately did not — the container-tag gate
   * refused it. Its own hue rather than a shade of paused: not red, because
   * nothing is faulty and a red fleet page trains operators to ignore red; not
   * amber, because that is idle, and a nest that refused a run is the opposite
   * of idle. Violet is unclaimed by the other four states, so a blocked nest is
   * findable in a wall of tiles at a glance. */
  --status-blocked:      var(--c-violet-500);
  --status-blocked-soft: var(--c-violet-100);
  --status-disconnected: var(--c-gray-400);
  --status-disconnected-soft: var(--c-gray-200);

  /* ---- Spacing scale (4px base) ---- */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;

  /* ---- Radius ---- */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-pill: 999px;

  /* ---- Elevation ---- */
  --shadow-sm: 0 1px 2px rgba(17, 24, 39, 0.06);
  --shadow-md: 0 1px 3px rgba(17, 24, 39, 0.08), 0 1px 2px rgba(17, 24, 39, 0.04);
  --shadow-lg: 0 4px 16px rgba(17, 24, 39, 0.10);

  /* ---- Typography ---- */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, "Inter", sans-serif;
  --font-mono: "SF Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --fs-xs: 11px;
  --fs-sm: 13px;
  --fs-md: 14px;
  --fs-lg: 16px;
  --fs-xl: 20px;
  --fs-2xl: 26px;
  --fs-3xl: 32px;

  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;

  /* ---- Layout ---- */
  --nav-rail-w: 84px;
  --content-max: 1360px;
  --z-nav: 40;
  --z-toast: 90;
}

/* Dark theme scaffold — not the focus of Phase 0 (mockups are light), but the
 * seam exists so Phase 6 can flip it on without editing components. */
:root[data-theme="dark"] {
  --surface-page:   #0f1420;
  --surface-card:   #171d2b;
  --surface-sunken: #10151f;
  --surface-nav:    #131926;

  --text-strong: #f3f4f6;
  --text-body:   #d1d5db;
  --text-muted:  #9ca3af;
  --text-faint:  #6b7280;

  --border:        #263042;
  --border-strong: #33405a;
  --brand-soft:    rgba(37, 99, 235, 0.16);
  /* The one status hue that needs lifting on a dark ground. violet-500 is
   * ~2.7:1 on --surface-card, and the container band renders it as TEXT, not
   * just a dot — measured side by side it read visibly dimmer than the green
   * band next to it. The other four states keep their single value. */
  --status-blocked: var(--c-violet-400);
}
