/*
  Design tokens, v2. The values here are the design system: design/tokens.json
  holds the same values with a usage note for each, design/README.md the rules.
  Page builders consume these properties and never add a colour, a font,
  a radius or a spacing step. A page that needs one stops and asks.
  v2 adds the two hands (README section 2): the pen (the human's ballpoint)
  and the pixel (the agents' drawings), the halftone of a photocopy, and the
  poster size for the signed promise.

  Themes: light by default, dark when the system asks for it, and either one
  forced by data-theme="light" or data-theme="dark" on any element.
  Breakpoint: 60rem (960px) is the only one; type steps switch there.
*/

:root,
[data-theme="light"] {
  color-scheme: light;

  /* Colour. Printed page, one ink. */
  --paper: #FFFFFF;
  --field: #FFFFFF;
  --ink: #17191F;
  --ink-muted: #5A5E65;
  --rule: #E0E1E4;
  --rule-strong: var(--ink);
  --border-control: #7D8088;
  --wash: rgba(23, 25, 31, 0.06);
  --signature: #1F39AC;
  --signature-hover: #162B8E;
  --signature-pressed: #102172;
  --on-signature: #FFFFFF;
  /* A light pencil line: a preview, always fainter than the pen's blue. */
  --pencil: rgba(23, 25, 31, 0.45);
  /* Card stock: the menu you are handed on Services and the order slip on
     Contact (HY-327), a sheet laid on the page. A flat stand-in until
     Lorenzo's paper; words on it measure 15.85:1 and 5.88:1 (muted). */
  --card: #F6F3EC;
  --card-edge: #E4DED1;
  --card-rule: #D9D2C3;
  --focus: var(--ink);
  --error: #B32322;
  --selection: #D2DEFA;
  --image-outline: rgba(0, 0, 0, 0.1);

  /* The photocopy: the shape of an image that is not here yet, printed in dots
     of ink on the paper. (v2.3 retired the pale screen that filled the frame.) */
  --halftone-strong: rgba(23, 25, 31, 0.62);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #18191C;
    --field: #202225;
    --ink: #E8E9EC;
    --ink-muted: #A8ABB1;
    --rule: #33353A;
    --rule-strong: var(--ink);
    --border-control: #7D8088;
    --wash: rgba(232, 233, 236, 0.08);
    --signature: #456CE6;
    --signature-hover: #3D62DB;
    --signature-pressed: #385CD4;
    --on-signature: #FFFFFF;
    --pencil: rgba(232, 233, 236, 0.3);
    --card: #222327;
    --card-edge: #34353A;
    --card-rule: #3B3C42;
    --focus: var(--ink);
    --error: #F6857A;
    --selection: #2D3F72;
    --image-outline: rgba(255, 255, 255, 0.1);
    --halftone-strong: rgba(232, 233, 236, 0.5);
  }
}

[data-theme="dark"] {
  color-scheme: dark;
  --paper: #18191C;
  --field: #202225;
  --ink: #E8E9EC;
  --ink-muted: #A8ABB1;
  --rule: #33353A;
  --rule-strong: var(--ink);
  --border-control: #7D8088;
  --wash: rgba(232, 233, 236, 0.08);
  --signature: #456CE6;
  --signature-hover: #3D62DB;
  --signature-pressed: #385CD4;
  --on-signature: #FFFFFF;
  --pencil: rgba(232, 233, 236, 0.3);
  --card: #222327;
  --card-edge: #34353A;
  --card-rule: #3B3C42;
  --focus: var(--ink);
  --error: #F6857A;
  --selection: #2D3F72;
  --image-outline: rgba(255, 255, 255, 0.1);
  --halftone-strong: rgba(232, 233, 236, 0.5);
}

