/* ==========================================================================
   AS-2027 design tokens
   Every color, font, size, and space on the site comes from this file.
   Light = "paper", dark = "board view". The theme follows the device setting.
   ========================================================================== */

@font-face {
  font-family: "Archivo";
  src: url("../fonts/archivo-var-latin.woff2") format("woff2");
  font-weight: 400 900;
  font-stretch: 62% 125%;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("../fonts/ibm-plex-mono-400-latin.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("../fonts/ibm-plex-mono-500-latin.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;

  /* Color: paper */
  --paper: #f6f7f5;
  --surface: #ffffff;
  --ink: #15191c;
  --grey: #5a625e;
  --rule: #c9cdc9;
  --mask: #17614a;        /* solder-mask green: links, active pin, focus */
  --probe: #c8372d;       /* only the highlighted trace in a diagram */
  --hatch: rgba(21, 25, 28, 0.09);
  --header-bg: rgba(246, 247, 245, 0.92);

  /* Type families */
  --font-sans: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  /* Type scale (1.25 ratio, 17px body) */
  --fs-display: clamp(2.75rem, 1.6rem + 5.2vw, 5.5rem);   /* 44 → 88 */
  --fs-h2: clamp(1.875rem, 1.45rem + 1.6vw, 2.625rem);    /* 30 → 42 */
  --fs-h3: clamp(1.375rem, 1.2rem + 0.6vw, 1.6875rem);    /* 22 → 27 */
  --fs-h4: 1.0625rem;                                      /* 17 */
  --fs-lead: clamp(1.1875rem, 1.1rem + 0.35vw, 1.3125rem); /* 19 → 21 */
  --fs-body: 1.0625rem;                                    /* 17 (16 on phones) */
  --fs-small: 0.9375rem;                                   /* 15 */
  --fs-label: 0.8125rem;                                   /* 13 */
  --fs-mono: 0.875rem;                                     /* 14 */

  --lh-display: 0.95;
  --lh-h2: 1.05;
  --lh-h3: 1.15;
  --lh-body: 1.6;

  /* Widths (font-stretch) */
  --w-expanded: 125%;
  --w-wide: 112%;
  --w-normal: 100%;
  --w-narrow: 87%;

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

  /* Layout */
  --max: 1120px;
  --spec-col: 200px;
  --gutter: 40px;
  --measure: 68ch;
  --header-h: 60px;

  /* Lines */
  --line-thin: 1px;
  --line-fig: 1.5px;
  --line-bold: 2px;
  --radius-btn: 2px;

  /* Motion */
  --t-fast: 150ms;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --paper: #121a17;
    --surface: #18221e;
    --ink: #e6ebe7;
    --grey: #97a39d;
    --rule: #2f3b36;
    --mask: #5cc79a;
    --probe: #f07a6e;
    --hatch: rgba(230, 235, 231, 0.07);
    --header-bg: rgba(18, 26, 23, 0.92);
  }
}
