/* ===========================================================================
   sldrz — THE TOKEN CONTRACT  (schemaVersion 2)
   ---------------------------------------------------------------------------
   This file is the single source of truth for every design token in sldrz.
   - Every token sldrz uses is declared here, with a working default value.
     The defaults are a complete, usable dark base. A site's own colours
     (style.colors in site.json, written as inline values by render.js and
     build.py) replace the colour values; Advanced design (core/tune.json)
     and the layout set some others. (1.12: themes were removed.)
   - Component CSS (core/base.css, core/components.css, sections/**) may only
     reference var(--s-*) — never a raw colour or a px size.
   - This is the ONE file allowed to contain literal colour values.
     tools/validate.py exempts it from that check and fails on any token
     that is used somewhere but not declared here.
   See docs/DESIGN-CONTRACT.md for the rules and the full table.
   =========================================================================== */

:root {
  /* --- colour: surfaces ------------------------------------------------- */
  --s-bg: #0b0e12;            /* page background */
  --s-bg-elev: #141a21;       /* cards, panels, anything raised */
  --s-bg-sunken: #05070a;     /* wells, inputs, inset strips */

  /* --- colour: text ----------------------------------------------------- */
  --s-fg: #e9eef4;            /* body and heading text */
  --s-fg-muted: #a8b8c8;      /* secondary text, meta, captions (AA on bg) */
  --s-fg-faint: #76879a;      /* decorative only — never meaningful text */

  /* --- colour: accent --------------------------------------------------- */
  --s-accent: #5de2c4;        /* the one brand colour; links, active state */
  --s-accent-fg: #04120f;     /* text drawn ON --s-accent (AA against it) */
  --s-accent-2: #c57bff;      /* secondary accent, used sparingly */

  /* --- colour: lines and focus ------------------------------------------ */
  --s-border: #222b35;        /* hairlines, card edges */
  --s-border-strong: #394654; /* emphasised edges, hover */
  --s-focus: #7cc7ff;         /* focus ring colour */
  --s-overlay: rgba(4, 6, 9, .78); /* scrims behind dialogs / over images */

  /* --- colour: status --------------------------------------------------- */
  --s-success: #58d68d;
  --s-warn: #f2c14e;
  --s-danger: #ff6b6b;

  /* --- type: families --------------------------------------------------- */
  --s-font-display: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --s-font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --s-font-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  /* --- type: fluid scale ------------------------------------------------ */
  --s-text-xs: clamp(.69rem, .66rem + .15vw, .76rem);
  --s-text-sm: clamp(.8rem, .77rem + .18vw, .88rem);
  --s-text-base: clamp(.94rem, .9rem + .22vw, 1.03rem);
  --s-text-lg: clamp(1.08rem, 1rem + .4vw, 1.25rem);
  --s-text-xl: clamp(1.3rem, 1.15rem + .7vw, 1.6rem);
  --s-text-2xl: clamp(1.6rem, 1.3rem + 1.4vw, 2.2rem);
  --s-text-3xl: clamp(2rem, 1.5rem + 2.6vw, 3.2rem);
  --s-text-4xl: clamp(2.6rem, 1.6rem + 5.4vw, 5.5rem);

  /* --- type: metrics ---------------------------------------------------- */
  --s-leading-tight: 1.05;
  --s-leading-normal: 1.55;
  --s-leading-loose: 1.75;
  --s-tracking-tight: -.02em;
  --s-tracking-normal: 0em;
  --s-tracking-wide: .14em;
  --s-weight-normal: 400;
  --s-weight-medium: 600;
  --s-weight-bold: 800;
  --s-case-display: none;     /* none | uppercase */

  /* --- space ramp (4px base) -------------------------------------------- */
  --s-space-0: 0rem;
  --s-space-1: .25rem;
  --s-space-2: .5rem;
  --s-space-3: .75rem;
  --s-space-4: 1rem;
  --s-space-5: 1.5rem;
  --s-space-6: 2rem;
  --s-space-7: 3rem;
  --s-space-8: 4rem;
  --s-space-9: 6rem;

  /* --- shape ------------------------------------------------------------ */
  --s-radius-none: 0px;
  --s-radius-sm: 3px;
  --s-radius-md: 8px;
  --s-radius-lg: 18px;
  --s-radius-pill: 999px;
  --s-border-w: 1px;
  --s-border-w-strong: 2px;

  /* --- depth ------------------------------------------------------------ */
  --s-shadow-1: 0 1px 2px rgba(0, 0, 0, .35);
  --s-shadow-2: 0 10px 30px rgba(0, 0, 0, .45);
  --s-shadow-3: 0 24px 70px rgba(0, 0, 0, .55);
  --s-ring: 0 0 0 3px color-mix(in srgb, var(--s-focus) 55%, transparent);

  /* --- motion ----------------------------------------------------------- */
  --s-dur-fast: 110ms;
  --s-dur-base: 220ms;
  --s-dur-slow: 480ms;
  --s-ease: cubic-bezier(.2, .7, .3, 1);

  /* --- layout ----------------------------------------------------------- */
  --s-container: 72rem;
  --s-gutter: clamp(1rem, 4vw, 2.5rem);
  --s-section-y: clamp(3rem, 8vw, 7rem);
  --s-grid-gap: clamp(.75rem, 2vw, 1.5rem);
  --s-header-h: 4rem;

  /* --- media ------------------------------------------------------------ */
  --s-ratio-hero: 16 / 9;
  --s-ratio-card: 3 / 4;
  --s-ratio-square: 1 / 1;

  /* --- character -------------------------------------------------------- */
  --s-bg-image: none;         /* pattern/gradient over --s-bg: grid, dots, scanlines, glow */
  --s-bg-size: auto;          /* tile size for --s-bg-image, e.g. 1.5rem 1.5rem */
  --s-head-bg: #0b0e12;       /* header bar and Menu panel */
  --s-head-fg: #e9eef4;       /* header text; 4.5:1 on --s-head-bg */
  --s-display-style: normal;  /* normal | italic for headlines */
  --s-display-shadow: none;   /* text-shadow on headlines: glow, offset, outline */
  --s-rule-style: solid;      /* solid | dashed | dotted | double, for every rule and border */
  --s-btn-case: none;         /* none | uppercase for buttons */
}

