/* ============================================================================
   Water Exposure editor — design tokens.
   Light is the default (:root). Dark is a full override under
   [data-theme="dark"] and prefers-color-scheme, unless [data-theme="light"]
   pins it. See docs/UX-PLAN.md §3.1.  Aesthetic reference: lucide.dev.
   ========================================================================== */

:root {
  /* --- neutrals (light) --- */
  --c-bg-0: #ffffff;
  --c-bg-1: #fafafa;
  --c-bg-2: #f4f4f5;
  --c-bg-3: #ececee;
  --c-line: #e4e4e7;
  --c-line-2: #d4d4d8;
  --c-scrim: rgba(9, 9, 11, 0.45);

  /* --- central work-area backdrop ---
     Light mode trades the near-black "stage" for a calm pastel so the centre
     column stops reading as a high-contrast slab; dark mode keeps the
     near-black. Every canvas / viewport / node-graph backdrop resolves
     through these, so the tone stays in one place. */
  --c-canvas: #e9e9f0;
  --c-canvas-checker: #e1e1ea;
  --c-canvas-ink: #9aa0ab;
  --c-canvas-grid: rgba(9, 9, 11, 0.09);
  --c-graph-dot: rgba(9, 9, 11, 0.08);
  --c-graph-edge: rgba(9, 9, 11, 0.28);

  /* --- text (light) --- */
  --c-text: #18181b;
  --c-text-mid: #52525b;
  --c-text-low: #a1a1aa;
  --c-text-dis: #c4c4c8;

  /* --- semantic (shared; dark only nudges brightness) --- */
  --c-accent: #f97316;
  --c-accent-hover: #fb8c3c;
  --c-accent-press: #ea580c;
  --c-accent-bg: rgba(249, 115, 22, 0.12);
  --c-accent-text: #ffffff;
  --c-solid: #18181b;
  --c-solid-hover: #27272a;
  --c-solid-text: #fafafa;
  --c-warn: #f59e0b;
  --c-warn-bg: rgba(245, 158, 11, 0.14);
  --c-danger: #ef4444;
  --c-danger-hover: #f26363;
  --c-danger-bg: rgba(239, 68, 68, 0.12);
  --c-success: #22c55e;
  --c-success-bg: rgba(34, 197, 94, 0.12);
  --c-info: #6366f1;

  /* --- node graph card (light) --- */
  --c-node-bg: #ffffff;
  --c-node-border: var(--c-line-2);
  --c-node-shadow: rgba(9, 9, 11, 0.16);
  --c-node-text: #3f434a;
  --c-node-head-bg: var(--c-bg-2);
  --c-node-title: var(--c-text);
  --c-node-field-bg: #fafafa;
  --c-node-field-border: var(--c-line-2);
  --c-node-field-text: var(--c-text);
  --c-node-sub: #6b7280;
  --c-node-out-label: #52525b;
  --c-node-port-unlinked-border: #b8bcc4;
  --c-node-minimap-bg: rgba(255, 255, 255, 0.85);
  --c-node-minimap-border: var(--c-line-2);
  --c-node-group-border: var(--c-line-2);
  --c-node-group-bg: rgba(9, 9, 11, 0.035);
  --c-node-act-hover-bg: rgba(9, 9, 11, 0.06);

  /* --- node type accent "tones" (light) — darkened/saturated vs. the dark-mode
     pastels below so 9px uppercase labels stay readable on a white card. --- */
  --c-tone-blue: #2563eb;
  --c-tone-gray: #57606c;
  --c-tone-orange: #c2410c;
  --c-tone-violet: #7c3aed;
  --c-tone-cyan: #0e7490;
  --c-tone-amber: #b45309;
  --c-tone-purple: #6d28d9;
  --c-tone-tan: #a15c07;
  --c-tone-pink: #a21caf;
  --c-tone-green: #047857;

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

  --fz-micro: 11px;
  --fz-sm: 12px;
  --fz-base: 13px;
  --fz-md: 14px;
  --fz-title: 15px;
  --fz-head: 19px;

  --fw-normal: 400;
  --fw-medium: 500;
  --fw-semi: 600;

  --lh-tight: 1.3;
  --lh-normal: 1.55;

  /* --- space (snap everything to this) --- */
  --s-1: 2px;
  --s-2: 4px;
  --s-3: 8px;
  --s-4: 12px;
  --s-5: 16px;
  --s-6: 24px;
  --s-7: 32px;
  --s-8: 48px;

  /* --- radius (lucide-rounded) --- */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-full: 999px;

  /* --- elevation (soft; border always present) --- */
  --e-0: none;
  --e-1: 0 1px 2px rgba(9, 9, 11, 0.06);
  --e-2: 0 4px 12px rgba(9, 9, 11, 0.1), 0 1px 3px rgba(9, 9, 11, 0.06);
  --e-3: 0 20px 56px rgba(9, 9, 11, 0.2);

  /* --- control sizing --- */
  --ctl-h-sm: 26px;
  --ctl-h-md: 32px;
  --ctl-pad-x: var(--s-4);

  /* --- motion --- */
  --t-fast: 120ms;
  --t-mid: 200ms;
  --ease: cubic-bezier(0.2, 0.6, 0.2, 1);

  /* --- focus --- */
  --focus-ring: 0 0 0 3px var(--c-accent-bg);

  color-scheme: light;
}

