/* Galeria do produto + lightbox */

.gallery .main-image {
    position: relative;
    width: 100%;
    border: 0;
    padding: 0;
    background: var(--surface, #f5f7f9);
    cursor: zoom-in;
    border-radius: 10px;
    overflow: hidden;
    color: inherit;
    font: inherit;
    box-shadow: none;
}

.gallery .main-image img {
    width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform .25s ease;
}

.gallery .main-image:hover img {
    transform: scale(1.015);
}

.gallery-zoom-hint {
    position: absolute;
    right: 0.75rem;
    bottom: 0.75rem;
    background: rgba(26, 31, 36, 0.7);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    pointer-events: none;
    opacity: 0.92;
}

.gallery .thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.7rem;
}

.gallery .thumb {
    width: 70px;
    height: 70px;
    padding: 0;
    border: 1px solid var(--line, #d7dee3);
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    overflow: hidden;
    color: inherit;
    box-shadow: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}

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

.gallery .thumb:hover {
    border-color: color-mix(in srgb, var(--primary, #0086ff) 55%, #d7dee3);
}

.gallery .thumb.is-active {
    border-color: var(--primary, #0086ff);
    box-shadow: 0 0 0 1px var(--primary, #0086ff);
    cursor: default;
}

/* —— Lightbox —— */
body.lightbox-open {
    overflow: hidden;
}

.product-lightbox[hidden] {
    display: none !important;
}

.product-lightbox {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(1rem, 3vw, 2rem);
}

.product-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 32, 0.72);
    backdrop-filter: blur(2px);
    cursor: zoom-out;
}

.product-lightbox-shell {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.85rem;
    width: min(720px, 100%);
    max-height: calc(100vh - 2rem);
    animation: productLightboxIn .18s ease-out;
}

@keyframes productLightboxIn {
    from { opacity: 0; transform: translateY(8px) scale(0.985); }
    to { opacity: 1; transform: none; }
}

.product-lightbox-frame {
    position: relative;
    width: 100%;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.28);
    overflow: hidden;
}

.product-lightbox-figure {
    margin: 0;
    display: grid;
    place-items: center;
    min-height: min(52vh, 420px);
    max-height: min(68vh, 640px);
    padding: clamp(1.25rem, 4vw, 2.5rem);
    background: linear-gradient(180deg, #fafbfc 0%, #fff 40%);
}

.product-lightbox-figure img {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: min(58vh, 560px);
    object-fit: contain;
}

.product-lightbox-close,
.product-lightbox-nav {
    position: absolute;
    z-index: 2;
    border: 0;
    margin: 0;
    padding: 0;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.96);
    color: #1a1f24 !important;
    font: inherit;
    font-size: 1.45rem;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    display: grid;
    place-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.14);
    transition: background .15s ease, transform .15s ease, box-shadow .15s ease;
}

.product-lightbox-close:hover,
.product-lightbox-nav:hover {
    background: #fff;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
    transform: scale(1.04);
}

.product-lightbox-close:focus-visible,
.product-lightbox-nav:focus-visible,
.product-lightbox-thumb:focus-visible {
    outline: 2px solid var(--primary, #0086ff);
    outline-offset: 2px;
}

.product-lightbox-close {
    top: 0.7rem;
    right: 0.7rem;
    font-size: 1.55rem;
}

.product-lightbox-nav.is-prev {
    left: 0.7rem;
    top: 50%;
    transform: translateY(-50%);
}

.product-lightbox-nav.is-next {
    right: 0.7rem;
    top: 50%;
    transform: translateY(-50%);
}

.product-lightbox-nav.is-prev:hover,
.product-lightbox-nav.is-next:hover {
    transform: translateY(-50%) scale(1.04);
}

.product-lightbox-meta {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
}

.product-lightbox-counter {
    margin: 0;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.product-lightbox-thumbs {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.4rem;
    max-width: 100%;
}

.product-lightbox-thumb {
    width: 48px;
    height: 48px;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.92);
    overflow: hidden;
    cursor: pointer;
    opacity: 0.72;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
    transition: opacity .15s ease, border-color .15s ease, transform .15s ease;
}

.product-lightbox-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.product-lightbox-thumb:hover {
    opacity: 1;
}

.product-lightbox-thumb.is-active {
    opacity: 1;
    border-color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.9), 0 2px 8px rgba(0, 0, 0, 0.25);
}

@media (max-width: 640px) {
    .product-lightbox {
        padding: 0.75rem;
        align-items: flex-end;
    }

    .product-lightbox-shell {
        width: 100%;
        max-height: calc(100vh - 1rem);
    }

    .product-lightbox-frame {
        border-radius: 12px 12px 10px 10px;
    }

    .product-lightbox-figure {
        min-height: 42vh;
        max-height: 58vh;
        padding: 1.5rem 1rem 1.25rem;
    }

    .product-lightbox-figure img {
        max-height: 48vh;
    }

    .product-lightbox-close {
        top: 0.55rem;
        right: 0.55rem;
        width: 36px;
        height: 36px;
    }

    .product-lightbox-nav {
        width: 36px;
        height: 36px;
        font-size: 1.3rem;
    }

    .product-lightbox-nav.is-prev {
        left: 0.45rem;
    }

    .product-lightbox-nav.is-next {
        right: 0.45rem;
    }

    .product-lightbox-thumb {
        width: 42px;
        height: 42px;
    }
}
