/* ==========================================================================
   APA BASE - reset, element defaults, typography, layout primitives.
   Depends on tokens.css. Load order: tokens.css -> base.css -> components.css
   ========================================================================== */

/* --------------------------------------------------------------------------
   0. Fonts. Self-hosted, subset to latin. All are SIL OFL
      (licences in /assets/fonts/). Preload both in <head>.
   -------------------------------------------------------------------------- */
/* Headings: Lato Bold (OFL, licence in /assets/fonts/). Every weight a
   heading asks for maps to the one Bold file, so all headings render bold. */
@font-face {
  font-family: "Lato Display";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/fonts/lato-bold-latin.woff") format("woff");
}
@font-face {
  font-family: "Lato Display";
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/fonts/lato-bolditalic-latin.woff") format("woff");
}
@font-face {
  font-family: "Figtree Variable";
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url("/assets/fonts/figtree-var-latin.woff2") format("woff2-variations");
}

/* --------------------------------------------------------------------------
   1. Reset
   -------------------------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + var(--space-m));
}

body,
h1, h2, h3, h4, h5, h6,
p, figure, blockquote, dl, dd, ul, ol {
  margin: 0;
}

ul[class], ol[class] { list-style: none; padding: 0; }

body {
  min-height: 100svh;
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  font-weight: var(--weight-regular);
  line-height: var(--lh-normal);
  font-synthesis-weight: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img, picture, svg, video, canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

input, button, textarea, select { font: inherit; color: inherit; }

button { background: none; border: 0; cursor: pointer; }

::selection { background: var(--color-selection); color: var(--color-text); }

/* --------------------------------------------------------------------------
   2. Focus. Visible, warm, never removed.
   -------------------------------------------------------------------------- */
:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 3px;
  border-radius: var(--radius-xs);
}
:focus:not(:focus-visible) { outline: none; }

.skip-link {
  position: absolute;
  left: var(--space-s);
  top: var(--space-s);
  z-index: var(--z-skip);
  transform: translateY(-200%);
  padding: var(--space-2xs) var(--space-s);
  background: var(--color-brand-deep);
  color: var(--color-text-invert);
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  text-decoration: none;
  transition: transform var(--dur-fast) var(--ease-out);
}
.skip-link:focus { transform: translateY(0); }

/* --------------------------------------------------------------------------
   3. Typography
   -------------------------------------------------------------------------- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-weight: var(--weight-regular);
  color: var(--color-text);
  text-wrap: balance;
}

h1 {
  font-size: var(--fs-4xl);
  line-height: var(--lh-tight);
  letter-spacing: var(--track-hero);
  font-weight: var(--weight-light);
}
h2 {
  font-size: var(--fs-3xl);
  line-height: var(--lh-display);
  letter-spacing: var(--track-tight);
  font-weight: var(--weight-light);
}
h3 {
  font-size: var(--fs-xl);
  line-height: var(--lh-snug);
  letter-spacing: var(--track-tight);
}
h4 {
  font-size: var(--fs-lg);
  line-height: var(--lh-snug);
}
h5, h6 {
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  color: var(--color-text-muted);
}

p { text-wrap: pretty; }
p + p { margin-top: 1em; }

a {
  color: var(--color-accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  text-decoration-color: color-mix(in srgb, var(--color-accent) 40%, transparent);
  transition: color var(--dur-fast) var(--ease-out),
              text-decoration-color var(--dur-fast) var(--ease-out);
}
a:hover {
  color: var(--color-accent-quiet);
  text-decoration-color: currentColor;
}

strong, b { font-weight: var(--weight-semibold); }

blockquote { margin: 0; }

hr {
  border: 0;
  height: 1px;
  background: var(--color-border);
  margin-block: var(--space-xl);
}

/* Type utilities ---------------------------------------------------------- */
.display    { font-family: var(--font-display); font-optical-sizing: auto; }
.font-body  { font-family: var(--font-body); }

.t-hero {
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-size: var(--fs-hero);
  font-weight: var(--weight-light);
  line-height: var(--lh-tight);
  letter-spacing: var(--track-hero);
  text-wrap: balance;
}
.t-lead {
  font-size: var(--fs-lg);
  line-height: var(--lh-relaxed);
  color: var(--color-text-muted);
  max-width: var(--measure-tight);
}
.t-body-lg { font-size: var(--fs-md); line-height: var(--lh-relaxed); }
.t-small   { font-size: var(--fs-sm); }
.t-micro   { font-size: var(--fs-micro); }
.t-muted   { color: var(--color-text-muted); }
.t-subtle  { color: var(--color-text-subtle); }
.t-center  { text-align: center; }
.t-measure { max-width: var(--measure); }
.t-measure-tight { max-width: var(--measure-tight); }

