/* ============================================================================
   GOBIMANS Client-Ops — DESIGN TOKENS (single source of truth)
   ----------------------------------------------------------------------------
   The machine-readable spine of the CRM's look. Everything visual references a
   token from here; styles.css holds only component rules. To re-skin the whole
   app, you edit this file and nothing else.

   Loaded BEFORE styles.css (see index.html) so every rule inherits these vars.

   Why plain CSS custom properties and not a Style-Dictionary / W3C-JSON build:
   the app is vanilla, no bundler, no build step. CSS vars give us the same
   "one source, machine-readable, swap-to-reskin" contract at this scale without
   adding a toolchain. (Per the no-overengineering rule — solutions to real size.)

   LOCKED by brand: the colour roles (ultramarine / terracotta / orange on honest
   cool-white + coal) AND the type family — Geologica, decided by Andrei 25.07.2026
   (GOBIMANS-332, closing the GOBIMANS-182 hold). Этот файл — единственный источник
   правды по шрифту: AGENTS.md ссылается сюда, а не повторяет. Менять семейство —
   значит менять --font-ui ниже, остальные шрифтовые токены следуют за ним.
   Structure below the colour roles — spacing, radii, elevation, the type scale —
   is free to evolve.
   ============================================================================ */

:root {
  --content-max: none;   /* полная ширина экрана; вернуть 1100px — одна строка */
  /* Honest cool neutrals — no warm cream, no pure #fff/#000. --ink carries the ultramarine hue
     (coal-ultramarine #14122A) so it doubles as both body text and the rail/topbar surface —
     De Stijl logic: white + coal carry the structure, ultramarine/terracotta/orange are the POV. */
  /* GOBIMANS-326: был чистый #ffffff — вопреки строке комментария прямо над ним и правилу в
     AGENTS.md. Теперь холодный белый в тон бренда: OKLCH L 0.99 · C 0.005 · H 285 — это тот же
     оттенок, что у --ink (#14122a → H 285.1), взятый почти без насыщенности.
     Контраст проверен, AA держится: --muted 5.01:1 (было 5.17), --ink-2 8.19, --bronze-ink 5.21.
     Фон QR (--qr-bg) остаётся литеральным #ffffff — там белый нужен для сканера, а не для глаза. */
  --surface:    #fbfbff;   /* card surfaces — cold white, ultramarine-tinted */
  --parch:      #efefef;   /* page canvas (neutral light gray) */
  --parch-2:    #f5f5f5;   /* alt surface / inset / column background */
  --parch-3:    #e8e8e8;   /* stronger inset / divider */
  --ink:        #14122a;   /* coal-ultramarine — text + rail/topbar surface + primary button. GOBIMANS-182. */
  --ink-2:      #4d4d4d;   /* secondary text, body emphasis */
  --muted:      #6d6d6d;   /* darkened for AA >4.5:1 on white */
  --line:       #e2e2e2;   /* border */
  --line-soft:  #ededed;
  --bronze:     #ff682c;   /* PRIMARY accent — Signal Orange (active/focus/marks, NOT button bg) */
  --bronze-2:   #ff7d47;   /* on-dark accent — lighter orange */
  /* --bronze on white is ~2.9:1 — fails the 3:1 UI-component-contrast floor for a focus
     ring (WCAG 2.2 SC 1.4.11). A touch darker clears it while staying visibly "the orange"
     and still reads fine on the dark rail. GOBIMANS-195. */
  --focus-ring: color-mix(in oklch, var(--bronze) 85%, black);
  --bronze-ink: #816729;   /* Sienna Bronze — muted brand tone for headings/links/marks */
  --terra:      #c4633b;   /* terracotta — secondary accent (kept, Andrei's) */
  --orange:     #ff682c;

  /* Client-portal QR (GOBIMANS-144). Literal, NOT var(--ink) — --ink flips light in dark mode,
     which would kill contrast. A QR needs a light quiet zone + dark modules to scan in either
     theme; this is coal-ultramarine (brand dark), not pure #000. */
  --qr-fg:      #14122a;
  --qr-bg:      #ffffff;

  /* status — backlog · brief · production · review · approval · done */
  --s-backlog:  oklch(0.60 0.025 265);
  /* W3 retired the «В брифе» column, but this token is NOT the column's: TAG_COLORS borrows it as
     one of six tag hues and .ctr-badge--renewing paints renewing contracts with it. Deleting it
     with the status would have taken two unrelated features down. It also still paints the retired
     status wherever the journal shows it. */
  --s-brief:    oklch(0.56 0.15 264);
  --s-prod:     oklch(0.70 0.16 58);
  --s-review:   oklch(0.55 0.15 300);
  --s-appr:     oklch(0.58 0.15 38);
  --s-done:     oklch(0.55 0.13 150);
  --s-none:     oklch(0.74 0.018 265);

  /* Chain-progress segment that has NOT been reached yet (GOBIMANS-401, audit 6.21). It used to be
     var(--line) at opacity .55 — 1,15:1 on the card, so «цепочка на 1 из 5» and «цепочка готова»
     looked the same, and at 4× zoom the bar read as one solid strip. A pending segment is a real
     part of the picture, not a hairline: it gets its own token and clears ~3:1 in both themes. */
  --chain-pending: #8e8ea0;

  /* urgency / priority — A hot(red)/B warn(amber) already existed; C ("understood") had no
     dedicated colour and fell back to the near-invisible --s-none grey (GOBIMANS-252). A calm
     cool teal reads clearly as "no rush" without clashing with any existing status/urgency hue
     (27 hot, 58-64 warn/prod, 150 done, 264 brief, 300 review, 38 approval). */
  --u-hot:      oklch(0.55 0.20 27);
  --u-warn:     oklch(0.72 0.16 60);
  --u-ok:       oklch(0.62 0.09 200);

  /* ── Tinted status surfaces (GOBIMANS-336, audit slice 2 S2-2) ──────────
     The pale plaques behind overdue tags, "stuck"/"silent" age chips, journal
     icons and access tags. These were 20 bare hex literals in styles.css, so
     the dark theme could not reach them: it overrides tokens, and there was no
     token to override — the plaques stayed light and glowed on a dark page.

     Three families, not twenty values. The old set carried two near-identical
     ambers (#F6ECD8/#FDEFD6, borders #E7D2A8/#F0D9A8, ink #95661F/#9A6400);
     that was drift, not intent, so they collapse into one warn family.

     Dark is not the light tint dimmed. A tinted plaque needs a dark surface of
     the same hue and a LIGHTER ink than the light theme uses: --u-hot and
     --s-done sit at L=0.55, which reads fine on a pale plaque and badly on a
     dark one, so the dark inks step up to ~L=0.80. */
  --tint-bad-bg:    #F6E4E1;
  --tint-bad-line:  #E6C3BD;
  --tint-bad-ink:   var(--u-hot);
  --tint-warn-bg:   #F6ECD8;
  --tint-warn-line: #E7D2A8;
  --tint-warn-ink:  #95661F;
  --tint-ok-bg:     #E7F0E7;
  --tint-ok-line:   #CADCC9;
  --tint-ok-ink:    var(--s-done);

  /* ── Structural scale system ────────────────────────────────────────────
     A real design-system spine, tuned to GOBIMANS values. 4px spacing ladder,
     a radii ramp, and a 5-tier elevation ramp — every shadow tinted to the
     ultramarine hue so depth reads as the brand, never a generic grey drop.
     De Stijl logic holds: structural planes stay flat (border + whisper-lift);
     only things that genuinely float earn real elevation. */
  --sp-1:  4px;  --sp-2:  8px;  --sp-3: 12px; --sp-4: 16px; --sp-5: 20px;
  --sp-6: 24px;  --sp-8: 32px;  --sp-10: 40px; --sp-12: 48px; --sp-16: 64px; --sp-20: 80px;

  --r-xs:    4px;
  --r-sm:    6px;
  --r-md:    8px;     /* cards + inputs */
  --r-lg:    16px;
  --r-full:  9999px;
  --r-pill:  999px;   /* buttons / tags — pill */
  --radius:    var(--r-md);    /* back-compat aliases — existing rules keep working */
  --radius-sm: var(--r-sm);

  /* elevation ramp — resting < hover/menu < modal/popover < toast < dragging */
  --e-1:    0 1px 2px rgba(32,32,32,.04);
  --e-2:    0 1px 3px rgba(32,32,32,.04), 0 4px 12px rgba(32,32,32,.03);
  --e-3:    0 2px 6px rgba(32,32,32,.06), 0 16px 40px rgba(32,32,32,.08);
  --e-4:    0 4px 10px rgba(32,32,32,.08), 0 24px 60px rgba(32,32,32,.10);
  --e-drag: 0 10px 24px rgba(32,32,32,.14), 0 2px 6px rgba(32,32,32,.10);
  --shadow: var(--e-2);        /* legacy alias → hover / menu tier */
  --topbar-h:  54px;
  /* GOBIMANS-199: was a magic number in .kanban's min-height calc — chrome above/below the board
     (filter strip, paddings) not covered by --topbar-h.
     GOBIMANS-401: 188 → 132. Two of the strips it accounted for are gone — the status-proportion
     bar (audit 4.6) and the separate tab band, now folded into the project-header row (audit 4.7). */
  --kanban-chrome: 132px;

  /* motion — ease-out only, short durations (product register) */
  --ease:       cubic-bezier(.22, 1, .36, 1);   /* ease-out-quint */
  --t-fast:     120ms;
  --t-base:     200ms;
}

