/* MTS Granat — unofficial reconstruction of the public Behance case "MTS GRANAT DESIGN SYSTEM 1.0".
   Source legend used in comments:
     [case NN]     value is printed in Behance image NN (docs/source/README.md) and checked by pixel sampling
     [measured NN] value is not printed, it was measured from pixels of image NN (approximate)
     [recon]       reconstruction: the case shows no such value
   Full map: docs/source/SOURCE_MAP.md. Naming mirrors ds-storm (--ds2-* there, --gr-* here), dark mode = [data-ds-mode="dark"]. */
:root {
  /* ───────── Primitive — "Constant" palette [case 05]: charts and illustrations, same in both modes ───────── */
  --gr-greyscale-900: #000000;
  --gr-greyscale-800: #1d2023;
  --gr-greyscale-700: #2c3135;
  --gr-greyscale-600: #434a51;
  --gr-greyscale-500: #626c77;
  --gr-greyscale-400: #969fa8;
  --gr-greyscale-300: #bbc1c7;
  --gr-greyscale-200: #e2e5eb;
  --gr-greyscale-100: #f2f3f7;
  --gr-greyscale-0: #ffffff;

  --gr-blackberry-darkest: #002094;
  --gr-blackberry-dark: #003db7;
  --gr-blackberry-normal: #014fce;
  --gr-blackberry-light: #6384e0;
  --gr-blackberry-lightest: #e7eafa;

  --gr-blueberry-darkest: #0048aa;
  --gr-blueberry-dark: #007cff;
  --gr-blueberry-normal: #0097fd;
  --gr-blueberry-light: #45b6fc;
  --gr-blueberry-lightest: #e1f3fe;

  --gr-mint-darkest: #00724d;
  --gr-mint-dark: #03a17b;
  --gr-mint-normal: #00c19b;
  --gr-mint-light: #00d9bc;
  --gr-mint-lightest: #dff9f5;

  --gr-apple-darkest: #027722;
  --gr-apple-dark: #04aa42;
  --gr-apple-normal: #26cd58;
  --gr-apple-light: #74df8b;
  --gr-apple-lightest: #e8faeb;

  --gr-lime-darkest: #808201;
  --gr-lime-dark: #a6c100;
  --gr-lime-normal: #c1eb1d;
  --gr-lime-light: #d3f36b;
  --gr-lime-lightest: #f8fee7;

  --gr-banana-darkest: #f37f19;
  --gr-banana-dark: #fac031;
  --gr-banana-normal: #fbe739;
  --gr-banana-light: #fdf177;
  --gr-banana-lightest: #fffde8;

  --gr-orange-darkest: #ba360a;
  --gr-orange-dark: #e04a17;
  --gr-orange-normal: #f95721;
  --gr-orange-light: #ffa080;
  --gr-orange-lightest: #fbe9e7;

  --gr-raspberry-darkest: #8e003f;
  --gr-raspberry-dark: #c51345;
  --gr-raspberry-normal: #ea1f49;
  --gr-raspberry-light: #f55f7e;
  --gr-raspberry-lightest: #ffe4e9;

  --gr-cranberry-darkest: #7f3363;
  --gr-cranberry-dark: #bb4079;
  --gr-cranberry-normal: #e54887;
  --gr-cranberry-light: #e677ad;
  --gr-cranberry-lightest: #f9e7f0;

  --gr-plum-darkest: #471c61;
  --gr-plum-dark: #6d2d79;
  --gr-plum-normal: #883888;
  --gr-plum-light: #a86ea7;
  --gr-plum-lightest: #f0e7f0;

  /* Primitive — brand [case 05] */
  --gr-mts-red: #e30611;

  /* Primitive — values that the case prints only as semantic styles [case 05] */
  --gr-red-pressed: #d40610; /* [measured 09] primary button hover / pressed / focus fill */
  --gr-negative-light: #eb4a13;
  --gr-positive-light: #12b23f;
  --gr-warning-dark: #fad67d;
  --gr-warning-text-light: #8a5200; /* [recon] dark amber from Banana/Darkest #F37F19 (hue ~32deg): 6.4:1 on #FFFFFF, text-safe; banana-dark #FAC031 is 1.6:1 */
  --gr-negative-dark: #fa8a64;
  --gr-tabbar-inactive-light: #aeb5bd;
  --gr-tabbar-inactive-dark: #58616b;
  --gr-text-primary-dark: #fafafa;
  --gr-stroke-rgb: 188 195 208; /* #BCC3D0 */
  --gr-steel-rgb: 127 140 153; /* #7F8C99 */
  --gr-slate-rgb: 98 108 119; /* #626C77 */
  --gr-ink-rgb: 29 32 35; /* #1D2023 */

  /* ───────── Semantic — Text [case 05] ───────── */
  --gr-text-headline: var(--gr-greyscale-900);
  --gr-text-primary: var(--gr-greyscale-800);
  --gr-text-secondary: var(--gr-greyscale-500);
  --gr-text-tertiary: var(--gr-greyscale-400); /* only Medium weight and heavier; exception — input masks */
  --gr-text-inverted: var(--gr-greyscale-0); /* tooltip, toast, snackbar */
  --gr-text-positive: var(--gr-positive-light);
  --gr-text-negative: var(--gr-negative-light);
  --gr-text-warning: var(--gr-warning-text-light); /* [recon] warning text; 6.4:1 on #FFFFFF (bg-primary and elevated), AA */
  --gr-text-link: var(--gr-blueberry-dark);
  --gr-text-link-secondary: var(--gr-greyscale-400); /* web only */
  --gr-text-on-brand: var(--gr-greyscale-0); /* [case 05] Greyscale 0: permanently white text and icons */
  --gr-text-disabled: #b2b9bf; /* [measured 09] label of a disabled button */

  /* ───────── Semantic — Background [case 05] ───────── */
  --gr-bg-primary: var(--gr-greyscale-0); /* main theme background */
  --gr-bg-primary-elevated: var(--gr-greyscale-0); /* 1st level: cards, input, tabbar */
  --gr-bg-modal: var(--gr-greyscale-0); /* 2nd level: dropdown menus, sheets */
  --gr-bg-stroke: rgb(var(--gr-stroke-rgb) / 0.5); /* separators and outlines */
  --gr-stroke-strong: rgb(var(--gr-steel-rgb)); /* [recon] stronger divider / outline = Steel #7F8C99 opaque (the case stroke at 100% opacity is only 1.8:1): 3.4:1 on #FFFFFF, 3.1:1 on Greyscale/100 */
  --gr-bg-accent-subtle: color-mix(in srgb, var(--gr-accent-active) 12%, transparent); /* [recon] selected row / icon tile: Accent/Active #007CFF at 12% = ~#E0EFFF over white; Text/Primary on it 14.0:1 */
  --gr-bg-secondary: var(--gr-greyscale-100);
  --gr-bg-secondary-elevated: var(--gr-greyscale-0); /* 1st level over the secondary background */
  --gr-bg-inverted: var(--gr-greyscale-800); /* tooltip, toast, snackbar */
  --gr-bg-overlay: rgb(var(--gr-ink-rgb) / 0.4);
  --gr-bg-hover: rgb(var(--gr-stroke-rgb) / 0.25); /* case: "25%, multiply" — drawn over the element background, under content */
  --gr-bg-navbar: rgb(255 255 255 / 0.92); /* iOS navbar, only with background blur */
  --gr-bg-disabled: var(--gr-greyscale-200); /* [measured 09] disabled button fill */

  /* ───────── Semantic — Icons [case 05] ───────── */
  --gr-icon-primary: var(--gr-greyscale-900); /* navbar and secondary buttons */
  --gr-icon-secondary: var(--gr-greyscale-400); /* interactive icons */
  --gr-icon-tertiary: var(--gr-greyscale-300); /* decorative icons */

  /* ───────── Semantic — Controls [case 05] ───────── */
  --gr-control-primary-active: var(--gr-mts-red); /* selected, active control */
  --gr-control-primary-active-hover: var(--gr-red-pressed); /* [measured 09] */
  --gr-control-secondary-active: var(--gr-greyscale-800);
  --gr-control-tertiary-active: var(--gr-greyscale-100); /* secondary button fill */
  --gr-control-inactive: rgb(var(--gr-stroke-rgb) / 0.5); /* switched-off Switch, preselected Radio/Checkbox */
  --gr-control-alternative: var(--gr-greyscale-0); /* default Radio/Checkbox, Secondary Inverted Button */
  --gr-control-tabbar-active: var(--gr-mts-red);
  --gr-control-tabbar-inactive: var(--gr-tabbar-inactive-light);
  --gr-control-on-primary: var(--gr-greyscale-0); /* [recon] content over primary-active */
  --gr-control-on-secondary: var(--gr-greyscale-0); /* [recon] content over secondary-active */

  /* ───────── Semantic — Accent [case 05] ───────── */
  --gr-accent-active: var(--gr-blueberry-dark); /* icons and focus state */
  --gr-accent-positive: var(--gr-apple-normal);
  --gr-accent-warning: var(--gr-banana-dark);
  --gr-accent-negative: var(--gr-orange-normal); /* icons and error state */

  /* ───────── Semantic — Brand [case 05] ───────── */
  --gr-brand: var(--gr-mts-red);

  /* ───────── Typography ─────────
     Original fonts are proprietary; free substitutes are plugged in here and only here.
     To switch to the originals, override these three tokens:
       --gr-font-display: "MTS Wide";  --gr-font-text: "MTS Sans";  --gr-font-compact: "MTS Compact"; */
  --gr-font-display: "Unbounded", "Arial Black", system-ui, sans-serif; /* substitute for MTS Wide */
  --gr-font-text: "Golos Text", "Helvetica Neue", Arial, system-ui, sans-serif; /* substitute for MTS Sans */
  --gr-font-compact: "Inter Tight", "Arial Narrow", system-ui, sans-serif; /* substitute for MTS Compact */

  --gr-weight-regular: 400;
  --gr-weight-medium: 500;
  --gr-weight-bold: 700;
  --gr-weight-black: 900;
  --gr-weight-ultra: 900; /* case: "Ultra Wide / 1000"; the substitute tops out at 900 */

  /* Type scale [case 05]: size / line height. Shorthand = weight size/line family. */
  --gr-type-promo: var(--gr-weight-ultra) 44px/44px var(--gr-font-display);
  --gr-type-h1-black: var(--gr-weight-black) 32px/36px var(--gr-font-text);
  --gr-type-h1-bold: var(--gr-weight-bold) 32px/36px var(--gr-font-text);
  --gr-type-h2-black: var(--gr-weight-black) 24px/28px var(--gr-font-text);
  --gr-type-h2-bold: var(--gr-weight-bold) 24px/28px var(--gr-font-text);
  --gr-type-h2-medium: var(--gr-weight-medium) 24px/28px var(--gr-font-text);
  --gr-type-h3-bold: var(--gr-weight-bold) 20px/24px var(--gr-font-text);
  --gr-type-h3-medium: var(--gr-weight-medium) 20px/24px var(--gr-font-text);
  --gr-type-h3-regular: var(--gr-weight-regular) 20px/28px var(--gr-font-text);
  --gr-type-p1-bold: var(--gr-weight-bold) 17px/24px var(--gr-font-text);
  --gr-type-p1-medium: var(--gr-weight-medium) 17px/24px var(--gr-font-text);
  --gr-type-p1-regular: var(--gr-weight-regular) 17px/24px var(--gr-font-text);
  --gr-type-p2-bold: var(--gr-weight-bold) 14px/20px var(--gr-font-text);
  --gr-type-p2-medium: var(--gr-weight-medium) 14px/20px var(--gr-font-text);
  --gr-type-p2-regular: var(--gr-weight-regular) 14px/20px var(--gr-font-text);
  --gr-type-p3-bold: var(--gr-weight-bold) 12px/16px var(--gr-font-text);
  --gr-type-p3-medium: var(--gr-weight-medium) 12px/16px var(--gr-font-text);
  --gr-type-p3-regular: var(--gr-weight-regular) 12px/16px var(--gr-font-text);
  /* "P2/P3 Medium Uppercase" = the medium style + text-transform: uppercase (class .gr-type-p2-upper / -p3-upper). */

  /* Margin below a text block [case 05] */
  --gr-type-gap-promo: 24px;
  --gr-type-gap-h1: 24px;
  --gr-type-gap-h2: 24px;
  --gr-type-gap-h3: 16px;
  --gr-type-gap-p1: 16px;
  --gr-type-gap-p2: 12px;
  --gr-type-gap-p3: 8px;

  /* Maximum line width [case 05]: (size / 1.166 or 1.375) × 55 characters */
  --gr-measure-promo: 2076px;
  --gr-measure-h1: 1510px;
  --gr-measure-h2: 1132px;
  --gr-measure-h3: 944px;
  --gr-measure-p1: 680px;
  --gr-measure-p2: 560px;
  --gr-measure-p3: 480px;

  /* ───────── Spacing ─────────
     The case states only "4px baseline grid" [case 06]; the step names are a reconstruction [recon]. */
  --gr-space-0: 0;
  --gr-space-1: 4px;
  --gr-space-2: 8px;
  --gr-space-3: 12px;
  --gr-space-4: 16px;
  --gr-space-5: 20px;
  --gr-space-6: 24px;
  --gr-space-8: 32px;
  --gr-space-10: 40px;
  --gr-space-12: 48px;
  --gr-space-14: 56px;
  --gr-space-16: 64px;

  /* ───────── Grid [case 06] ───────── */
  --gr-grid-mobile-columns: 4;
  --gr-grid-mobile-gutter: 12px;
  --gr-grid-mobile-margin: 20px;
  --gr-grid-tablet-columns: 12;
  --gr-grid-tablet-gutter: 32px;
  --gr-grid-tablet-margin: 40px;
  --gr-grid-desktop-columns: 12;
  --gr-grid-desktop-gutter: 32px;
  --gr-grid-desktop-margin: 56px;
  --gr-breakpoint-tablet: 768px;
  --gr-breakpoint-desktop: 1280px;

  /* ───────── Radius ─────────
     Not printed in the case. 8px is measured on buttons [measured 09]; the rest is a reconstruction [recon]. */
  --gr-radius-xs: 4px; /* checkbox, counter corners, small tags */
  --gr-radius-sm: 6px; /* inputs, chips */
  --gr-radius-md: 8px; /* buttons [measured 09] */
  --gr-radius-lg: 16px; /* cards, modals */
  --gr-radius-xl: 24px; /* sheets */
  --gr-radius-pill: 999px;
  --gr-radius-circle: 50%;

  /* ───────── Shadows ─────────
     The case names five levels and their purpose [case 05] but prints no numbers:
     offsets, blur and opacity are measured from the swatches [measured 05] — approximate. */
  --gr-shadow-rgb: 0 0 0;
  --gr-shadow-lowest: 0 0 6px rgb(var(--gr-shadow-rgb) / 0.06), 0 2px 8px rgb(var(--gr-shadow-rgb) / 0.06); /* pressed cards on mobile */
  --gr-shadow-low: 0 0 8px rgb(var(--gr-shadow-rgb) / 0.06), 0 4px 12px rgb(var(--gr-shadow-rgb) / 0.08); /* cards, headers by default */
  --gr-shadow-middle: 0 0 6px rgb(var(--gr-shadow-rgb) / 0.06), 0 8px 20px rgb(var(--gr-shadow-rgb) / 0.12); /* hover, header on scroll, controls over cards */
  --gr-shadow-upper-middle: 0 -6px 24px rgb(var(--gr-shadow-rgb) / 0.12); /* sheets on mobile (shadow goes up) */
  --gr-shadow-high: 0 4px 24px rgb(var(--gr-shadow-rgb) / 0.12), 0 12px 24px rgb(var(--gr-shadow-rgb) / 0.16); /* dropdowns, modals, sheets */

  /* ───────── Sizes of controls ─────────
     44px height, 8px radius and 24px side padding are measured on the button table [measured 09]; others [recon]. */
  --gr-control-height-sm: 32px;
  --gr-control-height-md: 44px;
  --gr-control-height-lg: 52px;
  --gr-border-width: 1px;
  --gr-border-width-strong: 2px; /* outline button [measured 09] */
  --gr-focus-ring: 0 0 0 2px var(--gr-bg-primary), 0 0 0 4px var(--gr-accent-active); /* [recon] colour = Accent/Active "focus state" [case 05] */

  /* ───────── Motion and layers [recon] ───────── */
  --gr-duration-fast: 120ms;
  --gr-duration-normal: 200ms;
  --gr-ease-standard: cubic-bezier(0.2, 0, 0, 1);
  --gr-z-dropdown: 100;
  --gr-z-sticky: 200;
  --gr-z-overlay: 300;
  --gr-z-modal: 400;
  --gr-z-toast: 500;
  --gr-z-tooltip: 600;
}

