/*
 * TelecomSoft design tokens: Figma "Design System" page (node 1:3).
 *
 * Colours are the 22 variables of the "TelecomSoft Colors" collection (mode
 * Dark). Text styles and effects come from the Figma styles; letter spacing
 * is given in Figma as a percentage of the font size and is written here in
 * em (Figma -2 % = -0.02em). Soft fills (badges, pills, chips, tiles) are the
 * colour tokens at the alpha used in Figma, built with color-mix() so they
 * work on any background.
 *
 * App CSS must use these custom properties, never raw hex values.
 */

:root {
  color-scheme: dark;

  /* ------------------------------------------------------------ colour -- */
  --bg-canvas: #07080b;
  --bg-surface: #0d0f14;
  --bg-elevated: #13161d;
  --bg-raised: #1a1e27;

  --border-subtle: #222733;
  --border-strong: #2f3543;

  --text-primary: #f5f6f8;
  --text-secondary: #a6adbb;
  --text-tertiary: #6b7280;
  --text-inverse: #07080b;

  --brand-red: #e5252c;
  --brand-red-bright: #ff3b41;
  --brand-red-deep: #7a0e13;

  --severity-critical: #e5252c;
  --severity-high: #f97316;
  --severity-medium: #f5b400;
  --severity-low: #3b82f6;
  --severity-info: #8a93a6;

  --status-success: #22c55e;
  --status-violet: #a78bfa;

  --base-white: #ffffff;
  --base-black: #000000;

  /* Semantic tones (used by pills, chips, deltas, progress bars). */
  --tone-red: var(--severity-critical);
  --tone-orange: var(--severity-high);
  --tone-amber: var(--severity-medium);
  --tone-blue: var(--severity-low);
  --tone-gray: var(--severity-info);
  --tone-green: var(--status-success);
  --tone-violet: var(--status-violet);

  /* Alpha of soft fills, measured on the Figma screens. */
  --alpha-soft: 12%;     /* active nav row, KPI icon tile, "Encrypted at rest" badge */
  --alpha-pill: 13%;     /* status pills */
  --alpha-chip: 14%;     /* severity chips, delta pills, file badges, access pills */
  --alpha-avatar: 22%;   /* avatar backgrounds */
  --alpha-ring: 50%;     /* active pagination border */

  --overlay-hover: rgb(255 255 255 / 0.03);
  --overlay-head: rgb(255 255 255 / 0.02);   /* table header band */
  --overlay-secondary: rgb(255 255 255 / 0.04); /* secondary button fill */
  --overlay-chip: rgb(255 255 255 / 0.05);   /* scope tags on cards */
  --scrim: rgb(3 4 6 / 0.72);

  /* --------------------------------------------------------- typography -- */
  --font-display: "Space Grotesk", "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  /* Figma text styles: family / weight / size / line height / tracking. */
  --type-display-xl: 500 68px/74px var(--font-display);   --track-display-xl: -0.03em;
  --type-display-l: 500 52px/58px var(--font-display);    --track-display-l: -0.025em;
  --type-h2: 500 44px/52px var(--font-display);           --track-h2: -0.02em;
  --type-h3: 500 28px/36px var(--font-display);           --track-h3: -0.015em;
  --type-h4: 500 20px/28px var(--font-display);           --track-h4: -0.01em;
  --type-h5: 500 17px/24px var(--font-display);           --track-h5: -0.005em;
  --type-data-xl: 500 34px/40px var(--font-display);      --track-data-xl: -0.02em;
  --type-data-l: 500 26px/32px var(--font-display);       --track-data-l: -0.015em;
  --type-body-l: 400 20px/30px var(--font-sans);          --track-body-l: -0.015em;
  --type-body-m: 400 16px/26px var(--font-sans);          --track-body-m: 0em;
  --type-body-s: 400 14px/21px var(--font-sans);          --track-body-s: -0.002em;
  --type-body-xs: 400 12px/17px var(--font-sans);         --track-body-xs: 0em;
  --type-label-m: 500 15px/22px var(--font-sans);         --track-label-m: 0em;
  --type-label-s: 500 14px/20px var(--font-sans);         --track-label-s: -0.001em;
  --type-label-s-strong: 600 14px/20px var(--font-sans);  --track-label-s-strong: -0.001em;
  --type-label-xs-strong: 600 12px/16px var(--font-sans); --track-label-xs-strong: 0em;
  --type-button-m: 600 14px/20px var(--font-sans);        --track-button-m: 0em;
  --type-button-l: 600 16px/24px var(--font-sans);        --track-button-l: 0em;
  --type-eyebrow: 500 12px/16px var(--font-mono);         --track-eyebrow: 0.08em;
  --type-mono-s: 400 13px/21px var(--font-mono);          --track-mono-s: 0em;
  --type-mono-xs: 400 12px/18px var(--font-mono);         --track-mono-xs: 0em;

  /* ------------------------------------------------------------ effects -- */
  /* Glow/Red: Figma's variable is a drop shadow #E5252C 45 %, y 8, blur 28,
     spread -6, but Figma renders it about 1.5x stronger than the same CSS
     (red channel 2-14 px below the CTA: Figma 73/61/47/35, CSS 54/44/34/26).
     This value is fitted to the Overview, Reports and Targets exports (sum of
     squared errors over 30 samples around each CTA: 45-57, was ~3500). */
  --glow-red: 0 7px 26px -2px rgb(229 37 44 / 0.52);
  /* Elevation/Float: two drop shadows. */
  --elevation-float: 0 28px 64px -12px rgb(0 0 0 / 0.55), 0 2px 6px 0 rgb(0 0 0 / 0.3);

  --focus-ring: 0 0 0 2px var(--bg-canvas), 0 0 0 4px var(--brand-red-bright);

  /* -------------------------------------------------------------- radii -- */
  --radius-xs: 6px;    /* chips, scope tags, kbd */
  --radius-sm: 7px;    /* segmented-control segments */
  --radius-md: 8px;    /* file badges, pagination, toggle options, workspace tile */
  --radius-tile: 9px;  /* letter tiles */
  --radius-lg: 10px;   /* buttons, inputs, nav items, icon tiles, tooltips */
  --radius-xl: 12px;   /* inner cards: board cards, upload rows, sidebar cards */
  --radius-2xl: 16px;  /* panels and KPI cards */
  --radius-full: 999px;

  /* ------------------------------------------------------------ spacing -- */
  --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;

  /* ------------------------------------------------------------- layout -- */
  --sidebar-width: 264px;
  --topbar-height: 76px;
  --page-padding: 32px;
  --grid-gap: 20px;      /* between KPI cards */
  --section-gap: 24px;   /* between rows of panels */
  --control-height: 40px;
  --control-height-sm: 36px;
  --control-height-lg: 52px;

  /* ------------------------------------------------------------- motion -- */
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --duration-fast: 120ms;
  --duration: 180ms;
  --duration-slow: 260ms;

  /* ------------------------------------------------------------ z-index -- */
  --z-sticky: 20;
  --z-sidebar: 40;
  --z-dropdown: 60;
  --z-overlay: 80;
  --z-toast: 100;
}