:root {
  /* Type. One family; weight and size carry the hierarchy. */
  --font-sans: "Libre Franklin", "Libre Franklin Fallback", Arial, sans-serif;
  --weight-regular: 400;
  --weight-medium: 600;
  --weight-bold: 700;

  /* Sizes in rem so the reader's own text-size setting scales the site.
     Phone values first; the desktop step is set below at 60rem.
     On a phone the four heading sizes grow with that setting only as far as
     the screen's width lets a long word fit its line: at twice the text on a
     360 phone, a 40px heading at 80px broke "cualquier" mid-word and widened
     the page (HY-324). The vw cap equals the rem size on a 320 phone, so at
     the default text nothing moves from 320 up; the floor keeps each heading
     larger than the one under it, and the smallest, bold, as large as the
     body text however large that is. */
  --size-poster: min(2.75rem, max(13.75vw, 1.4375rem));  /* 44px; 96px on desktop. The signed promise only. */
  --size-display: min(2.5rem, max(12.5vw, 1.375rem));    /* 40px; 64px on desktop */
  --size-title: min(1.875rem, max(9.375vw, 1.25rem));    /* 30px; 40px on desktop */
  --size-heading: min(1.375rem, max(6.875vw, 1.125rem)); /* 22px; 24px on desktop */
  --size-lede: 1.25rem;      /* 20px; 22px on desktop */
  --size-body: 1.125rem;     /* 18px */
  --size-ui: 1rem;           /* 16px */
  --size-small: 0.9375rem;   /* 15px */

  --leading-display: 1.05;
  --leading-title: 1.12;
  --leading-heading: 1.25;
  --leading-lede: 1.45;
  --leading-body: 1.6;
  --leading-ui: 1.375;
  --leading-small: 1.45;

  --tracking-display: -0.025em;
  --tracking-title: -0.02em;
  --tracking-heading: -0.01em;

  /* Spacing. A 4px grid; the number in the name is the multiple of 4. */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;
  --space-16: 64px;
  --space-24: 96px;
  --space-32: 128px;

  /* Layout, built from the steps above. The gutter grows with the screen,
     20px on a phone to 48px at 960px, so the page column only ever widens as
     the screen does and every component switches together (README section 6). */
  --gutter: clamp(var(--space-5), 5vw, var(--space-12));
  --section-gap: var(--space-16);
  /* 1200px up to a 1500px screen, then four fifths of the screen, up to
     1920px at 2400 and wider. A page held at 1200 floated in the middle of a
     1920 screen with 360px of nothing either side, and home's headline got a
     476px column whatever the screen (RB on HY-453: "layout doesnt seem to be
     truly adaptive on desktop"). The 1920px ceiling rises on a screen taller
     than about 1190px, by 1536px for every 950px of height (2048 at 2560 by
     1300 or 1440, 2328 at 3440 by 1440, 3072 at 3840 by 2160), so a big
     screen keeps the proportions of a 1920 by 950 browser window instead of
     gaining only empty margins; home's first screen scales with it
     (pages.css). Below that height the ceiling stays 1920 (HY-453,
     2026-11-18, decision 102). */
  --page-max: max(75rem, min(0.8 * var(--grow-w), max(120rem, 1.6168 * var(--grow-h))));
  /* What the growth above, and every growth past 1500 (pages.css, about.css),
     is measured against: the window at 100% zoom, never vw or svh, so browser
     zoom scales every page (HY-485, Alma). js/theme.js sets --window-w and
     --window-h from the window; without script a screen counts as 1920 by
     1080 at most. */
  --window-w: 1920px;
  --window-h: 1080px;
  --grow-w: min(100vw, var(--window-w));
  --grow-h: min(100svh, var(--window-h));
  --measure: 34em;     /* about 66 characters of body text */
  --tap: 44px;         /* the floor for anything a finger presses */

  /* Radius. Square-ish, like paper; never one radius on everything. */
  --radius-sm: 4px;
  --radius-md: 8px;

  /* Borders. The system has no shadows: structure comes from space and a few rules. */
  --border-hairline: 1px;
  --border-strong: 2px;
  --focus-width: 2px;
  --focus-offset: 2px;

  /* Motion. In answer to the reader, plus the page's one orchestrated moment. */
  --duration-fast: 120ms;
  --duration-open: 180ms;
  --ease-out: cubic-bezier(0.2, 0, 0, 1);

  /* The pen: the human's ballpoint. Its ink is --signature; it never prints words.
     A stroke draws at the speed of a hand: slow start, fast middle, slow lift. */
  --pen-width: 2.5px;
  --duration-draw: 560ms;
  --ease-pen: cubic-bezier(0.55, 0, 0.35, 1);

  /* The pixel: one square of the agents' pixel art. Art scales by whole squares only. */
  --pixel: 2px;
}

@media (min-width: 60rem) {
  :root {
    --size-poster: 6rem;       /* 96px */
    --pixel: 3px;
    /* The three large steps hold their size to a 1440 screen, then grow
       with it as the page column does, less than the column grows, so a
       wider screen sets longer lines at a larger size (HY-453): display 64
       to 73px at 1920 and 84px at 2560, title 40 to 45 and 51, lede 22 to
       24 and 26. Body text keeps its size; its measure keeps it readable. */
    --size-display: clamp(4rem, 2.375rem + 0.018 * var(--grow-w), 5.5rem);
    --size-title: clamp(2.5rem, 1.6rem + 0.01 * var(--grow-w), 3.25rem);
    --size-heading: 1.5rem;    /* 24px */
    --size-lede: clamp(1.375rem, 1.1rem + 0.003 * var(--grow-w), 1.625rem);
    --section-gap: var(--space-32);
  }
}
