/* Gallery Styles */
.custom-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
}

.custom-gallery img {
    cursor: pointer;
    width: 100%;
    height: auto;
    border-radius: 5px;
    transition: transform 0.2s;
}

.custom-gallery img:hover {
    transform: scale(1.05);
}

/* Modal Styles */
.custom-modal {
    display: none; /* Ensure it is hidden initially */
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);

    /* Flexbox for centering */
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0; /* Hidden by default */
    visibility: hidden; /* Hidden by default */
    transition: opacity 0.3s ease, visibility 0.3s ease; /* Smooth transitions */
}

.custom-modal.active {
    display: flex;
    opacity: 1;
    visibility: visible;
}

.custom-modal-content {
    max-width: 90%;
    max-height: 80%;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    border-radius: 5px;
}

.custom-modal-close {
    position: absolute;
    top: 10px;
    right: 25px;
    color: white;
    font-size: 35px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1001; /* Ensure it's above the modal content */
}

.custom-modal-close:hover,
.custom-modal-close:focus {
    color: #bbb;
    text-decoration: none;
    cursor: pointer;
}

#customCaption {
    text-align: center;
    color: white;
    margin-top: 15px;
}

/* Responsive Rules */
@media (min-width: 768px) {
    .custom-gallery {
        grid-template-columns: repeat(4, 1fr); /* 4 images per row on desktop */
    }
}

@media (max-width: 767px) {
    .custom-gallery {
        grid-template-columns: repeat(2, 1fr); /* 2 images per row on mobile */
    }
}
