/* Octinity — tokens. The one source of every value the brand is drawn in: paper and graphite, the inks on them,
   the signal, the hairlines and ticks, the type scale, the spacing, the measure and the motion. Plain custom
   properties on :root, so any project takes them by importing this file; nothing here styles an element.

   Roles, not hues: a component asks for `--o-line` or `--o-ink-muted`, and the surface it stands on (`.o-light`,
   `.o-dark`, `.o-theme`, surfaces.css) answers with the right one. The literal colours below are only for the
   surfaces to pick from; the few that are not a role yet still differ by surface are `light-dark(paper, graphite)`. Figure colours (sage, aluminium) are for drawings only, never for text, borders or states. */
/* One device pixel, in CSS pixels: what a fine line inside a box is snapped to, so it lands on whole pixels of the
   screen. The head's step (scripts/octinity/pixel.ts) says it exactly at any screen and zoom; without it, the common
   screens by their resolution. */
:root { --o-dpx: 1px; }
@media (resolution >= 1.2dppx) { :root { --o-dpx: .8px; } }
@media (resolution >= 1.45dppx) { :root { --o-dpx: calc(1px / 1.5); } }
@media (resolution >= 1.95dppx) { :root { --o-dpx: .5px; } }
@media (resolution >= 2.9dppx) { :root { --o-dpx: calc(1px / 3); } }

