/*
 * tokens.css — Skylor V2 Design Tokens (E8.10)
 *
 * LOCKED 2026-04-24 via Branch UF1.
 *
 * This file is the single source of truth for typography, elevation, radius,
 * breakpoints, z-index, motion, and dark-mode surface primitives. It extends
 * (does not replace) the color / spacing / status / priority tokens declared
 * in base.css (E8.8).
 *
 * Rule R1 (E8.0.1): from UF1 onward, NO new hardcoded CSS values in
 * templates or component styles. Every value consumed here.
 *
 * Loaded BEFORE base.css in templates/base.html so base.css (and every
 * downstream stylesheet) can reference any variable defined here.
 */

:root {
    /* ---------------------------------------------------------------- */
    /* Typography — font families, type ramp, line-heights, weights     */
    /* ---------------------------------------------------------------- */
    /* Shell-S1: Inter unified platform-wide (app + landing + auth) for one
       consistent, high-density voice. Montserrat / Plus Jakarta Sans retired. */
    /* DS-2 canonical: one sans alias for all UI text, one mono. New work MUST
       target --font-sans / --font-mono. */
    --font-sans:    'Inter', system-ui, -apple-system, sans-serif;
    --font-mono:    'JetBrains Mono', Menlo, monospace;
    /* @deprecated — kept for back-compat; resolve to --font-sans (value-preserving,
       all four were already Inter). Do not use in new work. (DS-1.1 / DS-2 map.) */
    --font-heading: var(--font-sans);
    --font-body:    var(--font-sans);
    /* Bootstrap's own font variables were never wired to the platform tokens,
       so its utility classes (.font-monospace, any --bs-font-monospace
       consumer) silently fell back to the BROWSER's system-mono stack
       (SFMono/Menlo/Consolas/Courier New) instead of the design system's
       JetBrains Mono — the exact "different font in the same card" bug
       (money/ID/score-point spans that use .font-monospace next to Inter
       sans text). One override fixes every existing usage platform-wide. */
    --bs-font-sans-serif: var(--font-sans);
    --bs-font-monospace:  var(--font-mono);

    --fs-2xs:  0.625rem;   /* 10px — micro chips, calendar tags */
    --fs-11:   0.6875rem;  /* 11px — U1: group headings, tags, xs chips */
    --fs-xs:   0.75rem;    /* 12px — captions, meta */
    --fs-13:   0.8125rem;  /* 13px — DS-1: canonical control / body / cell text (the dense-UI step) */
    --fs-15:   0.9375rem;  /* 15px — U1: sheet / preview titles */
    --fs-sm:   0.875rem;   /* 14px — secondary text, table cells */
    --fs-base: 1rem;       /* 16px — body */
    --fs-md:   1.125rem;   /* 18px — emphasized body, card titles */
    --fs-lg:   1.25rem;    /* 20px — section headings */
    --fs-xl:   1.5rem;     /* 24px — page headings */
    --fs-2xl:  1.875rem;   /* 30px — dashboard hero numbers */
    --fs-3xl:  2.25rem;    /* 36px — landing / empty-state hero */

    --lh-tight:   1.2;     /* headings */
    --lh-snug:    1.375;   /* subheadings */
    --lh-normal:  1.5;     /* body */
    --lh-relaxed: 1.625;   /* long-form */

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

    /* ---------------------------------------------------------------- */
    /* Elevation — shadow ramp + focus ring                             */
    /* ---------------------------------------------------------------- */
    --shadow-xs:    0 1px 1px rgba(0, 0, 0, 0.04);
    --shadow-sm:    0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md:    0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg:    0 10px 15px rgba(0, 0, 0, 0.10);
    --shadow-xl:    0 20px 25px rgba(0, 0, 0, 0.12);
    --shadow-focus: 0 0 0 3px rgba(59, 130, 246, 0.35);

    /* ---------------------------------------------------------------- */
    /* Radius                                                           */
    /* ---------------------------------------------------------------- */
    --radius-xs:   0.25rem;    /* 4px — chips, badges */
    --radius-sm:   0.375rem;   /* 6px */
    --radius-md:   0.5rem;     /* 8px */
    --radius-lg:   0.75rem;    /* 12px */
    --radius-xl:   1rem;       /* 16px — cards, large surfaces */
    --radius-full: 9999px;     /* pills, avatars */

    /* ---------------------------------------------------------------- */
    /* Breakpoints (mobile-first, Bootstrap-aligned)                    */
    /* Exposed as custom properties for JS / documentation. Media       */
    /* queries themselves still use raw values (CSS spec limitation).   */
    /* ---------------------------------------------------------------- */
    --bp-xs:  320px;
    --bp-sm:  576px;
    --bp-md:  768px;
    --bp-lg:  992px;
    --bp-xl:  1200px;
    --bp-2xl: 1400px;

    /* ---------------------------------------------------------------- */
    /* Z-index scale (prevents the "1000000" war)                       */
    /* ---------------------------------------------------------------- */
    --z-base:            1;
    --z-dropdown:        100;
    --z-sticky:          200;
    --z-sidebar:         300;
    --z-offcanvas:       400;
    --z-modal-backdrop:  500;
    --z-modal:           510;
    --z-toast:           600;
    --z-tooltip:         700;
    --z-popover:         800;
    --z-command-palette: 900;

    /* ---------------------------------------------------------------- */
    /* Motion — durations + easings                                     */
    /* ---------------------------------------------------------------- */
    --duration-instant: 50ms;
    --duration-fast:    150ms;
    --duration-normal:  250ms;
    --duration-slow:    400ms;

    --easing-standard: cubic-bezier(0.4, 0, 0.2, 1);
    --easing-emphasis: cubic-bezier(0.2, 0, 0, 1);

    /* ---------------------------------------------------------------- */
    /* Dark-mode primitives (semantic surface naming)                   */
    /* Declared in UF1; dark theme override deferred to V3.             */
    /* A [data-theme="dark"] block can swap these without touching      */
    /* any component.                                                   */
    /* ---------------------------------------------------------------- */
    /* DS-2: these dark-ready --color- primitives are the SOURCE OF TRUTH.
       The base.css --bg- / --text- / --border aliases are thin @deprecated
       names that resolve to these (no value change), so a future
       [data-theme="dark"] flips primitives only. Four primitives added
       2026-06-23 (-surface-2 / -hover / -text-secondary / -border-strong) —
       value-preserving against the base.css literals they replace. */
    --color-surface:          #ffffff;   /* card surface        (was --bg-surface)   */
    --color-surface-muted:    #f8fafc;   /* page surface        (was --bg-page)      */
    --color-surface-2:        #f1f5f9;   /* raised surface      (was --bg-surface-2) */
    --color-hover:            #e2e8f0;   /* hover wash          (was --bg-hover)     */
    --color-text:             #0f172a;   /* text primary        (was --text-main)    */
    --color-text-secondary:   #475569;   /* text secondary      (was --text-sec)     */
    --color-text-muted:       #64748b;   /* text muted          (was --text-muted)   */
    --color-border:           #e2e8f0;   /* border              (was --border)       */
    --color-border-strong:    #cbd5e1;   /* border strong       (was --border-strong)*/
    --color-on-accent:        #ffffff;   /* text/icon on a filled accent (primary/synq/danger) */

    /* ---------------------------------------------------------------- */
    /* Shell-S1 — Shell layout + density tokens.                        */
    /* Single source of truth for the app frame + high-density rhythm.  */
    /* Consumed by Shell-S2 (sidebar), S3 (navbar), S5 (density pass).  */
    /* Additive: defaults match today's layout; the density pass tunes  */
    /* the content gutters/row heights against these names, in one place.*/
    /* ---------------------------------------------------------------- */
    /* Sidebar surfaces (DS-4.1). The dark rail had NO tokens at all — its palette
       lived as ~21 hex literals in base.css, which is exactly what makes dark mode
       expensive later. Declared here as semantic roles; base.css consumes them.
       No new literals were introduced: these are the values already shipping. */
    --sidebar-surface:            #0f172a;  /* Midnight-Indigo ground            */
    --sidebar-surface-raised:     #151d33;  /* flyout / raised panel             */
    --sidebar-surface-active:     #211c4d;  /* active leaf tint fill             */
    --sidebar-on-surface:         #e8ecf6;  /* primary label on the dark ground  */
    --sidebar-on-surface-dim:     #93a0bb;  /* secondary label / resting icon    */
    --sidebar-on-surface-muted:   #64748b;  /* zone captions, meta               */

    --shell-navbar-h:             56px;   /* dense top bar height */
    --shell-sidebar-w:            248px;  /* expanded sidebar width */
    --shell-sidebar-w-collapsed:  64px;   /* icon-only rail width */
    --content-pad-x:              24px;   /* horizontal content gutter */
    --content-pad-y:              20px;   /* vertical gutter below navbar */
    --content-pad-x-dense:        16px;   /* high-density horizontal gutter */
    --content-pad-y-dense:        14px;   /* high-density vertical gutter */
    --density-row-h:              40px;   /* default list/table row height */
    --density-row-h-compact:      34px;   /* compact (dense tables) */
    /* DS-5.1 — the number that actually HOLDS a Compact row at 34px. On a table
       row `height` is a FLOOR, so the row is only as short as its tallest cell
       control: 26 + 4 + 4 padding = 34. Nothing in a Compact row may exceed it.
       (Nine row heights, 34px-57px, came from ignoring this.) */
    --table-ctl-h:                26px;   /* in-row control ceiling */
    --table-avatar:               20px;   /* in-row avatar */
    --table-cell-pad-y:           4px;    /* vertical cell padding (Compact) */
    --table-cell-pad-x:          10px;    /* horizontal — room for column rules */
    /* Command Center row-2 pair — Company Pulse ‖ AI Usage by Member share ONE
       height so the two columns align row-wise, not just at the bottom edge
       (founder, 2026-08-27). Row 1 takes whatever is left, so both columns
       compute identically without either card being hard-coded. */
    --exec-pair-h:                260px;
    /* The gap BETWEEN the two rows must match on both sides or row 1 cannot be
       equal: the decide stack used --density-gap (12px) while the rail carries
       Bootstrap's g-3 gutter (16px), and Next Best Actions came out 389 against
       a 385 Team Workload — exactly the 4px difference. */
    --exec-pair-gap:              1rem;
    /* Home list cards cap and scroll rather than stretch. A workspace with 50
       people must not produce a 50-row "My Team" card and a page that scrolls
       for a screen and a half. */
    --home-list-max-h:            232px;
    --density-gap:                12px;   /* default grid/card gap */
    --density-gap-tight:          8px;    /* tight grid gap */

    /* ── DS-7.2 … DS-7.10 · the dashboard redesign contract (locked 2026-08-27).
       Three values the redesign needs. Tokens, not literals, so dark mode stays
       a one-session job and a page cannot drift off the grammar. ── */
    --metric-tile-min-h:         62px;   /* DS-7.2 metric tile floor — a tile is
                                            never shorter than label+value+sub */
    --quiet-strip-h:             28px;   /* DS-7.4 the one-line strip that zero-
                                            valued metrics collapse into */
    --synq-line-pad-y:            7px;   /* DS-8.10 the Synq line's tight rows */
    /* DS-9.1 — the figure band's cell floor. It was a fixed 64px HEIGHT, which
       is shorter than label + value + sub at DS-1 sizes, so the third line was
       clipped inside the box on every dashboard (founder, 2026-09-04). A FLOOR,
       never a height: a two-line sub grows the cell instead of losing a line. */
    --dash-strip-cell-h:         78px;
    --card-head-h:               36px;   /* every dashboard card head is the same
                                            height, so heads line up across
                                            columns whether or not the card has
                                            an action link on the right */
    --signal-row-h:              50px;   /* one Actionable-Inbox / NBA row: title
                                            line + meta line at 13px/10px. FIVE fit
                                            before the list scrolls. This is a fixed
                                            HEIGHT, not a floor — see components.css */
    --synq-wash:              #fdf4ff;   /* DS-8.10 the line's ground — distinct
                                            from the indigo used for FACTS, so
                                            "written" reads apart from "measured" */
    --synq-wash-border:       #f5d0fe;

    /* ── Synq Platinum Compact (founder approved canvas 5UGUqkAh rev 2, 22 Oct 2026).
       The in-app Platinum palette, first used by every Synq surface
       (static/css/synq_platinum.css). Graphite + silver hairlines + one soft
       shadow; the brand --primary stays the one action colour (white-label). ── */
    --pt-graphite:            #15171c;   /* text, the Synq mark, counts           */
    --pt-text-2:              #4b5160;   /* row sentences                          */
    --pt-meta:                #6b7280;   /* scope, timestamps, trust — ≥4.5:1     */
    --pt-line:                #e6e8ec;   /* card hairline                          */
    --pt-line-soft:           #eef0f3;   /* dividers inside a card                 */
    --pt-line-strong:         #cdd1d8;   /* hover hairline                         */
    --pt-fill:                #f3f4f6;   /* active tab, neutral icon tile          */
    --pt-hover:               #f7f8fa;   /* row hover                              */
    --pt-subtle:              #fafafb;   /* open-row header, doc box               */
    --pt-shadow-card:         0 1px 2px rgba(16, 24, 40, .04), 0 12px 32px -18px rgba(16, 24, 40, .18);
    --pt-shadow-lift:         0 1px 2px rgba(16, 24, 40, .05), 0 10px 24px -14px rgba(16, 24, 40, .22);
    --pt-shadow-pop:          0 12px 32px -8px rgba(16, 24, 40, .22), 0 2px 6px rgba(16, 24, 40, .06);
    --synq-dot:               #d946ef;   /* the magenta dot on the Synq mark       */
    --synq-line-tint:         #fbf8fc;   /* the model-written line's ground        */
    --synq-line-edge:         #f3e8f7;
    --synq-line-ink:          #3b1f47;
    --synq-label:             #a21caf;   /* the "Synq" word on a line              */
}

/*
 * Respect reduced-motion (R1 compliance).
 * When the user's OS prefers reduced motion: clamp every motion token to
 * 0ms so any `transition:` / `animation:` consuming these variables
 * becomes instant, and disable non-essential keyframe animations.
 */
@media (prefers-reduced-motion: reduce) {
    :root {
        --duration-instant: 0ms;
        --duration-fast:    0ms;
        --duration-normal:  0ms;
        --duration-slow:    0ms;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}
