/**
 * Abstract visual depth: noise, blurred gradients, circuit lines, tech textures.
 * No layout changes. CSS-only or SVG assets.
 */

/* Page-level circuit: full viewport, behind all content, subtle. */
.page-circuit-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}
.page-circuit-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 120% 80% at 70% 20%, rgba(56, 189, 248, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse 80% 120% at 20% 80%, rgba(99, 102, 241, 0.05) 0%, transparent 50%);
  opacity: 0.9;
  animation: mesh-drift 20s ease-in-out infinite;
}
.page-circuit-bg__svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.08;
}
.page-circuit-bg .circuit-path,
.page-circuit-bg .circuit-path-reverse {
  animation-duration: 12s;
}
@media (prefers-reduced-motion: reduce) {
  .page-circuit-bg .circuit-path,
  .page-circuit-bg .circuit-path-reverse {
    stroke-dashoffset: 0;
    animation: none;
  }
}

/* Circuit Pulse canvas – PCB-style paths with moving pulses */
.circuit-pulse-canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  contain: strict;
}
.circuit-pulse-canvas canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* AnimatedCircuitBackground – full-width SVG, pointer-events: none, behind content. Opacity 0.08–0.12. */
.animated-circuit-background {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.animated-circuit-background__base {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(180deg, #05070A 0%, #050A14 60%, #060816 100%);
}
.animated-circuit-background__glow {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(56, 189, 248, 0.06) 0%, transparent 50%);
}
.animated-circuit-background .animated-circuit-bg {
  z-index: 0;
}

/* Circuit SVG: two layers (forward + reverse), 8–12s, rounded stroke, subtle glow. Respects prefers-reduced-motion. */
.animated-circuit-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.03;
  overflow: hidden;
  contain: layout paint;
}
.theme-dark .animated-circuit-bg {
  opacity: 0.1;
}
.animated-circuit-bg svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.animated-circuit-bg .circuit-path {
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  stroke-linecap: round;
  animation: circuit-draw 10s ease-out forwards;
}
.animated-circuit-bg .circuit-path-reverse {
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  stroke-linecap: round;
  animation: circuit-draw 10s ease-out forwards;
}
.animated-circuit-bg .circuit-path:nth-child(1) { animation-delay: 0s; }
.animated-circuit-bg .circuit-path:nth-child(2) { animation-delay: 0.4s; }
.animated-circuit-bg .circuit-path:nth-child(3) { animation-delay: 0.8s; }
.animated-circuit-bg .circuit-path:nth-child(4) { animation-delay: 1.2s; }
.animated-circuit-bg .circuit-path:nth-child(5) { animation-delay: 1.6s; }
.animated-circuit-bg .circuit-path:nth-child(6) { animation-delay: 2s; }
.animated-circuit-bg .circuit-path:nth-child(7) { animation-delay: 2.4s; }
.animated-circuit-bg .circuit-path:nth-child(8) { animation-delay: 2.8s; }
.animated-circuit-bg .circuit-path:nth-child(9) { animation-delay: 3.2s; }
.animated-circuit-bg .circuit-path-reverse:nth-child(1) { animation-delay: 1s; }
.animated-circuit-bg .circuit-path-reverse:nth-child(2) { animation-delay: 1.5s; }
.animated-circuit-bg .circuit-path-reverse:nth-child(3) { animation-delay: 2s; }
.animated-circuit-bg .circuit-path-reverse:nth-child(4) { animation-delay: 2.5s; }
.animated-circuit-bg .circuit-path-reverse:nth-child(5) { animation-delay: 3s; }
.animated-circuit-bg .circuit-path-reverse:nth-child(6) { animation-delay: 3.5s; }
@keyframes circuit-draw {
  to { stroke-dashoffset: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .animated-circuit-bg .circuit-path,
  .animated-circuit-bg .circuit-path-reverse {
    stroke-dashoffset: 0;
    animation: none;
  }
}

/* Hero depth: blurred gradients + circuit SVG + noise (uses hero::before, hero::after kept in components) */
.hero.hero-depth::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: url(/images/noise.svg), url(/images/circuit-lines.svg);
  background-repeat: repeat;
  background-size: 200px 200px, 200px 200px;
  opacity: 0.03;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 30%, black 15%, transparent 65%);
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 30%, black 15%, transparent 65%);
}
.hero.hero-depth .container {
  position: relative;
  z-index: 1;
}
/* Blurred gradient blobs for hero - wrapper needed; use extra pseudo via .hero-depth */
.hero.hero-depth::after {
  content: '';
  position: absolute;
  width: 500px;
  height: 500px;
  top: -150px;
  right: -150px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.08) 0%, transparent 65%);
  filter: blur(90px);
  pointer-events: none;
  z-index: 0;
}
/* Second blob */
.hero.hero-depth {
  overflow: hidden;
}
.hero.hero-depth .container::before {
  content: '';
  position: absolute;
  width: 350px;
  height: 350px;
  bottom: -120px;
  left: -120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(19, 109, 236, 0.06) 0%, transparent 65%);
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
}
.hero.hero.hero-depth .container {
  position: relative;
}

