/*
 * Project gallery: a gallery block with the class "project-gallery" becomes one large square picture,
 * up to three square thumbnails and arrows (script.js builds it after the block and hides the block
 * once it is built).
 */

.project-gallery {
    position: relative;
    width: 100%;
}

.project-gallery.is-gallery-ready {
    display: none;
}

.project-gallery-ui {
    width: 100%;
    color: var(--mcg-color-text-on-dark);
}

/* The large picture */
.project-gallery-ui__main {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
}

.project-gallery-ui__main-image {
    display: block;
    width: 100%;
    height: 100%;
    margin: 0;
    object-fit: cover;
}

/* Thumbnails */
.project-gallery-ui__thumbs-viewport {
    width: 100%;
    margin-top: 40px;
    overflow: hidden;
}

.project-gallery-ui__thumbs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 40px;
    width: 100%;
}

.project-gallery-ui__thumb {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    cursor: pointer;
}

.project-gallery-ui__thumb-image {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    margin: 0;
    opacity: 0.72;
    transition: opacity 0.2s ease;
}

.project-gallery-ui__thumb:hover .project-gallery-ui__thumb-image,
.project-gallery-ui__thumb:focus-visible .project-gallery-ui__thumb-image,
.project-gallery-ui__thumb.is-active .project-gallery-ui__thumb-image {
    opacity: 1;
}

.project-gallery-ui__thumb:focus-visible {
    outline: 2px solid var(--mcg-color-text-on-dark);
    outline-offset: 4px;
}

/* The arrows */
.project-gallery-ui__nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 40px;
    margin-top: 90px;
}

.project-gallery-ui__arrow {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    margin: 0;
    padding: 0;
    border: 3px solid var(--mcg-color-text-on-dark);
    border-radius: 50%;
    background: transparent;
    color: var(--mcg-color-text-on-dark);
    cursor: pointer;
    transition:
        background-color 0.2s ease,
        color 0.2s ease;
}

.project-gallery-ui__arrow:hover,
.project-gallery-ui__arrow:focus-visible {
    background: var(--mcg-color-surface);
    color: var(--mcg-color-primary);
}

.project-gallery-ui__arrow:focus-visible {
    outline: 2px solid var(--mcg-color-text-on-dark);
    outline-offset: 4px;
}

.project-gallery-ui__arrow::before {
    content: "";
    width: 17px;
    height: 17px;
    border-top: 3px solid currentColor;
    border-right: 3px solid currentColor;
}

.project-gallery-ui__arrow--prev::before {
    transform: rotate(-135deg);
    margin-left: 7px;
}

.project-gallery-ui__arrow--next::before {
    transform: rotate(45deg);
    margin-right: 7px;
}

.project-gallery-ui.has-one-image .project-gallery-ui__thumbs-viewport,
.project-gallery-ui.has-one-image .project-gallery-ui__nav {
    display: none;
}

@container (max-width: 1024px) {
    .project-gallery-ui__thumbs-viewport {
        margin-top: 30px;
    }

    .project-gallery-ui__thumbs {
        gap: 24px;
    }

    .project-gallery-ui__nav {
        gap: 30px;
        margin-top: 60px;
    }

    .project-gallery-ui__arrow {
        width: 62px;
        height: 62px;
        border-width: 2px;
    }

    .project-gallery-ui__arrow::before {
        width: 14px;
        height: 14px;
        border-top-width: 2px;
        border-right-width: 2px;
    }
}

@container (max-width: 768px) {
    .project-gallery-ui__thumbs-viewport {
        margin-top: 24px;
    }

    .project-gallery-ui__thumbs {
        gap: 12px;
    }

    .project-gallery-ui__nav {
        gap: 24px;
        margin-top: 40px;
    }

    .project-gallery-ui__arrow {
        width: 52px;
        height: 52px;
    }

    .project-gallery-ui__arrow::before {
        width: 12px;
        height: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .project-gallery-ui__thumb-image,
    .project-gallery-ui__arrow {
        transition: none;
    }
}