:root {
  /* ── Paper and graphite ─────────────────────────────────────────────────────────────────────────────────── */
  --o-paper: #f0ede3;            /* the light section */
  --o-paper-raised: #f6f3ea;     /* a card or a screen raised on paper */
  --o-paper-sunk: #e5e5dd;       /* a band set back from the paper */
  --o-graphite: #1c201f;         /* the dark section, the header, the footer */
  --o-graphite-deep: #151817;    /* the band under the graphite */
  --o-panel: #1f2422;            /* a field or a panel on graphite */
  --o-panel-hi: #222826;         /* the same, in use */

  /* ── Inks ───────────────────────────────────────────────────────────────────────────────────────────────── */
  --o-ink-on-paper: #252925;          /* 12.60:1 on paper */
  --o-ink-strong-on-paper: #1f231f;
  --o-ink-muted-on-paper: #5d665f;    /* 5.08:1 — leads, notes */
  --o-ink-soft-on-paper: #626c62;     /* labels: 4.67:1 — mono caps, never running text */
  --o-ink-on-graphite: #f0eee7;       /* 14.18:1 */
  --o-ink-muted-on-graphite: #b0b8ae; /* 8.08:1 — leads, notes, a field's hint */
  --o-ink-soft-on-graphite: #a4aba1;  /* labels, quiet controls: 6.99:1 */

  /* ── The signal ─────────────────────────────────────────────────────────────────────────────────────────── */
  --o-signal: #fa8645;           /* action, charge, the current value; a line or a fill, never text on paper */
  --o-signal-hot: #ffb377;       /* the fill under the pointer */
  --o-signal-text: #a65427;      /* the signal as text on paper: 4.57:1 */
  --o-on-signal: #191c1d;        /* text on the signal fill: 6.99:1 */
  --o-signal-glow: #fa864566;
  --o-signal-tint: #fa864514;

  /* ── Hairlines and ticks ────────────────────────────────────────────────────────────────────────────────── */
  --o-line-on-paper: #d1d1c9;
  --o-line-strong-on-paper: #c3c9b8;
  --o-line-on-graphite: #3b3e3d;
  --o-line-strong-on-graphite: #5a6357;
  --o-cap: light-dark(#8d977f, #cad2bf); /* the end caps of a rule and a zone */
  --o-tick: #85907555;           /* a minor division */
  --o-tick-major: #acb69a80;     /* a detent */
  --o-tick-mark: light-dark(#8d977f, #b9c1ac); /* a chapter mark */
  --o-dim: #9ba58e;              /* a node or marker still waiting for the charge */

  /* ── States ─────────────────────────────────────────────────────────────────────────────────────────────── */
  --o-error-on-paper: #b42318;
  --o-error-on-graphite: #f2a465;
  --o-error-line: #d98a4e;
  --o-success-on-paper: #365f43;
  --o-success-on-graphite: #b8d1a6;

  /* ── Figures only ───────────────────────────────────────────────────────────────────────────────────────── */
  --o-sage: #dce1d2;
  --o-aluminium: #dce2e3;

  /* ── Type ───────────────────────────────────────────────────────────────────────────────────────────────── */
  --o-font: 'OctoSans', 'OctoSans Fallback', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --o-font-mono: ui-monospace, 'SF Mono', 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
  /* Headings grow with the window and stop at their own end, each a fifth to a quarter over the next at every width,
     so the page's call, a principal section and a section read as three sizes; reading sizes are fixed, because text
     whose measure changes with the window is text whose measure the reader feels. */
  --o-type-display: clamp(44px, 4.7vw, 70px); /* the page's call */
  --o-type-h1: clamp(36px, 4vw, 58px);        /* a principal section */
  --o-type-h2: clamp(32px, 3.3vw, 46px);      /* a section */
  --o-type-h3: clamp(24px, 2.5vw, 36px);      /* a section's sub-head */
  --o-type-h4: clamp(22px, 2.1vw, 32px);      /* a thing in a section: a case, a question */
  --o-type-h5: clamp(19px, 1.7vw, 26px);      /* a thing in a thing: a row */
  --o-type-lead: 21px;
  --o-type-body-lg: 18px;
  --o-type-body: 16px;
  --o-type-body-sm: 15px;
  --o-type-note: 13px;
  --o-type-label: 12px;                       /* the mono caps; nothing that carries meaning is set smaller */
  --o-type-figure: clamp(54px, 5.4vw, 86px);  /* a meter's digits */
  --o-type-price: clamp(44px, 4.2vw, 64px);   /* a price */
  --o-type-figure-sm: clamp(36px, 3.2vw, 48px);
  --o-leading-reading: 1.6;
  --o-tracking-head: -.035em;
  --o-tracking-label: .035em;
  --o-tracking-engraving: .08em;

  /* ── Space and measure ──────────────────────────────────────────────────────────────────────────────────── */
  --o-space-1: 4px;
  --o-space-2: 8px;
  --o-space-3: 12px;
  --o-space-4: 16px;
  --o-space-5: 24px;
  --o-space-6: 32px;
  --o-space-7: 48px;
  --o-space-8: 64px;
  --o-space-9: 96px;
  --o-container: 1440px;
  --o-gutter: 56px;              /* 36 ≤1180, 24 ≤900, 20 ≤600 */
  --o-section: 96px;             /* a section's top and bottom: 68 ≤900, 56 ≤600 */
  /* One of the page's twelve columns, and the step a heading's second line takes: never so little that the band in it
     stops reading as a band (an em and a half of the heading; an em on a phone, where the words need the room). */
  --o-column: calc((min(100vw, var(--o-container) + 2 * var(--o-gutter)) - 2 * var(--o-gutter)) / 12);
  --o-step-em: 1.5;
  --o-step: max(var(--o-column), var(--o-step-em) * 1em);
  --o-intro-gap: 72px;           /* heading block → content: 44 on a phone */

  /* ── Controls ───────────────────────────────────────────────────────────────────────────────────────────── */
  --o-control: 54px;             /* 40 on a phone: the small control's height, a step under the finger's 44 goal */
  --o-control-sm: 40px;
  --o-target: 44px;              /* the goal for a press area; a control may sit between the 24 px minimum and it */

  /* ── Motion ─────────────────────────────────────────────────────────────────────────────────────────────── */
  --o-ease: cubic-bezier(.2, .7, .2, 1);      /* settle: a rule drawn, a marker gliding */
  --o-ease-fold: cubic-bezier(.65, 0, .35, 1); /* a fold: the header narrowing */
  --o-fast: .2s;                               /* colour and border */
  --o-base: .3s;                               /* a reveal */
  --o-slow: .6s;                               /* a sweep, a drawn line */
}

@media (max-width: 1180px) { :root { --o-gutter: 36px; } }
@media (max-width: 900px) { :root { --o-gutter: 24px; --o-section: 68px; --o-intro-gap: 44px; } }
@media (max-width: 600px) { :root { --o-gutter: 20px; --o-section: 56px; --o-control: 40px; --o-step-em: 1; } }
/* A phone's type: the headings keep their order, each a quarter or so under the one above, so the steps read apart —
   the page's call 42 at the top, a principal section 36, a section 32 (the steps nearly meet on a narrow phone, where the call is held by its line), a meter's figures 30 among them; the lead comes
   down to a step over the body, and the smallest reading text up to 14 — under it only the caps of a label, which name
   a thing and are read at a glance. The page's call is the one step that keeps shrinking: its first line, `Сайты и
   спецпроекты`, is the longest in the site's own words and is measured in ems of itself, so a fixed size starts
   breaking it at 454 and breaks the second line at 421. 8.4vw holds that line whole down to the narrowest phone (28). */
@media (max-width: 600px) { :root { --o-type-display: clamp(28px, 8.4vw, 42px); --o-type-h1: 36px; --o-type-h2: 32px; --o-type-h3: 22px; --o-type-h4: 21px; --o-type-figure-sm: 30px; --o-type-lead: 18px; --o-type-note: 14px; } }
/* A narrow phone (454 and under): every step comes down one notch — the headings a pixel or three, the reading text a
   pixel — so the page keeps the room the smaller window took away, and the lead stays a step over the body. */
@media (max-width: 454px) { :root {
  --o-type-h1: 32px; --o-type-h2: 28px; --o-type-h3: 21px; --o-type-h4: 20px; --o-type-h5: 18px;
  --o-type-figure-sm: 28px; --o-type-price: 40px;
  --o-type-lead: 17px; --o-type-body-lg: 17px; --o-type-body: 15px; --o-type-body-sm: 14px; } }
/* A small phone (340 and under): the same order a step smaller, the reading text a pixel under a phone's and the
   gutter narrower, so the words keep their room; the controls keep a press's height. */
@media (max-width: 340px) { :root { --o-gutter: 16px; --o-section: 48px; --o-intro-gap: 36px;
  --o-type-h1: 28px; --o-type-h2: 26px; --o-type-h3: 20px; --o-type-h4: 19px; --o-type-h5: 17px;
  --o-type-figure-sm: 26px; --o-type-price: 38px; --o-type-lead: 17px; --o-type-body-lg: 16px; --o-type-body: 15px;
  --o-type-body-sm: 14px; --o-type-note: 13px; } }
/* The scale of the breaks: 340, 454, 600, 900 and 1180 are the system's (the lines above). A media query cannot read a
   custom property, so a stylesheet writes the number out: the site's pages also break where their figures stack, at 700
   and 1100, and nowhere else but the header's own steps (octinity/header.css), which follow the width of its row. */