/* ---------------------------------------------------------------------------
   Dark theme (GOBIMANS-94) — manual toggle (menu + localStorage), not
   prefers-color-scheme. Same coal-ultramarine hue family, inverted for
   content surfaces; the rail/topbar stay their own fixed dark regardless
   (see .rail/.topstrip in styles.css) — only the canvas/cards/text invert.
   Status/accent hues (--s-*, --bronze, --terra, --orange) are left as-is;
   every component that tints against a neutral already reads var(--surface)/
   var(--ink) instead of hardcoded white/black, so they invert correctly too.
   --------------------------------------------------------------------------- */
:root[data-theme="dark"] {
  /* GOBIMANS-401 (audit 6.24): the three planes used to differ on the edge of the threshold —
     page #14122a / column #1a1830 / card #211f38, i.e. 1,05:1 column-over-page and 1,09:1
     card-over-column. The board read as one dark sheet with text on it; cards were not objects.
     The page stays the brand coal (--ink's own colour) and the two surfaces above it step up
     instead: column 1,13:1 over the page, card 1,25:1 over the column, 1,42:1 over the page.
     The borders carry the rest of the separation — they were darker than the card they outlined
     (#2a2748 on #211f38), so a card edge was invisible; now the hairline reads at 1,8:1.
     --muted follows the lighter card so secondary text keeps AA on it (5,0:1, was 4,2:1 on the
     new surface / 5,3:1 on the old darker one). */
  --surface:    #302c58;
  --parch:      #14122a;
  --parch-2:    #201d3c;
  --parch-3:    #3b3568;
  --ink:        #f1eff8;
  --ink-2:      #c9c6d9;
  --muted:      #a29dc2;
  --line:       #565093;
  --line-soft:  #423c73;
  /* GOBIMANS-401 (audit 4.2 / 2.9): --bronze-ink had no dark value at all, so the light-theme
     olive #816729 sat on a dark card at 2,71:1 — below the 3:1 floor for the type badge on the
     portal and for every heading/link/mark that uses it here. Same hue (42°), lifted to read on
     dark: 6,9:1 on a card. This is the token fix the portal's local override waits on. */
  --bronze-ink: #d5ba7b;
  /* Pending chain segment, dark half — see the light value above. 3,1:1 on a dark card. */
  --chain-pending: #7c74ad;

  /* GOBIMANS-336: the tinted status plaques, dark half. Same three hues as the light
     set (27 hot, 75 amber, 150 done), carried by a dark surface instead of a pale one,
     with the ink stepped up to stay legible on it. */
  --tint-bad-bg:    oklch(0.30 0.06 27);
  --tint-bad-line:  oklch(0.40 0.08 27);
  --tint-bad-ink:   oklch(0.80 0.12 27);
  --tint-warn-bg:   oklch(0.30 0.05 75);
  --tint-warn-line: oklch(0.40 0.07 75);
  --tint-warn-ink:  oklch(0.83 0.11 75);
  --tint-ok-bg:     oklch(0.30 0.05 150);
  --tint-ok-line:   oklch(0.40 0.07 150);
  --tint-ok-ink:    oklch(0.80 0.12 150);
}

