/**
 * Single-product Swiper gallery — main image + thumbnail strip + lightbox.
 *
 * Scoped under .safari-product-gallery so it doesn't leak into the homepage
 * Custom Slider Manager swiper or any other Swiper instance on the page.
 */

.safari-product-gallery {
    position: relative;
    width: 100%;
    margin-bottom: 1.5rem;
}

/* ── Main carousel ───────────────────────────────────────────────────── */

.safari-product-gallery__main {
    position: relative;
    width: 100%;
    background: #f3f4f6;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 12px;
}

.safari-product-gallery__slide {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 4 / 3;
    background: #f3f4f6;
}

.safari-product-gallery__link {
    display: block;
    width: 100%;
    height: 100%;
    cursor: zoom-in;
}

.safari-product-gallery__image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ── Nav arrows on main carousel ─────────────────────────────────────── */

.safari-product-gallery__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.9);
    color: #1f2937;
    border: none;
    border-radius: 9999px;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    transition: background .15s, transform .15s;
    font-size: 16px;
    line-height: 1;
}

.safari-product-gallery__nav:hover {
    background: #fff;
    transform: translateY(-50%) scale(1.05);
}

.safari-product-gallery__nav--prev { left: 12px; }
.safari-product-gallery__nav--next { right: 12px; }

.safari-product-gallery__nav.swiper-button-disabled {
    opacity: 0.35;
    cursor: default;
    pointer-events: none;
}

/* ── Thumbnail strip ─────────────────────────────────────────────────── */

.safari-product-gallery__thumbs {
    width: 100%;
    margin-top: 0;
}

.safari-product-gallery__thumb {
    width: 80px;
    aspect-ratio: 1;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color .15s, opacity .15s;
    opacity: 0.65;
    background: #f3f4f6;
}

.safari-product-gallery__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.safari-product-gallery__thumb:hover { opacity: 0.85; }

.safari-product-gallery__thumb.swiper-slide-thumb-active {
    border-color: #2271b1;
    opacity: 1;
}

@media (min-width: 640px) {
    .safari-product-gallery__thumb { width: 96px; }
}

/* ── Single-image variant: hide thumbs entirely (Q3-A) ──────────────── */

.safari-product-gallery.single-image .safari-product-gallery__main {
    margin-bottom: 0;
}

/* ── Fullscreen lightbox (custom — replaces PhotoSwipe) ──────────────── */

.safari-gallery-lightbox-open { overflow: hidden; }

.safari-gallery-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: safari-gallery-fade-in .15s ease-out;
}

@keyframes safari-gallery-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.safari-gallery-lightbox__stage {
    position: relative;
    max-width: min(96vw, 1400px);
    max-height: 92vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.safari-gallery-lightbox__image {
    max-width: 100%;
    max-height: 92vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5);
}

.safari-gallery-lightbox__counter {
    position: absolute;
    bottom: -36px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.85);
    font-size: 13px;
    letter-spacing: 0.04em;
}

.safari-gallery-lightbox__close,
.safari-gallery-lightbox__prev,
.safari-gallery-lightbox__next {
    position: fixed;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.18);
    cursor: pointer;
    border-radius: 9999px;
    transition: background .15s, transform .15s;
    z-index: 1;
}

.safari-gallery-lightbox__close {
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    font-size: 24px;
    line-height: 1;
}

.safari-gallery-lightbox__prev,
.safari-gallery-lightbox__next {
    top: 50%;
    transform: translateY(-50%);
    width: 52px;
    height: 52px;
    font-size: 22px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.safari-gallery-lightbox__prev { left: 20px; }
.safari-gallery-lightbox__next { right: 20px; }

.safari-gallery-lightbox__close:hover,
.safari-gallery-lightbox__prev:hover,
.safari-gallery-lightbox__next:hover {
    background: rgba(255, 255, 255, 0.22);
}

.safari-gallery-lightbox__prev:hover,
.safari-gallery-lightbox__next:hover {
    transform: translateY(-50%) scale(1.05);
}

@media (max-width: 640px) {
    .safari-gallery-lightbox__prev,
    .safari-gallery-lightbox__next {
        width: 44px;
        height: 44px;
    }
    .safari-gallery-lightbox__prev { left: 8px; }
    .safari-gallery-lightbox__next { right: 8px; }
    .safari-gallery-lightbox__close { top: 8px; right: 8px; width: 40px; height: 40px; }
}
