/* --- Extracurricular Card Stack Animation --- */
.card-stack-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 500px;
    perspective: 1000px;
    /* Adds depth */
    margin-top: 2rem;
}

.card-stack {
    position: relative;
    width: 300px;
    height: 400px;
    transition: 0.5s ease-in-out;
    cursor: pointer;
}

.card {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-color);
    border: 2px solid var(--main-color);
    border-radius: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 20px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    transition: transform 0.6s cubic-bezier(0.25, 1, 0.5, 1), box-shadow 0.6s ease;
    /* Weightless floating feel */
    overflow: hidden;
    /* Mask the sliding image */

    /* Glassmorphism hint */
    backdrop-filter: blur(10px);
    background: rgba(15, 23, 42, 0.95);
    z-index: 1;
    /* Default lower */
}


.card-bg-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
    /* Behind content */
    transform: translateY(100%);
    /* Starts hidden at bottom */
    transition: transform 0.5s ease-in-out;
    opacity: 0.8;
    /* Increased visibility */
    /* mask-image removed for better visibility */
}

/* On hover of specific card, slide up ITS image */
.card:hover .card-bg-img {
    transform: translateY(0);
}

.card-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    position: relative;
    z-index: 2;
    /* Keep above image */
}

.card-content h3 {
    font-size: 2.5rem;
    color: var(--main-color);
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.card-content p {
    font-size: 1.6rem;
    color: var(--text-color);
    line-height: 1.6;
}

/* Initial Stack State */
.card-center {
    z-index: 3;
    transform: rotate(0deg);
}

.card-left {
    z-index: 2;
    transform: rotate(-3deg) translateX(-5px);
    /* Slight peek */
}

.card-right {
    z-index: 1;
    transform: rotate(3deg) translateX(5px);
    /* Slight peek */
}

/* Hover Interaction */
.card-stack:hover .card-left {
    transform: translateX(-105%) rotate(-10deg) scale(0.95);
    box-shadow: -10px 10px 30px rgba(0, 0, 0, 0.6);
    z-index: 4;
    /* Ensure visible */
}

.card-stack:hover .card-right {
    transform: translateX(105%) rotate(10deg) scale(0.95);
    box-shadow: 10px 10px 30px rgba(0, 0, 0, 0.6);
    z-index: 4;
}

.card-stack:hover .card-center {
    transform: translateY(-20px) scale(1.05);
    /* Floating up */
    box-shadow: 0 0 15px var(--main-color);
    /* Reduced glow amount */
    z-index: 5;
}

/* Responsiveness */
@media (max-width: 768px) {
    .card-stack-container {
        height: auto;
        padding: 4rem 0;
    }

    .card-stack {
        width: 100%;
        height: auto;
        display: flex;
        flex-direction: column;
        gap: 2rem;
        align-items: center;
    }

    .card {
        position: relative;
        width: 80%;
        height: 300px;
        /* Reset transform important to override hover on mobile */
        transform: none !important;
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    }

    /* Reset transforms for mobile */
    .card-left,
    .card-right,
    .card-center {
        transform: none !important;
    }

    .card-stack:hover .card-left,
    .card-stack:hover .card-right,
    .card-stack:hover .card-center {
        transform: none !important;
    }
}

@media (max-width: 450px) {
    .card {
        width: 95%;
        height: 280px;
    }

    .card-content h3 {
        font-size: 2rem;
    }

    .card-content p {
        font-size: 1.4rem;
    }
}