/* Type system — ONE Cyrillic-capable family carries the whole product UI (headings, labels,
   body, numbers); hierarchy comes from weight + tracking, not a second face. Bricolage
   Grotesque (Latin-only — it has NO Cyrillic) is kept STRICTLY for the GOBIMANS wordmark logo.
   Swap --font-ui to retypeset the entire app. */
:root {
  --font-ui:      "Geologica", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  /* GOBIMANS-325: Space Grotesk убран и из этой строки, и из запроса к Google Fonts.
     Находка S3-4 говорила «грузится и не используется» — это верно для styles.css, но
     НЕ для токенов: семейство стояло здесь первым, а --font-display висит на 25 правилах,
     включая .eh__name (H1 проекта). У Space Grotesk нет кириллицы, поэтому русский заголовок
     «Nebessa — июль 2026» и так распадался: латиница шла одним шрифтом, кириллица падала на
     Inter — посреди одной строки. Убрать семейство из запроса, не тронув токен, значило бы
     оставить это как есть.
     Дисплейное начертание теперь берёт ту же семью, что и весь интерфейс — ровно то, что
     обещает комментарий выше («ONE Cyrillic-capable family carries the whole product UI»),
     и то, что даёт --font-ui как единственную ручку для смены шрифта целиком. */
  --font-display: var(--font-ui);
  /* GOBIMANS-332: цифры больше не называют семью отдельно — иначе смена --font-ui перестаёт
     перетипографировать продукт целиком, ровно как это случилось со Space Grotesk (GOBIMANS-325).
     Табличные цифры включает font-variant-numeric ниже, а не отдельный шрифт. */
  --font-num:     var(--font-ui);
  --font-logo:    "Bricolage Grotesque", var(--font-ui);   /* GOBIMANS wordmark stays */
  /* optical tracking ramp — larger type sets tighter */
  --tk-display: -0.022em;
  --tk-head:    -0.013em;
  --tk-tight:   -0.006em;
  /* type scale — weight + tracking carry hierarchy (GOBIMANS-332: шкала снята с Geologica) */
  --fs-display:  33px;
  --fs-h1:       28px;
  --fs-h2:       24px;
  --fs-h3:       18px;
  --fs-body-lg:  16px;
  --fs-body:     15px;
  --fs-sm:       14px;
  --fs-caption:  12.5px;
  --fs-overline: 11px;
}
