/* ================================================================
   FILE: styles/base.css
   PURPOSE: Global design tokens, typography, and CSS reset.
   SYSTEM: "Restrained editorial dark" - warm matte palette, bold serif
           display (Fraunces) + clean sans body (Figtree), flat surfaces,
           hairline borders. One muted accent. No neon, no glass, no glow.
   EXPORTS (CSS custom properties):
     --bg, --bg-2, --surface, --surface-2, --ink, --ink-dim, --muted,
     --line, --line-2, --accent, --accent-dim, --accent-line,
     --font-display, --font-body, --font-mono, --radius, --radius-sm
   DEPENDENCIES: Google Fonts (Fraunces, Figtree, Space Mono)
   NOTE: All literal color/scale values live in :root. Components use
         var(--token) only.
================================================================ */

:root {
  /* --- MATTE PALETTE (warm, desaturated; inspired by the reference set) --- */
  --bg:          #0c0c0e;   /* matte near-black, faintly warm */
  --bg-2:        #111113;   /* lifted band background */
  --surface:     #161619;   /* flat card surface */
  --surface-2:   #1d1d21;   /* raised / hover surface */
  --ink:         #f4f1ea;   /* warm off-white - primary text */
  --ink-dim:     #cfccc4;   /* secondary text */
  --muted:       #8d897f;   /* warm grey - captions, labels */

  /* Hairline borders (the editorial "line", not a box) */
  --line:        rgba(244, 241, 234, 0.09);
  --line-2:      rgba(244, 241, 234, 0.16);

  /* One restrained accent - muted teal, used sparingly */
  --accent:      #74c2b3;
  --accent-ink:  #0c0c0e;   /* text on an accent fill */
  --accent-dim:  rgba(116, 194, 179, 0.14);
  --accent-line: rgba(116, 194, 179, 0.34);
  --accent-glow: 0 0 25px rgba(116, 194, 179, 0.25); /* soft halo for living surfaces */
  --telemetry-bg: #09090a; /* terminal well behind log streams */

  /* --- TYPOGRAPHY --- */
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body:    "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono:    "Space Mono", ui-monospace, "Cascadia Code", monospace;

  /* Fluid type scale */
  --fs-eyebrow: 0.78rem;
  --fs-h1:   clamp(2.6rem, 5.2vw, 4.2rem);
  --fs-h2:   clamp(2rem, 4.2vw, 3.25rem);
  --fs-h3:   1.35rem;
  --fs-lede: clamp(1.05rem, 1.5vw, 1.3rem);
  --fs-body: 1.0625rem;
  --fs-small: 0.8125rem;

  /* Spacing */
  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2rem;
  --space-5: 3rem;
  --space-6: 4.5rem;
  --space-7: 7.5rem;

  /* Radius - editorial = modest curves */
  --radius:    14px;
  --radius-sm: 10px;
  --radius-pill: 999px;

  /* Layout */
  --maxw: 1140px;
  --maxw-narrow: 760px;
  --nav-h: 70px;

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast: 0.2s;
  --dur-mid:  0.45s;
  --dur-slow: 0.7s;

  --shadow-soft: 0 1px 0 var(--line), 0 18px 50px -30px rgba(0, 0, 0, 0.8);
}

/* --- RESET --- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 16px);
}

/* Prevent conflict between Lenis JS smooth scroll and native CSS scroll-behavior */
html.lenis {
  scroll-behavior: auto !important;
}
html.lenis-smooth {
  scroll-behavior: auto !important;
}


body {
  margin: 0;
  min-height: 100%;
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.65;
  font-weight: 400;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--ink);
  margin: 0;
  font-weight: 600;
  line-height: 1.04;
  letter-spacing: -0.02em;
  font-optical-sizing: auto;
}

p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

a { color: inherit; text-decoration: none; transition: color var(--dur-fast) var(--ease-out); }
img, svg { display: block; max-width: 100%; }

/* --- BRAND LOGO GLYPH (reusable) ---
   Micro and standard logo marks intended to sit on the matte dark canvas.
   The source PNG is now transparent, so no blend mode is needed. */
.brand-logo {
  display: inline-block;
  flex: none;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  filter: contrast(1.05) saturate(0.95);
}
.brand-logo--micro {
  width: 16px;
  height: 16px;
  background-image: url("../assets/icons/final_logo.png");
}
.brand-logo--small {
  width: 26px;
  height: 26px;
  background-image: url("../assets/icons/final_logo.png");
}
.brand-logo--inline {
  width: 32px;
  height: 32px;
  background-image: url("../assets/icons/final_logo.png");
}

button { font-family: inherit; font-size: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input { font-family: inherit; }

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

/* Visible keyboard focus */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}
:focus:not(:focus-visible) { outline: none; }

/* Skip link */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 2000;
  background: var(--ink);
  color: var(--bg);
  padding: 10px 16px;
  font-family: var(--font-body);
  font-weight: 600;
  border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; }

