.gallery {
    position: relative;
}

.gallery-wrapper {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    padding: 4rem;

    @media only screen and (max-width: 1023px) {
        padding: 2rem;
    }
}

.gallery-wrapper .inner {
    display: flex;
    flex-direction: column;
    gap: 0.5rem
}

.gallery-wrapper .inner .title {
    color: var(--color-coconut-husk);
    text-transform: uppercase;
}

.gallery-wrapper .inner p {
    max-width: 40%;

    @media only screen and (max-width: 1023px) {
        max-width: 100%;
    }
}

.gallery-wrapper .show-all {
    display: flex;
    justify-content: center;
}

.gallery-mosaic {
    position: relative;
    display: grid;
    grid-template-columns: 50% 30% 20%;
    grid-template-rows: 1fr 1fr;
    gap: .5rem;
    align-items: stretch;
    height: clamp(420px, 70vh, 820px);

    @media only screen and (max-width: 1023px) {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto;
        height: auto;
    }
}

.gallery-mosaic > a {
    position: relative;
    display: block;
    overflow: hidden;
    cursor: default;
    text-decoration: none;
    border-radius: 0;
    transition: border-radius 0.6s ease;
}

.gallery-mosaic > a:hover {
    border-radius: 1.5rem;
}

.gallery-mosaic > a img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .45s ease;
}

.gallery-mosaic > a:hover img,
.gallery-mosaic > a:focus-visible img {
    transform: scale(1.06);
}

.gallery-mosaic > a.item-main {
    grid-column: 1;
    grid-row: 1 / span 2;
    height: 100%;
    border-radius: 0;
    transition: border-radius 0.6s ease;

    @media only screen and (max-width: 1023px) {
        grid-column: 1 / span 2;
        grid-row: 1;
        height: auto;
        aspect-ratio: 16 / 10;
    }
}

.gallery-mosaic > a.item-main:hover {
    border-radius: 1.5rem;
}

.gallery-mosaic > a:nth-of-type(2) {
    grid-column: 2;
    grid-row: 1;

    @media only screen and (max-width: 1023px) {
        grid-column: 1;
        grid-row: 2;
        aspect-ratio: 4 / 3;
    }
}

.gallery-mosaic > a:nth-of-type(3) {
    grid-column: 2;
    grid-row: 2;

    @media only screen and (max-width: 1023px) {
        grid-column: 2;
        grid-row: 2;
        aspect-ratio: 4 / 3;
    }
}

.gallery-mosaic > a:nth-of-type(4) {
    grid-column: 3;
    grid-row: 1;

    @media only screen and (max-width: 1023px) {
        grid-column: 1;
        grid-row: 3;
        aspect-ratio: 4 / 3;
    }
}

.gallery-mosaic > a:nth-of-type(5) {
    grid-column: 3;
    grid-row: 2;

    @media only screen and (max-width: 1023px) {
        grid-column: 2;
        grid-row: 3;
        aspect-ratio: 4 / 3;
    }
}

.sm-glb-thumbs {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: .5rem;
    padding: .5rem .75rem;
    background: linear-gradient(to top, rgba(0, 0, 0, .55), rgba(0, 0, 0, 0));
    z-index: 2147483647;
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.sm-glb-thumbs.ready {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.sm-glb-viewport {
    overflow: hidden;
    width: 100%;
}

.sm-glb-track {
    display: flex;
    justify-content: center;
    gap: .75rem;
    padding: .25rem .25rem .35rem;
}

.sm-glb-thumb {
    flex: 0 0 auto;
    width: 132px;
    height: 80px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    outline: none;
    opacity: .75;

    @media only screen and (max-width: 640px) {
        width: 100px;
        height: 64px;
    }
}

.sm-glb-thumb.active {
    opacity: 1;
}

.sm-glb-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0;
    opacity: .9;
    transition: transform .3s ease, opacity .2s ease, border-radius 0.3s ease;
}

.sm-glb-thumb:hover img,
.sm-glb-thumb:focus-visible img {
    transform: scale(1.02);
    opacity: 1;
    border-radius: 1rem;
}

.sm-glb-thumb.active img {
    opacity: 1;
    outline: 2px solid #fff;
    outline-offset: -2px;
}

.sm-glb-nav {
    width: 36px;
    height: 36px;
    padding-bottom: 2px;
    border: 0;
    background: rgba(0, 0, 0, .35);
    color: #fff;
    cursor: pointer;
}

.sm-glb-nav:hover {
    background: rgba(0, 0, 0, .55);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }

    .gallery-mosaic > a,
    .gallery-mosaic > a img,
    .sm-glb-thumbs,
    .sm-glb-thumb img {
        transition: none !important;
        transform: none !important;
    }
}