.gallery {
    position: relative;
    z-index: 1;
}

.gallery::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: 0;
    background-image: url("../assets/images/background.jpg");
    background-repeat: repeat;
    background-position: center;
    background-size: contain;
    opacity: 10%;
}

.gallery-section {
    padding: 48px;
}

.preview-close-btn {
    width: 40px;
    height: 40px;
    background: #00000059;
    border: 2px solid #ffffff;
    top: -25px;
    right: -50px;
}

.preview-close-btn > span {
    display: inline-block;
    width: 12px;
    height: 12px;
    background-image: url("../assets/icons/close.svg");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

.gallery-item img {
    cursor: pointer;
    transition: box-shadow 0.3s ease;
}

.gallery-item img:hover {
    outline: 8px solid #ffffff;
    outline-offset: -8px;
    box-shadow: -2px 0 2px rgba(0, 0, 0, 0.1), 2px 0 2px rgba(0, 0, 0, 0.2),
        0 4px 3px rgba(0, 0, 0, 0.2);
}

.gallery-grid {
    margin-top: 20px;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    grid-auto-rows: 80px;
    gap: 24px;
    grid-auto-flow: dense;
}

.gallery-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.item1,
.item11,
.item15,
.item22,
.item25,
.item32,
.item36 {
    grid-column: span 2;
    grid-row: span 3;
}

.item3 {
    grid-row: span 2;
}

.item4 {
    grid-column: span 3;
    grid-row: span 3;
}

.item5,
.item7,
.item8,
.item16,
.item14,
.item17,
.item18,
.item24,
.item27,
.item28,
.item31,
.item37 {
    grid-row: span 2;
}

.item12,
.item35 {
    grid-row: span 3;
}

.item13,
.item30 {
    grid-column: span 2;
}

.item23,
.item33 {
    grid-column: span 2;
    grid-row: span 2;
}

.item3 img {
    object-position: 80% 50%;
}

.item11 img {
    object-position: 100% 50%;
}

.item13 img {
    object-position: 50% 80%;
}

.item39 img {
    object-position: 50% 30%;
}

@media (max-width: 991px) {
    .gallery-grid {
        grid-template-columns: repeat(6, 1fr);
    }

    .item36 {
        grid-row: span 2;
    }
}

@media (max-width: 767px) {
    .gallery-section {
        padding: 0;
    }

    .gallery-grid {
        margin-top: 48px;
    }

    .preview-close-btn {
        top: -50px;
        right: 0;
    }

    .gallery-grid {
        gap: 16px;
    }
}

@media (max-width: 576px) {
    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
