/* WinDAGs paired-theme source, semantic and component tokens. */
:root {
  color-scheme: light;
  --surface-overlay: rgba(255,248,240,.96);
  --on-accent: #1a1a2e;
  --focus-ring: #005b91;
  --dag-pending: #3f4057;
  --dag-running: #103b69;
  --dag-completed: #2d490d;
  --dag-failed: #6f2421;
  --dag-retrying: #563900;
  --dag-human: #4a285c;
  --dag-vague: #563900;

  /* ═══ TIER 1: PRIMITIVES (oklch) ═══ */
  /* Win31 Core */
  --p-black:      oklch(0 0 0);
  --p-white:      oklch(1 0 0);
  --p-gray:       oklch(0.80 0 0);       /* #C0C0C0 */
  --p-dark-gray:  oklch(0.56 0 0);       /* #808080 */
  --p-light-gray: oklch(0.90 0 0);       /* #DFDFDF */
  --p-navy:       oklch(0.27 0.17 264);  /* #000080 */
  --p-teal:       oklch(0.52 0.09 194);  /* #008080 */

  /* Neo Accents */
  --p-yellow:     oklch(0.93 0.16 100);  /* #FFEB3B */
  --p-pink:       oklch(0.63 0.24 6);    /* #FF4081 */
  --p-red:        oklch(0.64 0.22 25);   /* #FF5252 */
  --p-orange:     oklch(0.75 0.16 60);   /* #FF9800 */
  --p-green:      oklch(0.67 0.16 145);  /* #4CAF50 */
  --p-blue:       oklch(0.61 0.16 250);  /* #2196F3 */
  --p-purple:     oklch(0.44 0.19 310);  /* #9C27B0 */
  --p-cream:      oklch(0.96 0.02 90);   /* #F5F0E6 */

  /* Logo-derived primaries (from Tauri desktop app) */
  --p-coral:      oklch(0.62 0.18 25);   /* #F07060 */
  --p-coral-lt:   oklch(0.76 0.10 25);   /* #F8A098 */
  --p-lime:       oklch(0.82 0.17 115);  /* #B5D635 */
  --p-lime-lt:    oklch(0.90 0.10 115);  /* #D5E890 */
  --p-sky:        oklch(0.65 0.13 240);  /* #4A9DD8 */
  --p-sky-lt:     oklch(0.82 0.07 240);  /* #A0D0F0 */
  --p-sky-ink:    oklch(0.50 0.14 240);  /* #006AAA — readable blue text */
  --p-lavender:   oklch(0.74 0.10 310);  /* #C5A5D8 */
  --p-lavender-lt:oklch(0.87 0.05 310);  /* #E0D0F0 */
  --p-amber:      oklch(0.76 0.15 75);   /* #F0A830 */
  --p-amber-lt:   oklch(0.87 0.09 75);   /* #F8D080 */

  /* Warm surfaces */
  --p-surface-cream: oklch(0.98 0.01 80); /* #FFF8F0 */
  --p-surface-cloud: oklch(0.96 0.02 300);/* #F5F0FA */

  /* Outline system (indigo-black, warmer than pure black) */
  --p-outline:       oklch(0.18 0.04 270);/* #1A1A2E */
  --p-outline-med:   oklch(0.35 0.03 270);/* #404058 */
  --p-outline-lt:    oklch(0.56 0.02 270);/* #808098 */

  /* Chrome tints */
  --p-chrome-pink:   oklch(0.93 0.04 10); /* #FFE0E8 */
  --p-chrome-blue:   oklch(0.94 0.03 240);/* #E0F0FF */
  --p-chrome-yellow: oklch(0.97 0.03 95); /* #FFF8D0 */
  --p-chrome-green:  oklch(0.95 0.04 140);/* #E8FFE0 */

  /* Extended palette (used in specific contexts) */
  --p-mid-blue:   oklch(0.55 0.14 250);  /* #1084D0 — Win95 gradient end */
  --p-dark-teal:  oklch(0.40 0.07 194);  /* #005858 */
  --p-light-teal: oklch(0.67 0.08 165);  /* #26A69A */
  --p-success:    oklch(0.73 0.18 148);  /* #0CCE6B */
  --p-body-gray:  oklch(0.86 0 0);       /* #D4D0C8 — Win95 body */
  --p-teal-wash:  oklch(0.94 0.03 194);  /* Very light teal tint */

  /* ═══ TIER 2: SEMANTIC ═══ */
  /* Surfaces — warm cream instead of cold gray */
  --surface:          var(--p-surface-cream);
  --surface-elevated: var(--p-white);
  --surface-sunken:   var(--p-surface-cloud);
  --surface-code:     oklch(0.20 0 0);   /* #1E1E1E — dark code bg */
  --surface-body:     var(--p-body-gray); /* Win95 body panels */

  /* Text — indigo-black instead of pure black */
  --text-primary:     var(--p-outline);
  --text-muted:       oklch(0.32 0 0);   /* #595959 — WCAG AAA on white */
  --text-secondary:   var(--p-outline-med);
  --text-inverse:     var(--p-white);
  --text-link:        #103b69;
  --text-link-hover:  #123e3d;

  /* Typography scale: pixel and mono faces need a higher optical floor */
  --type-ui-min:       0.875rem;  /* 14px: compact chrome only */
  --type-ui-caption:   1rem;      /* 16px: labels, badges, status */
  --type-ui-control:   1rem;      /* 16px: buttons, tabs, form controls */
  --type-body-small:   1.0625rem; /* 17px: dense explanatory copy */
  --type-body:         1.125rem;  /* 18px: default readable copy */
  --type-code-small:   0.9375rem; /* 15px: compact code */
  --leading-ui-tight:  1.12;
  --leading-ui:        1.25;
  --leading-body:      1.5;

  /* Borders — outline instead of pure black */
  --border-hard:      var(--p-outline);
  --border-subtle:    var(--p-outline-med);
  --border-highlight: var(--p-white);
  --border-light:     var(--p-light-gray);

  /* Accents */
  --accent-primary:   var(--p-navy);
  --accent-secondary: var(--p-teal);
  --accent-warning:   var(--p-orange);
  --accent-danger:    var(--p-red);
  --accent-success:   var(--p-green);
  --accent-info:      var(--p-blue);
  --accent-special:   var(--p-purple);

  /* ═══ TIER 3: COMPONENT ═══ */
  --titlebar-bg:       var(--accent-primary);
  --titlebar-text:     var(--text-inverse);
  --window-bg:         var(--surface);
  --window-border:     var(--border-hard);
  --code-bg:           var(--surface-code);
  --code-text:         var(--text-inverse);
  --badge-bg:          var(--surface);
  --badge-border:      var(--border-hard);

  /* Legacy aliases (for var() references in existing CSS) */
  --win31-gray: var(--p-gray);
  --win31-dark-gray: var(--p-dark-gray);
  --win31-light-gray: var(--p-light-gray);
  --win31-navy: var(--p-navy);
  --win31-teal: var(--p-teal);
  --win31-white: var(--p-white);
  --win31-black: var(--p-outline);
  --neo-yellow: var(--p-yellow);
  --neo-pink: var(--p-pink);
  --neo-red: var(--p-red);
  --neo-orange: var(--p-orange);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --surface: #151824;
  --surface-elevated: #202536;
  --surface-sunken: #10131e;
  --surface-body: #272d40;
  --surface-code: #10131e;
  --surface-overlay: rgba(21,24,36,.96);
  --text-primary: #f2f0e9;
  --text-secondary: #d0d4e1;
  --text-muted: #b8bfd1;
  --text-inverse: #f2f0e9;
  --text-link: #9fd7ff;
  --text-link-hover: #c6e7ff;
  --border-hard: #99a5c0;
  --border-subtle: #72809b;
  --border-light: #48536c;
  --border-highlight: #71809c;
  --focus-ring: #b3ddff;
  --dag-pending: #b8bfd1;
  --dag-running: #9fd7ff;
  --dag-completed: #c2e77c;
  --dag-failed: #ffb0a4;
  --dag-retrying: #ffd08a;
  --dag-human: #dfb7f4;
  --dag-vague: #ffe1a8;
  --win31-gray: var(--surface-body);
  --win31-dark-gray: #73809a;
  --win31-light-gray: #46516b;
  --win31-white: var(--surface-elevated);
  --win31-black: var(--text-primary);
}

