/* ============================================================
   TCW DESIGN TOKENS — Chassis Layer (LOCKED)
   ============================================================
   Authoritative spec:
     .planning/UI-REVIEW/TCW-SWATCH-SYSTEM.md
     .planning/UI-REVIEW/V02-MASTER-SPEC.md
   Owner: V02 / F43 / Plan 43-01

   Three-layer token model:
     1. PRIMITIVES   — raw values (colors, sizes)
     2. SEMANTIC     — purpose-mapped tokens (status, track, spacing, radius, type)
     3. COMPONENT    — set per-swatch in 43-03 (NOT defined here)

   These chassis tokens are LOCKED. They do NOT change per-tenant.
   Tenant overrides are scoped to swatch (colors) + font system only.
   ============================================================ */

/* ============================================================
   LAYER 1: PRIMITIVES
   Raw values. Never consumed directly by component CSS.
   ============================================================ */
:root {
    /* ---------- Status primitives ---------- */
    --c-green-500: #22C55E;   /* Confirmed */
    --c-amber-500: #F5A524;   /* Tickets Low */
    --c-coal-900:  #3A3A42;   /* Sold Out */

    /* ---------- Track band primitives ---------- */
    --c-slate-600:  #4C5567;
    --c-plum-700:   #7D2248;
    --c-moss-600:   #5A7A3D;
    --c-copper-600: #B36A24;
    --c-ink-700:    #2E3E5F;
    --c-dune-500:   #B89968;

    /* ---------- Spacing primitives (4px base scale) ---------- */
    --c-space-4:   4px;
    --c-space-8:   8px;
    --c-space-12:  12px;
    --c-space-16:  16px;
    --c-space-20:  20px;
    --c-space-24:  24px;
    --c-space-32:  32px;
    --c-space-40:  40px;
    --c-space-48:  48px;
    --c-space-64:  64px;
    --c-space-80:  80px;
    --c-space-96:  96px;
    --c-space-128: 128px;

    /* ---------- Radius primitives ---------- */
    --c-radius-4:   4px;
    --c-radius-8:   8px;
    --c-radius-12:  12px;
    --c-radius-16:  16px;
    --c-radius-999: 999px;

    /* ---------- Typography size primitives ---------- */
    --c-font-11:  11px;
    --c-font-13:  13px;
    --c-font-15:  15px;
    --c-font-18:  18px;
    --c-font-32:  32px;
    --c-font-64:  64px;
    --c-font-96:  96px;
    --c-font-144: 144px;

    /* ---------- Motion primitives (43-08) ---------- */
    --c-motion-0:    0ms;
    --c-motion-120:  120ms;
    --c-motion-200:  200ms;
    --c-motion-320:  320ms;

    /* ---------- Alert palette primitives (43-08) ----------
       Bootstrap 5.3-derived alert colors. Locked across swatches —
       semantic intent (success/danger/warning/info) is universal even
       when canvas/accent rebrand per tenant. */
    --c-alert-success-bg:     #d1e7dd;
    --c-alert-success-border: #a3cfbb;
    --c-alert-success-text:   #0a3622;
    --c-alert-danger-bg:      #f8d7da;
    --c-alert-danger-border:  #f1aeb5;
    --c-alert-danger-text:    #58151c;
    --c-alert-warning-bg:     #fff3cd;
    --c-alert-warning-border: #ffe69c;
    --c-alert-warning-text:   #664d03;
    --c-alert-info-bg:        #cfe2ff;
    --c-alert-info-border:    #9ec5fe;
    --c-alert-info-text:      #084298;

    /* ---------- Pure status primitives (43-08) ---------- */
    --c-red-600:    #dc3545;
    --c-blue-600:   #0d6efd;
    --c-purple-600: #6f42c1;

    /* ---------- Dirty/unsaved-changes primitive (49-03, TD-011) ---------- */
    --c-gold-400: #FFD666;   /* Dirty/unsaved-changes indicator */
}

