/*
 * CahFelix Tech WP - Animations CSS
 * Animações e transições para melhorar a experiência do usuário
 */

/* ==========================================================================
   KEYFRAMES
   ========================================================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

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

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}



@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
        transform: translate3d(0,0,0);
    }
    40%, 43% {
        animation-timing-function: cubic-bezier(0.755, 0.050, 0.855, 0.060);
        transform: translate3d(0, -30px, 0);
    }
    70% {
        animation-timing-function: cubic-bezier(0.755, 0.050, 0.855, 0.060);
        transform: translate3d(0, -15px, 0);
    }
    90% {
        transform: translate3d(0,-4px,0);
    }
}

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

/* ==========================================================================
   ANIMATION CLASSES
   ========================================================================== */

/* Fade animations */
.animate-fade-in {
    animation: fadeIn 0.6s ease-out;
}

.animate-fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

.animate-fade-in-down {
    animation: fadeInDown 0.6s ease-out;
}

/* Slide animations */
.animate-slide-in-left {
    animation: slideInLeft 0.6s ease-out;
}

.animate-slide-in-right {
    animation: slideInRight 0.6s ease-out;
}

/* Scale animations */
.animate-scale-in {
    animation: scaleIn 0.4s ease-out;
}

/* Utility animations - mantendo apenas as utilizadas */
.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ==========================================================================
   SCROLL ANIMATIONS
   ========================================================================== */

/* Elementos que animam quando entram na viewport */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease-out;
}

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

/* Variações de delay para animações em sequência */
.animate-delay-100 {
    animation-delay: 0.1s;
}

.animate-delay-200 {
    animation-delay: 0.2s;
}



/* ==========================================================================
   HOVER ANIMATIONS
   ========================================================================== */

/* Hover lift effect */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* Hover scale effect */
.hover-scale {
    transition: transform 0.3s ease;
}

.hover-scale:hover {
    transform: scale(1.05);
}

/* Hover glow effect */
.hover-glow {
    transition: box-shadow 0.3s ease;
}

.hover-glow:hover {
    box-shadow: 0 0 20px hsl(var(--accent) / 0.3);
}

/* ==========================================================================
   LOADING ANIMATIONS
   ========================================================================== */

/* Loading spinner */
.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid hsl(var(--muted));
    border-top: 2px solid hsl(var(--accent));
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Loading dots */
.loading-dots {
    display: inline-flex;
    gap: 4px;
}

.loading-dots span {
    width: 6px;
    height: 6px;
    background-color: hsl(var(--accent));
    border-radius: 50%;
    animation: pulse 1.4s ease-in-out infinite both;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }
.loading-dots span:nth-child(3) { animation-delay: 0s; }

/* ==========================================================================
   TRANSITION UTILITIES
   ========================================================================== */

/* Smooth transitions */
.transition-smooth {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.transition-fast {
    transition: all 0.15s ease;
}

.transition-slow {
    transition: all 0.6s ease;
}

/* Transform utilities */
.transform {
    transform: translateZ(0); /* Force hardware acceleration */
}

/* ==========================================================================
   REDUCED MOTION
   ========================================================================== */

/* Respeitar preferências de movimento reduzido */
@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;
    }

    .animate-on-scroll {
        opacity: 1;
        transform: none;
    }

    .engineer-post-card:hover {
        transform: none;
    }
}

/* ==========================================================================
   BLOG SPECIFIC ANIMATIONS
   ========================================================================== */

/* Animação para cards de posts */
.post-card-enter {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.post-card-enter.animate-in {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Animação para imagens de posts */
.post-image-reveal {
    overflow: hidden;
    position: relative;
}

.post-image-reveal img {
    transform: scale(1.1);
    transition: transform 0.6s ease;
}

.post-image-reveal.animate-in img {
    transform: scale(1);
}

/* Animação para texto de posts */
.post-content-fade {
    opacity: 0;
    transform: translateY(15px);
    transition: all 0.5s ease;
    transition-delay: 0.2s;
}

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

/* Animação para tags */
.tag-bounce-in {
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.tag-bounce-in.animate-in {
    opacity: 1;
    transform: scale(1);
}

/* Stagger animation para múltiplos elementos */
.stagger-item {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease;
}

.stagger-item:nth-child(1) { transition-delay: 0.1s; }
.stagger-item:nth-child(2) { transition-delay: 0.2s; }
.stagger-item:nth-child(3) { transition-delay: 0.3s; }
.stagger-item:nth-child(4) { transition-delay: 0.4s; }
.stagger-item:nth-child(5) { transition-delay: 0.5s; }
.stagger-item:nth-child(6) { transition-delay: 0.6s; }

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

/* ==========================================================================
   INTERACTIVE ANIMATIONS
   ========================================================================== */

/* Hover effect para posts */
.post-hover-effect {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.post-hover-effect::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
    transition: left 0.6s ease;
}

.post-hover-effect:hover::before {
    left: 100%;
}

.post-hover-effect:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
}



/* Glow pulse animation */
.glow-pulse {
    animation: glow-pulse 2s ease-in-out infinite alternate;
}

@keyframes glow-pulse {
    from {
        box-shadow: 0 0 5px hsl(var(--accent) / 0.3);
    }
    to {
        box-shadow: 0 0 20px hsl(var(--accent) / 0.6);
    }
}

/* ==========================================================================
   PERFORMANCE OPTIMIZATIONS
   ========================================================================== */

/* Force hardware acceleration for animated elements */
.animate-fade-in,
.animate-fade-in-up,
.animate-fade-in-down,
.animate-slide-in-left,
.animate-slide-in-right,
.animate-scale-in,
.hover-lift,
.hover-scale,
.post-card-enter,
.post-hover-effect,
.float,
.glow-pulse {
    will-change: transform, opacity;
    backface-visibility: hidden;
    perspective: 1000px;
}