/* CTA section depth: blurred gradients + circuit + noise */
.cta-section.cta-depth {
  overflow: hidden;
}
.cta-section.cta-depth::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: url(/images/noise.svg), url(/images/circuit-lines.svg);
  background-repeat: repeat;
  background-size: 200px 200px, 180px 180px;
  opacity: 0.04;
}
.cta-section.cta-depth::after {
  content: '';
  position: absolute;
  width: 400px;
  height: 400px;
  bottom: -100px;
  left: -100px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.04) 0%, transparent 70%);
  filter: blur(100px);
  pointer-events: none;
  z-index: 0;
}
.cta-section.cta-depth .container {
  position: relative;
  z-index: 1;
}

/* Section accent depth: layered gradient + dot grid */
.section-accent.section-depth {
  position: relative;
  background-image: linear-gradient(180deg, transparent 0%, rgba(19, 109, 236, 0.02) 40%, rgba(19, 109, 236, 0.025) 50%, rgba(19, 109, 236, 0.02) 60%, transparent 100%);
}
.section-accent.section-depth::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: radial-gradient(circle, rgba(19, 109, 236, 0.03) 1px, transparent 1px);
  background-size: 28px 28px;
}
.section-accent.section-depth .container {
  position: relative;
  z-index: 1;
}

/* Data-flow line – thin animated gradient strip (use on a div or section divider) */
.data-flow-line {
  height: 1px;
  width: 100%;
  background: linear-gradient(90deg, transparent 0%, var(--color-primary) 20%, var(--color-accent-neon) 50%, var(--color-primary) 80%, transparent 100%);
  background-size: 200% 100%;
  opacity: 0.35;
  animation: data-flow-shift 8s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
  .data-flow-line {
    animation: none;
  }
}

/* Abstract orbs – floating gradient blobs (cyan / indigo / purple), behind content */
.abstract-orbs {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.abstract-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.5;
  will-change: transform;
}
.theme-dark .abstract-orb {
  opacity: 0.4;
}
/* Hero orbs – larger, more saturated */
.hero .abstract-orb--1 {
  width: 420px;
  height: 420px;
  top: -12%;
  right: -8%;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.25) 0%, rgba(56, 189, 248, 0.06) 40%, transparent 70%);
}
.hero .abstract-orb--2 {
  width: 320px;
  height: 320px;
  bottom: -10%;
  left: -5%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.2) 0%, rgba(99, 102, 241, 0.04) 50%, transparent 70%);
}
.hero .abstract-orb--3 {
  width: 280px;
  height: 280px;
  top: 40%;
  left: 15%;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.15) 0%, transparent 60%);
}
.hero .abstract-orb--4 {
  width: 200px;
  height: 200px;
  top: 20%;
  right: 25%;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.12) 0%, transparent 65%);
}
.hero .abstract-orb--5 {
  width: 240px;
  height: 240px;
  bottom: 15%;
  right: 20%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.12) 0%, transparent 60%);
}
/* Section / CTA orbs – smaller, subtler */
.abstract-orbs--section .abstract-orb--1,
.abstract-orbs--cta .abstract-orb--1 {
  width: 280px;
  height: 280px;
  top: -80px;
  right: 10%;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.12) 0%, transparent 65%);
}
.abstract-orbs--section .abstract-orb--2,
.abstract-orbs--cta .abstract-orb--2 {
  width: 220px;
  height: 220px;
  bottom: -60px;
  left: 5%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.1) 0%, transparent 60%);
}
.abstract-orbs--section .abstract-orb--3,
.abstract-orbs--cta .abstract-orb--3 {
  width: 180px;
  height: 180px;
  top: 50%;
  left: -40px;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.08) 0%, transparent 65%);
}
.abstract-orbs--cta .abstract-orb--4 {
  width: 200px;
  height: 200px;
  top: 20%;
  right: -30px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.1) 0%, transparent 60%);
}
.section-with-orbs {
  position: relative;
  overflow: hidden;
}
.section-with-orbs .container {
  position: relative;
  z-index: 1;
}

