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

html {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* ==== Ambient layer: faint grid + drifting glow orbs + grain ============= */
/* The whole-site texture that makes near-black read as "designed dark",     */
/* not "unstyled dark". Fixed, non-interactive, compositor-cheap.            */
.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  /* faint blueprint grid in navy ink, fading out below the hero */
  background-image:
    repeating-linear-gradient(0deg, rgba(20,28,80,0.045) 0 1px, transparent 1px 72px),
    repeating-linear-gradient(90deg, rgba(20,28,80,0.045) 0 1px, transparent 1px 72px);
  -webkit-mask-image: radial-gradient(120% 70% at 50% 0%, #000 30%, transparent 75%);
  mask-image: radial-gradient(120% 70% at 50% 0%, #000 30%, transparent 75%);
}
.ambient .orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(110px);
  opacity: 0.4;
  will-change: transform;
}
.orb-a { width: 560px; height: 560px; left: -160px; top: -180px;
         background: radial-gradient(circle, rgba(99,102,241,0.30), transparent 70%);
         animation: orb-drift 26s ease-in-out infinite alternate; }
.orb-b { width: 480px; height: 480px; right: -140px; top: 30vh;
         background: radial-gradient(circle, rgba(8,145,178,0.20), transparent 70%);
         animation: orb-drift 32s ease-in-out infinite alternate-reverse; }
.orb-c { width: 520px; height: 520px; left: 30vw; bottom: -240px;
         background: radial-gradient(circle, rgba(139,92,246,0.18), transparent 70%);
         animation: orb-drift 38s ease-in-out infinite alternate; }
@keyframes orb-drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(60px, -40px, 0) scale(1.12); }
}
/* grain: SVG feTurbulence data-URI kills gradient banding at 4% opacity */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  pointer-events: none;
  opacity: 0.025;
  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='0.8' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
@media (max-width: 720px) {
  .ambient .orb { filter: blur(60px); } /* halve blur cost on mobile GPUs */
}
@media (prefers-reduced-motion: reduce) {
  .ambient .orb { animation: none; }
}

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

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out);
}

a:hover { color: var(--accent-soft); }

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  color: var(--ink);
  margin: 0 0 var(--space-4);
  font-weight: 700;
  letter-spacing: -0.02em;
}

h1 { font-size: clamp(36px, 5vw, 56px); line-height: 1.1; }
h2 { font-size: clamp(28px, 4vw, 40px); line-height: 1.2; font-weight: 600; }
h3 { font-size: clamp(20px, 2.4vw, 24px); line-height: 1.3; font-weight: 600; }
h4 { font-size: 18px; line-height: 1.4; font-weight: 600; }

p { margin: 0 0 var(--space-4); color: var(--ink-soft); }

ul, ol { margin: 0 0 var(--space-4); padding-left: var(--space-5); color: var(--ink-soft); }
li { margin-bottom: var(--space-2); }

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

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--space-5);
}

.container-narrow {
  width: 100%;
  max-width: var(--container-narrow);
  margin-inline: auto;
  padding-inline: var(--space-5);
}

.section {
  padding-block: clamp(var(--space-8), 10vw, var(--space-10));
}

/* Sections vary by DEPTH of the same dark canvas, never by flipping light. */
.section-soft { background: var(--surface-soft); }
.section-dark { background: var(--surface-dark); color: var(--ink); }
.section-dark h1,
.section-dark h2,
.section-dark h3 { color: var(--ink); }
.section-dark p { color: var(--ink-muted); }

.eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--space-3);
}

/* Monospace utility — pair with `.eyebrow`, metric numbers, badges, terminal */
.mono { font-family: var(--font-mono); }

.lead {
  font-size: clamp(17px, 2vw, 19px);
  line-height: 1.6;
  color: var(--ink-soft);
  max-width: 60ch;
}

.hidden { display: none !important; }
.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: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
