/* Card Stack Container */
.competition-cards-stack {
    position: relative;
    width: 344px;
    height: 462px;
    perspective: 1500px;
    perspective-origin: center center;
}

/* Base card styling */
.competition-cards-stack .competition-box {
    position: absolute;
    width: 344px;
    transition: all 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-style: preserve-3d;
    backface-visibility: hidden;
    cursor: pointer;
}

.competition-box div {
    background: #fff;
}
/* Initial stacked positions - all cards start in the back */
.competition-cards-stack .competition-box {
    bottom: 20px;
    left: 20px;
    opacity: 0;
    transform: translateZ(-200px) translateY(100px) rotateX(-15deg) scale(0.8);
}

/* Card 1 Animation - Infinite Loop */
.competition-cards-stack .card-1 {
    z-index: 4;
    animation: cardCycle1 14s cubic-bezier(0.34, 1.56, 0.64, 1) infinite;
}

/* Card 2 Animation - Infinite Loop */
.competition-cards-stack .card-2 {
    z-index: 3;
    animation: cardCycle2 14s cubic-bezier(0.34, 1.56, 0.64, 1) infinite;
}

/* Card 3 Animation - Infinite Loop */
.competition-cards-stack .card-3 {
    z-index: 2;
    animation: cardCycle3 14s cubic-bezier(0.34, 1.56, 0.64, 1) infinite;
}

/* Card 4 Animation - Infinite Loop */
.competition-cards-stack .card-4 {
    z-index: 1;
    animation: cardCycle4 14s cubic-bezier(0.34, 1.56, 0.64, 1) infinite;
}

/* Card 1 Keyframes */
@keyframes cardCycle1 {
    0%, 100% {
        opacity: 0;
        transform: translateZ(-200px) translateY(100px) rotateX(-15deg) scale(0.8);
        z-index: 1;
    }
    2%, 20% {
        opacity: 1;
        transform: translateZ(0) translateY(0) rotateX(0deg) scale(1);
        box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
        z-index: 4;
    }
    25%, 98% {
        opacity: 0;
        transform: translateZ(-200px) translateX(-100px) rotateY(-25deg) rotateX(15deg) scale(0.7);
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
        z-index: 1;
    }
}

/* Card 2 Keyframes */
@keyframes cardCycle2 {
    0%, 24% {
        opacity: 0;
        transform: translateZ(-200px) translateY(100px) rotateX(-15deg) scale(0.8);
        z-index: 1;
    }
    27%, 45% {
        opacity: 1;
        transform: translateZ(0) translateY(0) rotateX(0deg) scale(1);
        box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
        z-index: 4;
    }
    50%, 100% {
        opacity: 0;
        transform: translateZ(-200px) translateX(-100px) rotateY(-25deg) rotateX(15deg) scale(0.7);
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
        z-index: 1;
    }
}

/* Card 3 Keyframes */
@keyframes cardCycle3 {
    0%, 49% {
        opacity: 0;
        transform: translateZ(-200px) translateY(100px) rotateX(-15deg) scale(0.8);
        z-index: 1;
    }
    52%, 70% {
        opacity: 1;
        transform: translateZ(0) translateY(0) rotateX(0deg) scale(1);
        box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
        z-index: 4;
    }
    75%, 100% {
        opacity: 0;
        transform: translateZ(-200px) translateX(-100px) rotateY(-25deg) rotateX(15deg) scale(0.7);
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
        z-index: 1;
    }
}

/* Card 4 Keyframes */
@keyframes cardCycle4 {
    0%, 74% {
        opacity: 0;
        transform: translateZ(-200px) translateY(100px) rotateX(-15deg) scale(0.8);
        z-index: 1;
    }
    77%, 95% {
        opacity: 1;
        transform: translateZ(0) translateY(0) rotateX(0deg) scale(1);
        box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
        z-index: 4;
    }
    98%, 100% {
        opacity: 0;
        transform: translateZ(-200px) translateX(-100px) rotateY(-25deg) rotateX(15deg) scale(0.7);
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
        z-index: 1;
    }
}

/* PAUSE ANIMATION ON HOVER - This is the key feature */
.competition-cards-stack:hover .competition-box {
    animation-play-state: paused !important;
}

/* Hover effect for individual cards */
.competition-cards-stack .competition-box:hover {
    transform: translateZ(20px) scale(1.02) !important;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.3) !important;
    transition: transform 0.3s ease, box-shadow 0.3s ease !important;
}

/* Add a subtle background glow effect */
.competition-cards-stack::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(101, 51, 145, 0.1) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
}

/* Responsive adjustments */
@media screen and (max-width: 768px) {
    .competition-cards-stack {
        width: 100%;
        max-width: 344px;
        margin: 0 auto;
    }
    
    .competition-cards-stack .competition-box {
        width: 100%;
        max-width: 344px;
    }
}

@media screen and (max-width: 576px) {
    .competition-cards-stack {
        height: 400px;
    }
    
    .competition-cards-stack .competition-box {
        left: 10px;
        bottom: 10px;
    }
    
    /* Adjust animation timing for mobile */
    .competition-cards-stack .card-1,
    .competition-cards-stack .card-2,
    .competition-cards-stack .card-3,
    .competition-cards-stack .card-4 {
        animation-duration: 16s;
    }
}