/* ============================================
   INLINE SVG NOISE TEXTURE
   ============================================ */

/* Noise overlay using inline SVG - replaces external noise.svg */
.noise-overlay {
  position: relative;
}

.noise-overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  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='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 128px 128px;
  opacity: 0.03;
  mix-blend-mode: overlay;
}

/* Animated noise variant */
.noise-overlay--animated::before {
  animation: noiseShift 0.15s steps(5) infinite;
}

@keyframes noiseShift {
  0% { transform: translate(0, 0); }
  20% { transform: translate(-2%, -2%); }
  40% { transform: translate(1%, 2%); }
  60% { transform: translate(-1%, 1%); }
  80% { transform: translate(2%, -1%); }
  100% { transform: translate(0, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .noise-overlay--animated::before {
    animation: none;
  }
}

/* Darker noise for light sections */
.noise-overlay--dark::before {
  opacity: 0.02;
  mix-blend-mode: multiply;
}

/* Lighter noise for dark sections */
.noise-overlay--light::before {
  opacity: 0.04;
  mix-blend-mode: screen;
}

/* ============================================
   ISOMETRIC GRID PATTERN
   ============================================ */

.isometric-grid {
  position: relative;
}

.isometric-grid::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: 
    linear-gradient(30deg, rgba(56, 189, 248, 0.03) 1px, transparent 1px),
    linear-gradient(150deg, rgba(56, 189, 248, 0.03) 1px, transparent 1px),
    linear-gradient(270deg, rgba(56, 189, 248, 0.02) 1px, transparent 1px);
  background-size: 40px 70px, 40px 70px, 80px 40px;
  opacity: 0.8;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 50%, black 20%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 50%, black 20%, transparent 70%);
}

/* Perspective grid variant */
.perspective-grid::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: 
    linear-gradient(90deg, rgba(56, 189, 248, 0.03) 1px, transparent 1px),
    linear-gradient(rgba(56, 189, 248, 0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  transform: perspective(500px) rotateX(60deg);
  transform-origin: center top;
  opacity: 0.6;
  mask-image: linear-gradient(to bottom, black 0%, transparent 80%);
  -webkit-mask-image: linear-gradient(to bottom, black 0%, transparent 80%);
}

/* ============================================
   DOT GRID PATTERNS
   ============================================ */

.dot-grid {
  position: relative;
}

.dot-grid::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: radial-gradient(circle, rgba(56, 189, 248, 0.15) 1px, transparent 1px);
  background-size: 24px 24px;
  opacity: 0.5;
}

.dot-grid--sparse::before {
  background-size: 40px 40px;
}

.dot-grid--dense::before {
  background-size: 16px 16px;
  opacity: 0.3;
}

/* Faded dot grid */
.dot-grid--fade::before {
  mask-image: radial-gradient(ellipse 70% 50% at 50% 50%, black 0%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 70% 50% at 50% 50%, black 0%, transparent 70%);
}

/* ============================================
   LINE GRID PATTERNS
   ============================================ */

.line-grid {
  position: relative;
}

