/* Flipbox Gallery Container */
#flipbox-gallery {
    margin-top: 20px;
    display: flex;
    flex-direction: column; /* Arrange h2 and flipbox container vertically */
    justify-content: center;
    align-items: center;
    padding: 80px 0;
    background-color: black;
}

#flipbox-gallery h2 {
    text-align: center;
    font-size: 34px;
    margin-bottom: 30px;
    color: white;
    text-transform: uppercase;
    border-bottom: 2px solid red; /* Accent underline */
    padding-bottom: 10px;
    width: 100%; /* Ensure it spans full width */
    max-width: 800px; /* Limit max width for better alignment */
}
/* Flipbox Container */

.flipbox-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    width: 100%;
    max-width: 1500px;
}

/* Flipbox Styling */
.flipbox {
    perspective: 1000px;
    position: relative;
}

.flipbox-inner {
    position: relative;
    width: 100%;
    height: 300px; /* Consistent height for all flipboxes */
    transform-style: preserve-3d;
    transition: transform 0.6s ease-in-out;
    margin: 0; /* Ensure no unexpected movement from margins */
    display: flex;
    justify-content: center;
    align-items: center;
}

.flipbox-front,
.flipbox-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    overflow: hidden;
    padding: 5px;
}

.flipbox-front {
    background: #5193f7;
    transform: rotateY(0deg);
}

.flipbox-back {
    background: rgb(192, 25, 25);
    transform: rotateY(180deg);
}

/* Ensure images fit properly */
.flipbox-front img,
.flipbox-back img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
}

/* Hover Effect for Desktop */
@media (min-width: 769px) {
    .flipbox:hover .flipbox-inner {
        transform: rotateY(180deg);
    }
}

/* Click Effect for Mobile */
@media (max-width: 768px) {
    #flipbox-gallery h2{
        padding-top: 60px;
    }
    .flipbox-inner.active {
        transform: rotateY(180deg);
    }
    #flipbox-gallery {
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 0px;
        margin: 0;
        background-color: black;
    }
    .flipbox-container {
        display: flex; /* Change grid to flex for better centering */
        flex-direction: column; /* Stack flipboxes vertically */
        align-items: center; /* Center align the flipboxes */
        gap: 20px; /* Maintain spacing between flipboxes */
        padding: 0px; /* Add padding to prevent overflow */
        width: 100%; /* Ensure flipboxes fit the screen width */
        max-width: 350px; /* Limit the width for uniformity */
    }

    .flipbox {
        width: 100%; /* Ensure flipboxes fit the screen width */
        max-width: 350px; /* Limit the width for uniformity */
        margin: 0 auto; /* Center the flipbox horizontally */
    }
}