/* ------------------------------------------------------- text styles -- */
/* One utility class per Figma text style. */

.t-display-xl { font: var(--type-display-xl); letter-spacing: var(--track-display-xl); }
.t-display-l { font: var(--type-display-l); letter-spacing: var(--track-display-l); }
.t-h2 { font: var(--type-h2); letter-spacing: var(--track-h2); }
.t-h3 { font: var(--type-h3); letter-spacing: var(--track-h3); }
.t-h4 { font: var(--type-h4); letter-spacing: var(--track-h4); }
.t-h5 { font: var(--type-h5); letter-spacing: var(--track-h5); }
.t-data-xl { font: var(--type-data-xl); letter-spacing: var(--track-data-xl); }
.t-data-l { font: var(--type-data-l); letter-spacing: var(--track-data-l); }
.t-body-l { font: var(--type-body-l); letter-spacing: var(--track-body-l); }
.t-body-m { font: var(--type-body-m); letter-spacing: var(--track-body-m); }
.t-body-s { font: var(--type-body-s); letter-spacing: var(--track-body-s); }
.t-body-xs { font: var(--type-body-xs); letter-spacing: var(--track-body-xs); }
.t-label-m { font: var(--type-label-m); letter-spacing: var(--track-label-m); }
.t-label-s { font: var(--type-label-s); letter-spacing: var(--track-label-s); }
.t-label-s-strong { font: var(--type-label-s-strong); letter-spacing: var(--track-label-s-strong); }
.t-label-xs-strong { font: var(--type-label-xs-strong); letter-spacing: var(--track-label-xs-strong); }
.t-button-m { font: var(--type-button-m); letter-spacing: var(--track-button-m); }
.t-button-l { font: var(--type-button-l); letter-spacing: var(--track-button-l); }
.t-eyebrow { font: var(--type-eyebrow); letter-spacing: var(--track-eyebrow); text-transform: uppercase; }
.t-mono-s { font: var(--type-mono-s); letter-spacing: var(--track-mono-s); }
.t-mono-xs { font: var(--type-mono-xs); letter-spacing: var(--track-mono-xs); }

/* Text colours */
.c-primary { color: var(--text-primary); }
.c-secondary { color: var(--text-secondary); }
.c-tertiary { color: var(--text-tertiary); }
.c-red { color: var(--brand-red); }
.c-green { color: var(--status-success); }
.c-blue { color: var(--severity-low); }
.c-amber { color: var(--severity-medium); }
.c-orange { color: var(--severity-high); }
.c-violet { color: var(--status-violet); }

/* Users who ask for more contrast get brighter secondary text and borders
   (the Figma tertiary grey is about 4:1 on the surface colour). */
@media (prefers-contrast: more) {
  :root {
    --text-secondary: #c4c9d3;
    --text-tertiary: #959cab;
    --border-subtle: #343a48;
    --border-strong: #4a5162;
  }
}

/* Phase 4 i18n (docs/architecture.md §17.7): Space Grotesk has no Cyrillic, so Russian display text (headings, KPI
   values) uses Inter for the whole word instead of mixing two fonts. English and Uzbek keep Space Grotesk; the
   --type-* tokens above read --font-display on the same element, so they follow. */
:root:lang(ru) {
  --font-display: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* JetBrains Mono has no U+02BB (the oʻ / gʻ okina): in Uzbek, mono labels take that one glyph from Inter, which
   matches the UI face, instead of a random system fallback. Nothing else changes (every other glyph is in the
   mono font), and English never sees this rule. */
:root:lang(uz) {
  --font-mono: "JetBrains Mono", "Inter", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}
