/* ==========================================================================
   Base : reset, elements, typography, layout primitives, utilities
   ========================================================================== */

/* Fonts : self-hosted, latin subset, swap. Files land in assets/fonts/.
   Guarded so missing files never block render (system fallback stack). */
@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url("../fonts/space-grotesk-variable.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("../fonts/inter-variable.woff2") format("woff2");
}

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

html {
  -webkit-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(--step-0);
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0 0 var(--space-3);
  text-wrap: balance;
}
h1 { font-size: var(--step-4); }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-2); }
h4 { font-size: var(--step-1); }

p { margin: 0 0 var(--space-3); max-width: 68ch; }

a { color: var(--pitch-deep); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--pitch); }

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

ul, ol { margin: 0 0 var(--space-3); padding-left: 1.2em; }

strong { font-weight: 600; }

hr { border: 0; border-top: 1px solid var(--line-soft); margin: var(--space-5) 0; }

/* Focus : always visible, never removed */
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 3px;
}

/* Skip link */
.skip-link {
  position: absolute;
  left: var(--space-3);
  top: -60px;
  z-index: 999;
  background: var(--ink);
  color: #fff;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  transition: top var(--dur-1) var(--ease);
}
.skip-link:focus { top: var(--space-3); color: #fff; }

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

.section { padding-block: var(--space-7); }
.section-sm { padding-block: var(--space-6); }
.section--tint { background: var(--paper-2); }
.section--ink { background: var(--ink); color: var(--paper); }
.section--ink h1, .section--ink h2, .section--ink h3 { color: #fff; }

/* Technical grid overlay for alternating sections */
.section--grid {
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 44px 44px;
}

/* Eyebrow : engineering-drawing micro label */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--pitch-deep);
  margin: 0 0 var(--space-3);
}
.eyebrow::before {
  content: "";
  width: 28px;
  height: 2px;
  background: var(--pitch);
}
.section--ink .eyebrow { color: var(--pitch-tint); }

.lede { font-size: var(--step-1); color: var(--ink-soft); max-width: 60ch; }
.section--ink .lede { color: rgba(255,255,255,.82); }

/* Court-line divider */
.court-divider {
  height: 2px;
  background: var(--line-soft);
  border: 0;
  margin: 0;
}

/* ---- 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;
}
[hidden] { display: none !important; }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.flow > * + * { margin-top: var(--space-3); }
.flow-lg > * + * { margin-top: var(--space-4); }

/* content-visibility for long below-fold sections */
.cv-auto {
  content-visibility: auto;
  contain-intrinsic-size: auto 600px;
}

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