/* Component roles consume semantic colors. Source values stay in this file. */
:root {
  --desktop-bg: #0a5354;
  --action-bg: #1a1a2e;
  --action-text: #ffffff;
  --action-hover-bg: #303044;
  --nav-feature-bg: linear-gradient(135deg, var(--p-coral-lt), var(--p-sky-lt));
  --nav-feature-text: var(--on-accent);
  --action-primary-bg: var(--p-coral-lt);
  --action-primary-text: var(--on-accent);
  --action-primary-hover-bg: #f7b9ae;
  --titlebar-bg: var(--p-navy);
  --titlebar-end: #154a85;
  --titlebar-text: #ffffff;
  --titlebar-gradient: linear-gradient(90deg, var(--titlebar-bg), var(--titlebar-end));
  --status-info: #103b69;
  --status-info-surface: #e8f1fc;
  --status-success: #1d4223;
  --status-success-surface: #e9f3df;
  --status-warning: #563900;
  --status-warning-surface: #fff0c7;
  --status-danger: #6f2421;
  --status-danger-surface: #ffe9e3;
  --status-special: #4a285c;
  --status-special-surface: #f1e6fa;
  --field-bg: var(--surface-elevated);
  --field-text: var(--text-primary);
  --field-border: var(--border-hard);
  --selection-bg: #b3ddff;
  --selection-text: #151824;
  --inline-code-bg: var(--surface-sunken);
  --inline-code-text: var(--text-primary);
  --code-bg: #10131e;
  --code-text: #f2f0e9;
  --code-muted: #b8bfd1;
  --code-blue: #9fd7ff;
  --code-green: #c2e77c;
  --code-amber: #ffd08a;
  --code-purple: #dfc3ff;
  --code-red: #ffb8ae;
  --code-teal: #a5e6dc;
  --link-text: var(--text-link);
  --link-hover: var(--text-link-hover);
  --window-bg: var(--surface-body);
  --window-content-bg: var(--surface-elevated);
  --table-stripe: var(--surface-sunken);
  --chrome-pink: var(--status-danger-surface);
  --chrome-blue: var(--status-info-surface);
  --chrome-yellow: var(--status-warning-surface);
  --chrome-green: var(--status-success-surface);
  --preview-shade: rgb(0 0 0 / .3);
  --hero-teal-gradient: linear-gradient(to bottom right, var(--p-teal), var(--p-navy));
  --hero-navy-gradient: linear-gradient(to bottom right, var(--p-navy), oklch(0.20 0.12 264));
  --hero-purple-gradient: linear-gradient(to bottom right, var(--p-purple), var(--p-navy));
  --hero-coral-gradient: linear-gradient(to bottom right, var(--p-coral), oklch(0.35 0.15 25));
  --glow-feedback: rgb(240 112 96 / .2);
  --glow-running: rgb(74 157 216 / .15);
  --glow-completed: rgb(181 214 53 / .12);
  --glow-failed: rgb(240 112 96 / .15);
  --glow-retrying: rgb(240 168 48 / .15);
  --glow-human: rgb(197 165 216 / .15);
  --diagram-edge: var(--text-secondary);
}
:root[data-theme="dark"] {
  --desktop-bg: #102e32;
  --action-bg: #dce4ff;
  --action-text: #151824;
  --action-hover-bg: #c5d4fb;
  --status-info: #b3ddff;
  --status-info-surface: #18283b;
  --status-success: #d2eea0;
  --status-success-surface: #243021;
  --status-warning: #ffdda5;
  --status-warning-surface: #352919;
  --status-danger: #ffc6ba;
  --status-danger-surface: #362429;
  --status-special: #e3c8ff;
  --status-special-surface: #30243d;
  --inline-code-bg: var(--surface-body);
}

/* Graph title roles: fixed dark title gradients with light labels. */
:root {
 --status-fill-ink:#fff;
 --dag-badge-ink:var(--status-fill-ink);
 --dag-title-pending:linear-gradient(135deg,#404058,#1a1a2e);
 --dag-title-running:linear-gradient(135deg,#24567c,#172d68);
 --dag-title-completed:linear-gradient(135deg,#365b28,#234537);
 --dag-title-failed:linear-gradient(135deg,#8e352e,#632631);
 --dag-title-retrying:linear-gradient(135deg,#77501d,#5e3b28);
 --dag-title-waiting-human:linear-gradient(135deg,#644579,#442d65);
 --dag-title-vague:linear-gradient(135deg,#77551d,#574028);
}
:root[data-theme="dark"] {--status-fill-ink:#151824}

/* Wide technical references pan inside a named keyboard region. */
.reference-table-scroll {max-width:100%;overflow-x:auto}
.reference-table-scroll:focus-visible {outline:3px solid var(--focus-ring);outline-offset:3px}
