
/* Hex motion + spark refinement
   Restores slow drift on internal pages and adds occasional pink/blue flare points. */

/* Keep homepage strong; refine internals only */
body:not(.home-page)::before {
  opacity: .16 !important;
  background-size: 500px auto !important;
  background-position: 0 0 !important;
  will-change: background-position, opacity, filter;
  animation: cgHexFieldDriftInner 120s linear infinite, cgHexPulseInner 11s ease-in-out infinite !important;
}

@keyframes cgHexFieldDriftInner {
  0%   { background-position: 0 0; }
  50%  { background-position: -130px -70px; }
  100% { background-position: -260px -140px; }
}

@keyframes cgHexPulseInner {
  0%,100% { opacity: .14; filter: brightness(.72) saturate(.72); }
  50%     { opacity: .18; filter: brightness(.86) saturate(.85); }
}

/* Signal layer visible across all pages, still behind content */
body > .signal-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

/* Existing nodes: make them part of the spark system */
body .signal-layer .node {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  opacity: 0;
  will-change: opacity, transform, box-shadow;
}

body .signal-layer .n1,
body .signal-layer .n3,
body .signal-layer .n5 {
  background: rgba(74, 187, 255, .95) !important;
  box-shadow: 0 0 7px rgba(74,187,255,.9), 0 0 15px rgba(74,187,255,.45);
}

body .signal-layer .n2,
body .signal-layer .n4 {
  background: rgba(255, 62, 170, .95) !important;
  box-shadow: 0 0 7px rgba(255,62,170,.9), 0 0 15px rgba(255,62,170,.45);
}

/* Randomized appended sparks */
body .signal-layer .spark {
  position: absolute;
  border-radius: 999px;
  opacity: 0;
  transform: scale(.35);
  animation-name: cgSparkFlash !important;
  animation-timing-function: ease-in-out !important;
  animation-iteration-count: infinite !important;
  mix-blend-mode: screen;
}

body .signal-layer .spark-blue {
  background: rgba(80, 205, 255, .95);
  box-shadow: 0 0 6px rgba(80,205,255,.95), 0 0 18px rgba(80,205,255,.55), 0 0 36px rgba(80,205,255,.2);
}

body .signal-layer .spark-pink {
  background: rgba(255, 72, 170, .95);
  box-shadow: 0 0 6px rgba(255,72,170,.95), 0 0 18px rgba(255,72,170,.55), 0 0 36px rgba(255,72,170,.2);
}

@keyframes cgSparkFlash {
  0%, 84%, 100% {
    opacity: 0;
    transform: scale(.25);
    filter: brightness(.85);
  }
  87% {
    opacity: .08;
    transform: scale(.55);
  }
  90% {
    opacity: .95;
    transform: scale(1.3);
    filter: brightness(1.22);
  }
  94% {
    opacity: .38;
    transform: scale(.78);
  }
}

/* Home page can keep slightly brighter sparks */
.home-page .signal-layer .spark-blue {
  box-shadow: 0 0 7px rgba(80,205,255,.98), 0 0 22px rgba(80,205,255,.6), 0 0 46px rgba(80,205,255,.22);
}
.home-page .signal-layer .spark-pink {
  box-shadow: 0 0 7px rgba(255,72,170,.98), 0 0 22px rgba(255,72,170,.6), 0 0 46px rgba(255,72,170,.22);
}

@media (max-width: 900px) {
  body:not(.home-page)::before {
    opacity: .14 !important;
    background-size: 460px auto !important;
    animation-duration: 140s, 12s !important;
  }

  body .signal-layer .spark {
    box-shadow: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  body:not(.home-page)::before {
    animation: cgHexPulseInner 11s ease-in-out infinite !important;
  }
  body .signal-layer .spark,
  body .signal-layer .node {
    animation: none !important;
    opacity: .08 !important;
  }
}
