/* ============================================================================
   ProductAnywhere — design tokens (kimi-k3 build, Phase 1 source of truth)
   ----------------------------------------------------------------------------
   HARD RULE: hex literals and colour functions may exist ONLY in this file,
   inside the :root token blocks below. Everything else in the system consumes
   var(--pa-*). A build gate greps for hex outside this file and fails.

   Two meanings, carried literally:
     hue        = lane     (blue → The Leader · teal → The Expert · purple → The Builder)
     saturation = maturity (step 01 signal → 02 pilot → 03 receipt → 04 proven)

   Light is canonical (paper ground). Dark is a full theme and INVERTS the
   maturity ladder's direction: on a dark ground the deep facets collapse
   below 2.6:1, so step 04 is re-mapped to the lightest tint. Lane hue never
   changes across themes; only the ladder direction does.

   All ratios below are computed (WCAG 2.1), not estimated. Grounds:
   paper #FAFAF9 (light) · ink #0C0F14 (dark).
   ========================================================================== */

/* ---------------------------------------------------------------------------
   LIGHT THEME (canonical) — bare :root
   ------------------------------------------------------------------------- */
:root {
  color-scheme: light;

  /* -- Lane ladders, light direction: step 04 = deepest = most mature --------
     Ratios vs paper / vs ink. "fill only" = never carries text.            */
  --pa-blue-1: #AAC6DF;   /* 01 signal   1.70 / 10.83  fill only            */
  --pa-blue-2: #1073CA;   /* 02 pilot    4.65 /  3.96  body text on paper   */
  --pa-blue-3: #0963B2;   /* 03 receipt  5.85 /  3.14  body text on paper   */
  --pa-blue-4: #053865;   /* 04 proven  11.42 /  1.61  body text on paper   */

  --pa-teal-1: #ABDED8;   /* 01 signal   1.42 / 12.95  fill only            */
  --pa-teal-2: #2DB4A3;   /* 02 pilot    2.46 /  7.47  fill only            */
  --pa-teal-3: #018171;   /* 03 receipt  4.59 /  4.00  body text on paper   */
  --pa-teal-4: #016155;   /* 04 proven   7.07 /  2.60  body text on paper   */
  /* Exact logo teal mid, kept for fills where brand fidelity matters.
     3.66:1 on paper — FAILS AA body. Fill only, never text.                */
  --pa-teal-logo-mid: #019380;

  --pa-purple-1: #BA92DC; /* 01 signal   2.44 /  7.53  fill only            */
  --pa-purple-2: #7F27CC; /* 02 pilot    6.56 /  2.80  body text on paper   */
  --pa-purple-3: #690CBA; /* 03 receipt  8.51 /  2.16  body text on paper   */
  --pa-purple-4: #460A7B; /* 04 proven  12.65 /  1.45  body text on paper   */

  /* -- Primary brand blue: the wordmark colour, identical to the mark's
        mid-blue facet. This value must stay exact.                          */
  --pa-brand: #0A5DB2;    /* 6.24 on paper · white-on-brand 6.52            */
  --pa-on-brand: #FFFFFF;

  /* -- Lane aliases (hue = lane). Resolve through the ladders above, so the
        dark block rethemes them automatically.                              */
  --pa-leader-1: var(--pa-blue-1);
  --pa-leader-2: var(--pa-blue-2);
  --pa-leader-3: var(--pa-blue-3);
  --pa-leader-4: var(--pa-blue-4);
  --pa-expert-1: var(--pa-teal-1);
  --pa-expert-2: var(--pa-teal-2);
  --pa-expert-3: var(--pa-teal-3);
  --pa-expert-4: var(--pa-teal-4);
  --pa-builder-1: var(--pa-purple-1);
  --pa-builder-2: var(--pa-purple-2);
  --pa-builder-3: var(--pa-purple-3);
  --pa-builder-4: var(--pa-purple-4);

  /* -- Neutrals ---------------------------------------------------------- */
  --pa-ground: #FAFAF9;        /* paper — the canonical brand surface       */
  --pa-surface: #FFFFFF;       /* tab planes                                */
  --pa-surface-2: #F3F2EF;     /* recessed steps, inset panels (1.07:1)     */
  --pa-line: #E5E3DE;          /* structural hairlines ONLY — never on tabs */
  --pa-ink: #0C0F14;           /* 18.38 on paper                            */
  --pa-ink-muted: #525B68;     /*  6.58 on paper — AA body                  */
  --pa-ink-faint: #6E7681;     /*  4.40 on paper — LARGE TEXT / decorative  */
                               /*  only. Forbidden for body copy.           */

  /* Text placed on a saturated facet fill (selected chips, facet labels).  */
  --pa-on-facet: #FFFFFF;      /* on blue-3 6.11 · teal-3 4.79 · purple-2 6.85 */

  /* -- Typography --------------------------------------------------------- */
  --pa-font-display: "Montserrat", "Avenir Next", "Century Gothic", Futura, "Segoe UI", system-ui, sans-serif;
  --pa-font-text: "Source Serif 4", "Iowan Old Style", Palatino, Georgia, "Times New Roman", serif;
  --pa-font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --pa-text-eyebrow: 0.8125rem;  /* 13 — mono, uppercase, tracked           */
  --pa-text-small: 0.9375rem;    /* 15                                      */
  --pa-text-body: 1.0625rem;     /* 17                                      */
  --pa-text-lede: 1.3125rem;     /* 21                                      */
  --pa-text-h3: 1.5625rem;       /* 25                                      */
  --pa-text-h2: 1.9375rem;       /* 31                                      */
  --pa-text-h1: 2.4375rem;       /* 39                                      */
  --pa-text-hero: 3.375rem;      /* 54                                      */

  --pa-lh-display: 1.08;
  --pa-lh-head: 1.2;
  --pa-lh-body: 1.65;
  --pa-lh-mono: 1.55;

  --pa-measure: 66ch;            /* long-form prose limit                   */
  --pa-measure-lede: 52ch;

  /* -- Space (8px base), grid, radii, elevation ----------------------------
     Whitespace rhythm, stated as a rule:
       · section block padding  — 96px desktop / 64px ≤768px (never less)
       · tab-to-tab gaps        — 16px minimum, 24px default (ground, not
         borders, separates tabs — the mark uses negative space only)
       · card interior padding  — 24px / 32px hero surfaces
       · prose blocks           — max 66ch, lede 52ch
       · shell                  — max 1120px, 24px page gutter              */
  --pa-space-half: 0.25rem;  /* 4   */
  --pa-space-1: 0.5rem;      /* 8   */
  --pa-space-2: 1rem;        /* 16  */
  --pa-space-3: 1.5rem;      /* 24  */
  --pa-space-4: 2rem;        /* 32  */
  --pa-space-6: 3rem;        /* 48  */
  --pa-space-8: 4rem;        /* 64  */
  --pa-space-12: 6rem;       /* 96  */
  --pa-space-16: 8rem;       /* 128 */

  --pa-shell: 70rem;             /* 1120px max content width                */
  --pa-gutter: 1.5rem;           /* 24px page gutter                        */

  --pa-radius-tab: 0.625rem; /* 10 — the tab plane                          */
  --pa-radius-facet: 0.125rem; /* 2 — facet chips (machined, near-square)   */
  --pa-radius-pill: 999px;     /* availability chip, filter control         */

  --pa-elev-tab: 0 1px 2px rgb(12 15 20 / 0.04), 0 8px 24px rgb(12 15 20 / 0.06);
  --pa-elev-tab-hover: 0 2px 4px rgb(12 15 20 / 0.05), 0 16px 40px rgb(12 15 20 / 0.09);

  /* -- Motion ------------------------------------------------------------- */
  --pa-dur-fast: 160ms;
  --pa-dur: 200ms;
  --pa-ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  /* -- Focus -------------------------------------------------------------- */
  --pa-focus-width: 2px;
  --pa-focus-offset: 2px;
}

