/* ==========================================================================
   BASE — reset, element defaults, layout primitives, utilities
   ========================================================================== */

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: var(--header-height); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
img, picture, svg, video { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }
table { border-collapse: collapse; }
[hidden] { display: none !important; } /* `hidden` always wins over component display rules (JS toggles it) */

/* ---------- Elements ---------- */
body {
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  color: var(--color-heading);
  line-height: var(--leading-tight);
  text-wrap: balance;
}
h1 { font-family: var(--font-display); font-size: var(--text-5xl); font-weight: var(--weight-black); letter-spacing: var(--tracking-tight); }
h2 { font-family: var(--font-heading); font-size: var(--text-3xl); font-weight: var(--weight-bold); letter-spacing: var(--tracking-tight); }
h3 { font-family: var(--font-body); font-size: var(--text-base); font-weight: var(--weight-semibold); line-height: var(--leading-snug); }
p { text-wrap: pretty; }

a { color: var(--color-link); text-underline-offset: 0.2em; }
a:hover { color: var(--color-link-hover); }
:focus-visible { outline: var(--border-width-thick) solid var(--color-focus); outline-offset: var(--border-width-thick); }

strong, b, th, dt, legend, optgroup { font-weight: var(--weight-semibold); }
s { color: var(--color-text-muted); }

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

.section { padding-block: var(--section-padding-y); }
.section--tight { padding-block: calc(var(--section-padding-y) / 2); }
.section--alt { background: var(--color-bg-alt); }
.section--inverse { background: var(--color-surface-inverse); 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);
}

/* ---------- Icons ---------- */
.icon {
  width: var(--icon-md);
  height: var(--icon-md);
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon--sm { width: var(--icon-sm); height: var(--icon-sm); }
.icon--lg { width: var(--icon-lg); height: var(--icon-lg); }
.icon--xl { width: var(--icon-xl); height: var(--icon-xl); }
.icon--fill { fill: currentColor; stroke: none; }

/* ---------- Text helpers ---------- */
.highlight { color: var(--color-highlight); }
.lead { font-size: var(--text-lg); color: var(--color-text); max-width: var(--measure); }
.muted { color: var(--color-text-muted); }
.script-note {
  font-family: var(--font-script);
  font-weight: var(--weight-semibold);
  font-size: var(--text-xl);
  line-height: var(--leading-tight);
  transform: rotate(-6deg);
}

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  text-decoration: none;
  white-space: nowrap;
}
.link-arrow::after { content: "→"; transition: transform var(--duration-fast) var(--ease-standard); }
.link-arrow:hover::after { transform: translateX(var(--space-1)); }

/* ---------- Utilities ---------- */
.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;
}
