/* ============================================================
   FLEXTRIBE — Product Detail Page (PDP)
   Loads on: is_singular('product') only
   ============================================================ */

/* Gallery sticky on desktop */
.fxt-gallery {
    position: sticky; top: 8rem;
    align-self: start;
    display: flex; flex-direction: column; gap: 1rem;
    min-width: 0;
}
@media (max-width: 1024px) { .fxt-gallery { position: relative; top: auto; } }

/* Main image — square 1:1 */
.fxt-main-img-wrap {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: 1.5rem;
    background: var(--flex-offwhite);
    border: 1px solid rgba(209,211,212,0.3);
    overflow: hidden;
    box-shadow: var(--flex-shadow-card);
}
.fxt-main-img-wrap img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: opacity 0.25s ease;
}
.fxt-main-img-wrap img.fxt-img-fade {
    opacity: 0;
}

/* ── LIGHTBOX ─────────────────────────────────────────────── */
#fxt-lightbox {
    display: none;
    position: fixed; inset: 0; z-index: 99999;
    align-items: center; justify-content: center;
}
#fxt-lightbox.active { display: flex; }

#fxt-lb-overlay {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.92);
    backdrop-filter: blur(8px);
}
#fxt-lb-inner {
    position: relative; z-index: 1;
    max-width: 90vw; max-height: 90vh;
    display: flex; align-items: center; justify-content: center;
}
#fxt-lb-img {
    max-width: 90vw; max-height: 88vh;
    object-fit: contain;
    border-radius: 1rem;
    transition: opacity 0.18s ease;
    display: block;
    cursor: default;
    touch-action: pinch-zoom;
}
#fxt-lb-close {
    position: fixed; top: 1.25rem; right: 1.25rem;
    width: 2.75rem; height: 2.75rem;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 50%; color: #fff;
    font-size: 1.125rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s;
}
#fxt-lb-close:hover { background: rgba(255,255,255,0.25); }

#fxt-lb-prev, #fxt-lb-next {
    position: fixed; top: 50%; transform: translateY(-50%);
    width: 3rem; height: 3rem;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 50%; color: #fff;
    font-size: 1.75rem; line-height: 1; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s;
}
#fxt-lb-prev:hover, #fxt-lb-next:hover { background: rgba(255,255,255,0.25); }
#fxt-lb-prev { left: 1.25rem; }
#fxt-lb-next { right: 1.25rem; }

#fxt-lb-counter {
    position: fixed; bottom: 1.5rem; left: 50%;
    transform: translateX(-50%);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem; letter-spacing: 0.15em;
    color: rgba(255,255,255,0.5);
}

/* Prev / Next arrow buttons */
.fxt-gal-arrow {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 2.5rem; height: 2.5rem;
    background: rgba(255,255,255,0.97);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(209,211,212,0.7);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: #414042;
    box-shadow: 0 4px 14px rgba(0,0,0,0.18);
    transition: background 0.2s, box-shadow 0.2s;
    z-index: 2;
}
.fxt-gal-arrow:hover {
    background: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.fxt-gal-prev { left: 0.75rem; }
.fxt-gal-next { right: 0.75rem; }

/* Dot indicators */
.fxt-gal-dots {
    position: absolute; bottom: 0.875rem; left: 50%;
    transform: translateX(-50%);
    display: flex; gap: 0.375rem; z-index: 2;
}
.fxt-gal-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: rgba(255,255,255,0.5);
    transition: background 0.2s, transform 0.2s;
}
.fxt-gal-dot.active {
    background: #fff;
    transform: scale(1.3);
}

/* Thumbnails — horizontal row below main image */
.fxt-thumbs {
    display: flex; flex-direction: row;
    gap: 0.625rem;
    overflow-x: auto;
    padding-bottom: 0.25rem;
    scrollbar-width: none;
}
.fxt-thumbs::-webkit-scrollbar { display: none; }

.fxt-thumb {
    flex-shrink: 0;
    width: 4.5rem; height: 4.5rem;
    border-radius: 0.75rem;
    border: 2px solid transparent;
    overflow: hidden;
    background: var(--flex-offwhite);
    cursor: pointer;
    padding: 0;
    transition: border-color 0.2s;
}
.fxt-thumb img {
    width: 100%; height: 100%;
    object-fit: cover;
    opacity: 0.65;
    transition: opacity 0.2s;
}
.fxt-thumb:hover img,
.fxt-thumb.active img { opacity: 1; }
.fxt-thumb.active { border-color: #414042; }

/* ── AMAZON-STYLE MAGNIFIER ZOOM ───────────────────────────── */
#fxt-zoom-lens {
    display: none;
    position: fixed;
    z-index: 1000;
    border: 2px solid #F3924D;
    border-radius: 6px;
    background: rgba(243,146,77,0.08);
    pointer-events: none;
    box-shadow: 0 0 0 1px rgba(243,146,77,0.3);
}
#fxt-zoom-panel {
    display: none;
    position: fixed;
    z-index: 1001;
    border-radius: 1rem;
    border: 1px solid rgba(209,211,212,0.5);
    box-shadow: 0 8px 40px rgba(0,0,0,0.18);
    background-color: var(--flex-offwhite);
    background-repeat: no-repeat;
    overflow: hidden;
    pointer-events: none;
}
@media (max-width: 1099px) {
    #fxt-zoom-lens,
    #fxt-zoom-panel { display: none !important; }
}
