/* ================================================
   ✨ Animation System
   ================================================ */

/* ===== Scroll Reveal Animations ===== */
/* Start visible so content never disappears after Blazor re-render / scroll */
.animate-on-scroll {
    opacity: 1;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.animate-on-scroll.animate-in {
    transform: translateY(0);
}

/* Stagger animation for cards */
.skills-grid .skill-card:nth-child(1) { transition-delay: 0.05s; }
.skills-grid .skill-card:nth-child(2) { transition-delay: 0.1s; }
.skills-grid .skill-card:nth-child(3) { transition-delay: 0.15s; }
.skills-grid .skill-card:nth-child(4) { transition-delay: 0.2s; }
.skills-grid .skill-card:nth-child(5) { transition-delay: 0.25s; }
.skills-grid .skill-card:nth-child(6) { transition-delay: 0.3s; }
.skills-grid .skill-card:nth-child(7) { transition-delay: 0.35s; }
.skills-grid .skill-card:nth-child(8) { transition-delay: 0.4s; }
.skills-grid .skill-card:nth-child(9) { transition-delay: 0.45s; }
.skills-grid .skill-card:nth-child(10) { transition-delay: 0.5s; }
.skills-grid .skill-card:nth-child(11) { transition-delay: 0.55s; }
.skills-grid .skill-card:nth-child(12) { transition-delay: 0.6s; }
.skills-grid .skill-card:nth-child(13) { transition-delay: 0.65s; }
.skills-grid .skill-card:nth-child(14) { transition-delay: 0.7s; }

.portfolio-grid .portfolio-card:nth-child(1) { transition-delay: 0.1s; }
.portfolio-grid .portfolio-card:nth-child(2) { transition-delay: 0.2s; }
.portfolio-grid .portfolio-card:nth-child(3) { transition-delay: 0.3s; }

.testimonial-grid .testimonial-card:nth-child(1) { transition-delay: 0.1s; }
.testimonial-grid .testimonial-card:nth-child(2) { transition-delay: 0.2s; }
.testimonial-grid .testimonial-card:nth-child(3) { transition-delay: 0.3s; }

/* ===== Header Scroll Effect ===== */
.header {
    transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}

.header.scrolled {
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.6);
    background: rgba(10, 10, 10, 0.98);
}

/* ===== Hover Effects ===== */
.card-hover {
    position: relative;
    overflow: hidden;
}

.card-hover::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 188, 212, 0.1), transparent);
    transition: left 0.5s ease;
}

.card-hover:hover::before {
    left: 100%;
}

/* ===== Pulse Animation for CTA ===== */
@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(0, 188, 212, 0.7);
    }
    50% {
        box-shadow: 0 0 0 20px rgba(0, 188, 212, 0);
    }
}

.cta-button::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    animation: pulse 2s infinite;
}

/* ===== Shimmer Loading Effect ===== */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-card) 0%,
        rgba(255, 255, 255, 0.05) 50%,
        var(--bg-card) 100%
    );
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
}

/* ===== Glow Effect ===== */
.glow {
    position: relative;
}

.glow::after {
    content: '';
    position: absolute;
    inset: -2px;
    background: linear-gradient(45deg, transparent, var(--primary), transparent);
    border-radius: inherit;
    opacity: 0;
    z-index: -1;
    filter: blur(10px);
    transition: opacity var(--transition-base);
}

.glow:hover::after {
    opacity: 0.5;
}

/* ===== Scale on Hover ===== */
.scale-hover {
    transition: transform var(--transition-base);
}

.scale-hover:hover {
    transform: scale(1.05);
}

/* ===== Rotate on Hover ===== */
.rotate-hover {
    transition: transform var(--transition-base);
}

.rotate-hover:hover {
    transform: rotate(5deg);
}

/* ===== Fade In/Out ===== */
.fade-enter {
    opacity: 0;
    animation: fadeIn 0.3s ease-out forwards;
}

.fade-exit {
    opacity: 1;
    animation: fadeOut 0.3s ease-out forwards;
}

@keyframes fadeIn {
    to { opacity: 1; }
}

@keyframes fadeOut {
    to { opacity: 0; }
}

/* ===== Slide In Animations ===== */
@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== Bounce ===== */
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.bounce {
    animation: bounce 2s infinite;
}

/* ===== Reduce Motion for Accessibility ===== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
