/* ==========================================================================
   Serpelin - design tokens (single source of truth)
   World: «Технический каталог». Light, warm-engineering, one amber signal.
   Production: self-host the three families (woff2) and replace the
   Google Fonts <link> with @font-face rules pointing at /fonts/.
   ========================================================================== */

:root {
  /* ---------- Color: grounds & sheets ---------- */
  --c-ground:        #EDEDE8; /* limestone (grey, not cream) - default page ground */
  --c-sheet:         #FAFAF8; /* paper white - raised sheets, tables, form fields */
  --c-stone:         #E1E0DA; /* deeper stone - alternating section ground */
  --c-rule:          #D2D1CA; /* hairline rules, table lines, field borders */
  --c-rule-strong:   #B3B1A8; /* emphasised rules, hover borders */

  /* ---------- Color: ink ---------- */
  --c-ink:           #19202A; /* graphite-blue - headings, body, drawing line */
  --c-ink-2:         #444D59; /* secondary text (≥7:1 on ground) */
  --c-ink-3:         #5E6672; /* tertiary text, captions (≥4.6:1 on ground) */
  --c-line-muted:    #A6ACB3; /* passive drawing lines, never text */

  /* ---------- Color: the signal (amber lamp) ---------- */
  --c-signal:        #E9A23B; /* fills: active position, live dot, cable trace */
  --c-signal-strong: #D98A1C; /* hover/pressed of signal fills */
  --c-signal-ink:    #8A4F0E; /* amber as TEXT on light grounds (≥5.6:1) */
  --c-signal-wash:   #F6E6C9; /* selection, highlighted table row */

  /* ---------- Color: drawing materials ---------- */
  --c-floor:         #E8E7E1;
  --c-slab-front:    #CFCDC5;
  --c-slab-side:     #DAD8D1;
  --c-wall:          #F7F7F4;
  --c-wall-shade:    #E5E4DE;
  --c-glass:         #DCE3E7;

  /* ---------- Color: night plate (one dark section: contact) ---------- */
  --c-night:         #161B23;
  --c-night-2:       #212833;
  --c-night-rule:    #343C49;
  --c-on-night:      #ECEAE4;
  --c-on-night-2:    #A9AFB8;

  /* ---------- Color: states ---------- */
  --c-ok:            #336B4A;
  --c-error:         #B03A2A;
  --c-focus:         var(--c-signal-ink);

  /* ---------- Type families ---------- */
  --f-display: "Geologica", "Onest", system-ui, sans-serif;
  --f-text:    "Onest", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-data:    "Martian Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  /* ---------- Type scale (fluid 360 → 1440) ---------- */
  --t-display:  clamp(2.375rem, 1.6rem + 3.2vw, 3.875rem); /* 38 → 62 hero only */
  --t-h1:       clamp(2.125rem, 1.5rem + 2.4vw, 3.25rem);  /* 34 → 52 section titles */
  --t-h2:       clamp(1.625rem, 1.3rem + 1.3vw, 2.25rem);  /* 26 → 36 */
  --t-h3:       clamp(1.25rem, 1.15rem + .45vw, 1.5rem);   /* 20 → 24 */
  --t-h4:       1.125rem;                                   /* 18 */
  --t-lead:     clamp(1.0625rem, 1rem + .3vw, 1.25rem);    /* 17 → 20 */
  --t-body:     1.0625rem;                                  /* 17 */
  --t-small:    .9375rem;                                   /* 15 */
  --t-caption:  .8125rem;                                   /* 13 */
  --t-data:     .8125rem;                                   /* 13 mono */
  --t-data-l:   1rem;                                       /* 16 mono: phone, codes in focus */

  --lh-tight:   1.04;
  --lh-head:    1.12;
  --lh-text:    1.6;
  --lh-data:    1.45;

  --tr-display: -0.03em;
  --tr-head:    -0.018em;
  --tr-text:    0;
  --tr-data:    0;

  --w-light: 300; --w-regular: 400; --w-medium: 500; --w-semibold: 600; --w-bold: 700;

  /* ---------- Space (4px base) ---------- */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px; --s-5: 24px;
  --s-6: 32px; --s-7: 48px; --s-8: 64px; --s-9: 96px; --s-10: 128px;

  --section-y:  clamp(64px, 4rem + 4vw, 120px);  /* vertical padding of a section */
  --section-y-dense: clamp(48px, 2.5rem + 3vw, 88px);
  --gutter:     clamp(16px, 1rem + 1vw, 28px);
  --margin:     clamp(16px, 4vw, 64px);
  --content:    1360px;
  --measure:    66ch;

  /* ---------- Shape ---------- */
  --r-0: 0;
  --r-1: 2px;   /* tags, chips, position badges */
  --r-2: 4px;   /* buttons, inputs */
  --r-3: 8px;   /* sheets, panels */
  --r-round: 999px;
  --hair: 1px;
  --stroke-draw: 1.15px; /* the one drawing stroke weight */
  --stroke-icon: 1.5px;

  /* ---------- Elevation (almost flat; paper, not glass) ---------- */
  --e-0: none;
  --e-1: 0 1px 0 var(--c-rule);
  --e-2: 0 1px 0 rgba(25,32,42,.06), 0 14px 32px -20px rgba(25,32,42,.28);
  --e-3: 0 2px 0 rgba(25,32,42,.05), 0 28px 60px -28px rgba(25,32,42,.35);

  /* ---------- Motion ---------- */
  --ease-out:    cubic-bezier(.16, 1, .3, 1);     /* expo-out: reveals, entries */
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);    /* state swaps, drawing */
  --ease-damped: cubic-bezier(.22, 1, .36, 1);    /* quint-out: needle-like settle, no overshoot */
  --d-micro:  120ms;  /* press, toggle */
  --d-fast:   200ms;  /* hover, focus */
  --d-base:   320ms;  /* tabs, accordions, highlight swap */
  --d-reveal: 640ms;  /* content reveal */
  --d-draw:   1400ms; /* signature line drawing */

  /* ---------- Layers ---------- */
  --z-base: 0; --z-sticky: 20; --z-header: 40; --z-overlay: 60; --z-toast: 80;
}

@media (prefers-reduced-motion: reduce) {
  :root { --d-micro: 0ms; --d-fast: 0ms; --d-base: 0ms; --d-reveal: 0ms; --d-draw: 0ms; }
}

/* ---------- Browser surfaces (part of the system) ---------- */
::selection { background: var(--c-signal-wash); color: var(--c-ink); }
html { caret-color: var(--c-signal-ink); scrollbar-color: var(--c-rule-strong) var(--c-ground); scrollbar-width: thin; }
:focus-visible { outline: 2px solid var(--c-focus); outline-offset: 3px; border-radius: var(--r-1); }
a { text-underline-offset: .22em; text-decoration-thickness: 1px; }
