/*
 * aisquare-pretty — token TEMPLATE
 *
 * This file is OPT-IN. Consumers do NOT have to import it. If your app already
 * has its own CSS variables for colors / radius (it does — both creator-studio
 * and ai-studio do), keep them. The library reads from `--primary`, `--radius`,
 * etc. via the Tailwind preset — whatever values your app sets, the primitives
 * inherit.
 *
 * The PRIMITIVE tier (color ramps 50→950, spacing, radius, motion, grid,
 * elevation) lives in `foundations.css` / the preset's
 * `foundationTokensPlugin` — the semantic tokens below are the mode-aware
 * layer on top of it. The `≈ <ramp>-<step>` comments tie each status value
 * to its nearest ramp anchor: the semantics keep their historical ROUNDED
 * triplets while the ramps carry Tailwind's decimals, so the pairs differ by
 * ≤1 RGB point per channel — visually identical, but NOT literally equal.
 * Do not "dedupe" a semantic token to `hsl(var(--<ramp>-500))`; that ships a
 * real (if invisible) color change. Only `--primary`/`--ring` = `navy-900`
 * and `--accent` = `accent-500` are exact.
 *
 * Use this file only if:
 *   1. You're starting a new consumer app from scratch, OR
 *   2. You want to align with the library's recommended defaults.
 *
 * Drop into your app:
 *   @import "@aisquare/pretty/tokens.template.css";
 *
 * Or just copy the variables into your own index.css and adjust values.
 */

