section {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}
  
section.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Hide all animated elements initially */
.animate-climbIn,
.animate-slideOppositeIn-left,
.animate-slideOppositeIn-right {
    opacity: 0;
}

/* Only start animations when parent section is visible */
section.visible .animate-climbIn {
    animation: climbIn 1s ease forwards;
}

section.visible .animate-slideOppositeIn-left {
    animation: slideInFromRight 1s ease forwards;
}

section.visible .animate-slideOppositeIn-right {
    animation: slideInFromLeft 1s ease forwards;
}

/* Sequential delays - only apply after section becomes visible */
section.visible .animate-climbIn:nth-child(1) {
    animation-delay: 0.3s; /* Slight delay after section appears */
}
section.visible .animate-climbIn:nth-child(2) {
    animation-delay: 0.6s;
}
section.visible .animate-climbIn:nth-child(3) {
    animation-delay: 0.9s;
}

section.visible .animate-slideOppositeIn:nth-child(1) {
    animation-delay: 0.3s;
}
section.visible .animate-slideOppositeIn:nth-child(2) {
    animation-delay: 0.6s;
}
section.visible .animate-slideOppositeIn:nth-child(3) {
    animation-delay: 0.9s;
}

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

@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-50%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInFromRight {
    from {
        opacity: 0;
        transform: translateX(50%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Grayscale effect remains the same */
.flex .img {
    filter: grayscale(100%);
    transition: filter 0.5s ease;
}

.flex .img:hover {
    filter: grayscale(0%);
}