.gallery {
    display: grid;
    gap: 20px;
    width: 100%;
    width: calc(100% - 40px);
    margin: 20px 20px;
}

.gallery.layout-1 {
    grid-template-columns: 1fr;
}

.gallery.layout-2 {
    grid-template-columns: 2fr 1fr;
}

.gallery.layout-3,
.gallery.layout-4,
.gallery.layout-5 {
    grid-template-columns: 2fr 1fr 1fr;
    grid-auto-rows: 220px;
}

.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 20px;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.gallery-item.large {
    grid-row: span 2;
}

.gallery-item.blur img {
    filter: blur(6px);
    transform: scale(1.05);
}

.gallery-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.gallery-overlay-content {
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
    font-weight: 600;
    font-size: 18px;
}

.gallery-overlay svg {
    width: 20px;
    height: 20px;
    stroke: white;
}

/* MOBILE VERSION BELOW */

@media (max-width: 768px) {

    .gallery-wrapper {
        position: relative;
    }

    .gallery {
        display: flex;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
        gap: 14px;
        width: calc(100% - 40px);
        padding: 0 20px 20px;
        margin: 20px 0;
    }

    .gallery::-webkit-scrollbar {
        display: none;
    }

    .gallery-item {
        flex: 0 0 78%;
		height: clamp(220px, 50vw, 300px);
        scroll-snap-align: center;
    }

    .gallery-item.large {
        grid-row: unset;
    }

    .gallery-item img {
        height: 100%;
    }

    /* Fade edges */
    .gallery-wrapper::before,
    .gallery-wrapper::after {
        content: "";
        position: absolute;
        top: 0;
        bottom: 40px;
        width: 40px;
        pointer-events: none;
        z-index: 2;
        height: 100%;
    }

    .gallery-wrapper::before {
        left: 0;
        background: linear-gradient(to right, white 0%, transparent 100%);
    }

    .gallery-wrapper::after {
        right: 0;
        background: linear-gradient(to left, white 0%, transparent 100%);
    }

    /* Pagination */
    .gallery-dots {
        display: flex;
        justify-content: center;
        gap: 8px;
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
    }

    .gallery-dot {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: #ccc;
        transition: transform .2s ease, background .2s ease;
    }

    .gallery-dot.active {
        background: #111;
        transform: scale(1.3);
    }
}