/* ==========================================================================
   First Brick — Base: reset, typography, containers, a11y primitives
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

* { margin: 0; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--color-text-primary);
  background: var(--color-bg-primary);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden; /* guard against accidental horizontal scroll */
}

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

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

a { color: var(--color-link); text-decoration: none; }
a:hover { color: var(--color-link-hover); }
a:not([class]) { text-decoration: underline; text-underline-offset: 2px; }

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

/* --- Headings --------------------------------------------------------- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--color-text-primary);
  line-height: var(--lh-heading);
  letter-spacing: var(--ls-heading);
  font-weight: var(--weight-bold);
  text-wrap: balance;
}
h1 { font-size: var(--fs-h1); line-height: var(--lh-tight); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }
h4 { font-size: var(--fs-h4); font-weight: var(--weight-medium); }

p { text-wrap: pretty; }

/* --- Reusable text helpers ------------------------------------------- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-8);
  font-family: var(--font-body);
  font-size: var(--fs-eyebrow);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  color: var(--color-foundation-blue);
}
.eyebrow--amber { color: var(--color-signal-amber); }
.eyebrow::before {
  content: "";
  width: 36px; height: 36px; /* 36px wide, ratio preserved (1:1) */
  flex: none;
  /* Building-block symbol: navy base + amber + slate (per Figma) */
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Crect x='5.76' y='25.92' width='36.48' height='15.36' rx='4.32' fill='%232B4C7E'/%3E%3Crect x='5.76' y='6.72' width='16.32' height='16.32' rx='4.32' fill='%23F2A65A'/%3E%3Crect x='25.92' y='6.72' width='16.32' height='16.32' rx='4.32' fill='%234E7CA8'/%3E%3C/svg%3E") center / contain no-repeat;
}
.eyebrow--plain::before { display: none; }

.lead {
  font-size: var(--fs-body-lg);
  color: var(--color-text-secondary);
  line-height: var(--lh-snug);
  max-width: 60ch;
}

.text-secondary { color: var(--color-text-secondary); }
.text-accent { color: var(--color-signal-amber); }
.display { font-size: var(--fs-display); line-height: var(--lh-tight); }

/* --- Container -------------------------------------------------------- */
.container {
  width: 100%;
  max-width: calc(var(--container-max) + var(--container-pad) * 2);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}
.container--narrow { max-width: calc(760px + var(--container-pad) * 2); }
.container--wide   { max-width: calc(1320px + var(--container-pad) * 2); }

/* --- Section rhythm --------------------------------------------------- */
.section { padding-block: var(--section-y); }
.section--muted { background: var(--color-bg-muted); }
.section--tight { padding-block: clamp(2.5rem, 1.5rem + 4vw, 4rem); }

/* Dark (Ink Navy) section — flips text to light for AA contrast */
.section--dark { background: var(--color-ink-navy); color: rgba(255, 255, 255, 0.82); }
.section--dark h1,
.section--dark h2,
.section--dark h3,
.section--dark h4 { color: var(--color-white); }
.section--dark p { color: rgba(255, 255, 255, 0.82); }
.section--dark .text-secondary { color: rgba(255, 255, 255, 0.78); }
.section--dark .text-accent { color: var(--color-signal-amber); } /* wins over the white heading rule */
.section--dark .eyebrow { color: var(--color-signal-amber); }
.section--dark a:not(.btn) { color: var(--color-white); }

.section-head { max-width: 62ch; margin-inline: auto; text-align: center; }
.section-head--left { margin-inline: 0; text-align: left; }
.section-head > * + * { margin-top: var(--space-16); }
/* Wider heading block to match Figma (heading 820px, lead 720px) */
.section-head.section-head--wide { max-width: 820px; }
.section-head--wide .lead { max-width: 720px; margin-inline: auto; }

/* Centered copy column (e.g. the dark "You started a business" section).
   Widths match Figma: heading up to 900px, body paragraphs up to 820px. */
.center-column { max-width: 900px; margin-inline: auto; text-align: center; }
.center-column > * + * { margin-top: var(--space-20); }
.center-column h2 { text-wrap: normal; } /* fill-then-wrap like Figma, not balanced */
.center-column p { max-width: 820px; margin-inline: auto; }

/* --- Accessibility: skip link ---------------------------------------- */
.skip-link {
  position: absolute;
  left: var(--space-16);
  top: -100px;
  z-index: 1000;
  background: var(--color-foundation-blue);
  color: var(--color-white);
  padding: var(--space-12) var(--space-20);
  border-radius: var(--radius-button);
  font-weight: var(--weight-semibold);
  transition: top var(--transition-fast);
}
.skip-link:focus { top: var(--space-16); color: var(--color-white); }

/* --- Visible focus styling ------------------------------------------- */
:focus-visible {
  outline: 3px solid var(--color-slate-blue);
  outline-offset: 2px;
  border-radius: 4px;
}
/* main is programmatically focused via skip link but shouldn't show a ring */
main:focus { outline: none; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* --- Reduced motion --------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