@layer base {
  :root {
    /* Radius — 12px base (AISquare canonical) */
    --radius: 12px;

    /* Color — HSL triplets, no commas (Tailwind reads them through the preset) */
    --background: 0 0% 100%;
    --foreground: 213 80% 13%; /* #071E3C */

    --card: 0 0% 100%;
    --card-foreground: 213 80% 13%;

    --popover: 0 0% 100%;
    --popover-foreground: 213 80% 13%;

    --primary: 213 80% 13%; /* = navy-900 — brand navy #071E3C */
    --primary-foreground: 0 0% 100%;

    --secondary: 210 40% 96%;
    --secondary-foreground: 213 80% 13%;

    --muted: 210 40% 96%; /* ≈ slate-100 */
    --muted-foreground: 215 16% 47%; /* ≈ slate-500 */

    --accent: 213 100% 56%; /* = accent-500 — brand blue #1F84FF */
    --accent-foreground: 0 0% 100%;

    --destructive: 0 84% 60%; /* ≈ red-500 */
    --destructive-foreground: 0 0% 100%;

    /* Semantic state colors — replaces literal `bg-emerald-500` / `bg-amber-500`
       in Badge / Avatar / status-pill primitives. Each is HSL triplet so the
       `bg-success/15` opacity syntax + dark-mode overrides + per-studio
       retinting all work. Calibrated for legibility at /10 fill + /30 border. */
    --success: 142 71% 45%;     /* ≈ green-500 — accessible on light bg */
    --success-foreground: 0 0% 100%;
    --warning: 38 92% 50%;      /* ≈ amber-500 — warm */
    --warning-foreground: 38 75% 12%;
    --info:    199 89% 48%;     /* ≈ sky-500 — distinct from --accent */
    --info-foreground: 0 0% 100%;
    --premium: 38 92% 50%;      /* ≈ amber-500 — warm gold for paid-tier badges */
    --premium-foreground: 38 25% 12%;

    --border: 214 32% 91%; /* ≈ slate-200 */
    --input: 214 32% 91%;  /* ≈ slate-200 */
    --ring: 213 80% 13%;   /* = navy-900 */

    /* Glow shadow scale — auras of increasing intensity. Pair with hover/focus
       and with the `pulse-glow` keyframe for AI-active states. Override per
       studio to retint. */
    --shadow-glow-sm: 0 4px 12px hsl(var(--accent) / 0.15);
    --shadow-glow: 0 8px 24px hsl(var(--accent) / 0.20);
    --shadow-glow-lg: 0 12px 36px hsl(var(--accent) / 0.28);
    --shadow-glow-xl: 0 20px 60px hsl(var(--accent) / 0.36);
    --shadow-glow-aurora:
      0 0 0 1px hsl(var(--accent) / 0.12),
      0 8px 24px hsl(var(--accent) / 0.24),
      0 24px 80px hsl(var(--primary) / 0.18);

    /* Elevation "pop" — a wide, soft lift a rung above `--aiko-shadow`, for
       floating read-only surfaces (HoverCard). Consumed via `shadow-pop`. */
    --shadow-pop: 0 30px 60px rgba(10, 37, 64, 0.18);

    /* Hairline divider colors (raw values). `border-hairline` /
       `border-hairline-strong` (also `bg-`/`text-`). */
    --hairline: #e1e7ef;
    --hairline-strong: #c7cfdb;

    /* Mesh / aurora gradient stops — used by `bg-mesh-aurora` and
       `bg-mesh-prism` utilities. Override these to retint per studio without
       editing the preset. */
    --mesh-1: var(--accent);
    --mesh-2: var(--primary);
    --mesh-3: var(--accent);

    /* Mood-lighting field/glow — the contract <MoodLighting> reads (the
       ambient gradient field + cursor glow behind hero / empty / onboarding /
       preview-stage moments). All values reference brand tokens BY NAME so the
       field follows whatever hue the consuming app derives — no raw hex here.

       `--mood-field-1` / `--mood-field-2` are the two drifting blob colors (low
       alpha, barely-there); `--mood-glow` is the cursor-glow color.

       `--mood-stage-bg` is the FIXED dark ink mat for `tone="stage"`. It is a
       literal dark triplet (`213 80% 13%` → navy #071E3C, the value
       --primary/--foreground hold in LIGHT mode), NOT `hsl(var(--foreground))`,
       because --foreground flips light under `.dark` and the stage must stay a
       dark mat in BOTH modes (it is a local dark backdrop, not a theme switch).
       `--mood-stage-glow` is the higher-alpha accent radial that glows against
       that dark mat.

       NOTE on the accent hue: the consuming app's `--accent` value is owned by
       unified Steel #43, which flags that `--forest` is *named* green but
       *paints* blue, and Brain #103 independently calls the accent forest-green
       — those two disagree. This primitive does NOT hardcode either; it
       references `--accent` by name, so whichever hue #43/#103 lands flows
       through automatically. (This #43 is the unified Steel-tokens issue — it
       is unrelated to the `aisquare-pretty#43` reduced-motion gap report cited
       in the preset's reduced-motion guard comment.) */
    --mood-field-1: hsl(var(--accent) / 0.07);
    --mood-field-2: hsl(var(--primary) / 0.045);
    --mood-glow: hsl(var(--accent) / 0.5);
    --mood-stage-bg: 213 80% 13%; /* fixed dark ink mat — dark in both modes */
    --mood-stage-glow: hsl(var(--accent) / 0.4);

    /* Surface treatments — composed by future Backdrop / Glass primitives.
       Each is an HSLA triplet (no commas, including alpha as a fourth slot). */
    --surface-glass-bg: var(--background);
    --surface-glass-alpha: 0.6; /* used inside hsl(var(--surface-glass-bg) / var(--surface-glass-alpha)) */
    --surface-glass-border: var(--border);
    --surface-glass-blur: 12px;

    /* Aiko brand surface — soft pastel paper, plus the three intrusion-level
       accents (whisper / nudge / intervene). Override per-studio if your
       brand wants to retint Aiko. The mark itself reads `--primary` for its
       container ink, so retinting --primary retints Aiko's hex too.

       Calibrated for blue/white brands: the paper is almost-white with just
       a hint of warmth, so it reads as a "sibling of card" rather than its
       own brand surface. The breathing AikoMark + accent border carry the
       "this is Aiko" signal. */
    --aiko-paper: 30 25% 98.5%; /* near-white with a barely-there warm tint */
    --aiko-spark: 76 55% 70%;   /* Whisper · silent presence (pastel sage) */
    --aiko-warm:  33 70% 72%;   /* Nudge · soft suggestion (pastel amber) */
    --aiko-hot:   9 68% 70%;    /* Intervene · active help (pastel coral) */

    /* Diff / review-preview surface — insertion and deletion colors plus
       pre-mixed soft fills, used by the redline review primitives
       (RedlineSpan, DiffRow). The solid colors carry insertion/deletion
       semantics; the `-bg` variants are tuned for a tinted cell/span fill.
       Insertion reads green (on-brand with --success); deletion reads red
       (on-brand with --destructive). HSL triplets so `bg-ins-bg/60` opacity
       syntax + dark-mode overrides + per-studio retinting all work. */
    --ins:        152 55% 36%;   /* insertion green — solid */
    --ins-bg:     152 60% 92%;   /* insertion soft fill */
    --del:        355 65% 45%;   /* deletion red — solid */
    --del-bg:     355 70% 95%;   /* deletion soft fill */

    /* Type face — ONE brand family (WS-15 typography consolidation;
       supersedes the three-face Onyx+Hex mix #122). Inter is self-hosted via
       Fontsource (OFL); import `@aisquare/ui/tokens/fonts.css` once to load
       the @font-face declarations. `--font-display` survives as a token but
       now resolves to Inter (the display voice is the same family; the
       `opsz` axis differentiates the cut). `--font-mono` is a system stack —
       no shipped mono face. Falls back to the system stack until `fonts.css`
       is imported. */
    --font-sans:
      "Inter Variable", "Inter", ui-sans-serif, system-ui, -apple-system,
      "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-display: var(--font-sans);
    --font-mono:
      ui-monospace, "SF Mono", SFMono-Regular, Menlo, Monaco, Consolas,
      "Liberation Mono", monospace;
  }

  .dark {
    --background: 213 80% 6%;
    --foreground: 0 0% 100%;

    --card: 213 80% 9%;
    --card-foreground: 0 0% 100%;

    --popover: 213 80% 9%;
    --popover-foreground: 0 0% 100%;

    --primary: 0 0% 100%;
    --primary-foreground: 213 80% 13%;

    --secondary: 213 50% 15%;
    --secondary-foreground: 0 0% 100%;

    --muted: 213 50% 15%;
    --muted-foreground: 215 16% 70%;

    --accent: 213 100% 56%;
    --accent-foreground: 0 0% 100%;

    --destructive: 0 70% 50%; /* ≈ red-600 */
    --destructive-foreground: 0 0% 100%;

    /* Dark-mode semantic state colors — slightly desaturated + lifted so
       /10 fills read clearly on a dark background. Foregrounds shift to
       brighter variants for AA contrast on the dark surface. */
    --success: 142 60% 55%; /* ≈ between green-400/500 */
    --success-foreground: 0 0% 100%;
    --warning: 38 80% 60%;  /* ≈ amber-400 */
    --warning-foreground: 38 25% 8%;
    --info:    199 80% 58%; /* ≈ between sky-400/500 */
    --info-foreground: 0 0% 100%;
    --premium: 38 80% 62%;  /* ≈ amber-400 */
    --premium-foreground: 38 25% 8%;

    --border: 213 50% 18%;
    --input: 213 50% 18%;
    --ring: 213 100% 56%;

    /* Dark-mode glow scale — slightly stronger alphas to read through dark surfaces */
    --shadow-glow-sm: 0 4px 12px hsl(var(--accent) / 0.22);
    --shadow-glow: 0 8px 24px hsl(var(--accent) / 0.30);
    --shadow-glow-lg: 0 12px 36px hsl(var(--accent) / 0.40);
    --shadow-glow-xl: 0 20px 60px hsl(var(--accent) / 0.50);
    --shadow-glow-aurora:
      0 0 0 1px hsl(var(--accent) / 0.20),
      0 8px 24px hsl(var(--accent) / 0.36),
      0 24px 80px hsl(var(--primary) / 0.30);

    /* Dark-mode elevation + hairline — shadow deepens to pure black, hairline
       flips to a low-alpha white so it reads on dark surfaces. */
    --shadow-pop: 0 30px 60px rgba(0, 0, 0, 0.55);
    --hairline: rgba(255, 255, 255, 0.1);
    --hairline-strong: rgba(255, 255, 255, 0.16);

    --mesh-1: var(--accent);
    --mesh-2: var(--primary);
    --mesh-3: var(--accent);

    /* Dark-mode mood-lighting — the field/glow track the dark `--accent` /
       `--primary` automatically (slightly higher alpha to read through the
       dark surface). `--mood-stage-bg` stays the SAME fixed dark ink triplet
       as light mode by design: the stage is a fixed dark mat, not a mode
       follower, so it does not change between themes. */
    --mood-field-1: hsl(var(--accent) / 0.10);
    --mood-field-2: hsl(var(--primary) / 0.07);
    --mood-glow: hsl(var(--accent) / 0.55);
    --mood-stage-bg: 213 80% 13%; /* unchanged — fixed dark in both modes */
    --mood-stage-glow: hsl(var(--accent) / 0.45);

    --surface-glass-bg: var(--card);
    --surface-glass-alpha: 0.55;
    --surface-glass-border: var(--border);

    /* Dark-mode Aiko — cool-blue lifted pastel, less yellow than the light
       cream. Sits ~3-4% lighter than `--background` so the helper reads as
       a separate surface without glowing. */
    --aiko-paper: 218 22% 13%;  /* lifted dark with a cool-blue hint */
    --aiko-spark: 76 45% 60%;   /* Whisper — desaturated sage in dark */
    --aiko-warm:  33 60% 64%;   /* Nudge — desaturated amber in dark */
    --aiko-hot:   9 60% 62%;    /* Intervene — desaturated coral in dark */
    --surface-glass-blur: 14px;

    /* Dark-mode diff / review-preview surface — insertion/deletion lose
       saturation and gain lightness so the soft `-bg` fills read as bands
       rather than alarms on a dark background. */
    --ins:        152 60% 55%;
    --ins-bg:     152 50% 18%;
    --del:        355 70% 62%;
    --del-bg:     355 50% 22%;

    /* Dark-mode type face — same single family as light (WS-15). Kept
       declared per-mode so a consumer overriding one mode's stack can't
       accidentally strand the other. */
    --font-sans:
      "Inter Variable", "Inter", ui-sans-serif, system-ui, -apple-system,
      "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-display: var(--font-sans);
    --font-mono:
      ui-monospace, "SF Mono", SFMono-Regular, Menlo, Monaco, Consolas,
      "Liberation Mono", monospace;
  }
}
