/* ============================================================
   BASE — Reset, typography, background system, helpers.
   ============================================================ */

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  /* Background mirrors the loader backdrop so navigation / pre-loader
     frames never flash a bare dark screen between page paints. */
  background-color: var(--bg);
  background-image: radial-gradient(60% 60% at 50% 38%, rgba(59, 130, 246, 0.18), transparent 70%),
    radial-gradient(40% 40% at 50% 70%, rgba(0, 229, 255, 0.1), transparent 70%);
  background-attachment: fixed;
  background-repeat: no-repeat;
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
  font-weight: 400;
  letter-spacing: -0.01em;
  overflow-x: hidden;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Lock scroll while menu / transition is active */
body.no-scroll {
  overflow: hidden;
}

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

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

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

ul,
ol {
  list-style: none;
}

input,
textarea,
select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

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

/* ---- Typography scale ---- */
h1,
h2,
h3,
h4 {
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: -0.03em;
}

h1 {
  font-size: var(--fluid-h1);
}
h2 {
  font-size: var(--fluid-h2);
}
h3 {
  font-size: var(--fluid-h3);
}

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

.lead {
  font-size: var(--fluid-lead);
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Gradient text helper */
.gradient-text {
  background: var(--grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.text-accent {
  color: var(--accent);
}
.text-secondary {
  color: var(--text-secondary);
}

/* Eyebrow / section label */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.eyebrow::before {
  content: "";
  width: 28px;
  height: 1px;
  background: var(--grad-primary);
}

/* ============================================================
   BACKGROUND SYSTEM — never plain black.
   Layered: aurora + grid + noise + glow + spotlight.
   ============================================================ */
.bg-layers {
  position: fixed;
  inset: 0;
  z-index: var(--z-bg);
  pointer-events: none;
  overflow: hidden;
}

/* Animated aurora gradient */
.bg-aurora {
  position: absolute;
  inset: -20%;
  background: var(--grad-aurora);
  filter: blur(40px);
  opacity: 0.55;
  animation: aurora-drift 24s var(--ease-in-out) infinite alternate;
  will-change: transform;
}

/* Soft grid pattern */
.bg-grid {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 30%, transparent 75%);
  opacity: 0.5;
}

/* Noise texture (inline SVG) */
.bg-noise {
  position: absolute;
  inset: 0;
  opacity: 0.04;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Floating blurred shapes */
.bg-shape {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.25;
  will-change: transform;
}
.bg-shape.s1 {
  width: 420px;
  height: 420px;
  background: var(--primary);
  top: 10%;
  left: -120px;
  animation: float-a 18s var(--ease-in-out) infinite alternate;
}
.bg-shape.s2 {
  width: 360px;
  height: 360px;
  background: var(--accent);
  bottom: 5%;
  right: -100px;
  animation: float-b 22s var(--ease-in-out) infinite alternate;
}

/* Mouse spotlight — position driven by JS via custom props */
.bg-spotlight {
  position: absolute;
  inset: 0;
  background: radial-gradient(
    420px circle at var(--mx, 50%) var(--my, 30%),
    rgba(59, 130, 246, 0.12),
    transparent 70%
  );
  transition: background 0.2s ease-out;
}

/* Accessibility: visually hidden but screen-reader available */
.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;
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -100px;
  left: var(--space-4);
  z-index: var(--z-cursor);
  background: var(--primary);
  color: #fff;
  padding: var(--space-3) var(--space-5);
  border-radius: var(--r-sm);
  transition: top var(--t-fast) var(--ease);
}
.skip-link:focus {
  top: var(--space-4);
}

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