/* Dark mode — <html data-ds-mode="dark"> (or on any subtree). Only semantic tokens change [case 05]. */
[data-ds-mode="dark"] {
  --gr-text-headline: var(--gr-greyscale-0);
  --gr-text-primary: var(--gr-text-primary-dark);
  --gr-text-secondary: var(--gr-greyscale-400);
  --gr-text-tertiary: var(--gr-greyscale-500);
  --gr-text-inverted: var(--gr-greyscale-900);
  --gr-text-positive: var(--gr-apple-light);
  --gr-text-negative: var(--gr-orange-light);
  --gr-text-warning: var(--gr-warning-dark); /* [recon] Warning/Dark #FAD67D: 15.0:1 on #000000, 11.7:1 on #1D2023, AAA */
  --gr-text-link: var(--gr-blueberry-light);
  --gr-text-link-secondary: var(--gr-greyscale-500);
  --gr-text-disabled: #4c545b; /* [measured 10] */

  --gr-bg-primary: var(--gr-greyscale-900);
  --gr-bg-primary-elevated: var(--gr-greyscale-800);
  --gr-bg-modal: var(--gr-greyscale-700);
  --gr-bg-stroke: rgb(var(--gr-steel-rgb) / 0.35);
  --gr-stroke-strong: rgb(var(--gr-steel-rgb)); /* [recon] Steel #7F8C99 opaque: 6.1:1 on #000000, 4.8:1 on #1D2023 */
  --gr-bg-accent-subtle: color-mix(in srgb, var(--gr-accent-active) 20%, transparent); /* [recon] Accent/Active #45B6FC at 20% = ~#253E4E over #1D2023; Text/Primary on it 10.7:1 */
  --gr-bg-secondary: rgb(var(--gr-slate-rgb) / 0.25);
  --gr-bg-secondary-elevated: rgb(var(--gr-slate-rgb) / 0.25);
  --gr-bg-inverted: var(--gr-greyscale-0);
  --gr-bg-overlay: rgb(var(--gr-ink-rgb) / 0.6);
  --gr-bg-hover: rgb(242 243 247 / 0.2);
  --gr-bg-navbar: rgb(0 0 0 / 0.92);
  --gr-bg-disabled: rgb(var(--gr-steel-rgb) / 0.16); /* [measured 10] ≈ #31373C over #1D2023 */

  --gr-icon-primary: var(--gr-greyscale-0);
  --gr-icon-secondary: var(--gr-greyscale-400);
  --gr-icon-tertiary: var(--gr-greyscale-500);

  --gr-control-primary-active: var(--gr-mts-red);
  --gr-control-primary-active-hover: var(--gr-red-pressed);
  --gr-control-secondary-active: var(--gr-greyscale-0);
  --gr-control-tertiary-active: rgb(var(--gr-steel-rgb) / 0.35);
  --gr-control-inactive: rgb(var(--gr-steel-rgb) / 0.35);
  --gr-control-alternative: rgb(var(--gr-steel-rgb) / 0.35);
  --gr-control-tabbar-active: var(--gr-greyscale-0);
  --gr-control-tabbar-inactive: var(--gr-tabbar-inactive-dark);
  --gr-control-on-secondary: var(--gr-greyscale-900);

  --gr-accent-active: var(--gr-blueberry-light);
  --gr-accent-positive: var(--gr-apple-light);
  --gr-accent-warning: var(--gr-warning-dark);
  --gr-accent-negative: var(--gr-negative-dark);

  --gr-shadow-rgb: 0 0 0;
  --gr-shadow-lowest: 0 0 6px rgb(var(--gr-shadow-rgb) / 0.3), 0 2px 8px rgb(var(--gr-shadow-rgb) / 0.3); /* [recon] the case shows shadows only in light mode */
  --gr-shadow-low: 0 0 8px rgb(var(--gr-shadow-rgb) / 0.3), 0 4px 12px rgb(var(--gr-shadow-rgb) / 0.36);
  --gr-shadow-middle: 0 0 6px rgb(var(--gr-shadow-rgb) / 0.3), 0 8px 20px rgb(var(--gr-shadow-rgb) / 0.44);
  --gr-shadow-upper-middle: 0 -6px 24px rgb(var(--gr-shadow-rgb) / 0.44);
  --gr-shadow-high: 0 4px 24px rgb(var(--gr-shadow-rgb) / 0.44), 0 12px 24px rgb(var(--gr-shadow-rgb) / 0.5);
  --gr-focus-ring: 0 0 0 2px var(--gr-bg-primary), 0 0 0 4px var(--gr-accent-active);
}
