/**
 * Shared typography — every page in the builder loads this.
 *
 * Replaces the per-page `font: 16px Arial` (and the design builder's
 * `font: 15px system-ui`) with the site's two families and its fluid type
 * scale. Consumes assets/css/tokens.css, so it must load after it, and after
 * each page's own inline <style> so equal-specificity element rules win on
 * source order.
 *
 * Scope is type only: family, size, weight, line-height and letter-spacing.
 * Colour, spacing, borders and the button tiers still follow the old palette
 * and are a separate pass.
 */

/* === METRIC-MATCHED FALLBACKS ===
 * display=swap alone still reflows the page when the web font lands. These two
 * faces re-serve the viewer's local Arial with Inter's and Plus Jakarta Sans's
 * metrics, so the fallback occupies the same space as the real font and the
 * swap is invisible.
 *
 * Every figure below was measured, not copied: average advance width over
 * a-z A-Z 0-9 and space, against the woff2 Google serves today (Inter v20,
 * Plus Jakarta Sans v12, both variable, default weight 400) and against
 * Windows Arial. size-adjust = webfont average / Arial average; the ascent,
 * descent and line-gap overrides are the font's own OS/2 sTypo metrics divided
 * by that size-adjust. Re-measure if either family is upgraded.
 *
 * Where Arial is absent (most Linux), local() fails, the rule is dropped and
 * the stack falls through to sans-serif. That is the normal limitation of this
 * technique, not a defect. */
@font-face {
  font-family: "Inter Fallback";
  src: local("Arial");
  size-adjust: 104.68%;
  ascent-override: 92.54%;
  descent-override: 23.04%;
  line-gap-override: 0%;
}

@font-face {
  font-family: "Plus Jakarta Sans Fallback";
  src: local("Arial");
  size-adjust: 103.63%;
  ascent-override: 100.17%;
  descent-override: 21.42%;
  line-gap-override: 0%;
}

/* The one place this file overrides a token, and only to widen the fallback
   chain. The families themselves are tokens.css's. */
:root {
  --font-heading: 'Plus Jakarta Sans', 'Plus Jakarta Sans Fallback', sans-serif;
  --font-body: 'Inter', 'Inter Fallback', sans-serif;
}

/* === ELEMENT DEFAULTS ===
   Mirrors the store theme's base.css. */
body {
  font-family: var(--font-body);
  font-size: var(--text-body);
  line-height: 1.6;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-heading);
  letter-spacing: -0.025em;
  line-height: 1.05;
}

h1 {
  font-size: var(--text-h3);
  font-weight: 800;
}

h2,
h3 {
  font-size: var(--text-h4);
  font-weight: 700;
}

/* Every page's h1 is an app-bar or page title, 24px to 26px as delivered, so
   --text-h3 (20px to 26px) is the right rung. --text-h1 and --text-h2 are the
   store's marketing scale and reach 72px and 56px, far past anything here.
   catnip-kit-range.html is the exception: a standalone entry page whose title
   was 40px, so it opts up to --text-h2 through a body class. */
.page-entry h1 {
  font-size: var(--text-h2);
}

/* === CONTROLS ===
   Buttons take the heading family at the site's button size, as on the store.
   Text transform and the three button colour tiers belong to the component
   pass and are deliberately not set here. Inputs and selects keep the body
   face so typed values read as content, not as chrome. */
button {
  font-family: var(--font-heading);
  font-size: var(--btn-font-size);
  font-weight: var(--btn-font-weight);
  line-height: 1.2;
}

select,
input,
textarea,
optgroup,
option {
  font-family: var(--font-body);
  font-size: var(--text-small);
  line-height: 1.2;
}

small {
  font-size: var(--text-small);
}

strong,
b {
  font-weight: 700;
}