/* The eyebrow. Light, wide-tracked capitals - the logo wordmark, reused. */
.eyebrow {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-family: var(--font-body);
  font-size: var(--fs-micro);
  font-weight: var(--weight-medium);
  letter-spacing: var(--track-caps);
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin: 0 0 var(--space-s);
}
.eyebrow::before {
  content: "";
  flex: none;
  width: 1.75rem;
  height: 2px;
  border-radius: 2px;
  background: var(--grad-recipe);
  background-size: 400% 100%;
}
.eyebrow--center { justify-content: center; }
.eyebrow--invert { color: var(--color-text-invert-muted); }
.eyebrow--plain::before { display: none; }

/* Prose block for long-form copy (blog, guides) */
.prose { max-width: var(--measure); }
.prose > * + * { margin-top: var(--space-m); }
.prose h2 { margin-top: var(--space-xl); font-size: var(--fs-2xl); }
.prose h3 { margin-top: var(--space-l); }
.prose ul, .prose ol { padding-left: 1.35em; }
.prose li + li { margin-top: var(--space-2xs); }

/* --------------------------------------------------------------------------
   4. Layout primitives
   -------------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: calc(var(--container) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container--wide   { max-width: calc(var(--container-wide) + var(--gutter) * 2); }
.container--text   { max-width: calc(var(--container-text) + var(--gutter) * 2); }
.container--narrow { max-width: calc(var(--container-narrow) + var(--gutter) * 2); }

.section { padding-block: var(--space-3xl); }
.section--tight { padding-block: var(--space-2xl); }
.section--loose { padding-block: var(--space-4xl); }
.section--flush-top { padding-top: 0; }
.section--alt  { background: var(--color-bg-alt); }
.section--sunk { background: var(--color-bg-sunk); }
.section--ink  {
  background: var(--color-surface-ink);
  color: var(--color-text-invert);
}
.section--ink h1, .section--ink h2, .section--ink h3, .section--ink h4 {
  color: var(--color-text-invert);
}
.section--ink a:not(.btn) { color: var(--color-accent-on-dark); }

/* stack: vertical rhythm without margin collapse surprises */
.stack { display: flex; flex-direction: column; }
.stack > * + * { margin-top: var(--stack-space, var(--space-m)); }
.stack--xs { --stack-space: var(--space-2xs); }
.stack--s  { --stack-space: var(--space-xs); }
.stack--m  { --stack-space: var(--space-m); }
.stack--l  { --stack-space: var(--space-l); }
.stack--xl { --stack-space: var(--space-xl); }

/* cluster: horizontal group that wraps */
.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--cluster-gap, var(--space-s));
}
.cluster--between { justify-content: space-between; }
.cluster--center  { justify-content: center; }
.cluster--tight   { --cluster-gap: var(--space-2xs); }

/* grid */
.grid { display: grid; gap: var(--grid-gap); }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid--auto {
  grid-template-columns: repeat(auto-fit, minmax(min(var(--grid-min, 17rem), 100%), 1fr));
}
@media (max-width: 60rem) {
  .grid--3, .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 40rem) {
  .grid--2, .grid--3, .grid--4 { grid-template-columns: minmax(0, 1fr); }
}
/* Two-up range: a lone third item is centred instead of left-orphaned. */
@media (min-width: 40.0625rem) and (max-width: 60rem) {
  .grid--3 > :nth-child(3):last-child {
    grid-column: 1 / -1;
    justify-self: center;
    width: calc(50% - var(--grid-gap) / 2);
  }
}

/* switcher: two columns above a threshold, stacked below */
.switcher {
  display: grid;
  gap: var(--grid-gap);
  align-items: var(--switcher-align, start);
}
@media (min-width: 56rem) {
  .switcher { grid-template-columns: var(--switcher-cols, 1fr 1fr); }
  .switcher--media  { --switcher-cols: 1fr 1.05fr; }
  .switcher--aside  { --switcher-cols: 1.35fr 1fr; }
  .switcher--center { --switcher-align: center; }
  .switcher--reverse > :first-child { order: 2; }
}

/* section header block used at the top of most sections */
.section-head { max-width: var(--measure); margin-bottom: var(--space-xl); }
.section--flush-bottom { padding-bottom: 0; }
.section-head--center {
  margin-inline: auto;
  text-align: center;
}
.section-head--center .eyebrow { justify-content: center; }
.section-head p { margin-top: var(--space-s); }

/* --------------------------------------------------------------------------
   5. Utilities
   -------------------------------------------------------------------------- */
.visually-hidden:not(:focus):not(:active) {
  clip-path: inset(50%);
  height: 1px; width: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
}
.no-wrap { white-space: nowrap; }
.full-bleed { width: 100%; }
.mt-0 { margin-top: 0 !important; }
.mt-l { margin-top: var(--space-l); }
.mt-xl { margin-top: var(--space-xl); }
.relative { position: relative; }

/* Hide from print: nav chrome */
@media print {
  .site-header, .site-footer, .cta-band, .skip-link { display: none !important; }
  body { background: #fff; color: #000; }
}
