/*
  PUXD design tokens.
  "Brand" tokens come from the brief and are fixed.
  The other tokens support them and are accepted for use. Revisit them once
  full content pages are in place.
  Breakpoints cannot be custom properties, so they are documented here:
    --bp-sm 40em (640px), --bp-lg 64em (1024px)
*/

@font-face {
  font-family: "Outfit";
  src: url("/assets/fonts/outfit-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Lora";
  src: url("/assets/fonts/lora-latin-wght-normal.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Lora";
  src: url("/assets/fonts/lora-latin-wght-italic.woff2") format("woff2");
  font-weight: 400 700;
  font-style: italic;
  font-display: swap;
}

/*
  Fallback faces: local system fonts resized to match the web fonts' metrics,
  so text does not reflow when the web fonts load. Values are calculated from
  the font files (weighted average glyph width and hhea metrics) against Arial
  and Georgia.
*/
@font-face {
  font-family: "Outfit Fallback";
  src: local("Arial");
  size-adjust: 98.9%;
  ascent-override: 101.1%;
  descent-override: 26.3%;
  line-gap-override: 0%;
}

@font-face {
  font-family: "Lora Fallback";
  src: local("Georgia");
  size-adjust: 106.1%;
  ascent-override: 94.8%;
  descent-override: 25.8%;
  line-gap-override: 0%;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("/assets/fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Colour: brand (fixed) */
  --color-primary: #0055cc;
  --color-teal: #00a2a8;
  --color-yellow: #ffb400;
  --color-salmon: #e57f75;
  --color-surface: #fbfbf8;
  --color-code-bg: #f5f7fa;

  /* Colour: supporting */
  --color-white: #ffffff;
  --color-ink: #1a2233;
  --color-ink-muted: #4a5568;
  --color-border: #dde1e8;
  --color-border-strong: #6b7280;
  --color-primary-dark: #003f99;
  --color-teal-dark: #00767b;
  --color-primary-tint: #e8f0fb;
  --color-teal-tint: #e3f4f5;
  --color-yellow-tint: #fff3d1;
  --color-salmon-tint: #fbe9e6;


  --color-focus-on-dark: var(--color-yellow);
  --color-link-on-primary: var(--color-white);

  /* Type: families (brand) */
  --font-heading: "Outfit", "Outfit Fallback", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-ui: var(--font-heading);
  --font-body: "Lora", "Lora Fallback", Georgia, serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Type: sizes (ranges from the brief, fluid between 30rem and 60rem viewports) */
  --text-h1: clamp(2.25rem, 1.5rem + 2.5vw, 3rem);
  --text-h2: clamp(1.75rem, 1.5rem + 1vw, 2rem);
  --text-h3: clamp(1.25rem, 1rem + 0.8vw, 1.5rem);
  --text-body: 1rem;

  /* Type: supporting */
  --text-label: 0.875rem;
  --text-code: max(0.875em, 0.8125rem);
  --text-lede: clamp(1.125rem, 1rem + 0.5vw, 1.25rem);


  --text-h4: 1.125rem;
  --leading-body: 1.5; /* 24px at the 16px body size */
  --leading-heading: 1.2;
  --leading-tight: 1.35;

  /* Spacing: 4px base */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;
  --space-9: 6rem;

  /* Gap between navigation links. The four main links (209px of text at 320px wide)
     fit on one row at 320px with this gap, so it no longer needs to shrink. */
  --gap-nav: var(--space-5);

  /* Radius */
  --radius-sm: 0.25rem;
  --radius-md: 0.5rem;
  --radius-lg: 1rem;
  --radius-pill: 999px;

  /* Pill links (topic filters): 44px tall to tap, 36px on phones. See the override below. The tag list is always 36px. */
  --pill-height: 2.75rem;
  --pill-padding: var(--space-4);

  /* Widths */
  --width-prose: 42rem;
  --width-content: 72rem;
  --gutter: clamp(1rem, 4vw, 2rem);

  /* Focus */
  --focus-ring: 3px solid var(--color-primary);
}

/* Phones: pills are smaller, and still above the 24px WCAG 2.2 minimum with 8px between them. */
@media (max-width: 39.99em) {
  :root {
    --pill-height: 2.25rem;
    --pill-padding: var(--space-3);
  }
}