:root[data-theme="dark"],
:root[data-density] {
  /* placeholder so the selector list below stays valid if density lands first */
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --c-bg-0: #0c0c0d;
    --c-bg-1: #131315;
    --c-bg-2: #1a1a1d;
    --c-bg-3: #26262a;
    --c-line: #2a2a2e;
    --c-line-2: #3a3a40;
    --c-scrim: rgba(0, 0, 0, 0.6);

    --c-canvas: #0a0d11;
    --c-canvas-checker: #12161c;
    --c-canvas-ink: #55606d;
    --c-canvas-grid: rgba(255, 255, 255, 0.08);
    --c-graph-dot: rgba(255, 255, 255, 0.06);
    --c-graph-edge: rgba(255, 255, 255, 0.28);

    --c-text: #f4f4f5;
    --c-text-mid: #a1a1aa;
    --c-text-low: #71717a;
    --c-text-dis: #52525b;

    --c-accent: #fb8c3c;
    --c-accent-hover: #fda868;
    --c-accent-press: #f97316;
    --c-accent-bg: rgba(251, 140, 60, 0.15);
    --c-solid: #f4f4f5;
    --c-solid-hover: #e4e4e7;
    --c-solid-text: #18181b;

    --e-1: 0 1px 2px rgba(0, 0, 0, 0.4);
    --e-2: 0 4px 14px rgba(0, 0, 0, 0.5), 0 1px 3px rgba(0, 0, 0, 0.4);
    --e-3: 0 24px 64px rgba(0, 0, 0, 0.65);

    --c-node-bg: #171a1f;
    --c-node-border: #262a31;
    --c-node-shadow: rgba(0, 0, 0, 0.45);
    --c-node-text: #d7dde6;
    --c-node-head-bg: #1d2127;
    --c-node-title: #f2f5f9;
    --c-node-field-bg: #0f1114;
    --c-node-field-border: #2b2f37;
    --c-node-field-text: #cfe3ff;
    --c-node-sub: #7b8492;
    --c-node-out-label: #9aa4b1;
    --c-node-port-unlinked-border: #4a525d;
    --c-node-minimap-bg: rgba(12, 13, 16, 0.85);
    --c-node-minimap-border: #2a2e35;
    --c-node-group-border: #363b44;
    --c-node-group-bg: rgba(255, 255, 255, 0.022);
    --c-node-act-hover-bg: rgba(255, 255, 255, 0.08);

    --c-tone-blue: #8ab4f8;
    --c-tone-gray: #7b8492;
    --c-tone-orange: #fb923c;
    --c-tone-violet: #a78bfa;
    --c-tone-cyan: #22d3ee;
    --c-tone-amber: #f59e0b;
    --c-tone-purple: #b78cf0;
    --c-tone-tan: #f0a868;
    --c-tone-pink: #e879f9;
    --c-tone-green: #34d399;

    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --c-bg-0: #0c0c0d;
  --c-bg-1: #131315;
  --c-bg-2: #1a1a1d;
  --c-bg-3: #26262a;
  --c-line: #2a2a2e;
  --c-line-2: #3a3a40;
  --c-scrim: rgba(0, 0, 0, 0.6);

  --c-canvas: #0a0d11;
  --c-canvas-checker: #12161c;
  --c-canvas-ink: #55606d;
  --c-graph-dot: rgba(255, 255, 255, 0.06);
  --c-graph-edge: rgba(255, 255, 255, 0.28);

  --c-text: #f4f4f5;
  --c-text-mid: #a1a1aa;
  --c-text-low: #71717a;
  --c-text-dis: #52525b;

  --c-accent: #fb8c3c;
  --c-accent-hover: #fda868;
  --c-accent-press: #f97316;
  --c-accent-bg: rgba(251, 140, 60, 0.15);
  --c-solid: #f4f4f5;
  --c-solid-hover: #e4e4e7;
  --c-solid-text: #18181b;

  --e-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --e-2: 0 4px 14px rgba(0, 0, 0, 0.5), 0 1px 3px rgba(0, 0, 0, 0.4);
  --e-3: 0 24px 64px rgba(0, 0, 0, 0.65);

  --c-node-bg: #171a1f;
  --c-node-border: #262a31;
  --c-node-shadow: rgba(0, 0, 0, 0.45);
  --c-node-text: #d7dde6;
  --c-node-head-bg: #1d2127;
  --c-node-title: #f2f5f9;
  --c-node-field-bg: #0f1114;
  --c-node-field-border: #2b2f37;
  --c-node-field-text: #cfe3ff;
  --c-node-sub: #7b8492;
  --c-node-out-label: #9aa4b1;
  --c-node-port-unlinked-border: #4a525d;
  --c-node-minimap-bg: rgba(12, 13, 16, 0.85);
  --c-node-minimap-border: #2a2e35;
  --c-node-group-border: #363b44;
  --c-node-group-bg: rgba(255, 255, 255, 0.022);
  --c-node-act-hover-bg: rgba(255, 255, 255, 0.08);

  --c-tone-blue: #8ab4f8;
  --c-tone-gray: #7b8492;
  --c-tone-orange: #fb923c;
  --c-tone-violet: #a78bfa;
  --c-tone-cyan: #22d3ee;
  --c-tone-amber: #f59e0b;
  --c-tone-purple: #b78cf0;
  --c-tone-tan: #f0a868;
  --c-tone-pink: #e879f9;
  --c-tone-green: #34d399;

  color-scheme: dark;
}

/* compact density — later token swap, wired here so the gallery can demo it */
:root[data-density="compact"] {
  --s-3: 6px;
  --s-4: 9px;
  --s-5: 12px;
  --s-6: 18px;
  --ctl-h-sm: 22px;
  --ctl-h-md: 28px;
  --fz-base: 12px;
  --fz-md: 13px;
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
  }
}
