/* ===== SHARED NEBULA — Include this on ALL pages =====
   Single source of truth for the Reactive Nebula background.
   Edit THIS file and all pages update automatically.
   ===================================================== */

/* Prevent horizontal scroll on all pages (blobs + menu panels can overflow) */
html { overflow-x: hidden; }

/* Background fisso — visibile su TUTTI gli schermi */
#nebula {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: linear-gradient(160deg, #050a18 0%, #0c1a3a 30%, #0a1735 50%, #050a18 70%, #0b1428 100%);
  overflow: hidden;
}

/* TECH GRID — griglia sottile sopra il nebula */
#nebula::before {
  content: '';
  position: absolute;
  inset: 0;
  background-size: 60px 60px;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  z-index: 50;
  pointer-events: none;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, black 20%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, black 20%, transparent 70%);
}

/* NOISE — texture overlay */
#nebula::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='5' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 256px 256px;
  opacity: 0.09;
  pointer-events: none;
  z-index: 100;
  mix-blend-mode: overlay;
}

/* ============================================
   ENERGY BEAMS — linee verticali di luce
   ============================================ */
.energy-beam {
  position: absolute;
  width: 1px;
  pointer-events: none;
  z-index: 45;
  opacity: 0;
}
.energy-beam::after {
  content: '';
  position: absolute;
  width: 1px;
  height: 120px;
  background: linear-gradient(to bottom, transparent, var(--beam-color, rgba(147,197,253,0.4)), transparent);
  animation: beam-fall var(--beam-speed, 4s) var(--beam-delay, 0s) infinite linear;
  box-shadow: 0 0 6px var(--beam-color, rgba(147,197,253,0.2));
}

@keyframes beam-fall {
  0% { transform: translateY(-150px); opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { transform: translateY(calc(100vh + 150px)); opacity: 0; }
}

.energy-beam--1 { left: 15%; top: 0; opacity: 1; --beam-color: rgba(147,197,253,0.35); --beam-speed: 5s; --beam-delay: 0s; }
.energy-beam--2 { left: 40%; top: 0; opacity: 1; --beam-color: rgba(249,115,22,0.25); --beam-speed: 7s; --beam-delay: 2s; }
.energy-beam--3 { left: 65%; top: 0; opacity: 1; --beam-color: rgba(147,197,253,0.3); --beam-speed: 6s; --beam-delay: 4s; }
.energy-beam--4 { left: 85%; top: 0; opacity: 1; --beam-color: rgba(99,102,241,0.3); --beam-speed: 8s; --beam-delay: 1s; }
.energy-beam--5 { left: 30%; top: 0; opacity: 1; --beam-color: rgba(6,182,212,0.2); --beam-speed: 9s; --beam-delay: 3.5s; }

/* ============================================
   BLOB — 7 blob animati
   ============================================ */
.nb {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  will-change: transform, translate;
  transition: translate 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

/* 1 — Blu principale (grande, alto-destra) */
.nb--1 {
  width: 700px; height: 700px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.8) 0%, rgba(59, 130, 246, 0.3) 35%, transparent 65%);
  filter: blur(80px);
  top: -5%; right: -15%;
  animation: drift-a 12s ease-in-out infinite;
}

/* 2 — Arancio caldo (grande, basso-sinistra) */
.nb--2 {
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(249, 115, 22, 0.7) 0%, rgba(249, 115, 22, 0.2) 40%, transparent 65%);
  filter: blur(90px);
  bottom: -10%; left: -12%;
  animation: drift-b 14s ease-in-out infinite;
}

/* 3 — Cyan vivace (medio, centro-destra) */
.nb--3 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(6, 182, 212, 0.65) 0%, rgba(6, 182, 212, 0.2) 40%, transparent 65%);
  filter: blur(70px);
  top: 35%; right: 5%;
  animation: drift-c 10s ease-in-out infinite;
}

/* 4 — Indigo profondo (medio, sinistra) */
.nb--4 {
  width: 550px; height: 550px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.55) 0%, rgba(99, 102, 241, 0.15) 40%, transparent 65%);
  filter: blur(85px);
  top: 15%; left: -5%;
  animation: drift-d 16s ease-in-out infinite;
}

/* 5 — Bianco FORTE (grande, centro) */
.nb--5 {
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.25) 0%, rgba(200, 210, 255, 0.10) 35%, transparent 60%);
  filter: blur(60px);
  top: 25%; left: 30%;
  animation: drift-e 11s ease-in-out infinite;
}

