/* =====================================================
   ANIMATIONS — IndiaOutsource Theme
   All wrapped in prefers-reduced-motion check
   ===================================================== */

@keyframes io-marquee-left {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

@keyframes io-marquee-right {
  0% { transform: translateX(-50%); }
  100% { transform: translateX(0); }
}

@keyframes io-spin-conic {
  0% { --conic-angle: 0deg; }
  100% { --conic-angle: 360deg; }
}

@keyframes io-live-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(230,49,0,0.5); opacity: 1; }
  50% { box-shadow: 0 0 0 6px rgba(230,49,0,0); opacity: 0.7; }
}

@keyframes io-dot-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(230,49,0,0.4); }
  50% { box-shadow: 0 0 0 8px rgba(230,49,0,0); }
}

@keyframes io-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

@keyframes io-stamp {
  0% { opacity: 0; transform: rotate(-15deg) scale(2.5); }
  60% { transform: rotate(-15deg) scale(0.95); }
  100% { opacity: 1; transform: rotate(-15deg) scale(1); }
}

@keyframes io-threat-cycle {
  0% { width: 5%; }
  40% { width: 100%; }
  60% { width: 100%; }
  100% { width: 5%; }
}

@keyframes io-heat-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

@keyframes io-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes io-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes io-fade-slide-up {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes io-glitch-1 {
  0% { transform: translateX(-3px); clip-path: polygon(0 20%, 100% 20%, 100% 40%, 0 40%); }
  50% { transform: translateX(3px); }
  100% { transform: translateX(0); clip-path: none; }
}

@keyframes io-glitch-2 {
  0% { transform: translateX(3px); clip-path: polygon(0 60%, 100% 60%, 100% 80%, 0 80%); }
  50% { transform: translateX(-3px); }
  100% { transform: translateX(0); clip-path: none; }
}

@keyframes io-shred {
  0% { clip-path: inset(0 0 0 0); }
  15% { clip-path: inset(0 90% 0 0); }
  30% { clip-path: inset(0 0 0 80%); }
  45% { clip-path: inset(60% 0 0 0); }
  60% { clip-path: inset(0 0 70% 0); }
  75% { clip-path: inset(0 50% 50% 0); }
  100% { opacity: 0; clip-path: inset(0 100% 0 0); }
}

@keyframes io-char-drop {
  from { opacity: 0; transform: translateY(105%); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes io-badge-flip {
  from { opacity: 0; transform: rotateY(90deg); }
  to { opacity: 1; transform: rotateY(0deg); }
}

@keyframes io-radar-sweep {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes io-neon-flicker {
  0%, 89%, 91%, 93%, 100% { opacity: 1; }
  90%, 92% { opacity: 0.3; }
}

@keyframes io-scan-line {
  0% { top: -4px; }
  100% { top: 100%; }
}

@keyframes io-loading-bar {
  to { transform: translateX(0); }
}

@keyframes io-lock-unlock {
  0%, 100% { transform: rotate(0deg) translateY(0); }
  50% { transform: rotate(-35deg) translateY(-3px); }
}

@keyframes io-gauge-fill {
  from { stroke-dashoffset: 314; }
  to { stroke-dashoffset: var(--io-gauge-offset, 19); }
}

@keyframes io-gantt-expand {
  from { width: 0; }
  to { width: var(--io-gantt-w, 100%); }
}

@keyframes io-char-scramble {
  0%, 100% { content: attr(data-char); }
  50% { content: attr(data-scramble); }
}

/* =====================================================
   SCROLL ANIMATION SYSTEM (data-aos)
   ===================================================== */

@media (prefers-reduced-motion: no-preference) {
  [data-aos] {
    opacity: 0;
    transition: opacity 0.65s var(--ease-out), transform 0.65s var(--ease-out);
  }
  [data-aos="fade-up"] { transform: translateY(28px); }
  [data-aos="fade-down"] { transform: translateY(-28px); }
  [data-aos="slide-left"] { transform: translateX(36px); }
  [data-aos="slide-right"] { transform: translateX(-36px); }
  [data-aos="scale"] { transform: scale(0.93); }
  [data-aos="fade"] { transform: none; }
  [data-aos].io-anim-visible { opacity: 1; transform: none; }

  /* Stagger children */
  [data-stagger] > * {
    opacity: 0; transform: translateY(18px);
    transition: opacity 0.5s var(--ease-out), transform 0.5s var(--ease-out);
  }
  [data-stagger].io-anim-visible > * { opacity: 1; transform: none; }
  [data-stagger].io-anim-visible > *:nth-child(1) { transition-delay: 0ms; }
  [data-stagger].io-anim-visible > *:nth-child(2) { transition-delay: 80ms; }
  [data-stagger].io-anim-visible > *:nth-child(3) { transition-delay: 160ms; }
  [data-stagger].io-anim-visible > *:nth-child(4) { transition-delay: 240ms; }
  [data-stagger].io-anim-visible > *:nth-child(5) { transition-delay: 320ms; }
  [data-stagger].io-anim-visible > *:nth-child(6) { transition-delay: 400ms; }
  [data-stagger].io-anim-visible > *:nth-child(n+7) { transition-delay: 480ms; }

  /* Glitch text effect */
  [data-glitch] {
    position: relative;
    display: inline-block;
  }
  [data-glitch]::before,
  [data-glitch]::after {
    content: attr(data-text);
    position: absolute; inset: 0;
    opacity: 0; pointer-events: none;
  }
  [data-glitch].io-glitch-active::before {
    color: #ff0040;
    opacity: 0.75;
    animation: io-glitch-1 0.12s steps(2) both;
  }
  [data-glitch].io-glitch-active::after {
    color: #00ffff;
    opacity: 0.75;
    animation: io-glitch-2 0.12s steps(2) 0.04s both;
  }

  /* Tilt (3D mouse tracking) */
  [data-tilt] {
    transform-style: preserve-3d;
    will-change: transform;
    transition: transform 0.1s ease;
  }

  /* Magnetic */
  [data-magnetic] {
    position: relative;
    will-change: transform;
  }

  /* Decrypt text */
  [data-decrypt] {
    font-family: var(--f-mono);
  }

  /* Lock unlock animation */
  .io-lock-shackle {
    transform-origin: right center;
    transition: transform 0.4s var(--ease-out);
  }
  .io-form-submitting .io-lock-shackle {
    animation: io-lock-unlock 0.6s var(--ease-out) both;
  }

  /* Data shred effect */
  .io-data-shred {
    animation: io-shred 0.5s steps(8) both;
    pointer-events: none;
  }

  /* Badge flip */
  .io-badge-flip-1 { animation: io-badge-flip 0.4s var(--ease-out) 0.1s both; }
  .io-badge-flip-2 { animation: io-badge-flip 0.4s var(--ease-out) 0.25s both; }
  .io-badge-flip-3 { animation: io-badge-flip 0.4s var(--ease-out) 0.4s both; }
  .io-badge-flip-4 { animation: io-badge-flip 0.4s var(--ease-out) 0.55s both; }
  .io-badge-flip-5 { animation: io-badge-flip 0.4s var(--ease-out) 0.7s both; }

  /* Certification seal spin-in */
  @keyframes io-seal-spin {
    from { transform: rotate(-180deg) scale(0); opacity: 0; }
    80% { transform: rotate(10deg) scale(1.05); }
    to { transform: rotate(0deg) scale(1); opacity: 1; }
  }
  .io-seal-spin-in { animation: io-seal-spin 0.8s var(--ease-out) 0.5s both; }

  /* Scanning progress / skeleton */
  .io-skeleton {
    background: linear-gradient(90deg, var(--border) 25%, var(--elevated) 50%, var(--border) 75%);
    background-size: 200% 100%;
    animation: io-shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
  }

  /* Radar sweep CSS */
  .io-radar-arm { animation: io-radar-sweep 4s linear infinite; transform-origin: center; }

  /* Attack chain path draw */
  .io-attack-path { stroke-dasharray: 800; stroke-dashoffset: 800; transition: stroke-dashoffset 2.5s var(--ease-out); }
  .io-attack-path.io-animated { stroke-dashoffset: 0; }

  /* Compliance gauge */
  .io-gauge__fill.io-animated { animation: io-gauge-fill 1.5s var(--ease-out) 0.5s both; }

  /* Gantt bars */
  .io-gantt-bar.io-animated { animation: io-gantt-expand 1s var(--ease-out) both; }

  /* Compliance checklist */
  .io-checklist-item { opacity: 0; transform: translateX(-10px); transition: opacity 0.4s var(--ease-out), transform 0.4s var(--ease-out); }
  .io-checklist-item.io-visible { opacity: 1; transform: translateX(0); }
  .io-checklist-check { stroke-dasharray: 40; stroke-dashoffset: 40; transition: stroke-dashoffset 0.4s var(--ease-out); }
  .io-checklist-item.io-visible .io-checklist-check { stroke-dashoffset: 0; }

  /* Preloader char drop */
  .io-preloader__wordmark span {
    animation: io-char-drop 0.5s var(--ease-out) both;
  }
  .io-preloader__wordmark span:nth-child(1) { animation-delay: 0.3s; }
  .io-preloader__wordmark span:nth-child(2) { animation-delay: 0.37s; }
  .io-preloader__wordmark span:nth-child(3) { animation-delay: 0.44s; }
  .io-preloader__wordmark span:nth-child(4) { animation-delay: 0.51s; }
  .io-preloader__wordmark span:nth-child(5) { animation-delay: 0.58s; }
  .io-preloader__wordmark span:nth-child(6) { animation-delay: 0.65s; }
  .io-preloader__wordmark span:nth-child(7) { animation-delay: 0.72s; }
  .io-preloader__wordmark span:nth-child(8) { animation-delay: 0.79s; }
  .io-preloader__wordmark span:nth-child(9) { animation-delay: 0.86s; }
  .io-preloader__wordmark span:nth-child(10) { animation-delay: 0.93s; }
  .io-preloader__wordmark span:nth-child(11) { animation-delay: 1s; }
  .io-preloader__wordmark span:nth-child(12) { animation-delay: 1.07s; }
  .io-preloader__wordmark span:nth-child(13) { animation-delay: 1.14s; }

  /* Neon flicker on active nav */
  .io-nav-current { animation: io-neon-flicker 6s ease 2s; }

  /* Hero spotlight cursor */
  .io-hero { transition: --mx 0.1s ease, --my 0.1s ease; }
}

/* Reading progress bar — always rendered, no motion concern */
.io-reading-progress {
  position: fixed; top: 0; left: 0; right: 0; height: 2px;
  background: var(--signal); transform-origin: left;
  transform: scaleX(0); z-index: 9999; transition: transform 0.05s linear;
}
