/* base.css — shared reset + baseline + a11y scaffolding
 * Per docs/FRONTEND_TRD_v2.md §4.2 (spacing), §4.3 (radius), §10 (a11y).
 * Imported AFTER brand.css and tokens-{a,b}.css.
 */

/* Shared spacing scale (TRD §4.2) */
:root {
  --space-1: 0.25rem;  --space-2: 0.5rem;   --space-3: 0.75rem;
  --space-4: 1rem;     --space-5: 1.25rem;  --space-6: 1.5rem;  --space-8: 2rem;
  --space-10: 2.5rem;  --space-12: 3rem;    --space-16: 4rem;
  --space-20: 5rem;    --space-24: 6rem;    --space-32: 8rem;

  --radius-sm:   0.375rem;
  --radius-md:   0.5rem;
  --radius-lg:   0.75rem;
  --radius-xl:   1rem;
  --radius-2xl:  1.5rem;
  --radius-full: 9999px;

  /* Fluid type scale (TRD §4.1) */
  --text-xs:   clamp(0.75rem,  0.7rem  + 0.25vw, 0.875rem);
  --text-sm:   clamp(0.875rem, 0.8rem  + 0.35vw, 1rem);
  --text-base: clamp(1rem,     0.95rem + 0.25vw, 1.125rem);
  --text-lg:   clamp(1.125rem, 1rem    + 0.75vw, 1.5rem);
  --text-xl:   clamp(1.5rem,   1.2rem  + 1.25vw, 2.25rem);
  --text-2xl:  clamp(2rem,     1.2rem  + 2.5vw,  3.5rem);
  --text-3xl:  clamp(2.5rem,   1rem    + 4vw,    5rem);
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img, svg { display: block; max-width: 100%; height: auto; }

/* Headlines use shared display font (Instrument Serif Italic) per §4.0 brand anchor */
h1, h2 {
  font-family: var(--font-display, Georgia, serif);
  font-style: italic;
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 var(--space-4) 0;
}
h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); margin: 0 0 var(--space-3) 0; }
p { margin: 0 0 var(--space-4) 0; }

/* Container */
.wrap { max-width: 760px; margin: 0 auto; padding: 0 var(--space-6); }

/* Skip-nav (WCAG 2.4.1 Bypass Blocks) */
.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;
}
/* Skip-link uses sr-only composition pattern. Hidden via 1x1 + clip-path
 * regardless of any composed class padding. Geometry re-established on :focus.
 * (Pattern: A11Y Project + WAI-ARIA recommended.)
 */
.skip-link {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.skip-link:focus {
  position: fixed;
  top: var(--space-2);
  left: var(--space-2);
  width: auto;
  height: auto;
  padding: var(--space-3) var(--space-5);
  margin: 0;
  overflow: visible;
  clip: auto;
  clip-path: none;
  background: #231515;
  color: #fff;
  border-radius: var(--radius-md);
  font-weight: 600;
  text-decoration: none;
  outline: 2px solid var(--color-brand, #7bb3ff);
  outline-offset: 2px;
  z-index: 1000;
}

/* Main + footer baseline (style-agnostic structure) */
main { display: block; }
footer { padding: var(--space-10) 0 var(--space-16); font-size: var(--text-sm); line-height: 1.55; }
footer p { margin: 0 0 var(--space-3); }

/* Focus visible (TRD §10 — token resolves on BOTH styles after Phase 1.2 / 2.0) */
:focus-visible {
  outline: 2px solid var(--color-primary, #7bb3ff);
  outline-offset: 3px;
  border-radius: 2px;
}

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