/* =============================================================
   Spreadnix — Base / reset
   ============================================================= */

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

html {
  scroll-behavior: smooth; -webkit-text-size-adjust: 100%;
  background: var(--bg);
  transition: background var(--t-med) var(--ease-out);
  overflow-x: hidden; /* contain off-canvas nav / decorative blobs on mobile */
}

body {
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  color: var(--text);
  background: transparent;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  overflow-x: hidden;
  transition: color var(--t-med) var(--ease-out);
}

/* Animated "aurora" backdrop — two slow, drifting, blurred colour blobs.
   Fixed + transform-animated = compositor-friendly; disabled for reduced-motion. */
body::before, body::after {
  content: ""; position: fixed; z-index: -1; pointer-events: none;
  width: 62vmax; height: 62vmax; border-radius: 50%;
  filter: blur(80px); will-change: transform;
}
body::before {
  top: -22vmax; right: -12vmax;
  background: radial-gradient(circle, rgba(233,188,85,.42), transparent 66%);
  opacity: .42; animation: auroraA 26s ease-in-out infinite alternate;
}
body::after {
  bottom: -24vmax; left: -14vmax;
  background: radial-gradient(circle, rgba(47,226,151,.26), transparent 66%);
  opacity: .34; animation: auroraB 32s ease-in-out infinite alternate;
}
[data-theme="light"] body::before { opacity: .26; }
[data-theme="light"] body::after  { opacity: .18; }

/* Film-grain overlay — sits above everything at ~4% so surfaces read as
   material rather than flat colour. Pointer-transparent. */
html::after {
  content: ""; position: fixed; inset: 0; z-index: 9999; pointer-events: none;
  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='.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: 160px 160px;
  opacity: .045; mix-blend-mode: overlay;
}
[data-theme="light"] html::after { opacity: .035; }
@keyframes auroraA {
  from { transform: translate3d(0,0,0) scale(1); }
  to   { transform: translate3d(-9vmax,7vmax,0) scale(1.22); }
}
@keyframes auroraB {
  from { transform: translate3d(0,0,0) scale(1); }
  to   { transform: translate3d(11vmax,-6vmax,0) scale(1.16); }
}

::selection { background: color-mix(in srgb, var(--c-primary-600) 80%, transparent); color: var(--on-primary); }

/* Custom scrollbar */
* { scrollbar-width: thin; scrollbar-color: var(--surface-line-strong) transparent; }
*::-webkit-scrollbar { width: 11px; height: 11px; }
*::-webkit-scrollbar-thumb { background: var(--surface-line-strong); border-radius: 999px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--c-ink-400); background-clip: content-box; }

h1, h2, h3, h4, h5 {
  font-family: var(--font-head);
  line-height: var(--lh-tight);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

/* Display voice: wide Unbounded for the two loudest levels only —
   dense UI headings stay in the grotesque. */
h1, h2 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.005em;
}

h1 { font-size: clamp(1.9rem, 4.4vw, var(--fs-4xl)); }
h2 { font-size: clamp(1.45rem, 3vw, var(--fs-2xl)); }
h3 { font-size: var(--fs-lg); }

p { color: var(--text-muted); }

a { color: var(--c-primary-600); text-decoration: none; transition: color var(--t-fast); }
a:hover { color: var(--c-primary-700); }

img, svg, video { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
ul { list-style: none; padding: 0; }

:focus-visible {
  outline: 2px solid var(--c-primary-500);
  outline-offset: 2px;
  border-radius: 6px;
}

/* Glass surface utility */
.glass {
  background: var(--glass);
  backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  border: 1px solid var(--glass-border);
}

/* Skip link — visually hidden until focused, then revealed. */
.skip-link {
  position: fixed; top: 12px; left: 12px; z-index: 500;
  transform: translateY(-160%);
  background: var(--bg-elev); color: var(--text);
  border: 1px solid var(--surface-line-strong);
  padding: 10px 18px; border-radius: var(--r-pill);
  font-family: var(--font-head); font-weight: 600; font-size: var(--fs-sm);
  box-shadow: var(--sh-md);
  transition: transform var(--t-med) var(--ease-spring);
}
.skip-link:focus { transform: none; outline: 2px solid var(--c-primary-500); outline-offset: 2px; }

/* ---- Layout helpers --------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--sp-5);
}

.section { padding-block: clamp(3.5rem, 8vw, var(--sp-9)); }
.section--tight { padding-block: var(--sp-7); }
.section--sunken { background: var(--bg-sunken); }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--c-primary-600);
  background: var(--c-primary-100);
  border: 1px solid color-mix(in srgb, var(--c-primary-600) 32%, transparent);
  padding: 6px 14px;
  border-radius: var(--r-pill);
}

.section-head { max-width: 640px; margin-bottom: var(--sp-7); }
.section-head--center { margin-inline: auto; text-align: center; }
.section-head h2 { margin: var(--sp-3) 0; }
.section-head p { font-size: var(--fs-md); }

.text-up { color: var(--c-up); }
.text-down { color: var(--c-down); }
.muted { color: var(--text-muted); }

.grid { display: grid; gap: var(--sp-5); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 900px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

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

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