/* --- BACKGROUND LAYERS (living matte wall) ---
   Stack (back → front): bg-fallback (-3) · blueprint-grid (-3)
   · bg-canvas dust (-2) · content (0+) · tactile grain (9999, pointer-none).
   The grain sits over EVERY visual layer for a unified tactile film. */
.bg-canvas {
  position: fixed;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  display: block;
}
/* CSS fallback shown until/unless the dust canvas paints (and on no-canvas
   devices). A soft matte radial over the base - no harsh gradients. */
.bg-fallback {
  position: fixed;
  inset: 0;
  z-index: -3;
  background:
    radial-gradient(120% 80% at 50% -10%, #17171b 0%, var(--bg) 55%, #090909 100%);
}
/* Coordinate matrix grid - geometric wireframe alignment guide.
   Extremely faint hairlines at exact 80px pitch (spec §3.A.2). */
.blueprint-grid {
  position: fixed;
  inset: 0;
  z-index: -3;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(244, 241, 234, 0.015) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(244, 241, 234, 0.015) 1px, transparent 1px);
  background-size: 80px 80px;
  -webkit-mask-image: radial-gradient(120% 90% at 50% 30%, #000 55%, transparent 100%);
  mask-image: radial-gradient(120% 90% at 50% 30%, #000 55%, transparent 100%);
}
/* Tactile fine grain film - overlays ALL layers (z-index 9999, pointer-events
   none) so the grain reads as a physical surface texture across the whole site.
   Premium thickness 0.045, finer 120px tile, denser turbulence (spec §3.A.1). */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 120px 120px;
}

/* --- LAYOUT PRIMITIVES --- */
.section {
  position: relative;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: var(--space-7) var(--space-3);
}

.section__head {
  max-width: var(--maxw-narrow);
  margin: 0 auto var(--space-6);
}
/* Centered heads for symmetric sections; left-aligned variant via .section__head--left */
.section__head:not(.section__head--left) { text-align: center; }

.section__eyebrow {
  font-family: var(--font-mono);
  font-size: var(--fs-eyebrow);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--space-2);
}

.section__title {
  font-size: var(--fs-h2);
  margin-bottom: var(--space-3);
}

.section__lede {
  font-size: var(--fs-lede);
  color: var(--muted);
  max-width: 62ch;
}
.section__head:not(.section__head--left) .section__lede { margin-inline: auto; }
.section__lede em { color: var(--ink); font-style: italic; }

/* --- FLAT EDITORIAL CARD (replaces the old glassmorphism) ---
   Strategy: flat matte surface + hairline border. Depth comes from a soft,
   very low shadow, not from blur. USER: tune --surface / --line in :root. */
.glass-card,
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

/* --- BUTTONS --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.98rem;
  letter-spacing: -0.01em;
  border-radius: var(--radius-pill);
  padding: 0.8em 1.5em;
  line-height: 1;
  white-space: nowrap;
  border: 1px solid transparent;
  transition: transform var(--dur-fast) var(--ease-out),
              background-color var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out);
}
.btn__arrow { transition: transform var(--dur-fast) var(--ease-out); }
.btn:hover .btn__arrow { transform: translateX(3px); }

/* Primary: solid off-white on dark - confident, editorial, no glow */
.btn--primary { background: var(--ink); color: var(--bg); }
.btn--primary:hover { transform: translateY(-1px); background: #ffffff; }

/* Quiet: hairline ghost */
.btn--quiet { color: var(--ink); border-color: var(--line-2); }
.btn--quiet:hover { border-color: var(--ink); background: var(--surface-2); }

/* Ghost (nav) */
.btn--ghost { color: var(--ink); border-color: var(--line-2); }
.btn--ghost:hover { border-color: var(--accent); color: var(--ink); }

.btn--lg { padding: 0.95em 1.8em; font-size: 1.02rem; }

/* --- RISK-REVERSAL ANCHOR (clean SVG-style checks, no emoji) --- */
.risk-anchor {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-4);
  margin-top: var(--space-3);
  font-size: var(--fs-small);
  color: var(--muted);
}
.risk-anchor li {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
}
/* CSS-drawn checkmark - a rotated corner, no glyph/emoji */
.risk-anchor li::before {
  content: "";
  width: 6px;
  height: 10px;
  border: solid var(--accent);
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
  margin-bottom: 2px;
}

/* --- REVEAL ANIMATION --- */
[data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity var(--dur-slow) var(--ease-out),
              transform var(--dur-slow) var(--ease-out);
}
[data-reveal].is-visible { opacity: 1; transform: translateY(0); }
[style*="--child-index"] { transition-delay: calc(var(--child-index) * 70ms); }

/* --- REDUCED MOTION --- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
  [data-reveal] { opacity: 1; transform: none; }
}
