/* ==========================================================================
   BASE — reset, elements, layout primitives, utilities (tokens only)
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background: var(--color-bg);
  overflow-wrap: break-word;
}

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--font-heading);
  line-height: var(--leading-tight);
  color: var(--color-heading);
}
h1 { font-size: var(--text-4xl); font-weight: var(--weight-black); }
h2 { font-size: var(--text-3xl); font-weight: var(--weight-regular); }
h3 { font-size: var(--text-xl); font-weight: var(--weight-regular); }
h4 { font-size: var(--text-lg); font-weight: var(--weight-bold); }

p, ul, ol, figure, blockquote { margin: 0; }
ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }

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

a {
  color: var(--color-link);
  text-decoration: underline;
  text-underline-offset: 0.2em;
  transition: color var(--duration-fast) var(--ease-standard);
}
a:hover { color: var(--color-link-hover); }
a:focus-visible { outline: none; box-shadow: var(--shadow-focus); border-radius: var(--radius-sm); }

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

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

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

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

.section { padding-block: var(--section-padding-y); }
.section--alt { background: var(--color-bg-alt); }
.section--inverse { background: var(--color-surface-inverse); color: var(--color-text-inverse); }
.section--inverse h2, .section--inverse h3 { color: var(--color-text-inverse); }

.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.stack--sm { gap: var(--space-2); }
.stack--lg { gap: var(--space-8); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: var(--grid-gap);
}

/* Cards grid: 1 → 2 → 3 columns, incomplete last row centered (reference look) */
.card-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--grid-gap);
  padding: 0;
  margin: 0;
  list-style: none;
}
.card-grid > * { flex: 1 1 100%; min-width: 0; }
@media (min-width: 768px) {
  .card-grid > * { flex: 0 1 calc((100% - var(--grid-gap)) / 2); }
}
@media (min-width: 1024px) {
  .card-grid > * { flex: 0 1 calc((100% - 2 * var(--grid-gap)) / 3); }
}

/* ---------- Text helpers ---------- */
.prose { max-width: var(--measure); }
.prose > * + * { margin-top: var(--space-4); }
.prose h2 { font-size: var(--text-2xl); font-weight: var(--weight-bold); margin-top: var(--space-10); }
.prose h3 { font-size: var(--text-xl); font-weight: var(--weight-bold); margin-top: var(--space-8); }
.prose ul, .prose ol { padding-left: var(--space-6); }
.prose li + li { margin-top: var(--space-2); }

.lead { font-size: var(--text-lg); color: var(--color-text-muted); }
.eyebrow {
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-primary);
}

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

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: var(--space-2);
  z-index: var(--z-modal);
  padding: var(--space-2) var(--space-4);
  background: var(--color-surface);
  color: var(--color-text);
  border-radius: var(--radius-sm);
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; }