.line-grid::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: 
    linear-gradient(90deg, rgba(56, 189, 248, 0.04) 1px, transparent 1px),
    linear-gradient(rgba(56, 189, 248, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
}

.line-grid--subtle::before {
  background-image: 
    linear-gradient(90deg, rgba(56, 189, 248, 0.02) 1px, transparent 1px),
    linear-gradient(rgba(56, 189, 248, 0.02) 1px, transparent 1px);
}

/* ============================================
   CIRCUIT LINE PATTERNS (Inline SVG)
   ============================================ */

.circuit-pattern {
  position: relative;
}

.circuit-pattern::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg width='200' height='200' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 50 L50 50 L50 100 L100 100 M100 0 L100 50 L150 50 L150 100 L200 100 M0 150 L50 150 L50 200 M150 100 L150 150 L200 150' fill='none' stroke='rgba(56,189,248,0.08)' stroke-width='1'/%3E%3Ccircle cx='50' cy='50' r='2' fill='rgba(56,189,248,0.15)'/%3E%3Ccircle cx='100' cy='100' r='2' fill='rgba(99,102,241,0.15)'/%3E%3Ccircle cx='150' cy='50' r='2' fill='rgba(168,85,247,0.15)'/%3E%3Ccircle cx='150' cy='150' r='2' fill='rgba(56,189,248,0.15)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 200px 200px;
  opacity: 0.6;
}

/* ============================================
   GRADIENT MESH OVERLAYS
   ============================================ */

.gradient-mesh {
  position: relative;
}

.gradient-mesh::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: 
    radial-gradient(ellipse 50% 40% at 20% 30%, rgba(56, 189, 248, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse 40% 50% at 80% 70%, rgba(99, 102, 241, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse 60% 40% at 50% 90%, rgba(168, 85, 247, 0.05) 0%, transparent 50%);
}

/* ============================================
   SCANLINE EFFECT
   ============================================ */

.scanlines {
  position: relative;
}

.scanlines::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.02) 0px,
    rgba(0, 0, 0, 0.02) 1px,
    transparent 1px,
    transparent 2px
  );
  opacity: 0.5;
}

/* ============================================
   VIGNETTE EFFECT
   ============================================ */

.vignette {
  position: relative;
}

.vignette::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(ellipse 80% 60% at 50% 50%, transparent 50%, rgba(0, 0, 0, 0.3) 100%);
}

.vignette--subtle::after {
  background: radial-gradient(ellipse 90% 70% at 50% 50%, transparent 60%, rgba(0, 0, 0, 0.15) 100%);
}

/* ============================================
   GLOW SPOTS
   ============================================ */

.glow-spot {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
}

.glow-spot--cyan {
  background: rgba(56, 189, 248, 0.2);
}

.glow-spot--indigo {
  background: rgba(99, 102, 241, 0.2);
}

.glow-spot--purple {
  background: rgba(168, 85, 247, 0.2);
}

.glow-spot--sm {
  width: 150px;
  height: 150px;
}

.glow-spot--md {
  width: 300px;
  height: 300px;
}

.glow-spot--lg {
  width: 500px;
  height: 500px;
}

/* ============================================
   FROSTED GLASS BACKGROUNDS
   ============================================ */

.frosted {
  background: rgba(12, 15, 20, 0.7);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
}

.frosted--light {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
}

.frosted--strong {
  background: rgba(12, 15, 20, 0.85);
  backdrop-filter: blur(24px) saturate(200%);
  -webkit-backdrop-filter: blur(24px) saturate(200%);
}

/* ============================================
   RADIAL LIGHT EFFECT
   ============================================ */

.radial-light {
  position: relative;
}

.radial-light::before {
  content: '';
  position: absolute;
  top: -50%;
  left: 50%;
  transform: translateX(-50%);
  width: 150%;
  height: 100%;
  background: radial-gradient(ellipse 50% 30% at 50% 0%, rgba(56, 189, 248, 0.1) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ============================================
   REDUCED MOTION OVERRIDES
   ============================================ */

@media (prefers-reduced-motion: reduce) {
  .noise-overlay--animated::before,
  .circuit-pattern::before {
    animation: none;
  }
}
