/* ==========================================================================
   PRISHANETWORK CONCEPT - Animations Stylesheet
   Keyframes, Scroll Reveals, Micro-interactions & Reduced Motion
   ========================================================================== */

/* --------------------------------------------------------------------------
   Global Scroll Reveal Classes (Driven by IntersectionObserver in JS)
   -------------------------------------------------------------------------- */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: opacity, transform;
}

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

.reveal-left {
    opacity: 0;
    transform: translateX(-40px);
    transition: opacity 0.75s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.75s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: opacity, transform;
}

.reveal-left.active {
    opacity: 1;
    transform: translateX(0);
}

.reveal-right {
    opacity: 0;
    transform: translateX(40px);
    transition: opacity 0.75s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.75s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: opacity, transform;
}

.reveal-right.active {
    opacity: 1;
    transform: translateX(0);
}

.reveal-scale {
    opacity: 0;
    transform: scale(0.94);
    transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: opacity, transform;
}

.reveal-scale.active {
    opacity: 1;
    transform: scale(1);
}

/* Stagger Helpers for Child Elements */
.stagger-1 { transition-delay: 0.1s !important; }
.stagger-2 { transition-delay: 0.2s !important; }
.stagger-3 { transition-delay: 0.3s !important; }
.stagger-4 { transition-delay: 0.4s !important; }
.stagger-5 { transition-delay: 0.5s !important; }
.stagger-6 { transition-delay: 0.6s !important; }
.stagger-7 { transition-delay: 0.7s !important; }

/* --------------------------------------------------------------------------
   Hero Section Animations
   -------------------------------------------------------------------------- */
