/* =====================================================================
 * Stellar Core — canonical colour palette tokens.
 *
 * Single source of truth for every Stellar package (stellar_core,
 * stellar_knowledge_base, stellar_project_manager, stellar_defender …).
 * Loaded on every page; the tokens are inert until consumed.
 *
 * Scheme is chosen globally via the `data-stellar-color` attribute on
 * <html> (set from the stellar_core "Color palette" setting):
 *   • absent / empty  → DEFAULT: tokens map onto Bootstrap-5 `--bs-*`
 *     variables, so the look follows the active theme. Light/dark is
 *     handled automatically because Bootstrap flips `--bs-*` under
 *     `[data-bs-theme="dark"]`.
 *   • "enterprise"    → custom professional palette (slate/steel-blue),
 *     with a dedicated dark variant keyed off `[data-bs-theme="dark"]`.
 *
 * Token names mirror the legacy `--pm-fe-*` / `--kb-*` sets so the
 * package stylesheets can re-point 1:1.
 * ===================================================================== */

:root {
    /* DEFAULT scheme — inherit the theme via Bootstrap variables. */
    --stellar-bg: var(--bs-secondary-bg, #f3f4f6);
    --stellar-surface: var(--bs-body-bg, #ffffff);
    --stellar-border: var(--bs-border-color, #dee2e6);
    --stellar-text: var(--bs-body-color, #212529);
    --stellar-muted: var(--bs-secondary-color, #6c757d);
    --stellar-accent: var(--bs-primary, #0d6efd);
    --stellar-accent-rgb: var(--bs-primary-rgb, 13, 110, 253);
    --stellar-accent-soft: rgba(var(--stellar-accent-rgb), 0.10);
    --stellar-on-accent: #ffffff;
    --stellar-danger: var(--bs-danger, #dc3545);
    --stellar-danger-rgb: var(--bs-danger-rgb, 220, 53, 69);
    --stellar-danger-soft: rgba(var(--stellar-danger-rgb), 0.10);
    --stellar-warn: var(--bs-warning, #fd7e14);
    --stellar-warn-rgb: var(--bs-warning-rgb, 253, 126, 20);
    --stellar-warn-soft: rgba(var(--stellar-warn-rgb), 0.12);
    --stellar-success: var(--bs-success, #198754);
    --stellar-success-rgb: var(--bs-success-rgb, 25, 135, 84);
    --stellar-success-soft: rgba(var(--stellar-success-rgb), 0.12);

    /* Shared density / shape — compact + square (the enterprise feel that
     * both packages already shipped). Applies to every scheme. */
    --stellar-radius: 0;
    --stellar-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* ---------------------------------------------------------------------
 * Enterprise — light
 * ------------------------------------------------------------------- */
html[data-stellar-color="enterprise"] {
    --stellar-bg: #eef1f5;
    --stellar-surface: #ffffff;
    --stellar-border: #d3dae1;
    --stellar-text: #1c2733;
    --stellar-muted: #5c6b7a;
    --stellar-accent: #2c5282;
    --stellar-accent-rgb: 44, 82, 130;
    --stellar-accent-soft: rgba(44, 82, 130, 0.09);
    --stellar-on-accent: #ffffff;
    --stellar-danger: #c0392b;
    --stellar-danger-rgb: 192, 57, 43;
    --stellar-danger-soft: rgba(192, 57, 43, 0.10);
    --stellar-warn: #b7791f;
    --stellar-warn-rgb: 183, 121, 31;
    --stellar-warn-soft: rgba(183, 121, 31, 0.12);
    --stellar-success: #2f855a;
    --stellar-success-rgb: 47, 133, 90;
    --stellar-success-soft: rgba(47, 133, 90, 0.12);
    --stellar-shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
}

/* ---------------------------------------------------------------------
 * Enterprise — dark (both attributes live on <html>)
 * ------------------------------------------------------------------- */
html[data-stellar-color="enterprise"][data-bs-theme="dark"] {
    --stellar-bg: #11151a;
    --stellar-surface: #1a2027;
    --stellar-border: #2b333d;
    --stellar-text: #e4e9ef;
    --stellar-muted: #92a0b0;
    --stellar-accent: #5b9bd5;
    --stellar-accent-rgb: 91, 155, 213;
    --stellar-accent-soft: rgba(91, 155, 213, 0.16);
    --stellar-on-accent: #0b1320;
    --stellar-danger: #e06c63;
    --stellar-danger-rgb: 224, 108, 99;
    --stellar-danger-soft: rgba(224, 108, 99, 0.16);
    --stellar-warn: #e0b252;
    --stellar-warn-rgb: 224, 178, 82;
    --stellar-warn-soft: rgba(224, 178, 82, 0.16);
    --stellar-success: #57b685;
    --stellar-success-rgb: 87, 182, 133;
    --stellar-success-soft: rgba(87, 182, 133, 0.16);
    --stellar-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}
