/* ============================================================================
   BASE  —  reset + global typography. Uses ONLY variables from theme/theme.css.
   Never hardcode colors/fonts here.
   ============================================================================ */

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

* { margin: 0; padding: 0; }

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

body {
  font-family: var(--font-body);
  font-size: var(--fs-body);
  font-weight: var(--weight-regular);
  line-height: var(--lh-normal);
  letter-spacing: var(--tracking-normal);
  color: var(--color-text);
  background-color: var(--color-bg);
  /* Subpixel rendering on light bg = solid, not thin/pale glyphs. */
  -webkit-font-smoothing: subpixel-antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  overflow-x: hidden;
  transition: var(--theme-transition);
}
/* Keep glyphs solid in dark mode where light-on-dark would otherwise look thin */
[data-theme="dark"] body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

/* The 3D canvas sits behind everything */
#bg-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: var(--z-bg);
  pointer-events: none;
}

img,
picture,
video,
canvas { max-width: 100%; display: block; }
/* Cursor FX sizes its own canvas in JS — never clamp it via max-width: 100%. */
.cursor-fx__canvas,
.cursor-fx__icon { max-width: none; max-height: none; }

a {
  color: var(--accent, var(--color-accent));
  text-decoration: none;
  transition: color var(--speed-fast) var(--ease-out),
              opacity var(--speed-fast) var(--ease-out);
}
/* On hover a link takes its component's own color (--accent), never a
   hardcoded blue. Header/footer/announce links set their own hover above this. */
a:hover { color: var(--accent, var(--color-accent)); }

button { font: inherit; color: inherit; cursor: pointer; background: none; border: none; }

ul, ol { list-style: none; }

/* ---- Headings: DISPLAY font, bold + large ---- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--color-text);
}

p { line-height: var(--lh-relaxed); color: var(--color-text-soft); font-weight: var(--weight-regular); }

strong { font-weight: var(--weight-bold); color: var(--color-text); }

/* ---- Reusable type helpers ---- */
.t-hero    { font-size: var(--fs-hero); }
.t-display { font-size: var(--fs-display); }
.t-title   { font-size: var(--fs-title); }
.t-heading { font-size: var(--fs-heading); }
.t-lead    { font-size: var(--fs-lead); font-weight: var(--weight-regular); line-height: var(--lh-snug); color: var(--color-text-soft); }
.t-body    { font-size: var(--fs-body); }
.t-small   { font-size: var(--fs-small); }
.t-tiny    { font-size: var(--fs-tiny); }

.t-muted   { color: var(--color-text-muted); }
.t-soft    { color: var(--color-text-soft); }
.t-accent  { color: var(--color-accent); }

.eyebrow {
  font-size: var(--fs-small);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  /* The text above a title is neutral white-grey on every page (--eyebrow-color),
     never a content color. The card/section keeps its color elsewhere. */
  color: var(--eyebrow-color);
}

.text-center { text-align: center; }

/* ---- Layout primitives ---- */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--content-gutter);
}
.container-wide { max-width: var(--content-max-wide); }
.container-narrow { max-width: 760px; }
.container-blog {
  width: min(100%, var(--content-max-wide));
  max-width: min(1100px, calc(100vw - 2 * var(--content-gutter)));
}

.section { padding-block: var(--section-padding-y); position: relative; transition: var(--theme-transition); }
/* 1px hairline between consecutive sections (none above the first). */
.section + .section { border-top: 1px solid var(--section-divider); }
/* Plain vs particle bands — section--alt is applied dynamically by visibility.js
   on visible sections only (alternating from the top of the page). */
.section:not(.section--dark) { background-color: transparent; }
.section.section--alt:not(.section--dark) { background-color: var(--color-bg-alt); }
.section--dark {
  background-color: var(--color-surface-dark);
  color: var(--color-text-invert);
}
.section--dark h1, .section--dark h2, .section--dark h3, .section--dark h4 { color: var(--color-text-invert); }
.section--dark p { color: var(--color-text-invert-soft); }

.section-head { max-width: 820px; margin-bottom: var(--space-xl); }
.section-head.text-center { margin-inline: auto; }
.section-head .eyebrow { display: block; margin-bottom: var(--space-sm); }
.section-head p { margin-top: var(--space-sm); font-size: var(--fs-lead); }

/* ---- Accessibility ---- */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: var(--radius-xs);
}

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