.gallery-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); /* Auto-fit columns */
    gap: 10px; /* Spacing between images */
    padding: 10px;
    max-width: 1200px;
    margin: 0 auto;
}

.gallery-img {
    width: 100%;
    height: 350px; /* Set a fixed height for a consistent grid */
    object-fit: contain;
    cursor: pointer;
    transition: transform 0.2s ease-in-out;
}

.gallery-img.rotated {
    rotate: 90deg;
    scale: 0.8;
}

/* Optional: Add a hover effect */
.gallery-img:hover {
    transform: scale(1.03);
}

/* The Modal (background) */
.modal {
    display: none; /* Hidden by default */
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto; /* Enables scrolling for the whole modal if content is too large */
    background-color: rgba(0,0,0,0.9);
    padding: 5vh 0; /* Add padding at the top and bottom to prevent it from touching the screen edges */
    box-sizing: border-box; /* Include padding in the element's total width and height */
    text-align: center; /* Center the modal content horizontally */
}

/* Modal content (zoomed image) */
.modal-content {
    margin: auto;
    display: block;
    max-height: 90vh; /* Limits the height of the image to 90% of the viewport height */
    object-fit: contain; /* Ensures the whole image is visible without cropping */
    max-width: 100%;
    vertical-align: middle;
    /*  height: 100%; */
}

.modal-content.rotated {
    rotate: 90deg;
}

@media (max-width: 768px) {
    .download-btn {
        /* right: 10px !important;*/
    }

    .close-btn {
        top: 0 !important;
        right: 10px !important;
    }
}

    /* The download  Button */
    .download-btn {
        top: 35px;
        right: -15px;
        position: absolute;
        transform: translate(-50%, -50%);
        z-index: 10;
        display: flex;
        justify-content: center;
        align-items: center;
        width: 50px;
        height: 50px;
        background-color: rgba(0, 0, 0, 0.6);
        border-radius: 30%;
        transition: background-color 0.3s ease;
        font-size: 42px;
        color: white;
        cursor: pointer;
        line-height: 42px;
        border: 2px solid white;
    }

    /* The Close Button */
    .close-btn {
        position: fixed; /* Use fixed positioning for the close button */
        top: 15px;
        right: 35px;
        color: #f1f1f1;
        font-size: 40px;
        font-weight: bold;
        transition: 0.3s;
        cursor: pointer;
    }

    .gallery-actions {
        text-align: center;
        margin: 20px 0;
    }

    #downloadAllBtn {
        padding: 10px 20px;
        font-size: 16px;
        cursor: pointer;
        background-color: #007bff;
        color: white;
        border: none;
        border-radius: 5px;
        transition: background-color 0.2s;
    }

    #downloadAllBtn:hover {
        background-color: #0056b3;
    }

    .imageModalNav {
        font-size: 100px;
        color: white;
        cursor: pointer;
        display: inline-block; /* Allows setting width/height and padding */
        border: 1px solid black; /* Adds a border */
        border-radius: 5px; /* Rounds the corners */
        padding: 2px 5px; /* Adds space around the character */
        background-color: rgba(100,100,100,0.5); /* Optional background color */
        text-align: center; /* Centers the character horizontally */
        transform: translate(0, -50%); /* center vertically */
    }

    .noselect {
        -webkit-touch-callout: none; /* iOS Safari */
        -webkit-user-select: none; /* Safari */
        -khtml-user-select: none; /* Konqueror HTML */
        -moz-user-select: none; /* Old versions of Firefox */
        -ms-user-select: none; /* Internet Explorer/Edge */
        user-select: none; /* Non-prefixed version, currently
                                  supported by Chrome, Edge, Opera and Firefox */
    }

    .imageModalNav div {
        position: relative;
        top: calc(((-1em / 1.5) + 1ex) / 2);
    }

    div#imageModalLeft {
        position: fixed;
        left: 20px;
        top: 50%;
    }

    div#imageModalRight {
        position: fixed;
        right: 20px;
        top: 50%;
    }

    #setname {
        margin-left: 20px;
    }

    .description {
        margin: 20px;
        max-width: 600px;
    }

    .description p,
    .description li {
        line-height: 140%;
    }

    #imageModalIndex {
        position: fixed;
        top: 10px;
        left: 50%;
        color: white;
        transform: translate(-50%, 0);
    }

    body:has(div#imageModal.open) {
        overflow: hidden;
    }

    #imageModal.open {
        overflow: auto;
    }

    .description li:not(:first-child) {
        margin-top: 5px;
    }

    .gallery-container a {
        text-align: center;
    }