/* ============================================================================
   SPF Client-First — tokens
   The Client-First spacing scale, size scale and type scale. Every utility and
   component value reads one of these. One literal per breakpoint, in rem.
   Breakpoints: max-width 991 (tablet) / 767 (mobile landscape) / 479 (mobile
   portrait). No others. No clamp(), min() or max() (Instatic drops them).
   Brand values (color, fonts, radius, motif, motion) live in the site's theme.css.
   ============================================================================ */

:root {
  /* ---- spacing scale: margin-*, padding-*, spacer-*, gaps ---------------- */
  --space--0: 0rem;
  --space--tiny: 0.125rem;
  --space--xxsmall: 0.25rem;
  --space--xsmall: 0.5rem;
  --space--small: 1rem;
  --space--medium: 2rem;
  --space--large: 3rem;
  --space--xlarge: 4rem;
  --space--xxlarge: 5rem;
  --space--huge: 6rem;
  --space--xhuge: 8rem;
  --space--xxhuge: 12rem;

  /* ---- page structure ----------------------------------------------------- */
  --site--margin: 4rem;              /* padding-global, left and right */
  --padding-section--small: 3rem;
  --padding-section--medium: 5rem;
  --padding-section--large: 8rem;
  --container--small: 48rem;
  --container--medium: 64rem;
  --container--large: 90rem;         /* 1440px content width (house rule) */

  /* ---- size scale: max-width-* -------------------------------------------- */
  --max-width--xxsmall: 20rem;
  --max-width--xsmall: 25rem;
  --max-width--small: 30rem;
  --max-width--medium: 35rem;
  --max-width--large: 48rem;
  --max-width--xlarge: 64rem;
  --max-width--xxlarge: 80rem;

  /* ---- small fixed sizes (on the spacing scale) --------------------------- */
  --size--icon-small: 1rem;
  --size--icon-medium: 2rem;
  --size--icon-large: 3rem;
  --size--tap: 3rem;                 /* minimum tap target (48px >= 44px) */

  /* ---- type scale: heading-style-h1..h6 ---------------------------------- */
  --heading-style--h1: 4rem;
  --heading-style--h2: 3rem;
  --heading-style--h3: 2rem;
  --heading-style--h4: 1.5rem;
  --heading-style--h5: 1.25rem;
  --heading-style--h6: 1.125rem;
  --heading-style--display: 6rem;

  /* ---- type scale: text-size-* (nothing below 1rem / 16px) --------------- */
  --text-size--large: 1.5rem;
  --text-size--medium: 1.25rem;
  --text-size--regular: 1.125rem;
  --text-size--small: 1rem;

  /* ---- type roles: leading, tracking, weight ------------------------------ */
  --line-height--heading: 1.1;
  --line-height--tight: 1.25;
  --line-height--body: 1.5;
  --letter-spacing--heading: -0.02em;
  --letter-spacing--normal: 0em;
  --letter-spacing--allcaps: 0.06em;
  --font-weight--light: 300;
  --font-weight--normal: 400;
  --font-weight--medium: 500;
  --font-weight--semibold: 600;
  --font-weight--bold: 700;
  --font-weight--xbold: 800;

  /* ---- the site recipe (theme.json "recipe", AGENTS "One voice") ----------
     theme build writes these from the recipe; these are the library default.
     Headings take their size from the tag: h1 the page step, h2 the section
     step, h3 to h6 the item step, so a page has three heading sizes and no
     section sets its own. */
  --type--page: var(--heading-style--h1);
  --type--section: var(--heading-style--h2);
  --type--item: var(--heading-style--h4);
  --heading--gap: var(--space--small);
  --heading--rule: none;
  --heading--rule-width: var(--space--huge);
  --button--secondary-padding: var(--space--medium);
  --button--secondary-border: currentColor;
  --button--secondary-decoration: none;
  --motif--mark-display: inline-block;
  /* what the checks read: the recipe's padding size, accent roles, motif role and image roles */
  --recipe--padding: medium;
  --recipe--accent: action link;
  --recipe--motif: hero-edge;
  --recipe--images: ground bleed gallery;
}

/* the recipe's colour roles, read again inside every section scheme (below, "section schemes"), so a dark or accent section's links, rules and button hovers follow its colours.
   theme build writes the site's own under the same selector. */
:root,
[data-scheme] {
  --heading--rule-color: var(--color--text-primary);
  --color--link: var(--color--text-accent);
  --button--secondary-hover-border: var(--color--text-primary);
  --button--secondary-hover-background: var(--color--text-primary);
  --button--secondary-hover-color: var(--color--background-primary);
}

