/* ═══ BASE — reset, type, global behaviour ═══════════════════════════════ */

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}
html.is-booting { overflow: hidden; }

body {
  font-family: var(--ff-body);
  font-size: var(--fs-body);
  font-weight: 420;
  line-height: 1.6;
  color: var(--bone-dim);
  background: var(--void);
  overflow-x: hidden;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Global grain + vignette — sits above the canvas, below content */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 55;
  opacity: .5;
  background:
    radial-gradient(ellipse 120% 80% at 50% 0%, transparent 40%, rgba(0,0,0,.55) 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.32'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

img, svg, canvas { display: block; max-width: 100%; }
img { height: auto; }
button, input, select, textarea { font: inherit; color: inherit; background: none; border: none; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; }
ul, ol { list-style: none; }

::selection { background: var(--signal); color: var(--void); }

:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 3px;
  border-radius: var(--r-xs);
}

/* ── Scrollbar ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--ink-900); }
::-webkit-scrollbar-thumb {
  background: var(--ink-500);
  border-radius: var(--r-pill);
  border: 2px solid var(--ink-900);
}
::-webkit-scrollbar-thumb:hover { background: var(--signal-deep); }

/* ═══ TYPOGRAPHY ════════════════════════════════════════ */

h1, h2, h3, h4 {
  font-family: var(--ff-display);
  color: var(--bone);
  line-height: 0.92;
  letter-spacing: -0.035em;
  font-weight: 800;
  text-wrap: balance;
}

.display {
  font-family: var(--ff-display);
  font-weight: 900;
  font-stretch: 118%;
  letter-spacing: -0.045em;
  line-height: 0.84;
  text-transform: uppercase;
  color: var(--bone);
}

.mono {
  font-family: var(--ff-mono);
  font-size: var(--fs-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 500;
}

.lead {
  font-size: var(--fs-lead);
  line-height: 1.62;
  color: var(--bone-dim);
  text-wrap: pretty;
}

.accent  { color: var(--signal); }
.dim     { color: var(--bone-faint); }
.nowrap  { white-space: nowrap; }

/* ═══ LAYOUT ════════════════════════════════════════════ */

.shell {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.shell--narrow { max-width: var(--max-narrow); }

.section {
  position: relative;
  padding-block: var(--section-y);
  z-index: var(--z-content);
}

/* ── Section header ────────────────────────────────────── */
.sec-head { margin-bottom: clamp(2.4rem, 5vw, 4.2rem); }

.sec-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  color: var(--signal);
  margin-bottom: 1.15rem;
}
.sec-eyebrow::before {
  content: '';
  width: 26px; height: 2px;
  background: currentColor;
  box-shadow: 0 0 12px currentColor;
}

.sec-title {
  font-size: var(--fs-h2);
  font-stretch: 112%;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -0.04em;
  max-width: 20ch;
}

.sec-sub {
  margin-top: 1.15rem;
  max-width: 62ch;
  font-size: var(--fs-lead);
  color: var(--bone-faint);
  text-wrap: pretty;
}

/* ═══ SCROLL REVEAL ═════════════════════════════════════ */

[data-reveal] {
  opacity: 0;
  transform: translate3d(0, 28px, 0);
  transition:
    opacity var(--t-slow) var(--e-out),
    transform var(--t-slow) var(--e-out);
  transition-delay: var(--reveal-delay, 0ms);
  will-change: opacity, transform;
}
[data-reveal='scale'] { transform: translate3d(0, 22px, 0) scale(.955); }
[data-reveal='left']  { transform: translate3d(-34px, 0, 0); }
[data-reveal='right'] { transform: translate3d(34px, 0, 0); }
[data-reveal].is-in {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
}

@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1; transform: none; }
  html { scroll-behavior: auto; }
}

/* ═══ SHARED ATOMS ══════════════════════════════════════ */

/* Chip / tag */
.chip {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .34rem .72rem;
  border-radius: var(--r-pill);
  border: 1px solid var(--hairline-2);
  background: var(--surface-2);
  font-family: var(--ff-mono);
  font-size: var(--fs-xs);
  letter-spacing: .11em;
  text-transform: uppercase;
  color: var(--bone-dim);
  white-space: nowrap;
}
.chip--live   { border-color: color-mix(in srgb, var(--live) 45%, transparent); color: var(--live); }
.chip--dev    { border-color: color-mix(in srgb, var(--dev) 45%, transparent);  color: var(--dev); }
.chip--wire   { border-color: color-mix(in srgb, var(--wire) 45%, transparent); color: var(--wire); }

/* Pulsing status dot */
.dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
  box-shadow: 0 0 0 0 currentColor;
  animation: dotPulse 2.1s var(--e-out) infinite;
}
@keyframes dotPulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 70%, transparent); }
  70%  { box-shadow: 0 0 0 8px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* ── Buttons ───────────────────────────────────────────── */
.btn {
  --btn-bg: var(--surface-2);
  --btn-fg: var(--bone);
  --btn-bd: var(--hairline-2);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  padding: .92rem 1.6rem;
  border-radius: var(--r-pill);
  background: var(--btn-bg);
  color: var(--btn-fg);
  border: 1px solid var(--btn-bd);
  font-family: var(--ff-mono);
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  overflow: hidden;
  isolation: isolate;
  transition:
    transform var(--t-fast) var(--e-snap),
    background var(--t-base) var(--e-out),
    border-color var(--t-base) var(--e-out),
    box-shadow var(--t-base) var(--e-out);
}
.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%),
              color-mix(in srgb, var(--signal) 30%, transparent), transparent 62%);
  opacity: 0;
  transition: opacity var(--t-base) var(--e-out);
}
.btn:hover {
  border-color: color-mix(in srgb, var(--signal) 55%, transparent);
  transform: translateY(-2px);
  box-shadow: 0 8px 26px rgba(0,0,0,.5);
}
.btn:hover::before { opacity: 1; }
.btn:active { transform: translateY(0) scale(.965); }

.btn--primary {
  --btn-bg: var(--signal);
  --btn-fg: var(--void);
  --btn-bd: var(--signal);
  font-weight: 700;
  box-shadow: 0 6px 30px var(--signal-glow);
}
.btn--primary:hover {
  box-shadow: 0 10px 44px var(--signal-glow);
  border-color: var(--signal);
}
.btn--primary::before { display: none; }

.btn--ghost { --btn-bg: transparent; }

.btn--sm { padding: .58rem 1.05rem; font-size: var(--fs-xs); }

/* Ripple injected by fx.js */
.ripple {
  position: absolute;
  border-radius: 50%;
  transform: scale(0);
  background: currentColor;
  opacity: .28;
  pointer-events: none;
  animation: rippleOut 620ms var(--e-out) forwards;
}
@keyframes rippleOut { to { transform: scale(2.6); opacity: 0; } }

/* ── Panel ─────────────────────────────────────────────── */
.panel {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

/* ── Utility ───────────────────────────────────────────── */
.vh {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.stack { display: flex; flex-direction: column; }
.row   { display: flex; align-items: center; }
.wrap  { flex-wrap: wrap; }
