/* ============================================================
   XXIST — base.css : tokens, reset, typography, primitives
   ============================================================ */

:root {
  /* Backgrounds (neutral, no warm tint) */
  --bg-0: #0A0A0A;      /* near-black */
  --bg-1: #111112;      /* charcoal */
  --bg-2: #19191B;      /* deep graphite */
  --bg-glass: rgba(26,26,28,0.55);

  /* Text */
  --ivory: #F4F2EE;     /* primary (neutral off-white) */
  --mist: #9A9A9A;      /* secondary */
  --stone: #6B6B6B;     /* tertiary */

  /* Accents — MONOCHROME: all map to neutral light / gray tones */
  --amber: #EDEAE4;     /* primary accent: bright neutral */
  --gold: #C9C9C9;      /* light gray */
  --copper: #7E7E7E;    /* mid gray */
  --violet: #8C8C8C;    /* gray (was violet) */
  --silver: #C7C7C7;
  /* shared rgba base for glows/tints (neutral white) */
  --accent-rgb: 237, 234, 228;

  /* Lines */
  --line: rgba(244,241,234,0.08);
  --line-strong: rgba(244,241,234,0.16);

  /* Type families */
  --font-display: 'Fraunces', 'Newsreader', Georgia, serif;
  --font-body: 'General Sans', 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Space Mono', ui-monospace, monospace;

  /* Type scale (fluid) */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.1875rem;
  --text-xl: clamp(1.35rem, 2.2vw, 1.75rem);
  --text-2xl: clamp(1.8rem, 3.4vw, 2.6rem);
  --text-3xl: clamp(2.6rem, 6vw, 4.2rem);
  --text-hero: clamp(3.2rem, 9vw, 7rem);

  /* Spacing */
  --sp-1: 0.5rem;
  --sp-2: 1rem;
  --sp-3: 1.5rem;
  --sp-4: 2rem;
  --sp-5: 3rem;
  --sp-6: 4.5rem;
  --sp-7: 7rem;
  --sp-8: 10rem;

  /* Layout */
  --maxw: 1280px;
  --gutter: clamp(1.25rem, 5vw, 5rem);
  --radius: 14px;
  --radius-lg: 22px;

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --t-fast: 180ms var(--ease-out);
  --t-med: 420ms var(--ease-out);
  --t-slow: 800ms var(--ease-out);

  /* Header */
  --header-h: 76px;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
/* No native smooth-scroll: Lenis owns scrolling. Native + Lenis on the same
   document fight each other and cause stutter. Reduced-motion / no-Lenis use
   the html[data-native-scroll] hook set by JS for smooth anchor jumps. */
html { -webkit-text-size-adjust: 100%; scroll-behavior: auto; }
html[data-native-scroll] { scroll-behavior: smooth; }

/* Lenis recommended styles */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-stopped { overflow: hidden; }
.lenis.lenis-smooth iframe { pointer-events: none; }

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

body {
  font-family: var(--font-body);
  background: var(--bg-0);
  color: var(--ivory);
  font-size: 1.0625rem;
  line-height: 1.65;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

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

::selection { background: rgba(237,234,228,0.22); color: var(--bg-0); }

/* ---------- Typography primitives ---------- */
.display {
  font-family: var(--font-display);
  font-weight: 460;
  line-height: 1.02;
  letter-spacing: -0.018em;
  font-optical-sizing: auto;
}
.serif { font-family: var(--font-display); }

.eyebrow,
.chapter-label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--mist);
  font-weight: 500;
}

.lead {
  font-size: var(--text-lg);
  line-height: 1.6;
  color: var(--ivory);
  font-weight: 400;
}
.body-muted { color: var(--mist); }
.body-dim { color: var(--stone); }

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 460; line-height: 1.05; letter-spacing: -0.018em; }

/* ---------- Focus & a11y ---------- */
:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 3px;
  border-radius: 3px;
}
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 9999;
  background: var(--bg-2);
  color: var(--ivory);
  padding: 0.75rem 1.25rem;
  border: 1px solid var(--line-strong);
  border-radius: 0 0 10px 0;
}
.skip-link:focus { left: 0; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Layout helpers ---------- */
.wrap { max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); width: 100%; }
.section { padding-block: var(--sp-8); position: relative; }
@media (max-width: 720px) { .section { padding-block: var(--sp-7); } }

.grain {
  pointer-events: none;
  position: fixed; inset: 0; z-index: 1;
  opacity: 0.035; mix-blend-mode: screen;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
