/* Crux V5 — Base: reset, root, typography, blueprint, focus, skip link, a11y foundation */

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  font-family: var(--font-body);
  font-size: var(--type-body);
  line-height: var(--lh-body);
  background: var(--bg-page);
  color: var(--text);
  overflow-x: clip;
  min-height: 100vh;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

img, svg, video { max-width: 100%; height: auto; display: block; }
ul, ol { list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: none; }
input, select, textarea { font: inherit; color: inherit; }

/* ---------- Typography ---------- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: var(--lh-display);
  letter-spacing: 0.01em;
  color: var(--text-strong);
  font-weight: 400;
}
h1 { font-size: var(--type-h1); }
h2 { font-size: var(--type-h2); }
h3 { font-size: var(--type-h3); }
h4 { font-size: var(--type-h4); }

/* Type-specimen utility classes (visual only; not semantic headings) */
.t-h1, .t-h2, .t-h3, .t-h4 {
  font-family: var(--font-display);
  line-height: var(--lh-display);
  letter-spacing: 0.01em;
  color: var(--text-strong);
  font-weight: 400;
  display: block;
}
.t-h1 { font-size: var(--type-h1); }
.t-h2 { font-size: var(--type-h2); }
.t-h3 { font-size: var(--type-h3); }
.t-h4 { font-size: var(--type-h4); }

p { font-size: var(--type-body); line-height: var(--lh-body); color: var(--text-muted); }
p + p { margin-top: var(--space-4); }

.lead { font-size: var(--type-lead); line-height: 1.5; color: var(--text); }
.small { font-size: var(--type-small); }

strong, b { font-weight: 600; color: var(--text); }

/* Mono eyebrow / label */
.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--type-label);
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  display: block;
  margin-bottom: var(--space-3);
}
.eyebrow::before { content: '// '; opacity: 0.5; }

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

/* Prose links: underlined, high contrast (color never the only cue) */
.prose a,
a.link {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 0.15em;
  border-radius: 2px;
}
.prose a:hover, a.link:hover { color: var(--link-hover); }

/* ---------- Focus (visible, ≥2px, ≥3:1) ---------- */
:focus { outline: none; }
:focus-visible {
  outline: var(--border-2) solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}
/* Forced-colors: keep a visible focus */
@media (forced-colors: active) {
  :focus-visible { outline: 2px solid Highlight; }
}

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute;
  left: var(--space-4);
  top: 0;
  transform: translateY(-120%);
  z-index: var(--z-toast);
  background: var(--action);
  color: var(--action-text);
  font-family: var(--font-mono);
  font-size: var(--type-small);
  font-weight: 600;
  padding: var(--space-3) var(--space-4);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  transition: transform var(--motion-fast) var(--ease-standard);
}
.skip-link:focus-visible { transform: translateY(0); }

/* ---------- Blueprint grid utility ----------
   The tiled square grid this utility painted was removed in the final
   production pass. The class stays as a layout hook (it establishes the
   positioning context several sections rely on) but draws nothing. */
.bp-grid { position: relative; }
.bp-grid > * { position: relative; z-index: 1; }

/* ---------- Screen-reader-only ---------- */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

/* ---------- Reduced motion: neutralize non-essential animation ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}
