/* ========================================
   SBHX - Circuit Animation Styles
   Gentle, subtle animations
   ======================================== */

/* ----- Circuit Background Container ----- */
.circuit-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  opacity: 0.6;
}

.circuit-bg object,
.circuit-bg svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Mobile: Keep circuit visible around hero content */
@media (max-width: 768px) {
  .circuit-bg {
    /* Expand beyond viewport to prevent shrinking */
    left: 50%;
    transform: translateX(-50%);
    width: 200vw;
    min-width: 1200px;
  }

  .circuit-bg object,
  .circuit-bg svg {
    width: 100%;
    height: 100%;
    object-position: center center;
  }
}

@media (max-width: 480px) {
  .circuit-bg {
    width: 250vw;
    min-width: 1400px;
  }
}

/* ----- Circuit Trace Paths ----- */
.circuit-trace {
  fill: none;
  stroke: var(--color-primary);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.3;
}

.circuit-trace-dim {
  stroke: var(--color-border);
  opacity: 0.5;
}

/* Animated traces - gentle pulse */
.circuit-trace-animated {
  stroke-dasharray: 200;
  stroke-dashoffset: 200;
  animation: trace-flow 8s ease-in-out infinite;
}

.circuit-trace-animated:nth-child(2) {
  animation-delay: -2s;
}

.circuit-trace-animated:nth-child(3) {
  animation-delay: -4s;
}

.circuit-trace-animated:nth-child(4) {
  animation-delay: -6s;
}

@keyframes trace-flow {

  0%,
  100% {
    stroke-dashoffset: 200;
    opacity: 0.2;
  }

  50% {
    stroke-dashoffset: 0;
    opacity: 0.5;
  }
}

/* ----- Circuit Nodes (Solder Points) ----- */
.circuit-node {
  fill: var(--color-primary);
  opacity: 0.4;
}

.circuit-node-glow {
  animation: node-pulse 4s ease-in-out infinite;
}

.circuit-node-glow:nth-child(odd) {
  animation-delay: -2s;
}

@keyframes node-pulse {

  0%,
  100% {
    opacity: 0.3;
    filter: drop-shadow(0 0 2px var(--color-primary));
  }

  50% {
    opacity: 0.8;
    filter: drop-shadow(0 0 8px var(--color-primary));
  }
}

/* ----- Flowing Data Effect ----- */
.data-particle {
  fill: var(--color-primary);
  opacity: 0;
}

.data-particle-animated {
  animation: data-flow 6s linear infinite;
}

.data-particle-animated:nth-child(2) {
  animation-delay: -1.5s;
}

.data-particle-animated:nth-child(3) {
  animation-delay: -3s;
}

.data-particle-animated:nth-child(4) {
  animation-delay: -4.5s;
}

@keyframes data-flow {
  0% {
    opacity: 0;
    offset-distance: 0%;
  }

  10% {
    opacity: 0.8;
  }

  90% {
    opacity: 0.8;
  }

  100% {
    opacity: 0;
    offset-distance: 100%;
  }
}

/* ----- Subtle Grid Background ----- */
.circuit-grid {
  stroke: var(--color-border);
  stroke-width: 0.5;
  opacity: 0.3;
}

/* ----- Glow Effects ----- */
.glow-filter {
  filter: url(#glow);
}

/* ----- Card Hover Circuit Effect ----- */
.card-circuit-corner {
  position: absolute;
  width: 60px;
  height: 60px;
  opacity: 0;
  transition: opacity var(--transition-base);
}

.card:hover .card-circuit-corner {
  opacity: 1;
}

.card-circuit-corner.top-left {
  top: -1px;
  left: -1px;
}

.card-circuit-corner.bottom-right {
  bottom: -1px;
  right: -1px;
  transform: rotate(180deg);
}

/* ----- Section Divider Animation ----- */
.section-divider {
  height: 2px;
  background: linear-gradient(90deg,
      transparent 0%,
      var(--color-border) 20%,
      var(--color-primary) 50%,
      var(--color-border) 80%,
      transparent 100%);
  background-size: 200% 100%;
  animation: divider-flow 8s ease-in-out infinite;
}

@keyframes divider-flow {

  0%,
  100% {
    background-position: 200% 0;
  }

  50% {
    background-position: -200% 0;
  }
}

/* ----- Hero Logo Animation ----- */
.hero-logo-animated {
  animation: logo-glow 4s ease-in-out infinite;
}

@keyframes logo-glow {

  0%,
  100% {
    text-shadow: 0 0 10px rgba(0, 255, 65, 0.3);
  }

  50% {
    text-shadow:
      0 0 20px rgba(0, 255, 65, 0.4),
      0 0 40px rgba(0, 255, 65, 0.2);
  }
}

/* ----- Scroll Reveal Animation ----- */
/*
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Staggered reveal for grid items */
/*
.reveal-stagger > * {
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal-stagger.visible > *:nth-child(1) { transition-delay: 0s; }
.reveal-stagger.visible > *:nth-child(2) { transition-delay: 0.1s; }
.reveal-stagger.visible > *:nth-child(3) { transition-delay: 0.2s; }
.reveal-stagger.visible > *:nth-child(4) { transition-delay: 0.3s; }
.reveal-stagger.visible > *:nth-child(5) { transition-delay: 0.4s; }
.reveal-stagger.visible > *:nth-child(6) { transition-delay: 0.5s; }

.reveal-stagger.visible > * {
  opacity: 1;
  transform: translateY(0);
}
*/
/* ----- Button Hover Circuit Effect ----- */
.btn-circuit {
  position: relative;
  overflow: hidden;
}

.btn-circuit::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg,
      transparent,
      rgba(0, 255, 65, 0.2),
      transparent);
  transition: left 0.5s ease;
}

.btn-circuit:hover::before {
  left: 100%;
}

/* ----- Typing Effect for Tagline ----- */
.typing-effect {
  overflow: hidden;
  white-space: nowrap;
  border-right: 2px solid var(--color-primary);
  animation:
    typing 2s steps(25) forwards,
    blink 0.8s step-end infinite;
}

@keyframes typing {
  from {
    width: 0;
  }

  to {
    width: 100%;
  }
}

@keyframes blink {
  50% {
    border-color: transparent;
  }
}

/* ----- Floating Elements ----- */
.float {
  animation: float 6s ease-in-out infinite;
}

.float:nth-child(even) {
  animation-delay: -3s;
}

@keyframes float {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-10px);
  }
}

/* ----- Reduced Motion Support ----- */
@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .circuit-trace-animated,
  .circuit-node-glow,
  .data-particle-animated,
  .hero-logo-animated,
  .typing-effect {
    animation: none;
  }

  .circuit-trace-animated {
    stroke-dashoffset: 0;
    opacity: 0.4;
  }

  .circuit-node-glow {
    opacity: 0.6;
  }
}
