/* ============================================================
   BASE
   Reset, global defaults, typography utilities, layout primitives.
   Component styles live in components.css.
   ============================================================ */

/* ----------------------------------------------------------
   Reset
---------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-body);
  font-size:   var(--type-body-size);
  font-weight: var(--type-body-weight);
  line-height: var(--type-body-lh);
  color:       var(--text-primary);
  background:  var(--surface-page);
}

img, svg, video       { display: block; max-width: 100%; height: auto; }
a                     { color: inherit; text-decoration: none; }
ul, ol                { list-style: none; }
button                { cursor: pointer; border: 0; background: 0; font: inherit; color: inherit; }
button[disabled]      { cursor: not-allowed; }
:focus-visible        { outline: var(--border-w-2) solid var(--action-primary); outline-offset: var(--s-h); }

/* Visually hidden but accessible to screen readers */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ============================================================
   TYPOGRAPHY UTILITIES
   ============================================================ */
.type-display {
  font-family: var(--font-display);
  font-size:   var(--type-display-size);
  font-weight: var(--type-display-weight);
  line-height: var(--type-display-lh);
  letter-spacing: var(--type-display-ls);
}
.type-h1 {
  font-family: var(--font-display);
  font-size:   var(--type-h1-size);
  font-weight: var(--type-h1-weight);
  line-height: var(--type-h1-lh);
  letter-spacing: var(--type-h1-ls);
}
.type-h2 {
  font-family: var(--font-display);
  font-size:   var(--type-h2-size);
  font-weight: var(--type-h2-weight);
  line-height: var(--type-h2-lh);
}
.type-h3 {
  font-family: var(--font-display);
  font-size:   var(--type-h3-size);
  font-weight: var(--type-h3-weight);
  line-height: var(--type-h3-lh);
}
.type-body-lg {
  font-family: var(--font-body);
  font-size:   var(--type-body-lg-size);
  font-weight: var(--type-body-lg-weight);
  line-height: var(--type-body-lg-lh);
  letter-spacing: var(--type-body-lg-ls);
}
.type-body {
  font-family: var(--font-body);
  font-size:   var(--type-body-size);
  font-weight: var(--type-body-weight);
  line-height: var(--type-body-lh);
}
.type-label {
  font-family:    var(--font-display);
  font-size:      var(--type-label-size);
  font-weight:    var(--type-label-weight);
  line-height:    var(--type-label-lh);
  letter-spacing: var(--type-label-ls);
  text-transform: uppercase;
}

/* ============================================================
   LAYOUT PRIMITIVES
   .page      — viewport flex shell
   .section   — vertical rhythm + surface
   .container — horizontal padding + max-width
   .stack     — vertical gap stack
   .cluster   — horizontal cluster (wraps)
   ============================================================ */

.page {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.section {
  padding-block: var(--space-section);
}
.section--flush  { padding-block: 0; }
.section--tight  { padding-block: var(--gap-lg); }

.section--light  { background: var(--surface-elevated); color: var(--text-primary); }
.section--page   { background: var(--surface-page);     color: var(--text-primary); }
.section--warm   { background: var(--surface-warm);     color: var(--text-primary); }
.section--yellow { background: var(--surface-yellow);   color: var(--text-primary); }
.section--dark   { background: var(--surface-dark);     color: var(--text-on-dark); }
.section--darker { background: var(--surface-darker);   color: var(--text-on-dark); }

.container {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--space-page-x);
}
.container--wide { max-width: var(--page-max); }
.container--read { max-width: var(--reading-max); }
.container--flush { padding-inline: 0; }

.stack { display: flex; flex-direction: column; }
.stack-xs  { gap: var(--gap-xs);  }
.stack-sm  { gap: var(--gap-sm);  }
.stack-md  { gap: var(--gap-md);  }
.stack-lg  { gap: var(--gap-lg);  }
.stack-xl  { gap: var(--gap-xl);  }
.stack-2xl { gap: var(--gap-2xl); }

.cluster { display: flex; flex-wrap: wrap; align-items: center; }
.cluster-xs { gap: var(--gap-xs); }
.cluster-sm { gap: var(--gap-sm); }
.cluster-md { gap: var(--gap-md); }
.cluster-lg { gap: var(--gap-lg); }
.cluster--center { justify-content: center; }
.cluster--end    { justify-content: flex-end; }

.center-text { text-align: center; }
.flow-children > * + * { margin-block-start: var(--gap-md); }
