.custom-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 7px;
}

.custom-gallery *,
.custom-gallery *::before,
.custom-gallery *::after {
    box-sizing: border-box;
}

.custom-gallery a {
    display: block;
    text-decoration: none;
    line-height: 0;
    overflow: hidden;
}

.custom-gallery img {
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
}

/* Galeria 1: 3 zdjęcia obok siebie */
.gallery-1 {
    display: flex;
    flex-wrap: nowrap;
    gap: 5px;
}

.gallery-1 > a {
    width: calc((100% - 10px) / 3);
}

/* Galeria 2: 1 pionowe + 1 poziome */
.gallery-2 {
    display: flex;
    flex-wrap: nowrap;
    gap: 5px;
    align-items: stretch;
}

.gallery-2 > a:first-child {
    width: calc((100% - 5px) / 3);
    aspect-ratio: 3 / 4;
}

.gallery-2 > a:last-child {
    width: calc(((100% - 5px) / 3) * 2);
    aspect-ratio: 3 / 2;
}

.gallery-2 > a img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Galeria 3: 1 poziome + 1 pionowe */
.gallery-3 {
    display: flex;
    flex-wrap: nowrap;
    gap: 5px;
    align-items: stretch;
}

.gallery-3 > a:first-child {
    width: calc(((100% - 5px) / 3) * 2);
    aspect-ratio: 3 / 2;
}

.gallery-3 > a:last-child {
    width: calc((100% - 5px) / 3);
    aspect-ratio: 3 / 4;
}

.gallery-3 > a img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Galeria 4: 1 pionowe + 2 poziome jedno nad drugim */
.gallery-4 {
    display: flex;
    flex-wrap: nowrap;
    gap: 5px;
    align-items: stretch;
}

.gallery-4 > a.gallery-item-main {
    width: calc((100% - 5px) * 0.474);
    align-self: stretch;
}

.gallery-4 > a.gallery-item-main img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-4 .right {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: calc((100% - 5px) * 0.526);
    align-self: stretch;
}

.gallery-4 .right > a {
    flex: 1;
    min-height: 0;
}

.gallery-4 .right > a img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Galeria 5: 2 poziome jedno nad drugim + 1 pionowe z prawej */
.gallery-5 {
    display: flex;
    flex-wrap: nowrap;
    gap: 5px;
    align-items: stretch;
}

.gallery-5 .left {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: calc((100% - 5px) * 0.526);
    align-self: stretch;
}

.gallery-5 .left > a {
    flex: 1;
    min-height: 0;
}

.gallery-5 .left > a img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-5 > a.gallery-item-main {
    width: calc((100% - 5px) * 0.474);
    align-self: stretch;
}

.gallery-5 > a.gallery-item-main img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Galeria 6: 1 zdjęcie */
.gallery-6 {
    display: flex;
}

.gallery-6 > a {
    width: 100%;
}

/* Galeria 7: 2 zdjęcia poziome obok siebie */
.gallery-7 {
    display: flex;
    flex-wrap: nowrap;
    gap: 5px;
}

.gallery-7 > a {
    width: calc((100% - 5px) / 2);
}

.custom-gallery.gallery-7 {
    margin-bottom: 3px;
}

