/**
 * MedCode Agency - Scroll & Dynamic Animation System
 * Smooth reveal on scroll up and down
 */

@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 0 25px rgba(0, 242, 254, 0.2), inset 0 0 15px rgba(0, 242, 254, 0.1);
        transform: translateY(0);
    }
    50% {
        box-shadow: 0 0 45px rgba(0, 242, 254, 0.4), inset 0 0 25px rgba(79, 172, 254, 0.2);
        transform: translateY(-4px);
    }
}

@keyframes floatSlow {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    50% {
        transform: translateY(-12px) rotate(1.5deg);
    }
}

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

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

/* Scroll Triggered Bidirectional Reveal Classes */
.reveal {
    opacity: 0;
    transform: translateY(35px);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: opacity, transform;
}

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

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

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

/* Active State Triggered on Scroll */
.reveal.active,
.reveal-left.active,
.reveal-right.active,
.reveal-scale.active {
    opacity: 1;
    transform: translate(0, 0) scale(1);
}

/* Stagger Delays for child cards */
.delay-1 { transition-delay: 0.1s; }
.delay-2 { transition-delay: 0.2s; }
.delay-3 { transition-delay: 0.3s; }
.delay-4 { transition-delay: 0.4s; }
.delay-5 { transition-delay: 0.5s; }

/* Glowing Orb Background Elements */
.glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.25;
    pointer-events: none;
    z-index: 0;
}

.orb-cyan {
    background: #00f2fe;
}

.orb-purple {
    background: #7928ca;
}

.orb-emerald {
    background: #10b981;
}

/* Float Helpers */
.float-element {
    animation: floatSlow 6s ease-in-out infinite;
}

.pulse-element {
    animation: pulseGlow 4s ease-in-out infinite;
}

/* Marquee Container */
.marquee-track {
    display: flex;
    overflow: hidden;
    user-select: none;
    gap: 30px;
}

.marquee-content {
    flex-shrink: 0;
    display: flex;
    justify-content: space-around;
    gap: 30px;
    min-width: 100%;
    animation: marquee 25s linear infinite;
}

.marquee-track:hover .marquee-content {
    animation-play-state: paused;
}

/* ==========================================================================
   MASTER INTERACTIVE ANIMATION SUITE (PRO DEVELOPER GRADE)
   ========================================================================== */

/* 1. Custom Interactive Cursor (Desktop Fine Pointer Devices) */
@media (pointer: fine) {
    #customCursorDot,
    #customCursorRing {
        position: fixed;
        top: 0;
        left: 0;
        pointer-events: none;
        border-radius: 50%;
        z-index: 999999;
        opacity: 0;
        will-change: transform, width, height, opacity;
    }

    #customCursorDot {
        width: 8px;
        height: 8px;
        background: #00f2fe;
        box-shadow: 0 0 10px #00f2fe, 0 0 20px rgba(0, 242, 254, 0.7);
        transform: translate(-50%, -50%);
        transition: opacity 0.3s ease, width 0.2s ease, height 0.2s ease, background 0.2s ease;
    }

    #customCursorRing {
        width: 36px;
        height: 36px;
        border: 1.5px solid rgba(0, 242, 254, 0.55);
        background: radial-gradient(circle, rgba(0, 242, 254, 0.08) 0%, transparent 70%);
        box-shadow: 0 0 20px rgba(0, 242, 254, 0.25);
        transform: translate(-50%, -50%);
        transition: opacity 0.3s ease, width 0.25s cubic-bezier(0.16, 1, 0.3, 1), height 0.25s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.25s ease, background 0.25s ease;
    }

    /* Hovering Interactive Elements */
    body.cursor-hover #customCursorDot {
        width: 4px;
        height: 4px;
        background: #ffffff;
        box-shadow: 0 0 12px #ffffff;
    }

    body.cursor-hover #customCursorRing {
        width: 62px;
        height: 62px;
        border-color: rgba(56, 189, 248, 0.9);
        background: radial-gradient(circle, rgba(0, 242, 254, 0.2) 0%, rgba(139, 92, 246, 0.1) 70%, transparent 100%);
        box-shadow: 0 0 35px rgba(0, 242, 254, 0.45);
    }

    /* Click Active State */
    body.cursor-click #customCursorRing {
        width: 28px;
        height: 28px;
        border-color: #00f2fe;
        background: rgba(0, 242, 254, 0.4);
        box-shadow: 0 0 30px rgba(0, 242, 254, 0.8);
    }
}

/* 2. Interactive Card Spotlight & 3D Tilt */
.service-card,
.portfolio-card,
.workflow-step-card,
.testimonial-card,
.code-mockup,
.estimator-card {
    position: relative;
    transform-style: preserve-3d;
    will-change: transform;
}

/* Mouse Flashlight Spotlight Overlay */
.service-card::before,
.portfolio-card::before,
.workflow-step-card::before,
.testimonial-card::before,
.code-mockup::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: inherit;
    background: radial-gradient(
        420px circle at var(--mouse-x, -500px) var(--mouse-y, -500px),
        rgba(0, 242, 254, 0.13),
        transparent 65%
    );
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
    z-index: 1;
}

.service-card:hover::before,
.portfolio-card:hover::before,
.workflow-step-card:hover::before,
.testimonial-card:hover::before,
.code-mockup:hover::before {
    opacity: 1;
}

/* 3. Magnetic Action Buttons */
.btn-cyan,
.btn-card-inquire,
.btn-submit-inquiry,
.btn-glass {
    will-change: transform;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease, background 0.25s ease;
}

/* 4. Hero Particle Canvas */
.hero-particle-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0.65;
}

/* 5. Continuous Text Gradient Shift Animation */
@keyframes gradientTextShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.text-gradient {
    background: linear-gradient(135deg, #00f2fe 0%, #38bdf8 25%, #a855f7 50%, #38bdf8 75%, #00f2fe 100%);
    background-size: 250% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientTextShift 8s ease infinite;
}

/* 6. Dynamic Badge Shimmer Sweep */
@keyframes badgeShimmer {
    0% { transform: translateX(-150%); }
    40%, 100% { transform: translateX(250%); }
}

.section-badge,
.hero-badge,
.portfolio-category-badge {
    position: relative;
    overflow: hidden;
}

.section-badge::after,
.hero-badge::after,
.portfolio-category-badge::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 45%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
    transform: translateX(-150%);
    animation: badgeShimmer 5s ease-in-out infinite;
    pointer-events: none;
}

/* 7. Code Mockup Interactive Glow Pulse */
.code-mockup {
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.4s ease;
}

.code-mockup:hover {
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.8), 0 0 40px rgba(0, 242, 254, 0.22);
}

/* 8. Accessibility: Honor 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;
    }
    #customCursorDot,
    #customCursorRing {
        display: none !important;
    }
}
