.square-gallery {
    --items: 3;
    border-radius: 1px;
    display: grid;
    gap: 5px;
    grid-auto-rows: minmax(200px, auto);
    grid-template-columns: repeat(4, 1fr);
    margin: 0 auto;
    overflow: hidden;
}

.gallery-item {
    background-color: #fff;
    background-position: 50%;
    background-repeat: no-repeat;
    background-size: cover; 
    cursor: pointer;
    display: flex;
    height: calc(var(--width) / var(--items) / 1.4);
    justify-content: center;
    opacity: .85;
    transition: all .2s ease-out;
    width: calc(var(--width) / var(--items));
}

.gallery-item:hover {
    opacity: 1;
}

.trip-image {
    aspect-ratio: 16/9;
    border-radius: 4px;
    box-shadow: 3px 4px 10px rgba(0,0,0,.3);
    height: auto;
    object-fit: cover; 
    width: 100%;
}

@media (min-width: 768px) {
    .square-gallery {
        --items: 4 !important;
    }
}

@media (min-width: 1200px) {
    .square-gallery {
        --items: 6 !important;
    }
}


/* ------- MODAL ------- */

#myImg {
    border-radius: 5px;
    cursor: pointer;
    transition: .3s;
}

#myImg:hover {
    opacity: .7;
}

.modal {
    background-color: rgba(0,0,0,.9);
    display: none;
    height: 100%;
    left: 0;
    overflow: auto;
    padding-top: 100px;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 9999;
}


.modal-content {
    align-items: center;
    background-color: transparent;
    display: flex;
    justify-content: center;

    max-width: 90vw !important;
    max-height: 90vh !important;

    overflow: hidden; 
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Zdjęcie w modalu */
.modal-content img {
    max-width: 90vw;
    max-height: 90vh;
    width: auto;
    height: auto;
    object-fit: contain !important;  /* CAŁE zdjęcie */
    border-radius: 4px;
}

#caption {
    color: #ccc;
    display: block;
    height: 150px;
    margin: auto;
    max-width: 700px;
    padding: 10px 0;
    text-align: center;
    width: 80%;
}

@keyframes zoom {
    0% { transform: scale(0); }
    100% { transform: scale(1); }
}

.close {
    color: #f1f1f1;
    right: 35px;
    top: 15px;
}

.close,
.left-gallery-switch,
.right-gallery-switch {
    font-size: 40px;
    font-weight: 700;
    position: absolute;
	cursor: pointer;
    transition: .3s;
}

.left-gallery-switch,
.right-gallery-switch {
    color: #ffffff73;
    cursor: pointer;
    top: 50%;
    transform: translateY(-50%);
    z-index: 9999;
}

.left-gallery-switch { left: 30px; }
.right-gallery-switch { right: 30px; }

.left-gallery-switch:hover,
.right-gallery-switch:hover,
.left-gallery-switch:focus,
.right-gallery-switch:focus {
    color: #fff;
}

.close:hover,
.close:focus {
    color: #bbb;
}

/* MOBILE */
@media only screen and (max-width: 700px) {

    .modal-content {
        max-width: 100vw !important;
        max-height: 100vh !important;
    }

    .modal-content img {
        max-width: 100vw;
        max-height: 100vh;
        width: auto;
        height: auto;
        object-fit: contain !important;
    }

    .square-gallery {
        --items: 3;
        border-radius: 3px;
        display: grid;
        gap: 5px;
        grid-auto-rows: minmax(200px, auto);
        grid-template-columns: repeat(1, 1fr);
        margin: 0 auto;
        overflow: hidden;
    }
}