/* ---- section schemes (SPEC 5e, "Page composition") -------------------------------
   Inside a section with data-scheme the colour tokens are remapped, so every class and component
   that reads them follows: a card on background-secondary sits light on the alt ground and dark on
   the dark one (css/global.css "section schemes" paints the ground). The page's own values are
   kept as --scheme-base--* so the remaps never read themselves. Colour and logo values come from
   the theme. */
:root {
  --scheme-base--background-primary: var(--color--background-primary);
  --scheme-base--background-secondary: var(--color--background-secondary);
  --scheme-base--background-tertiary: var(--color--background-tertiary);
  --scheme-base--background-alternate: var(--color--background-alternate);
  --scheme-base--text-primary: var(--color--text-primary);
  --scheme-base--text-secondary: var(--color--text-secondary);
  --scheme-base--text-alternate: var(--color--text-alternate);
  --scheme-base--text-accent: var(--color--text-accent);
  --scheme-base--text-accent-alternate: var(--color--text-accent-alternate);
  --scheme-base--border-primary: var(--color--border-primary);
  --scheme-base--border-alternate: var(--color--border-alternate);
  --scheme-base--accent: var(--color--accent);
  --scheme-base--accent-hover: var(--color--accent-hover);
  --scheme-base--accent-contrast: var(--color--accent-contrast);
  --scheme-base--logo-filter-alternate: var(--logo--filter-alternate);
}

[data-scheme="alt"] {
  --color--background-primary: var(--scheme-base--background-secondary);
  --color--background-secondary: var(--scheme-base--background-primary);
}

[data-scheme="dark"] {
  --color--background-primary: var(--scheme-base--background-alternate);
  --color--background-secondary: var(--scheme-base--background-alternate);
  --color--background-tertiary: var(--scheme-base--background-alternate);
  --color--background-alternate: var(--scheme-base--background-primary);
  --color--text-primary: var(--scheme-base--text-alternate);
  --color--text-secondary: var(--scheme-base--text-alternate);
  --color--text-alternate: var(--scheme-base--text-primary);
  --color--text-accent: var(--scheme-base--text-accent-alternate);
  --color--border-primary: var(--scheme-base--border-alternate);
  --color--border-alternate: var(--scheme-base--border-primary);
  --color--border-control: var(--scheme-base--text-alternate);
  --logo--filter: var(--scheme-base--logo-filter-alternate);
}

[data-scheme="accent"] {
  --color--background-primary: var(--scheme-base--accent);
  --color--background-secondary: var(--scheme-base--accent-hover);
  --color--background-tertiary: var(--scheme-base--accent-hover);
  --color--text-primary: var(--scheme-base--accent-contrast);
  --color--text-secondary: var(--scheme-base--accent-contrast);
  --color--text-accent: var(--scheme-base--accent-contrast);
  --color--border-primary: var(--scheme-base--accent-contrast);
  --color--border-control: var(--scheme-base--accent-contrast);
  --color--focus: var(--scheme-base--accent-contrast);
  --color--accent: var(--scheme-base--text-primary);
  --color--accent-hover: var(--scheme-base--text-secondary);
  --color--accent-contrast: var(--scheme-base--background-primary);
}

/* ---- tablet --------------------------------------------------------------- */
@media (max-width: 991px) {
  :root {
    --space--xlarge: 3rem;
    --space--xxlarge: 4rem;
    --space--huge: 5rem;
    --space--xhuge: 6rem;
    --space--xxhuge: 8rem;
    --site--margin: 3rem;
    --padding-section--medium: 4rem;
    --padding-section--large: 6rem;
    --heading-style--h1: 3.5rem;
    --heading-style--h2: 2.5rem;
    --heading-style--display: 5rem;
  }
}

/* ---- mobile landscape ----------------------------------------------------- */
@media (max-width: 767px) {
  :root {
    --space--large: 2rem;
    --space--xxlarge: 3rem;
    --space--huge: 4rem;
    --space--xhuge: 5rem;
    --space--xxhuge: 6rem;
    --site--margin: 2rem;
    --padding-section--small: 2rem;
    --padding-section--medium: 3rem;
    --padding-section--large: 4rem;
    --heading-style--h1: 3rem;
    --heading-style--h2: 2rem;
    --heading-style--h3: 1.5rem;
    --heading-style--h4: 1.25rem;
    --heading-style--h5: 1.125rem;
    --heading-style--h6: 1rem;
    --heading-style--display: 4rem;
    --text-size--large: 1.25rem;
    --text-size--medium: 1.125rem;
    --text-size--regular: 1rem;
  }
}

/* ---- mobile portrait ------------------------------------------------------ */
@media (max-width: 479px) {
  :root {
    --space--xlarge: 2rem;
    --space--xhuge: 4rem;
    --space--xxhuge: 5rem;
    --site--margin: 1rem;
    --heading-style--h1: 2.5rem;
    --heading-style--display: 3rem;
  }
}