/* --- section colour schemes (1.5) ------------------------------------------
   A section can ask for the accent or the inverse scheme (data-s-bg on the
   section). The page's own colours are captured once at :root (--sx-page-*),
   then the colour tokens are re-pointed inside that section, so every part
   of it (and of any layout) follows without knowing about schemes. */
:root {
  --sx-page-bg: var(--s-bg);
  --sx-page-fg: var(--s-fg);
  --sx-page-accent: var(--s-accent);
  --sx-page-accent-fg: var(--s-accent-fg);
}
[data-s-bg="accent"] {
  --s-bg: var(--sx-page-accent);
  --s-bg-elev: color-mix(in srgb, var(--sx-page-accent-fg) 10%, var(--sx-page-accent));
  --s-bg-sunken: color-mix(in srgb, var(--sx-page-accent-fg) 18%, var(--sx-page-accent));
  --s-fg: var(--sx-page-accent-fg);
  --s-fg-muted: color-mix(in srgb, var(--sx-page-accent-fg) 80%, var(--sx-page-accent));
  --s-fg-faint: color-mix(in srgb, var(--sx-page-accent-fg) 60%, var(--sx-page-accent));
  --s-accent: var(--sx-page-accent-fg);
  --s-accent-fg: var(--sx-page-accent);
  --s-border: color-mix(in srgb, var(--sx-page-accent-fg) 25%, var(--sx-page-accent));
  --s-border-strong: color-mix(in srgb, var(--sx-page-accent-fg) 45%, var(--sx-page-accent));
  --s-bg-image: none;
}
[data-s-bg="inverse"] {
  --s-bg: var(--sx-page-fg);
  --s-bg-elev: color-mix(in srgb, var(--sx-page-bg) 10%, var(--sx-page-fg));
  --s-bg-sunken: color-mix(in srgb, var(--sx-page-bg) 18%, var(--sx-page-fg));
  --s-fg: var(--sx-page-bg);
  --s-fg-muted: color-mix(in srgb, var(--sx-page-bg) 80%, var(--sx-page-fg));
  --s-fg-faint: color-mix(in srgb, var(--sx-page-bg) 60%, var(--sx-page-fg));
  --s-border: color-mix(in srgb, var(--sx-page-bg) 25%, var(--sx-page-fg));
  --s-border-strong: color-mix(in srgb, var(--sx-page-bg) 45%, var(--sx-page-fg));
  --s-bg-image: none;
}