/* 6 — Bianco secondario (medio, alto) */
.nb--6 {
  width: 450px; height: 450px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.18) 0%, rgba(180, 200, 255, 0.08) 40%, transparent 60%);
  filter: blur(50px);
  top: 5%; left: 50%;
  animation: drift-f 9s ease-in-out infinite;
}

/* 7 — Rosa/viola piccolo (accento) */
.nb--7 {
  width: 350px; height: 350px;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.5) 0%, rgba(168, 85, 247, 0.12) 40%, transparent 65%);
  filter: blur(70px);
  bottom: 20%; right: 25%;
  animation: drift-a 13s ease-in-out infinite reverse;
}

/* ============================================
   DRIFT ANIMATIONS
   ============================================ */
@keyframes drift-a {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(-60px, 80px) scale(1.15); }
  50% { transform: translate(40px, -50px) scale(0.9); }
  75% { transform: translate(70px, 40px) scale(1.08); }
}
@keyframes drift-b {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(80px, -60px) scale(1.2); }
  50% { transform: translate(-50px, -80px) scale(0.88); }
  75% { transform: translate(-70px, 50px) scale(1.12); }
}
@keyframes drift-c {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(-70px, 60px) scale(1.18); }
  66% { transform: translate(50px, -70px) scale(0.92); }
}
@keyframes drift-d {
  0%, 100% { transform: translate(0, 0) scale(1) rotate(0deg); }
  25% { transform: translate(50px, 70px) scale(1.1) rotate(3deg); }
  50% { transform: translate(-40px, -50px) scale(0.95) rotate(-2deg); }
  75% { transform: translate(-60px, 30px) scale(1.05) rotate(1deg); }
}
@keyframes drift-e {
  0%, 100% { transform: translate(0, 0) scale(1); }
  20% { transform: translate(40px, -60px) scale(1.12); }
  40% { transform: translate(-50px, 30px) scale(0.9); }
  60% { transform: translate(60px, 50px) scale(1.08); }
  80% { transform: translate(-30px, -40px) scale(0.95); }
}
@keyframes drift-f {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(60px, 50px) scale(1.15); }
  66% { transform: translate(-40px, -60px) scale(0.9); }
}

/* ============================================
   CARD SPOTLIGHT — glow che segue il cursore
   ============================================ */
.card-spotlight {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.card-spotlight .card-glow {
  position: absolute;
  width: 800px; height: 800px;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(135deg, #f97316, #3b82f6);
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0;
  transition: opacity 0.3s ease, left 0.15s ease, top 0.15s ease;
  pointer-events: none;
  z-index: 0;
  will-change: opacity;
}
.card-spotlight:hover .card-glow { opacity: 0.8; }
.card-spotlight > *:not(.card-glow) { position: relative; z-index: 1; }

/* ============================================
   LAYER Z-INDEX — content above nebula
   ============================================ */
.hero,
.hero-fade-out,
.trust-banner,
.section,
.accent-fade-in,
.accent-block,
.accent-fade-out,
.footer-fade-in,
.footer {
  position: relative;
  z-index: 1;
}

/* Hide dark/light fade transitions (unified dark = no transitions needed) */
.hero-fade-out,
.accent-fade-in,
.accent-fade-out,
.footer-fade-in {
  display: none !important;
}

/* Hero blob: hidden (nebula provides the background) */
.hero-blob { display: none !important; }

/* Sections: transparent backgrounds */
.hero { background: transparent !important; overflow: visible !important; }
.section { background: transparent !important; }
.accent-block { background: transparent !important; }

/* Hide old bg-fixed system (overridden by nebula) */
.bg-fixed { display: none !important; }

/* ============================================
   MOBILE — smaller blobs + less blur
   ============================================ */
@media (max-width: 768px) {
  .nb--1 { width: 400px; height: 400px; }
  .nb--2 { width: 350px; height: 350px; }
  .nb--3 { width: 280px; height: 280px; }
  .nb--4 { width: 300px; height: 300px; }
  .nb--5 { width: 350px; height: 350px; }
  .nb--6 { width: 250px; height: 250px; }
  .nb--7 { width: 200px; height: 200px; }
  .nb { filter: blur(35px); }
}

/* ============================================
   REDUCED MOTION
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  .nb { animation: none !important; }
  .energy-beam::after { animation: none !important; }
}