.hero-opening-eyebrow {
    animation: fadeSlideUp 0.8s 0.2s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.hero-opening-title {
    animation: fadeSlideUp 0.9s 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.hero-opening-desc {
    animation: fadeSlideUp 0.9s 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.hero-opening-actions {
    animation: fadeSlideUp 0.9s 0.65s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.hero-opening-visual {
    animation: fadeInScale 1.2s 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.hero-opening-panel {
    animation: slideInFromRight 1s 0.8s cubic-bezier(0.16, 1, 0.3, 1) both,
               techFloat 5s 1.8s ease-in-out infinite;
}

.hero-main-img.hero-zoom-in {
    animation: subtleHeroZoom 2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes subtleHeroZoom {
    from {
        transform: scale(1.05);
    }
    to {
        transform: scale(1);
    }
}

@keyframes fadeSlideUp {
    from {
        opacity: 0;
        transform: translateY(28px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideInFromRight {
    from {
        opacity: 0;
        transform: translateX(45px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* --------------------------------------------------------------------------
   Header Opening Animation
   -------------------------------------------------------------------------- */
.header-fade-in {
    animation: headerAppear 0.8s ease forwards;
}

@keyframes headerAppear {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --------------------------------------------------------------------------
   Process Step Data Pulse & Line Animations
   -------------------------------------------------------------------------- */
.process-packet {
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--cyan);
    border-radius: 50%;
    box-shadow: 0 0 12px var(--cyan), 0 0 20px var(--blue-bright);
    top: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 3;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.process-packet.moving {
    opacity: 1;
    animation: packetTravel 3s infinite linear;
}

@keyframes packetTravel {
    0% { left: 0%; }
    100% { left: 100%; }
}

.step-node.node-pulse {
    animation: nodePulseGlow 2s infinite ease-in-out;
}

@keyframes nodePulseGlow {
    0%, 100% {
        box-shadow: 0 0 15px rgba(8, 120, 209, 0.3);
    }
    50% {
        box-shadow: 0 0 30px rgba(19, 200, 255, 0.65);
    }
}

/* --------------------------------------------------------------------------
   Glow & Shimmer Effects
   -------------------------------------------------------------------------- */
.cyan-glow-pulse {
    animation: cyanPulse 3s infinite ease-in-out;
}

@keyframes cyanPulse {
    0%, 100% {
        box-shadow: 0 0 15px rgba(19, 200, 255, 0.2);
    }
    50% {
        box-shadow: 0 0 30px rgba(19, 200, 255, 0.5);
    }
}

/* --------------------------------------------------------------------------
   Floating Micro-Animations (Tech Elements & Badges)
   -------------------------------------------------------------------------- */
.float-gentle {
    animation: techFloat 4s ease-in-out infinite;
}

.float-gentle-delay {
    animation: techFloat 4.5s ease-in-out 1.2s infinite;
}

.float-reverse {
    animation: techFloatReverse 4.2s ease-in-out 0.6s infinite;
}

@keyframes techFloat {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-8px);
    }
}

@keyframes techFloatReverse {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(8px);
    }
}

/* --------------------------------------------------------------------------
   Pulsing Icon Aura & Rings
   -------------------------------------------------------------------------- */
.service-icon-wrap,
.feature-icon-box {
    position: relative;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.4s ease;
}

.service-card:hover .service-icon-wrap,
.feature-item:hover .feature-icon-box {
    transform: scale(1.1) translateY(-3px);
    box-shadow: 0 0 25px rgba(19, 200, 255, 0.6);
}

.service-icon-wrap::after,
.play-icon-wrap::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: inherit;
    border: 1px solid var(--cyan);
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.4s ease;
    pointer-events: none;
}

.service-card:hover .service-icon-wrap::after {
    opacity: 0.7;
    animation: iconRingExpand 1.6s infinite ease-out;
}

@keyframes iconRingExpand {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }
    100% {
        transform: scale(1.45);
        opacity: 0;
    }
}

/* --------------------------------------------------------------------------
   Button Shimmer & Light Sweep
   -------------------------------------------------------------------------- */
.btn-primary,
.btn-secondary {
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -150%;
    width: 60%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.35),
        transparent
    );
    transform: skewX(-25deg);
    transition: left 0.75s ease;
    pointer-events: none;
}

.btn-primary:hover::before {
    left: 170%;
}

/* Periodic ambient sheen on primary CTA */
#hero-primary-cta::before {
    animation: ambientSheen 6s infinite 2s ease-in-out;
}

@keyframes ambientSheen {
    0%, 80% {
        left: -150%;
    }
    100% {
        left: 170%;
    }
}

/* --------------------------------------------------------------------------
   Interactive 3D Tilt Card & Dynamic Spotlight Surface
   -------------------------------------------------------------------------- */
.service-card,
.gallery-item,
.process-step-card,
.about-feature-item {
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                border-color 0.35s ease;
    transform-style: preserve-3d;
}

.service-card:hover {
    border-color: rgba(19, 200, 255, 0.45) !important;
    box-shadow: 0 16px 40px rgba(3, 21, 46, 0.14),
                0 0 20px rgba(19, 200, 255, 0.18) !important;
}

/* --------------------------------------------------------------------------
   Cyber Streaming Lines on Eyebrows & Dividers
   -------------------------------------------------------------------------- */
.section-eyebrow {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.eyebrow-line::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, var(--cyan), var(--blue), transparent);
    background-size: 200% 100%;
    animation: cyberStream 3s infinite linear;
    border-radius: 2px;
}

@keyframes cyberStream {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

/* --------------------------------------------------------------------------
   Real Project Gallery Enhanced Micro-Interactions
   -------------------------------------------------------------------------- */
.gallery-item {
    position: relative;
}

.gallery-item::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 10px;
    width: 20px;
    height: 20px;
    border-top: 2px solid var(--cyan);
    border-left: 2px solid var(--cyan);
    opacity: 0;
    transform: scale(0.7);
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 4;
    pointer-events: none;
}

.gallery-item::after {
    content: '';
    position: absolute;
    bottom: 10px;
    right: 10px;
    width: 20px;
    height: 20px;
    border-bottom: 2px solid var(--cyan);
    border-right: 2px solid var(--cyan);
    opacity: 0;
    transform: scale(0.7);
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 4;
    pointer-events: none;
}

.gallery-item:hover::before,
.gallery-item:hover::after {
    opacity: 1;
    transform: scale(1);
}

.gallery-item:hover img {
    transform: scale(1.08) rotate(0.4deg);
    filter: brightness(1.05) contrast(1.05);
}

.gallery-tag {
    display: inline-block;
    transition: transform 0.3s ease, background 0.3s ease;
}

.gallery-item:hover .gallery-tag {
    transform: translateY(-2px);
    background: var(--blue-bright) !important;
    box-shadow: 0 0 12px rgba(19, 200, 255, 0.6);
}

/* --------------------------------------------------------------------------
   Counter Finish Bounce Animation
   -------------------------------------------------------------------------- */
.counter-pop {
    animation: counterBounce 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    text-shadow: 0 0 16px rgba(19, 200, 255, 0.8);
}

@keyframes counterBounce {
    0% { transform: scale(1); }
    50% { transform: scale(1.18); color: var(--cyan); }
    100% { transform: scale(1); }
}

/* --------------------------------------------------------------------------
   Click Ripple Effect
   -------------------------------------------------------------------------- */
.click-ripple {
    position: absolute;
    border-radius: 50%;
    transform: scale(0);
    animation: rippleEffect 0.6s linear;
    background-color: rgba(255, 255, 255, 0.45);
    pointer-events: none;
}

@keyframes rippleEffect {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* --------------------------------------------------------------------------
   Back to Top Floating Pulse
   -------------------------------------------------------------------------- */
.back-to-top.visible {
    animation: bttPulse 3s infinite ease-in-out;
}

@keyframes bttPulse {
    0%, 100% {
        box-shadow: 0 6px 20px rgba(3, 21, 46, 0.3), 0 0 0 0 rgba(19, 200, 255, 0.4);
    }
    50% {
        box-shadow: 0 8px 25px rgba(3, 21, 46, 0.4), 0 0 0 8px rgba(19, 200, 255, 0);
    }
}

/* --------------------------------------------------------------------------
   3D Machine Internal Hardware & Service Micro-Animations
   -------------------------------------------------------------------------- */

/* Cooling Turbines */
@keyframes spinTurbine {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes spinTurbineFast {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.spin-fan {
    transform-origin: center center;
    animation: spinTurbine 1.1s linear infinite;
}

.high-traffic .spin-fan {
    animation-duration: 0.45s !important;
}

/* ASIC Processor Core Glow */
@keyframes asicCoreGlow {
    0%, 100% {
        box-shadow: 0 0 16px rgba(19, 200, 255, 0.45), inset 0 0 16px rgba(0, 175, 255, 0.3);
        border-color: rgba(19, 200, 255, 0.65);
    }
    50% {
        box-shadow: 0 0 38px rgba(19, 200, 255, 0.95), inset 0 0 28px rgba(19, 200, 255, 0.7);
        border-color: #ffffff;
    }
}

.asic-glow {
    animation: asicCoreGlow 2.4s ease-in-out infinite;
}

/* PCB Circuit Data Bus Flow */
@keyframes packetDart {
    0% { stroke-dashoffset: 140; opacity: 0; }
    20% { opacity: 1; }
    80% { opacity: 1; }
    100% { stroke-dashoffset: 0; opacity: 0; }
}

.pcb-trace-data {
    stroke-dasharray: 20 80;
    animation: packetDart 2s linear infinite;
}

.high-traffic .pcb-trace-data {
    animation-duration: 0.8s !important;
}

/* Optical Laser Transceiver Guide */
@keyframes laserPulse {
    0%, 100% {
        opacity: 0.4;
        filter: drop-shadow(0 0 4px #00e5ff);
    }
    50% {
        opacity: 1;
        filter: drop-shadow(0 0 14px #00e5ff);
    }
}

.laser-beam {
    animation: laserPulse 1.8s ease-in-out infinite;
}

/* Port Activity LEDs (Natural Asynchronous Flickering) */
@keyframes ledFlicker1 {
    0%, 100% { opacity: 0.3; }
    18% { opacity: 1; }
    32% { opacity: 0.4; }
    48% { opacity: 1; }
    65% { opacity: 0.2; }
    82% { opacity: 0.95; }
}

@keyframes ledFlicker2 {
    0%, 100% { opacity: 0.85; }
    24% { opacity: 0.2; }
    42% { opacity: 1; }
    58% { opacity: 0.35; }
    76% { opacity: 1; }
    91% { opacity: 0.15; }
}

@keyframes ledFlicker3 {
    0%, 100% { opacity: 1; }
    30% { opacity: 0.15; }
    55% { opacity: 0.9; }
    80% { opacity: 0.25; }
}

.led-blink-1 { animation: ledFlicker1 0.7s infinite; }
.led-blink-2 { animation: ledFlicker2 0.55s infinite; }
.led-blink-3 { animation: ledFlicker3 0.85s infinite; }

/* Thermal Airflow Drift */
@keyframes airflowDrift {
    0% { transform: translateX(-40px); opacity: 0; }
    25% { opacity: 0.7; }
    75% { opacity: 0.7; }
    100% { transform: translateX(60px); opacity: 0; }
}

.airflow-particle {
    animation: airflowDrift 2.2s ease-in-out infinite;
}

/* CCTV 3D Micro-Animations */
@keyframes cctvCameraPan {
    0%, 100% { transform: rotate(18deg); }
    50% { transform: rotate(-22deg); }
}

@keyframes lidarScanCone {
    0%, 100% {
        opacity: 0.25;
        transform: scale(0.9) rotate(18deg);
    }
    50% {
        opacity: 0.75;
        transform: scale(1.15) rotate(-22deg);
    }
}

@keyframes cctvRecBlink {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.2; transform: scale(0.75); }
}

.cctv-scan-beacon {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background: #ef4444;
    border-radius: 50%;
    box-shadow: 0 0 10px #ef4444;
    animation: cctvRecBlink 1.4s ease-in-out infinite;
}

.service-cctv-icon {
    position: relative;
    overflow: visible;
}

.service-cctv-icon i {
    animation: cctvCameraPan 5s ease-in-out infinite;
    transform-origin: center top;
}

/* --------------------------------------------------------------------------
   Reduced Motion Accessibility (@media prefers-reduced-motion)
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .reveal,
    .reveal-left,
    .reveal-right,
    .reveal-scale {
        opacity: 1 !important;
        transform: none !important;
    }

    .hero-main-img {
        transform: none !important;
    }

    #hero-canvas,
    #globe-canvas {
        display: none !important;
    }

    .mouse-glow {
        display: none !important;
    }
}
