/* ========================================
   RICHARD ADAZE - ANIMATIONS
   Smooth transitions and micro-interactions
   ======================================== */

/* ========================================
   Fade-in Animation System
   ======================================== */

.animate-ready {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.animate-in {
    opacity: 1;
    transform: translateY(0);
}

/* Staggered delays for grid items */
.expertise-grid .animate-ready:nth-child(1) {
    transition-delay: 0ms;
}

.expertise-grid .animate-ready:nth-child(2) {
    transition-delay: 150ms;
}

.portfolio-grid .animate-ready:nth-child(1) {
    transition-delay: 0ms;
}

.portfolio-grid .animate-ready:nth-child(2) {
    transition-delay: 100ms;
}

.portfolio-grid .animate-ready:nth-child(3) {
    transition-delay: 200ms;
}

.insights-grid .animate-ready:nth-child(1) {
    transition-delay: 0ms;
}

.insights-grid .animate-ready:nth-child(2) {
    transition-delay: 100ms;
}

.insights-grid .animate-ready:nth-child(3) {
    transition-delay: 200ms;
}

.about-stats .animate-ready:nth-child(1) {
    transition-delay: 0ms;
}

.about-stats .animate-ready:nth-child(2) {
    transition-delay: 100ms;
}

.about-stats .animate-ready:nth-child(3) {
    transition-delay: 200ms;
}

/* ========================================
   Hero Title Animation
   ======================================== */

.hero-title .title-line {
    opacity: 0;
    transform: translateY(20px);
    animation: slideInUp 0.8s ease forwards;
}

.hero-title .title-line:nth-child(1) {
    animation-delay: 0.2s;
}

.hero-title .title-line:nth-child(2) {
    animation-delay: 0.4s;
}

@keyframes slideInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   Badge Pulse Animation
   ======================================== */

.badge-dot {
    position: relative;
}

.badge-dot::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: var(--color-secondary-400);
    opacity: 0;
    animation: ripple 2s ease-out infinite;
}

@keyframes ripple {
    0% {
        opacity: 0.6;
        transform: scale(0.5);
    }

    100% {
        opacity: 0;
        transform: scale(2);
    }
}

/* ========================================
   Card Hover Effects
   ======================================== */

.stat-card,
.expertise-card,
.portfolio-card,
.insight-card,
.cta-card {
    transform-style: preserve-3d;
    perspective: 1000px;
}

.stat-card:hover,
.expertise-card:hover,
.portfolio-card:hover,
.insight-card:hover,
.cta-card:hover {
    transform: translateY(-8px);
}

/* Glass morphism enhancement on hover */
.floating-card {
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.floating-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

/* ========================================
   Button Animations
   ======================================== */

.btn {
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300%;
    height: 300%;
}

.btn svg {
    transition: transform 0.3s ease;
}

.btn:hover svg {
    transform: translateX(3px);
}

/* ========================================
   Link Animations
   ======================================== */

.card-link,
.insight-link,
.cta-link {
    position: relative;
}

.card-link svg,
.insight-link svg,
.cta-link svg {
    transition: transform 0.3s ease;
}

.card-link:hover svg,
.insight-link:hover svg,
.cta-link:hover svg {
    transform: translateX(5px);
}

/* ========================================
   Social Link Animations
   ======================================== */

.social-link {
    position: relative;
    overflow: hidden;
}

.social-link::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--color-secondary-500);
    transform: translateY(100%);
    transition: transform 0.3s ease;
    z-index: -1;
}

.social-link:hover::before {
    transform: translateY(0);
}

.social-link svg {
    transition: transform 0.3s ease, color 0.3s ease;
}

.social-link:hover svg {
    transform: scale(1.1);
}

/* ========================================
   Scroll Progress Indicator
   ======================================== */

.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--color-secondary-500), var(--color-accent-400));
    transform-origin: left;
    transform: scaleX(0);
    z-index: 9999;
    transition: transform 0.1s ease-out;
}

/* ========================================
   Image Reveal Effect
   ======================================== */

.portfolio-image,
.insight-image {
    position: relative;
    overflow: hidden;
}

.portfolio-image::after,
.insight-image::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 0%, rgba(10, 22, 40, 0.8) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.portfolio-card:hover .portfolio-image::after,
.insight-card:hover .insight-image::after {
    opacity: 1;
}

/* ========================================
   Text Gradient Animation
   ======================================== */

.highlight {
    background-size: 200% auto;
    animation: shimmer 3s linear infinite;
}

@keyframes shimmer {
    0% {
        background-position: 0% center;
    }

    100% {
        background-position: 200% center;
    }
}

/* ========================================
   Navbar Transition
   ======================================== */

.navbar {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-link::after {
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========================================
   Mobile Menu Animation
   ======================================== */

@media (max-width: 768px) {
    .nav-menu {
        transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .nav-menu.active .nav-link {
        opacity: 0;
        animation: fadeInRight 0.4s ease forwards;
    }

    .nav-menu.active .nav-link:nth-child(1) {
        animation-delay: 0.1s;
    }

    .nav-menu.active .nav-link:nth-child(2) {
        animation-delay: 0.15s;
    }

    .nav-menu.active .nav-link:nth-child(3) {
        animation-delay: 0.2s;
    }

    .nav-menu.active .nav-link:nth-child(4) {
        animation-delay: 0.25s;
    }

    .nav-menu.active .nav-link:nth-child(5) {
        animation-delay: 0.3s;
    }

    @keyframes fadeInRight {
        from {
            opacity: 0;
            transform: translateX(20px);
        }

        to {
            opacity: 1;
            transform: translateX(0);
        }
    }
}

/* ========================================
   Loading Animation
   ======================================== */

.page-loader {
    position: fixed;
    inset: 0;
    background: var(--color-primary-900);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.page-loader.hidden {
    opacity: 0;
    visibility: hidden;
}

.loader-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(45, 212, 191, 0.2);
    border-top-color: var(--color-secondary-400);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ========================================
   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;
    }

    .floating-card {
        animation: none;
    }

    .scroll-indicator {
        animation: none;
    }

    .badge-dot::before {
        animation: none;
    }
}