/* AI:DA design system 2.0 — tokens.
 *
 * THIS FILE IS THE SOURCE OF TRUTH. tokens.json is generated from the first
 * :root block below (`node checks/tokens.mjs --write`); never edit the JSON by
 * hand.
 *
 * 2.0 keeps every 1.x name (principle 10) and changes values only where
 * CHANGELOG.md says why. What is new is marked NEW.
 *
 * The palette is palette v2 from the canvas («ветка 1.2»). Its sun, mane and
 * sun-mid sit outside sRGB, so the values here are the strongest ones sRGB can
 * show, and the vivid originals return for wide-gamut (P3) screens in the block
 * at the end. Contrast below is computed from the sRGB values.
 *
 * The sun is used at full strength as a FILL, with dark text on it — 11.2:1.
 */

:root {
  /* ── Surfaces ────────────────────────────────────────────────────────── */
  --paper: #ffffff;                  /* the page. Not off-white, not grey.   */
  --ink: oklch(0.19 0.005 80);       /* also a fill: dark plaque, white text */
  --sun: oklch(0.84 0.171 88);       /* the brand. A FILL. Never a letter.   */
  --mane: oklch(0.70 0.164 60);      /* the deeper sun — second dot, hover   */
                                     /* fill of the sun button. Never text.  */

  /* ── Letters — the only colours text is ever allowed to be ───────────── */
  --on-dark: #ffffff;                /* 18.5:1 on ink                        */
  --on-sun: var(--ink);              /* 11.2:1 on a sun fill                 */
  /* ink itself (18.5:1) is the ordinary text colour */
  --ink-2: oklch(0.48 0.006 80);     /*  6.5:1 — secondary text              */
  --ink-3: oklch(0.56 0.006 80);     /*  4.7:1 — 13px captions, the floor.   */
                                     /*  On paper only: 4.1–4.4:1 on fills.  */
  --alarm: oklch(0.54 0.205 27);     /*  5.6:1 — overdue, destructive,       */
                                     /*  critical. The only escalation.      */

  /* ── Lines and indicators ────────────────────────────────────────────── */
  --rule: oklch(0.92 0.004 85);      /* the hairline between rows. 1.3:1 —   */
                                     /* decoration, never a control's edge. */
  --line-control: oklch(0.66 0.005 80); /* NEW. 3.1:1 — the edge of a field,  */
                                     /* select, checkbox, switch, drop zone  */
                                     /* (WCAG 1.4.11 non-text contrast).     */
  --sun-mid: oklch(0.64 0.135 75);   /*  3.4:1 — bars and marks, never text  */
  --rule-on-dark: oklch(0.36 0.005 80); /* NEW. the hairline on an ink band or */
                                     /* slide; decoration, like --rule.      */

  /* ── Named states that used to be hard-coded in components.css ───────── */
  --ink-hover: oklch(0.28 0.005 80); /* NEW. hover of the ink button, 14.6:1 */
  --scrim: oklch(0.19 0.005 80 / 0.45); /* NEW. behind a modal               */

  /* ── Data — charts, heat maps, risk levels. Never interface chrome. ──── */
  /* NEW. One sequential scale on the ink hue, light to dark. The top of the
     scale is not a sixth grey: it is --alarm, the one escalation there is.
     Text on steps 1–4 is ink, on step 5 and on alarm it is white.          */
  --data-1: oklch(0.95 0.005 80);    /* ink on it 16.0:1                     */
  --data-2: oklch(0.87 0.005 80);    /* ink on it 12.5:1                     */
  --data-3: oklch(0.76 0.005 80);    /* ink on it  8.6:1                     */
  --data-4: oklch(0.60 0.005 80);    /* ink on it  4.7:1                     */
  --data-5: oklch(0.42 0.005 80);    /* white on it 8.5:1                    */
  /* Series in a chart, in this order, four at most: ink, sun, mane,
     data-3. A fifth series is a table, not a fifth colour.                 */
  --series-1: var(--ink);
  --series-2: var(--sun);
  --series-3: var(--mane);
  --series-4: var(--data-3);

  /* ── Type ────────────────────────────────────────────────────────────── */
  --font: 'Onest', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Geologica', system-ui, -apple-system, 'Segoe UI', sans-serif;

  /* The interface scale. A size that is not on it is a decision someone
     has to defend. Unchanged from 1.x.                                     */
  --text-caps: 11px;   /* uppercase labels, with --tracking-caps            */
  --text-xs: 12px;     /* status, meta                                      */
  --text-s: 13px;      /* captions — the smallest size --ink-3 is legal at   */
  --text-m: 14px;      /* interface default                                 */
  --text-l: 15px;      /* reading text, lead paragraphs                     */
  --text-title: 25px;  /* row and card titles                               */
  --text-display: 44px;/* numbers in the header tiles                       */
  --text-hero: 58px;   /* page title                                        */

  /* NEW. Marketing pages only: the one step above hero. The landing
     mock-ups went to 76–84px with the wordmark's tracking because the scale
     stopped at 58; this is that size, on the heading tracking.             */
  --text-display-xl: clamp(40px, 5.2vw, 76px);
  --text-lead-xl: 18px;              /* NEW. the sentence under that heading */

  /* NEW. Print (certificates, reports, PDF from the backend). In points.   */
  --print-caps: 7.5pt;
  --print-body: 10pt;
  --print-title: 16pt;
  --print-hero: 30pt;

  /* NEW. Frames at 1920×1080 — slides and video. In pixels of that frame.  */
  --frame-caps: 22px;
  --frame-body: 34px;
  --frame-title: 56px;
  --frame-hero: 128px;
  --frame-number: 220px;

  /* Display type is set tight; text type is not. */
  --tracking-hero: -0.045em;
  --tracking-display: -0.04em;
  --tracking-title: -0.025em;
  --tracking-mark: -0.05em;   /* the wordmark only — never a heading         */
  --tracking-caps: 0.12em;

  --leading-hero: 0.95;
  --leading-title: 1.15;
  --leading-text: 1.55;

  /* ── Space — NEW. Tailwind's 4px steps, with Tailwind's names ─────────── */
  /* For everything that is not Tailwind: PDF certificates, HyperFrames,
     e-mail, hand-written CSS. Same numbers, so both agree.                 */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-24: 96px;
  --space-32: 128px;

  /* ── Layout — NEW. Breakpoints live in LAYOUTS.md: 720 / 860 / 1200 ──── */
  --measure: 65ch;            /* running text never wider than this           */
  --container: 1200px;        /* the product page (was .aida-page's number)   */
  --container-wide: 1440px;   /* marketing bands, admin with a sidebar        */
  --gutter: 44px;             /* page side padding on desktop                 */
  --gutter-phone: 16px;       /* and on a phone                               */
  --sidebar: 248px;           /* admin navigation column                      */
  --form: 560px;              /* one form column                              */

  /* ── Shape ───────────────────────────────────────────────────────────── */
  /* Square by default: tiles, fills and rows have no radius. Rounding is for
     things the hand touches, and for circles.                              */
  --radius-0: 0;
  --radius-s: 4px;      /* inputs, buttons, small controls                  */
  --radius-pill: 999px; /* the colon dots, avatars, counters                */

  /* ── Depth ───────────────────────────────────────────────────────────── */
  /* A line carries depth. The one shadow is for what floats over content:
     a menu, a popover, a toast. NEW as a token; it was in the preset.      */
  --float-shadow: 0 8px 24px oklch(0.19 0.005 80 / 0.12);
  --z-sticky: 10;
  --z-modal: 50;
  --z-toast: 60;

  /* ── Focus — NEW as a token; the value is the one buttons already had ── */
  --focus-width: 2px;
  --focus-color: var(--ink);
  --focus-offset: 2px;

  /* ── Motion ──────────────────────────────────────────────────────────── */
  /* Every animation sits behind `motion-safe:` or prefers-reduced-motion.
     Movement is never the only thing carrying a meaning.                   */
  --motion-fast: 120ms;
  --motion: 200ms;
  --motion-slow: 400ms;       /* NEW. counting up, a screen changing          */
  --stagger: 60ms;            /* NEW. between rows entering one after another */
  --ease: cubic-bezier(0.2, 0, 0, 1);   /* no overshoot, ever               */

  /* ── Touch ───────────────────────────────────────────────────────────── */
  --touch-min: 44px;    /* WCAG 2.1 AA target size                          */
}

/* Wide-gamut screens (MacBook, iPhone, most phones since 2020) get the sun
   the canvas was drawn with. sun-mid stays: its canvas value is outside P3
   as well. Contrast barely moves — ink on the P3 sun is 11.2:1 too.        */
@media (color-gamut: p3) {
  :root {
    --sun: oklch(0.84 0.18 88);
    --mane: oklch(0.70 0.185 60);
  }
}
