/* ═══════════════════════════════════════════════════════════════════
   BASE — reset, typography, grain, cursor, shared primitives
   ═══════════════════════════════════════════════════════════════════ */

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

* { margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth; /* superseded by Lenis when JS is live */
}

/* Lenis drives scroll itself; native smooth would fight it. */
html.lenis { scroll-behavior: auto; }
html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: var(--t-body);
  line-height: 1.62;
  font-weight: 400;
  letter-spacing: 0.002em;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
}

/* While the preloader is up, the document must not scroll behind it.
   `is-loading` lives on <html> because it is set in <head>, before
   <body> exists. */
html.is-loading body { overflow: hidden; }

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

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

button, input, select, textarea {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
}

button { cursor: pointer; }

ul, ol { list-style: none; }

::selection { background: var(--acc); color: #fff; }

/* ── Focus ────────────────────────────────────────────────────────
   Visible, on-brand, and only for keyboard users. Never remove. */
:focus-visible {
  outline: 2px solid var(--acc);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip-link {
  position: fixed;
  top: var(--s2); left: var(--s2);
  z-index: 200;
  padding: 0.7rem 1.1rem;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--mono);
  font-size: var(--t-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transform: translateY(-200%);
  transition: transform var(--dur-fast) var(--ease-out);
}
.skip-link:focus { transform: translateY(0); }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* ── Typography primitives ───────────────────────────────────────── */

.mono {
  font-family: var(--mono);
  font-size: var(--t-mono);
  font-weight: 400;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

h1, h2, h3 {
  font-family: var(--display);
  font-weight: 700;
  line-height: 0.94;
  letter-spacing: -0.032em;
  text-wrap: balance;
}

p { text-wrap: pretty; }
p + p { margin-top: 1.15em; }

.lede {
  font-size: var(--t-lede);
  line-height: 1.42;
  letter-spacing: -0.014em;
  color: var(--ink);
  text-wrap: balance;
}

/* ── Link with a rule that wipes in from the left ───────────────── */
.link-underline {
  position: relative;
  display: inline-block;
  padding-bottom: 3px;
  color: var(--ink);
  font-size: 0.92rem;
}
.link-underline::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 1px;
  background: var(--line-strong);
  transform-origin: left;
  transition: background var(--dur-fast) var(--ease-out);
}
.link-underline::before {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 1px;
  background: var(--acc);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--dur) var(--ease-out);
  z-index: 1;
}
.link-underline:hover::before { transform: scaleX(1); }

/* ── Buttons ──────────────────────────────────────────────────────
   Not pills. Slightly-squared, hairline bordered, with an accent
   fill that wipes up from the bottom on hover. */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.92rem 1.5rem;
  border-radius: var(--r-sm);
  font-size: 0.88rem;
  font-weight: 500;
  letter-spacing: 0.005em;
  overflow: hidden;
  isolation: isolate;
  transition: color var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-out);
  will-change: transform;
}
.btn > * { position: relative; z-index: 2; }
.btn svg { width: 13px; height: 13px; flex: none; transition: transform var(--dur) var(--ease-out); }
.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  transform: translateY(101%);
  transition: transform var(--dur) var(--ease-out);
}
.btn:hover::after { transform: translateY(0); }
.btn:hover svg { transform: translate(2px, -2px); }
.btn:active { transform: translateY(1px); }

.btn--primary {
  background: var(--ink);
  color: var(--bg);
  border: 1px solid var(--ink);
}
.btn--primary::after { background: var(--acc); }
.btn--primary:hover { color: #fff; border-color: var(--acc); }

.btn--ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line-mid);
}
.btn--ghost::after { background: var(--surface-hi); }
.btn--ghost:hover { border-color: var(--line-strong); }

.btn--block { width: 100%; justify-content: center; }

/* ── Film grain ───────────────────────────────────────────────────
   SVG turbulence tiled at ~3% opacity. This is the single biggest
   difference between "designed" and "rendered by a gradient". */
.grain {
  position: fixed;
  inset: -120px;
  z-index: var(--z-grain);
  pointer-events: none;
  opacity: 0.036;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grainShift 8s steps(6) infinite;
  will-change: transform;
}
@keyframes grainShift {
  0%   { transform: translate(0, 0); }
  16%  { transform: translate(-24px, 12px); }
  33%  { transform: translate(16px, -20px); }
  50%  { transform: translate(-18px, -14px); }
  66%  { transform: translate(22px, 18px); }
  83%  { transform: translate(-12px, 22px); }
  100% { transform: translate(0, 0); }
}

/* ── Cursor ───────────────────────────────────────────────────────
   A small ring that lags the pointer. Dot is drawn by CSS at the
   exact pointer position; the ring trails it. Desktop only. */
.cursor {
  position: fixed;
  top: 0; left: 0;
  z-index: var(--z-cursor);
  width: 34px; height: 34px;
  margin: -17px 0 0 -17px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--dur) var(--ease-out),
              width var(--dur) var(--ease-out),
              height var(--dur) var(--ease-out),
              margin var(--dur) var(--ease-out),
              background var(--dur) var(--ease-out),
              border-color var(--dur) var(--ease-out);
  will-change: transform;
}
.cursor__dot {
  position: absolute;
  top: 50%; left: 50%;
  width: 3px; height: 3px;
  margin: -1.5px 0 0 -1.5px;
  border-radius: 50%;
  background: var(--ink);
}
.cursor.is-on { opacity: 1; }
/* Grows and tints when over anything interactive. */
.cursor.is-active {
  width: 62px; height: 62px;
  margin: -31px 0 0 -31px;
  background: var(--acc-soft);
  border-color: var(--acc-line);
}

@media (pointer: coarse), (prefers-reduced-motion: reduce) {
  .cursor { display: none; }
  .grain { animation: none; }
}

/* ── Ambient page glow ────────────────────────────────────────────
   Two very large, very low-opacity radial fields. They give the page
   depth without any surface actually being a gradient. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(60vw 60vw at 78% 8%,  rgba(109, 91, 255, 0.10), transparent 62%),
    radial-gradient(48vw 48vw at 12% 88%, rgba(47, 107, 255, 0.07), transparent 64%);
}
