/* ==========================================================================
   WebTribe — Motion
   Scroll reveals · Keyframes · Reduced-motion support
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Scroll reveal system
   -------------------------------------------------------------------------- */
.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition:
    opacity 700ms var(--ease),
    transform 700ms var(--ease);
  transition-delay: var(--reveal-delay, 0ms);
  will-change: opacity, transform;
}

.reveal-left {
  transform: translateX(-30px);
}

.reveal-right {
  transform: translateX(30px);
}

.reveal-scale {
  transform: scale(0.94);
}

.reveal.visible {
  opacity: 1;
  transform: none;
}

/* Staggered children helper: parent gets .reveal-stagger,
   children get .reveal with inline --reveal-delay */
.reveal-stagger > * {
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity 700ms var(--ease),
    transform 700ms var(--ease);
}

.reveal-stagger.visible > * {
  opacity: 1;
  transform: none;
}

/* --------------------------------------------------------------------------
   2. Hero entrance (applied on load)
   -------------------------------------------------------------------------- */
@keyframes hero-rise {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.hero-rise {
  animation: hero-rise 800ms var(--ease) both;
}

.hero-rise:nth-child(2) {
  animation-delay: 110ms;
}

.hero-rise:nth-child(3) {
  animation-delay: 220ms;
}

.hero-rise:nth-child(4) {
  animation-delay: 330ms;
}

.hero-rise:nth-child(5) {
  animation-delay: 440ms;
}

/* --------------------------------------------------------------------------
   3. Ambient keyframes
   -------------------------------------------------------------------------- */
@keyframes orb-float {
  0%, 100% {
    transform: translate(0, 0) scale(1);
  }
  33% {
    transform: translate(-30px, 24px) scale(1.06);
  }
  66% {
    transform: translate(22px, -18px) scale(0.97);
  }
}

@keyframes scroll-bob {
  0%, 100% {
    transform: translateY(0);
    opacity: 0.9;
  }
  50% {
    transform: translateY(7px);
    opacity: 0.4;
  }
}

@keyframes marquee {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}

@keyframes circuit-dash {
  to {
    stroke-dashoffset: -240;
  }
}

@keyframes node-pulse {
  0%, 100% {
    opacity: 0.35;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.35);
  }
}

@keyframes fa-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Circuit line draw in hero SVG */
.circuit-path {
  stroke-dasharray: 6 10;
  animation: circuit-dash 9s linear infinite;
}

.circuit-node {
  transform-origin: center;
  transform-box: fill-box;
  animation: node-pulse 3.4s ease-in-out infinite;
}

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

/* --------------------------------------------------------------------------
   4. Reduced motion — respect user preference
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

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

  .reveal,
  .reveal-stagger > * {
    opacity: 1;
    transform: none;
  }

  /* Mobile menu items appear immediately (no staggered delays) */
  .mobile-nav * {
    transition-delay: 0ms !important;
  }

  .mobile-nav .mobile-nav-top,
  .mobile-nav .mobile-nav-bottom,
  .mobile-nav .mobile-links > * {
    opacity: 1 !important;
    transform: none !important;
  }

  .marquee {
    animation: none;
  }
}
