/* ============================================================
   Just Wi-Fi — Animations & Motion
   ============================================================ */

/* ---- Reveal animations ---- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 500ms ease, transform 500ms ease;
}
.reveal.in-view {
  opacity: 1;
  transform: translateY(0);
}

.reveal-stagger > * {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 500ms ease, transform 500ms ease;
}
.reveal-stagger > *.in-view {
  opacity: 1;
  transform: translateY(0);
}

/* Fade only (no slide) */
.reveal-fade {
  opacity: 0;
  transition: opacity 600ms ease;
}
.reveal-fade.in-view { opacity: 1; }

/* Slide from left */
.reveal-left {
  opacity: 0;
  transform: translateX(-32px);
  transition: opacity 500ms ease, transform 500ms ease;
}
.reveal-left.in-view { opacity: 1; transform: translateX(0); }

/* Slide from right */
.reveal-right {
  opacity: 0;
  transform: translateX(32px);
  transition: opacity 500ms ease, transform 500ms ease;
}
.reveal-right.in-view { opacity: 1; transform: translateX(0); }

/* Scale up */
.reveal-scale {
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 500ms ease, transform 500ms ease;
}
.reveal-scale.in-view { opacity: 1; transform: scale(1); }

/* ---- Prefers-reduced-motion override ---- */
@media (prefers-reduced-motion: reduce) {
  .reveal, .reveal-stagger > *, .reveal-fade,
  .reveal-left, .reveal-right, .reveal-scale {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .signal-wave, .network-pulse, .hero-wave-ring { animation: none !important; }
}

/* ---- Signal wave hero background ---- */
.signal-waves {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.wave-origin {
  position: absolute;
  right: 20%;
  top: 50%;
  transform: translate(50%, -50%);
}
@media (max-width: 768px) {
  .wave-origin {
    right: 50%;
    top: 45%;
  }
}
.wave-ring {
  position: absolute;
  border-radius: 50%;
  border: 1.5px solid rgba(94, 234, 212, 0.63);
  opacity: 0;
  animation: wave-expand 4.8s linear infinite;
  animation-fill-mode: backwards;
}
.wave-ring:nth-child(1) { animation-delay: 0s;    width: 575px; height: 575px; top: -288px; left: -288px; }
.wave-ring:nth-child(2) { animation-delay: 1.2s;  width: 575px; height: 575px; top: -288px; left: -288px; }
.wave-ring:nth-child(3) { animation-delay: 2.4s;  width: 575px; height: 575px; top: -288px; left: -288px; }
.wave-ring:nth-child(4) { animation-delay: 3.6s;  width: 575px; height: 575px; top: -288px; left: -288px; }

@keyframes wave-expand {
  0%   { opacity: 0;    transform: scale(0.04); }
  8%   { opacity: 0.72; }
  18%  { opacity: 0.35; }
  28%  { opacity: 0.68; }
  75%  { opacity: 0.28; }
  100% { opacity: 0;    transform: scale(1); }
}

.wave-icon {
  position: absolute;
  top: 0;
  left: 0;
  width: 48px;
  height: 48px;
  transform: translate(-50%, -50%);
  color: rgba(94, 234, 212, 0.40);
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 0 8px rgba(20, 184, 166, 0.6));
}

/* ---- Network diagram animation ---- */
.network-diagram {
  width: 100%;
  max-width: 480px;
  margin-inline: auto;
}

.network-line {
  stroke-dasharray: 200;
  stroke-dashoffset: 200;
  animation: draw-line 1.5s ease forwards;
}
.network-line:nth-child(1) { animation-delay: 0.3s; }
.network-line:nth-child(2) { animation-delay: 0.5s; }
.network-line:nth-child(3) { animation-delay: 0.7s; }
.network-line:nth-child(4) { animation-delay: 0.9s; }
.network-line:nth-child(5) { animation-delay: 1.1s; }
.network-line:nth-child(6) { animation-delay: 1.3s; }

@keyframes draw-line {
  to { stroke-dashoffset: 0; }
}

.network-pulse {
  animation: node-pulse 2s ease-in-out infinite;
}
.network-pulse:nth-child(odd) { animation-delay: 0.5s; }

@keyframes node-pulse {
  0%, 100% { opacity: 1; r: 6; }
  50% { opacity: 0.6; r: 8; }
}

.data-packet {
  animation: packet-travel 3s linear infinite;
  opacity: 0;
}
.data-packet:nth-child(1) { animation-delay: 1s; }
.data-packet:nth-child(2) { animation-delay: 2s; }
.data-packet:nth-child(3) { animation-delay: 1.5s; }

@keyframes packet-travel {
  0%   { opacity: 0; offset-distance: 0%; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { opacity: 0; offset-distance: 100%; }
}

/* ---- Counter ---- */
.counter-value {
  display: inline-block;
  transition: none;
}

/* ---- Pulse (live indicators) ---- */
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}

.pulse-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--success);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

/* ---- Spinner ---- */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
.spinner--dark {
  border-color: rgba(15,23,42,0.2);
  border-top-color: var(--ink);
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---- Floating CTA entrance ---- */
@keyframes float-up {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- Nav mobile stagger ---- */
.nav-mobile-links a,
.nav-mobile-links button {
  opacity: 0;
  transform: translateX(20px);
  transition: color 150ms ease,
              transform 150ms ease,
              opacity 300ms ease var(--stagger, 0ms),
              transform 300ms ease var(--stagger, 0ms);
}
.nav-mobile.open .nav-mobile-links a,
.nav-mobile.open .nav-mobile-links button {
  opacity: 1;
  transform: translateX(0);
}
.nav-mobile-links > :nth-child(1)  { --stagger: 50ms; }
.nav-mobile-links > :nth-child(2)  { --stagger: 100ms; }
.nav-mobile-links > :nth-child(3)  { --stagger: 150ms; }
.nav-mobile-links > :nth-child(4)  { --stagger: 200ms; }
.nav-mobile-links > :nth-child(5)  { --stagger: 250ms; }
.nav-mobile-links > :nth-child(6)  { --stagger: 300ms; }
.nav-mobile-links > :nth-child(7)  { --stagger: 350ms; }
.nav-mobile-links > :nth-child(8)  { --stagger: 400ms; }

/* ---- Image lazy-load fade ---- */
img.lazy {
  opacity: 0;
  transition: opacity 400ms ease;
}
img.lazy.loaded { opacity: 1; }

/* ---- Hover underline slide ---- */
.hover-underline {
  position: relative;
  text-decoration: none;
}
.hover-underline::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: currentColor;
  transition: width var(--transition-base);
}
.hover-underline:hover::after { width: 100%; }

/* ---- Progress bar (quiz) ---- */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: var(--space-8);
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--turquoise), var(--turquoise-light));
  border-radius: var(--radius-full);
  transition: width 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- Step transition (quiz) ---- */
.quiz-step {
  display: none;
  animation: step-in 300ms ease forwards;
}
.quiz-step.active { display: block; }
@keyframes step-in {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
.quiz-step.leaving {
  animation: step-out 200ms ease forwards;
}
@keyframes step-out {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(-20px); }
}
