/* ==========================================================
   OMNIX// — base.css
   Reset, root typography, layout primitives, a11y, motion base.
   Loaded by EVERY page (after tokens.css).
   ========================================================== */

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

html, body {
  background: var(--ink);
  color: var(--paper);
  font-family: var(--grotesk);
  font-size: var(--fs-ui);
  line-height: 1.6;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body { position: relative; min-height: 100vh; }

img, svg, canvas { display: block; max-width: 100%; }

a { color: inherit; text-decoration: none; }

::selection { background: var(--spot); color: var(--spot-ink); }

/* ===== Headings (Fraunces display, opsz pinned per role) ===== */
h1, h2, h3, h4 { font-weight: 400; }

.t-display, .t-h1, .t-h2 {
  font-family: var(--serif);
  font-optical-sizing: auto;
  font-variation-settings: 'opsz' 144, 'wght' 900;
  line-height: 0.92;
  letter-spacing: -0.03em;
}
.t-display { font-size: var(--fs-display); letter-spacing: -0.04em; }
.t-h1 { font-size: var(--fs-h1); }
.t-h2 { font-size: var(--fs-h2); letter-spacing: -0.02em; line-height: 0.96; }
.t-h3 {
  font-family: var(--serif);
  font-variation-settings: 'opsz' 28, 'wght' 400;
  font-size: var(--fs-h3);
  line-height: 1.1;
  letter-spacing: -0.01em;
}

/* Serif italic accent — carries the existing <em> rhythm */
.t-display em, .t-h1 em, .t-h2 em, .t-h3 em, em.accent {
  font-style: italic;
  font-variation-settings: 'opsz' 72, 'wght' 400;
  letter-spacing: 0;
  color: var(--spot);
}

/* ===== Reading + lede (Archivo — never thin serif on dark) ===== */
.lede {
  font-family: var(--grotesk);
  font-weight: 400;
  font-size: var(--fs-lede);
  line-height: 1.5;
  color: var(--bone);
  max-width: 54ch;
}
.read {
  font-family: var(--grotesk);
  font-weight: 400;
  font-size: var(--fs-read);
  line-height: 1.7;
  color: var(--bone);
  max-width: var(--measure);
}
.read p + p { margin-top: 1.1em; }

/* ===== Mono labels / eyebrows / file refs ===== */
.eyebrow, .file-label {
  font-family: var(--mono);
  font-size: var(--fs-label);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.3em;
  color: var(--spot);
}
.file-label {
  display: inline-flex;
  align-items: center;
  gap: var(--s-3);
  color: var(--mist);
}
.file-label .n { color: var(--spot); }
.file-label::before {
  content: '';
  width: 28px;
  height: 1px;
  background: var(--spot);
}

/* Numerals never jitter */
.num, [data-count] { font-variant-numeric: tabular-nums; }

/* ===== Layout primitives ===== */
.wrap { max-width: var(--container); margin-inline: auto; padding-inline: var(--pad-x); }
.content { max-width: var(--content); margin-inline: auto; padding-inline: var(--pad-x); }
.section { padding-block: clamp(64px, 12vw, 160px); }
.rule { height: 1px; background: var(--line); border: 0; }
.rule-2 { height: 1px; background: var(--line-2); border: 0; }
.bleed { width: 100%; }

/* Marginalia spine: mono margin notes on desktop, inline eyebrow on mobile */
.spine {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-5);
}
@media (min-width: 900px) {
  .spine {
    grid-template-columns: minmax(160px, 1fr) minmax(0, 3fr);
    gap: clamp(32px, 6vw, 96px);
  }
  .spine > .margin { position: sticky; top: calc(var(--nav-h) + 24px); align-self: start; }
}

/* ===== Accessibility ===== */
.skip-link {
  position: fixed;
  top: 8px; left: 8px;
  z-index: 1000;
  background: var(--spot);
  color: var(--spot-ink);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 10px 16px;
  border-radius: 4px;
  transform: translateY(-150%);
  transition: transform var(--dur-fast) var(--ease);
}
.skip-link:focus { transform: translateY(0); }

.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;
}

:focus-visible {
  outline: 2px solid var(--spot);
  outline-offset: 3px;
  border-radius: 2px;
}
/* On spot-filled surfaces the ring flips to ink for contrast */
.on-spot :focus-visible { outline-color: var(--spot-ink); }

/* ===== Paper grain (subtle, fixed, non-interactive) ===== */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  mix-blend-mode: overlay;
}

/* Content sits above grain */
header, nav, main, section, footer { position: relative; z-index: 2; }

/* ===== Scroll-reveal (driven by motion.js, safe fallback) ===== */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.7s var(--ease-io), transform 0.7s var(--ease-io); will-change: opacity, transform; }
.reveal.in { opacity: 1; transform: none; }
.reveal[data-delay="1"] { transition-delay: 0.08s; }
.reveal[data-delay="2"] { transition-delay: 0.16s; }
.reveal[data-delay="3"] { transition-delay: 0.24s; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
}

/* No-JS safety: if motion.js never runs, nothing stays hidden */
.no-js .reveal { opacity: 1; transform: none; }

/* content-visibility on long lower sections (set per-page via .cv) */
.cv { content-visibility: auto; contain-intrinsic-size: auto 600px; }
