/* Foundation — reset, ambient background, typography */

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

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: var(--background-base);
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--foreground);
  background: var(--background-base);
  position: relative;
  isolation: isolate;
}

/* Layer 1 — base radial gradient */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -3;
  background: radial-gradient(
    ellipse at top,
    #0a0a0f 0%,
    var(--background-base) 50%,
    var(--background-deep) 100%
  );
  pointer-events: none;
}

/* Layer 2–3 — static ambient blobs */
.ambient-bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  overflow: hidden;
}

.ambient-bg::before,
.ambient-bg::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 1;
}

.ambient-bg::before {
  top: -20%;
  left: 50%;
  transform: translateX(-50%);
  width: 900px;
  height: 1400px;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 25%, transparent), transparent 70%);
}

.ambient-bg::after {
  top: 10%;
  right: -10%;
  width: 500px;
  height: 700px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.12), transparent 70%);
  filter: blur(100px);
}

.ambient-bg__blob {
  position: absolute;
  bottom: -10%;
  left: -5%;
  width: 600px;
  height: 800px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.1), transparent 70%);
  filter: blur(120px);
}

/* Layer 4 — grid overlay */
.ambient-bg__grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse at center, black 0%, transparent 75%);
  opacity: 0.5;
}

/* Noise texture via SVG data URI */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.015;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

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

a:hover {
  color: var(--foreground);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 50%, transparent);
  outline-offset: 2px;
}

.page-title {
  margin: 0 0 var(--space-xs);
  font-size: clamp(1.5rem, 4vw, 1.75rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.2;
  color: var(--foreground);
}

.page-title--gradient {
  background: linear-gradient(to bottom, #fff, rgba(255, 255, 255, 0.95) 40%, rgba(255, 255, 255, 0.7));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.page-subtitle {
  margin: 0;
  color: var(--foreground-muted);
  font-size: 1rem;
  line-height: 1.5;
}

.text-muted { color: var(--foreground-muted); }

.label-tag {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--foreground-muted);
}

.section-divider {
  height: 1px;
  border: none;
  margin: var(--space-xl) 0;
  background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.1), transparent);
}

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