/* =============================================================
   global.css — Reset, @font-face, base element styles, typography scale
   Imports tokens.css for all custom property values.
   ============================================================= */

/* 1. Design tokens */
@import url('tokens.css');

/* 2. Self-hosted variable fonts — zero Google Fonts network requests */
@font-face {
  font-family: 'Space Grotesk';
  src: url('../fonts/SpaceGrotesk-Variable.woff2') format('woff2');
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Inter';
  src: url('../fonts/Inter-Variable.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* 3. Box-model reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

/* 4. Base body */
body {
  font-family: var(--sans);
  font-size: clamp(0.9rem, 1.5vw, 1rem);
  font-weight: 400;
  line-height: 1.7;
  overflow-x: hidden;
}

/* 5. Typography scale — all heading sizes use clamp(); no fixed-px headings */
h1 {
  font-family: var(--display);
  font-size: clamp(1.7rem, 4vw, 3.2rem);
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -0.02em;
}

h2 {
  font-family: var(--display);
  font-size: clamp(1.1rem, 2vw, 1.3rem);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

h3 {
  font-family: var(--display);
  font-size: clamp(1rem, 1.5vw, 1.15rem);
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

/* 6. Prose container — constrains body text width on wide viewports */
.prose {
  max-width: 65ch;
}

.prose p {
  margin-bottom: var(--space-lg);
}

/* 7. Page-context body classes — controls surface colour and cursor behaviour */
body.page-dark {
  background: var(--hud-bg);
  color: var(--text-white);
  cursor: none;
}

body.page-light {
  background: var(--bg);
  color: var(--text);
  cursor: auto;
}

/* 8. Focus visible — accessible focus ring on all interactive elements */
:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

/* 9. Skip navigation link — visible on keyboard focus, before all nav items in DOM */
.skip-nav {
  position: absolute;
  top: -100%;
  left: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: var(--amber);
  color: var(--hud-bg);
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  z-index: 1000;
  border-radius: 4px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.skip-nav:focus {
  top: var(--space-sm);
}

/* 10. Vertical rhythm utility */
.section-spacing {
  padding-top: var(--space-2xl);
  padding-bottom: var(--space-2xl);
}

@media (min-width: 641px) {
  .section-spacing {
    padding-top: var(--space-3xl);
    padding-bottom: var(--space-3xl);
  }
}
