/* Reusable product lightbox/gallery for tegels.html */

html.gallery-modal-open,
body.gallery-modal-open {
    overflow: hidden;
    overscroll-behavior: none;
}

.gallery-image-trigger {
    display: block;
    cursor: zoom-in;
    transition: transform 0.16s ease, filter 0.16s ease;
}

.gallery-image-trigger:hover {
    transform: translateY(-1px) scale(1.01);
    filter: saturate(1.04);
}

.gallery-image-trigger:focus-visible {
    outline: 4px solid rgba(79, 70, 229, 0.35);
    outline-offset: 4px;
    border-radius: 14px;
}

.tile .gallery-image-trigger,
.to-be-released .gallery-image-trigger {
    width: 100%;
}

.to-be-released .gallery-image-trigger {
    border-radius: 0;
}

.shop-gallery {
    position: fixed;
    inset: 0;
    z-index: 2200;
    --gallery-left: 50vw;
    --gallery-top: 18vh;
    --gallery-width: 260px;
    --gallery-height: 260px;
    --gallery-nav-top: 50vh;
    --gallery-prev-left: calc(50vw - 110px);
    --gallery-next-left: calc(50vw + 110px);
    --gallery-close-left: calc(50vw + 88px);
    --gallery-close-top: 18vh;
    --gallery-dots-left: 50vw;
    --gallery-dots-top: calc(var(--gallery-top) + var(--gallery-height) + 12px);
}

.shop-gallery[hidden] {
    display: none !important;
}

.shop-gallery__backdrop {
    position: absolute;
    inset: 0;
    background: transparent;
}

.shop-gallery__dialog {
    position: relative;
    width: 100vw;
    height: 100dvh;
    outline: none;
}

.shop-gallery__header {
    position: fixed;
    top: var(--gallery-close-top);
    left: var(--gallery-close-left);
    z-index: 8;
    pointer-events: none;
}

.shop-gallery__meta {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.shop-gallery__title,
.shop-gallery__counter {
    margin: 0;
}

.shop-gallery__close,
.shop-gallery__nav,
.shop-gallery__dot {
    appearance: none;
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    padding: 0;
}

.shop-gallery__close {
    pointer-events: auto;
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: rgba(15, 23, 42, 0.96);
    font-size: 1.85rem;
    font-weight: 900;
    line-height: 1;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 999px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.28);
    transition: transform 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.shop-gallery__close:hover {
    transform: scale(1.06);
    background: #ffffff;
    color: #000000;
}

.shop-gallery__close:focus-visible,
.shop-gallery__nav:focus-visible,
.shop-gallery__dot:focus-visible {
    outline: 3px solid rgba(250, 204, 21, 0.95);
    outline-offset: 2px;
    border-radius: 999px;
}

.shop-gallery__stage {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.shop-gallery__viewport {
    position: relative;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.shop-gallery__figure {
    position: fixed;
    left: var(--gallery-left);
    top: var(--gallery-top);
    width: var(--gallery-width);
    height: var(--gallery-height);
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.shop-gallery__image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: transparent;
    border-radius: 12px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.26);
    pointer-events: auto;
    -webkit-user-drag: none;
    user-select: none;
}

.shop-gallery.is-open .shop-gallery__image {
    animation: gallery-pop 180ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.shop-gallery.has-multiple .shop-gallery__image {
    cursor: pointer;
}

.shop-gallery__caption {
    position: fixed;
    left: var(--gallery-dots-left);
    top: calc(var(--gallery-dots-top) + 20px);
    transform: translateX(-50%);
    margin: 0;
    color: rgba(15, 23, 42, 0.92);
    font-size: 0.82rem;
    line-height: 1.3;
    text-align: center;
    max-width: min(78vw, 420px);
    background: rgba(255, 255, 255, 0.94);
    border-radius: 999px;
    padding: 6px 12px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.16);
    pointer-events: auto;
}

.shop-gallery__nav {
    position: fixed;
    top: var(--gallery-nav-top);
    z-index: 7;
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transform: translateY(-50%);
    color: #ffffff;
    font-size: clamp(2rem, 3vw, 2.8rem);
    font-weight: 900;
    line-height: 1;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.98), 0 0 20px rgba(0, 0, 0, 0.72);
    transition: transform 0.15s ease, opacity 0.15s ease;
    pointer-events: auto;
    background: transparent;
    border-radius: 999px;
    -webkit-tap-highlight-color: transparent;
}

.shop-gallery__nav span {
    display: block;
    transform: translateY(-1px);
}

.shop-gallery__nav:hover {
    transform: translateY(-50%) scale(1.08);
}

.shop-gallery__nav--prev {
    left: var(--gallery-prev-left);
}

.shop-gallery__nav--next {
    left: var(--gallery-next-left);
}

.shop-gallery__nav[hidden] {
    display: none !important;
}

.shop-gallery__dots {
    position: fixed;
    left: var(--gallery-dots-left);
    top: var(--gallery-dots-top);
    transform: translateX(-50%);
    z-index: 6;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0;
}

.shop-gallery__dots[hidden] {
    display: none;
}

.shop-gallery__dot {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(15, 23, 42, 0.2);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.18);
    transition: transform 0.15s ease, background-color 0.15s ease;
}

.shop-gallery__dot.is-active {
    background: #111827;
    transform: scale(1.18);
}

@keyframes gallery-pop {
    from {
        opacity: 0;
        transform: scale(0.975);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@media (max-width: 768px) {
    .shop-gallery {
        --gallery-width: 220px;
        --gallery-height: 220px;
    }

    .shop-gallery__close {
        width: 40px;
        height: 40px;
        font-size: 1.65rem;
    }

    .shop-gallery__image {
        border-radius: 10px;
    }

    .shop-gallery__nav {
        width: 38px;
        height: 38px;
        font-size: 2.25rem;
    }

    .shop-gallery__caption {
        max-width: min(84vw, 360px);
        font-size: 0.78rem;
    }
}

@media (max-width: 480px) {
    .shop-gallery {
        --gallery-width: 190px;
        --gallery-height: 190px;
    }

    .shop-gallery__close {
        width: 38px;
        height: 38px;
        font-size: 1.58rem;
    }

    .shop-gallery__image {
        border-radius: 8px;
        box-shadow: 0 14px 32px rgba(15, 23, 42, 0.24);
    }

    .shop-gallery__nav {
        width: 34px;
        height: 34px;
        font-size: 2rem;
    }

    .shop-gallery__dot {
        width: 8px;
        height: 8px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .gallery-image-trigger,
    .shop-gallery__close,
    .shop-gallery__nav,
    .shop-gallery__dot {
        transition: none;
    }

    .shop-gallery.is-open .shop-gallery__image {
        animation: none;
    }
}
