/**
 * WizAtom_ProductThumbnails — atom CSS
 *
 * Owns ALL styling for the thumbnail strip BEM tree:
 *   .wiz-thumbs                (wrapper)
 *   .wiz-thumbs__track         (scrollable container or grid)
 *   .wiz-thumbs__item          (individual thumbnail cell)
 *   .wiz-thumbs__item--active  (highlighted active state)
 *   .wiz-thumbs__img           (the <img> inside each cell)
 *   .wiz-thumbs__play-icon     (overlay on video thumbnails)
 *   .wiz-thumbs__nav           (prev / next chevrons)
 *   .wiz-thumbs__nav--prev / --next
 *
 * Hardcoded defaults are intentional — Elementor selectors override these via
 * specificity. See SKILL.md → Learning [2026-04-07] Change 1.
 */

.wiz-thumbs {
    position: relative;
    width: 100%;
    box-sizing: border-box;
}

/* ── Track ─────────────────────────────────────────── */
.wiz-thumbs__track {
    display: flex;
    gap: 8px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.wiz-thumbs__track::-webkit-scrollbar {
    display: none;
}

/* Carousel — horizontal */
.wiz-thumbs--carousel.wiz-thumbs--horizontal .wiz-thumbs__track {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
}

/* Carousel — vertical */
.wiz-thumbs--carousel.wiz-thumbs--vertical .wiz-thumbs__track {
    flex-direction: column;
    flex-wrap: nowrap;
    overflow-x: hidden;
    overflow-y: auto;
    scroll-behavior: smooth;
}

/* Grid mode — fixed columns set by the widget via selector override */
.wiz-thumbs--grid .wiz-thumbs__track {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    overflow: visible;
    width: 100%;
}

/* Grid items must stretch to column width and auto-size to a square. The
   widget's per-thumbnail size control becomes a max-width in grid mode so
   small column counts don't stretch tiny images to absurd sizes. */
.wiz-thumbs--grid .wiz-thumbs__item {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
}

/* ── Item ─────────────────────────────────────────── */
.wiz-thumbs__item {
    position: relative;
    flex: 0 0 auto;
    width: 80px;
    height: 80px;
    box-sizing: border-box;
    cursor: pointer;
    background-color: #ffffff;
    border: 1px solid #dddddd;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s ease;
    user-select: none;
}

.wiz-thumbs__item:hover {
    border-color: #a1a1a1;
}

.wiz-thumbs__item:focus-visible {
    outline: 2px solid var(--wiz-color-primary, #2563eb);
    outline-offset: 2px;
}

/* Active state — chained selector (`.wiz-thumbs__item.wiz-thumbs__item--active`)
   bumps specificity to (0,2,0) so it beats the regular border control's
   (0,1,0)-equivalent `.wiz-thumbs__item` selector inside Elementor's
   {{WRAPPER}} scope. Without the chain, when an implementer customises
   the regular border-color via the Elementor panel the cascade order
   makes their custom color override the active state — invisible
   selection on PDP. */
.wiz-thumbs__item.wiz-thumbs__item--active {
    border-color: #111111;
    border-width: 2px;
    border-style: solid;
}

/* ── Image ─────────────────────────────────────────── */
.wiz-thumbs__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: inherit;
}

/* ── Video play icon overlay ────────────────────────── */
.wiz-thumbs__play-icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    background-color: rgba(0, 0, 0, 0.35);
    border-radius: inherit;
    pointer-events: none;
}

.wiz-thumbs__play-icon svg {
    /* Center the play triangle visually — its bounding box is left-heavy. */
    transform: translateX(2px);
}

/* ── Chevron navigation ────────────────────────────── */
.wiz-thumbs__nav {
    position: absolute;
    z-index: 5;
    width: 36px;
    height: 36px;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.95);
    color: #111111;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.wiz-thumbs__nav:hover {
    background-color: #ffffff;
}

.wiz-thumbs__nav:active {
    transform: scale(0.95);
}

.wiz-thumbs--horizontal .wiz-thumbs__nav--prev {
    left: -18px;
    top: 50%;
    transform: translateY(-50%);
}
.wiz-thumbs--horizontal .wiz-thumbs__nav--prev:active {
    transform: translateY(-50%) scale(0.95);
}

.wiz-thumbs--horizontal .wiz-thumbs__nav--next {
    right: -18px;
    top: 50%;
    transform: translateY(-50%);
}
.wiz-thumbs--horizontal .wiz-thumbs__nav--next:active {
    transform: translateY(-50%) scale(0.95);
}

.wiz-thumbs--vertical .wiz-thumbs__nav--prev {
    top: -18px;
    left: 50%;
    transform: translateX(-50%) rotate(90deg);
}
.wiz-thumbs--vertical .wiz-thumbs__nav--prev:active {
    transform: translateX(-50%) rotate(90deg) scale(0.95);
}

.wiz-thumbs--vertical .wiz-thumbs__nav--next {
    bottom: -18px;
    left: 50%;
    transform: translateX(-50%) rotate(90deg);
}
.wiz-thumbs--vertical .wiz-thumbs__nav--next:active {
    transform: translateX(-50%) rotate(90deg) scale(0.95);
}

/* Hide chevrons on small viewports — they overlap content. */
@media (max-width: 600px) {
    .wiz-thumbs__nav {
        display: none !important;
    }
}

/* Hide the entire thumbnail strip on mobile in carousel mode — the main-image
   atom shows dot indicators below the preview instead, matching v1 behavior.
   The .wiz-thumbs--editor-preview escape ensures implementers can still see
   and style the strip inside the Elementor editor at any preview viewport. */
@media (max-width: 768px) {
    .wiz-thumbs--carousel:not(.wiz-thumbs--editor-preview) {
        display: none !important;
    }
}

/* ── Editor preview helpers ──
   Inside the Elementor editor, force chevrons + strip to remain visible at
   every preview width so the implementer can style the carousel without
   flipping breakpoints. */
.wiz-thumbs--editor-preview {
    display: block !important;
}
.wiz-thumbs--editor-preview .wiz-thumbs__nav {
    display: flex !important;
}

/* In editor preview, render a thin dashed outline so the implementer can see
   the carousel boundary even with no background — purely a design-time aid. */
.elementor-editor-active .wiz-thumbs--editor-preview {
    outline: 1px dashed rgba(99, 102, 241, 0.35);
    outline-offset: 4px;
}