/* ============================================================
   LAYER 2: SEMANTIC
   Purpose-mapped tokens. THIS is what component CSS consumes.
   ============================================================ */
:root {
    /* ---------- Status (locked across all swatches) ---------- */
    --tcw-status-confirmed:    var(--c-green-500);
    --tcw-status-tickets-low:  var(--c-amber-500);
    --tcw-status-sold-out:     var(--c-coal-900);

    /* ---------- Track bands (locked across all swatches) ---------- */
    --tcw-track-slate:  var(--c-slate-600);
    --tcw-track-plum:   var(--c-plum-700);
    --tcw-track-moss:   var(--c-moss-600);
    --tcw-track-copper: var(--c-copper-600);
    --tcw-track-ink:    var(--c-ink-700);
    --tcw-track-dune:   var(--c-dune-500);

    /* ---------- Spacing scale (locked) ---------- */
    --tcw-space-1:  var(--c-space-4);    /*   4px */
    --tcw-space-2:  var(--c-space-8);    /*   8px */
    --tcw-space-3:  var(--c-space-12);   /*  12px */
    --tcw-space-4:  var(--c-space-16);   /*  16px */
    --tcw-space-5:  var(--c-space-20);   /*  20px */
    --tcw-space-6:  var(--c-space-24);   /*  24px */
    --tcw-space-7:  var(--c-space-32);   /*  32px */
    --tcw-space-8:  var(--c-space-40);   /*  40px */
    --tcw-space-9:  var(--c-space-48);   /*  48px */
    --tcw-space-10: var(--c-space-64);   /*  64px */
    --tcw-space-11: var(--c-space-80);   /*  80px */
    --tcw-space-12: var(--c-space-96);   /*  96px */
    --tcw-space-13: var(--c-space-128);  /* 128px */

    /* ---------- Radius scale (locked) ---------- */
    --tcw-radius-sharp:        var(--c-radius-4);    /*   4px */
    --tcw-radius-subtle:       var(--c-radius-8);    /*   8px */
    --tcw-radius-comfortable:  var(--c-radius-12);   /*  12px */
    --tcw-radius-pronounced:   var(--c-radius-16);   /*  16px */
    --tcw-radius-pill:         var(--c-radius-999);  /* 999px */

    /* ---------- Typography scale (locked) ---------- */
    --tcw-font-size-xs:   var(--c-font-11);   /*  11px */
    --tcw-font-size-sm:   var(--c-font-13);   /*  13px */
    --tcw-font-size-base: var(--c-font-15);   /*  15px */
    --tcw-font-size-lg:   var(--c-font-18);   /*  18px */
    --tcw-font-size-xl:   var(--c-font-32);   /*  32px */
    --tcw-font-size-2xl:  var(--c-font-64);   /*  64px */
    --tcw-font-size-3xl:  var(--c-font-96);   /*  96px */
    --tcw-font-size-4xl:  var(--c-font-144);  /* 144px */

    /* ---------- Motion (locked; gated by prefers-reduced-motion below) ---------- */
    --tcw-motion-instant: var(--c-motion-0);     /*   0ms */
    --tcw-motion-fast:    var(--c-motion-120);   /* 120ms */
    --tcw-motion-base:    var(--c-motion-200);   /* 200ms */
    --tcw-motion-slow:    var(--c-motion-320);   /* 320ms */

    /* ---------- Alert semantic tokens (43-08, locked) ----------
       Each alert state exposes bg / border / text. Universally locked
       so success-is-green / danger-is-red survives tenant rebranding. */
    --tcw-alert-success-bg:     var(--c-alert-success-bg);
    --tcw-alert-success-border: var(--c-alert-success-border);
    --tcw-alert-success-text:   var(--c-alert-success-text);
    --tcw-alert-danger-bg:      var(--c-alert-danger-bg);
    --tcw-alert-danger-border:  var(--c-alert-danger-border);
    --tcw-alert-danger-text:    var(--c-alert-danger-text);
    --tcw-alert-warning-bg:     var(--c-alert-warning-bg);
    --tcw-alert-warning-border: var(--c-alert-warning-border);
    --tcw-alert-warning-text:   var(--c-alert-warning-text);
    --tcw-alert-info-bg:        var(--c-alert-info-bg);
    --tcw-alert-info-border:    var(--c-alert-info-border);
    --tcw-alert-info-text:      var(--c-alert-info-text);

    /* ---------- Pure status accents (43-08) ----------
       Used for inline status text/badges where bg/border are not
       present (e.g., "Required" red asterisks, error-text inputs). */
    --tcw-status-danger:  var(--c-red-600);
    --tcw-status-primary: var(--c-blue-600);
    --tcw-status-accent:  var(--c-purple-600);

    /* ---------- Dirty/unsaved-changes indicator (49-03, TD-011) ----------
       Distinct hue from --c-amber-500 (tickets-low) - dedicated semantic
       token so an unrelated "unsaved changes" UI affordance no longer
       reuses the ticket-inventory amber. */
    --tcw-status-dirty: var(--c-gold-400);

    /* ---------- Surface/border defaults (43-08) ----------
       Generic neutrals for surfaces and borders that don't need
       tenant rebranding (form-control borders, divider lines, etc.).
       These pick up swatch-aware fallbacks in admin/public scopes. */
    --tcw-border-default: var(--tcw-spotlight, #dee2e6);
    --tcw-border-subtle:  var(--tcw-spotlight, #e9ecef);
    --tcw-border-strong:  var(--tcw-text-secondary, #ced4da);
}

/* ============================================================
   REDUCED-MOTION GATE
   Honors user accessibility preference; all transitions collapse
   to instant. Per RESEARCH.md acceptance criterion line 66.
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    :root {
        --tcw-motion-instant: 0ms;
        --tcw-motion-fast:    0ms;
        --tcw-motion-base:    0ms;
        --tcw-motion-slow:    0ms;
    }
}

/* ============================================================
   LAYER 3: COMPONENT (scaffold only — filled in by 43-03)
   Component-level tokens resolve through swatch CSS at runtime.
   Plan 43-03 will define the actual swatch bundles that set
   --tcw-canvas, --tcw-accent-1, --tcw-surface, etc.
   ============================================================ */
/* (Intentionally empty — see Plan 43-03) */

/* ============================================================
   DENSITY SCOPE: .admin-shell
   ============================================================
   Admin surfaces need higher information density than public pages.
   This scope tightens the chassis without redefining primitives.

   Contract (per 43-RESEARCH.md):
   - Body font size  : 13px (overrides --tcw-font-size-base)
   - Spacing scale   : 4 / 8 / 12 / 16 / 20 / 24 px (caps at space-6)
   - Radius          : caps at 8px (no comfortable/pronounced)
   ============================================================ */
.admin-shell {
    /* Body type tightened */
    --tcw-font-size-base: var(--c-font-13);

    /* Spacing tightened — keep 1..6 only; higher steps collapse to space-6 */
    --tcw-space-1:  var(--c-space-4);
    --tcw-space-2:  var(--c-space-8);
    --tcw-space-3:  var(--c-space-12);
    --tcw-space-4:  var(--c-space-16);
    --tcw-space-5:  var(--c-space-20);
    --tcw-space-6:  var(--c-space-24);
    --tcw-space-7:  var(--c-space-24);
    --tcw-space-8:  var(--c-space-24);
    --tcw-space-9:  var(--c-space-24);
    --tcw-space-10: var(--c-space-24);
    --tcw-space-11: var(--c-space-24);
    --tcw-space-12: var(--c-space-24);
    --tcw-space-13: var(--c-space-24);

    /* Radius caps at 8px — comfortable/pronounced flatten to subtle */
    --tcw-radius-comfortable: var(--c-radius-8);
    --tcw-radius-pronounced:  var(--c-radius-8);
    /* sharp / subtle / pill unchanged */
}
