/*
 * Matrix Solutions Group - Animations
 * ====================================
 */

/* ============================================
   Keyframe Animations
   ============================================ */

/* Fade In Up Animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
        filter: blur(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
        filter: blur(0);
    }
}

/* Fade In Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        filter: blur(10px);
    }

    to {
        opacity: 1;
        filter: blur(0);
    }
}

/* Glow Pulse Animation */
@keyframes glowPulse {

    0%,
    100% {
        box-shadow: 0 0 20px rgba(6, 182, 212, 0.2);
    }

    50% {
        box-shadow: 0 0 40px rgba(6, 182, 212, 0.4);
    }
}

/* Border Glow Animation */
@keyframes borderGlow {

    0%,
    100% {
        border-color: rgba(6, 182, 212, 0.3);
    }

    50% {
        border-color: rgba(6, 182, 212, 0.6);
    }
}

/* Typing Cursor Animation */
@keyframes blink {

    0%,
    50% {
        opacity: 1;
    }

    51%,
    100% {
        opacity: 0;
    }
}

/* Float Animation */
@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* Rotate Animation */
@keyframes rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Scale Pulse Animation */
@keyframes scalePulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

/* Slide In Left */
@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Slide In Right */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Counter Animation (for stats) */
@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   Animation Classes
   ============================================ */

/* Scroll-triggered animations - initial hidden state */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate-on-scroll.animate-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger delay utilities */
.delay-100 {
    transition-delay: 100ms;
}

.delay-200 {
    transition-delay: 200ms;
}

.delay-300 {
    transition-delay: 300ms;
}

.delay-400 {
    transition-delay: 400ms;
}

.delay-500 {
    transition-delay: 500ms;
}

.delay-600 {
    transition-delay: 600ms;
}

/* Continuous animations */
.animate-float {
    animation: float 3s ease-in-out infinite;
}

.animate-glow {
    animation: glowPulse 2s ease-in-out infinite;
}

.animate-border-glow {
    animation: borderGlow 2s ease-in-out infinite;
}

.animate-pulse {
    animation: scalePulse 2s ease-in-out infinite;
}

/* On-load animations */
.animate-fade-in {
    animation: fadeIn 0.6s ease forwards;
}

.animate-fade-in-up {
    animation: fadeInUp 0.6s ease forwards;
}

.animate-slide-left {
    animation: slideInLeft 0.6s ease forwards;
}

.animate-slide-right {
    animation: slideInRight 0.6s ease forwards;
}

/* ============================================
   Hover Effect Enhancements
   ============================================ */

/* Card hover glow effect */
.card-glow-hover {
    position: relative;
}

.card-glow-hover::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: linear-gradient(135deg, var(--color-accent-primary), var(--color-accent-secondary));
    border-radius: inherit;
    opacity: 0;
    z-index: -1;
    transition: opacity var(--transition-base);
}

.card-glow-hover:hover::before {
    opacity: 0.3;
}

/* Button ripple effect */
.btn-ripple {
    position: relative;
    overflow: hidden;
}

.btn-ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.4s ease, height 0.4s ease;
}

.btn-ripple:hover::after {
    width: 300px;
    height: 300px;
}

/* ============================================
   Text Animations
   ============================================ */

/* Typing cursor effect */
.typing-cursor::after {
    content: '|';
    color: var(--color-accent-primary);
    animation: blink 1s infinite;
    margin-left: 2px;
}

/* Gradient text animation */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.animate-gradient-text {
    background: linear-gradient(90deg, var(--color-accent-primary), var(--color-accent-secondary), var(--color-accent-primary));
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 3s ease infinite;
}

/* ============================================
   Loading States
   ============================================ */

/* Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-accent-primary);
    border-radius: 50%;
    animation: rotate 0.8s linear infinite;
}

/* Skeleton loading */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.skeleton {
    background: linear-gradient(90deg, var(--color-bg-elevated) 25%, var(--color-border) 50%, var(--color-bg-elevated) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-md);
}

/* ============================================
   Page Transition Effects
   ============================================ */

/* Page entrance */
.page-enter {
    animation: fadeIn 0.4s ease forwards;
}

/* Hero specific animations */
.hero-content-animated .hero__label {
    animation: fadeInUp 0.6s ease 0.2s forwards;
    opacity: 0;
}

.hero-content-animated .hero__title {
    animation: fadeInUp 0.6s ease 0.4s forwards;
    opacity: 0;
}

.hero-content-animated .hero__subtitle {
    animation: fadeInUp 0.6s ease 0.6s forwards;
    opacity: 0;
}

.hero-content-animated .hero__buttons {
    animation: fadeInUp 0.6s ease 0.8s forwards;
    opacity: 0;
}

/* ============================================
   Reduced Motion Support
   ============================================ */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .animate-on-scroll {
        opacity: 1;
        transform: none;
    }
}