/* Animations CSS */

/* Base transitions for all elements */
*, *::before, *::after {
    transition-property: background-color, border-color, color, fill, stroke, opacity, box-shadow, transform;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 250ms;
}



/* Animations for content based on scroll */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 600ms ease-out, transform 600ms ease-out;
}

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

.fade-in-left {
    opacity: 0;
    transform: translateX(-20px);
    transition: opacity 600ms ease-out, transform 600ms ease-out;
}

.fade-in-left.visible {
    opacity: 1;
    transform: translateX(0);
}

.fade-in-right {
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 600ms ease-out, transform 600ms ease-out;
}

.fade-in-right.visible {
    opacity: 1;
    transform: translateX(0);
}

.fade-in-up {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 600ms ease-out, transform 600ms ease-out;
}

.fade-in-up.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Staggered animations for content groups */
.stagger-item {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 600ms ease-out, transform 600ms ease-out;
}

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

/* Animation for section titles */
.section-title {
    position: relative;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    transition: width 600ms ease, left 600ms ease;
    border-radius: 1.5px;
}

.section-title.visible::after {
    width: 60px;
    left: calc(50% - 30px);
}

/* Section title animation for left-aligned titles */
.section-title.text-left::after {
    left: 0;
}

.section-title.text-left.visible::after {
    width: 60px;
    left: 0;
}

/* Enhanced hover animations for various elements */
.service-card, 
.project-card, 
.education-item, 
.approach-item, 
.faq-item {
    transition: transform 300ms ease, box-shadow 300ms ease;
}

/* Smooth image zoom effect */
.image-zoom-container {
    overflow: hidden;
}

.image-zoom {
    transition: transform 800ms ease;
}

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

/* Floating animation */
@keyframes float {
    0% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-15px);
    }
    100% {
        transform: translateY(0px);
    }
}

/* Smooth scroll behavior */
html {
    scroll-behavior: smooth;
}

/* Ensure animations play nicely on mobile */
@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;
    }
    
    .fade-in,
    .fade-in-left,
    .fade-in-right,
    .fade-in-up,
    .stagger-item {
        opacity: 1;
        transform: none;
    }
}

/* Back to top button */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease, background-color 0.3s ease;
    z-index: 99;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.back-to-top.visible {
    opacity: 1;
    transform: translateY(0);
}

.back-to-top:hover {
    background-color: var(--secondary-color);
    transform: translateY(-5px);
}

/* For mobile devices */
@media (max-width: 768px) {
    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
}