/* Product image viewer (machine pages + spare parts page) */

/* small "Show" button on the top-left corner of every product photo */
.machine-products-section .coursecard-single .grids5-info,
.products-results .coursecard-single .grids5-info {
    position: relative;
}

.img-show-btn {
    position: absolute;
    top: 8px;
    left: 8px;
    right: auto;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 26px;
    padding: 0 10px;
    border: 1px solid rgba(255, 255, 255, .38);
    border-radius: 999px;
    background: rgba(15, 18, 24, .62);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    color: #fff;
    font-family: inherit;
    font-size: .72rem;
    font-weight: 600;
    line-height: 1;
    letter-spacing: .02em;
    cursor: pointer;
    transition: background .2s ease, border-color .2s ease, transform .2s ease;
}

.img-show-btn i {
    font-size: .68rem;
}

.img-show-btn:hover,
.img-show-btn:focus-visible {
    background: var(--site-red, #e53935);
    border-color: var(--site-red, #e53935);
    outline: none;
    transform: translateY(-1px);
}

@media (max-width: 767px) {
    .img-show-btn {
        top: 6px;
        left: 6px;
        height: 24px;
        padding: 0 8px;
        font-size: .68rem;
    }
}

html.img-lb-open {
    overflow: hidden !important;
}

.img-lightbox {
    position: fixed;
    inset: 0;
    z-index: 200000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 56px 64px;
    background: rgba(8, 10, 14, .9);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    opacity: 0;
    visibility: hidden;
    transition: opacity .22s ease, visibility .22s ease;
    overscroll-behavior: contain;
    touch-action: pan-y;
}

.img-lightbox[hidden] {
    display: none;
}

.img-lightbox.is-open {
    opacity: 1;
    visibility: visible;
}

.img-lb-stage {
    margin: 0;
    max-width: 100%;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    transform: scale(.96);
    transition: transform .22s ease;
}

.img-lightbox.is-open .img-lb-stage {
    transform: none;
}

.img-lb-img {
    display: block;
    width: auto;
    height: auto;
    max-width: min(90vw, 1100px);
    max-height: calc(100vh - 170px);
    max-height: calc(100dvh - 170px);
    min-width: min(60vw, 420px);
    object-fit: contain;
    border-radius: 12px;
    background: #1b1f26;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .55);
    -webkit-user-select: none;
    user-select: none;
}

.img-lb-caption {
    max-width: min(90vw, 760px);
    color: #fff;
    text-align: center;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.img-lb-caption small {
    display: block;
    margin-top: 2px;
    font-weight: 500;
    font-size: .85rem;
    opacity: .75;
}

.img-lb-btn {
    position: absolute;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, .28);
    border-radius: 50%;
    background: rgba(255, 255, 255, .12);
    color: #fff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: background .2s ease, transform .2s ease;
}

.img-lb-btn:hover,
.img-lb-btn:focus-visible {
    background: var(--site-red, #e53935);
    border-color: var(--site-red, #e53935);
    outline: none;
}

.img-lb-close {
    top: 14px;
    right: 14px;
    font-size: 26px;
}

.img-lb-prev {
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
}

.img-lb-next {
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
}

.img-lb-btn[hidden] {
    display: none;
}

@media (max-width: 767px) {
    .img-lightbox {
        padding: 64px 12px 28px;
    }

    .img-lb-img {
        max-width: 94vw;
        max-height: calc(100vh - 190px);
        max-height: calc(100dvh - 190px);
        min-width: min(80vw, 320px);
        border-radius: 10px;
    }

    .img-lb-caption {
        font-size: .92rem;
    }

    .img-lb-btn {
        width: 40px;
        height: 40px;
        font-size: 17px;
    }

    .img-lb-close {
        top: 12px;
        right: 12px;
    }

    /* arrows sit under the photo on phones so they never cover it */
    .img-lb-prev,
    .img-lb-next {
        top: auto;
        bottom: 18px;
        transform: none;
    }

    .img-lb-prev {
        left: calc(50% - 52px);
    }

    .img-lb-next {
        right: calc(50% - 52px);
    }

    .img-lightbox.has-nav {
        padding-bottom: 76px;
    }
}

@media (prefers-reduced-motion: reduce) {

    .img-lightbox,
    .img-lb-stage {
        transition: none;
    }
}