/* ---------------------------------------------------------------------------
   DARK THEME — supported, never default.
   The maturity ladder INVERTS: step 04 (proven) is re-mapped to the lightest
   tint, because the deep facets collapse below 2.6:1 on a dark ground
   (blue-4 1.61 · purple-4 1.45 · teal-4 2.60 vs #0C0F14 — measured).
   Lane hues are unchanged; only ladder direction and neutrals re-theme.
   Dark ladder ratios vs ground #0C0F14, all computed.
   Keep the two selector blocks below byte-identical.
   ------------------------------------------------------------------------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;

    --pa-blue-1: #0D5A9E;   /* 01 signal   2.72  fill only                 */
    --pa-blue-2: #1073CA;   /* 02 pilot    3.96  fill / large text         */
    --pa-blue-3: #5FA5E0;   /* 03 receipt  7.26  body text                 */
    --pa-blue-4: #AAC6DF;   /* 04 proven  10.83  body text                 */

    --pa-teal-1: #016155;   /* 01 signal   2.60  fill only                 */
    --pa-teal-2: #018171;   /* 02 pilot    4.00  fill / large text         */
    --pa-teal-3: #2DB4A3;   /* 03 receipt  7.47  body text                 */
    --pa-teal-4: #ABDED8;   /* 04 proven  12.95  body text                 */
    --pa-teal-logo-mid: #019380; /* 5.01 on ink ground — fill only, still  */

    --pa-purple-1: #6A1BC0; /* 01 signal   2.31  fill only                 */
    --pa-purple-2: #8327CC; /* 02 pilot    2.86  fill only                 */
    --pa-purple-3: #A35FE0; /* 03 receipt  4.82  body text                 */
    --pa-purple-4: #BC92DC; /* 04 proven   7.57  body text                 */

    --pa-brand: #5FA5E0;    /* brand blue lifted to a dark-safe step (7.26) */
    --pa-on-brand: #0C0F14;

    --pa-ground: #0C0F14;        /* ink — the dark ground                  */
    --pa-surface: #131820;       /* 1.08 step above ground                 */
    --pa-surface-2: #1A212B;     /* 1.18 — recessed steps                  */
    --pa-line: #26303C;          /* structural hairlines only              */
    --pa-ink: #E9ECF0;           /* 16.20 on ground                        */
    --pa-ink-muted: #A3ACB9;     /*  8.37 on ground — AA body              */
    --pa-ink-faint: #6E7681;     /* decorative only on dark (3.66)         */

    --pa-on-facet: #0C0F14;      /* ink on tint fills: 10.83 / 12.95 / 7.53 */

    --pa-elev-tab: none;         /* dark separates by surface steps,       */
    --pa-elev-tab-hover: none;   /* never by shadow                        */
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --pa-blue-1: #0D5A9E;
  --pa-blue-2: #1073CA;
  --pa-blue-3: #5FA5E0;
  --pa-blue-4: #AAC6DF;

  --pa-teal-1: #016155;
  --pa-teal-2: #018171;
  --pa-teal-3: #2DB4A3;
  --pa-teal-4: #ABDED8;
  --pa-teal-logo-mid: #019380;

  --pa-purple-1: #6A1BC0;
  --pa-purple-2: #8327CC;
  --pa-purple-3: #A35FE0;
  --pa-purple-4: #BC92DC;

  --pa-brand: #5FA5E0;
  --pa-on-brand: #0C0F14;

  --pa-ground: #0C0F14;
  --pa-surface: #131820;
  --pa-surface-2: #1A212B;
  --pa-line: #26303C;
  --pa-ink: #E9ECF0;
  --pa-ink-muted: #A3ACB9;
  --pa-ink-faint: #6E7681;

  --pa-on-facet: #0C0F14;

  --pa-elev-tab: none;
  --pa-elev-tab-hover: none;
}
