/*
 * BSS Floor Visualizer - neutral functional base.
 *
 * This file only does the work that the widget cannot function without: stacking the two
 * images, clipping the "after" layer, and positioning the handle / labels / caption.
 * All brand styling (colours, type, radii, chip shapes) belongs in the active theme, so a
 * theme can restyle the gallery without this file changing. See the NopFurniture skin in
 * Themes/NopFurniture/Content/scss/plugins/_plugin-floor-visualizer.scss.
 */

.bss-fv {
    --fv-pos: 50%;
    display: block;
}

.bss-fv__data {
    display: none;
}

.bss-fv__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
}

/* No "view all" link to sit opposite the heading, so splitting the row would only push
   the title hard left. */
.bss-fv__head--center {
    display: block;
    text-align: center;
}

/* ---------- stage ---------- */

.bss-fv__stage {
    position: relative;
    overflow: hidden;
    width: 100%;
    /* Without an aspect-ratio the box would be zero-height until the first image decodes. */
    min-height: 160px;
    touch-action: pan-y;
    cursor: ew-resize;
    user-select: none;
    -webkit-user-select: none;
}

/* ---------- loading skeleton ----------
   The skeleton stands in for the WHOLE section, mirroring it block for block, so the two
   are never on screen at once: the real content is hidden while `--pending` is set and
   the script swaps them once the first image pair has decoded. */

.bss-fv__skeleton {
    display: none;
    flex-direction: column;
}

.bss-fv--pending > .bss-fv__skeleton {
    display: flex;
}

/* Hide the real content — not the JSON payload the script reads, and not the skeleton. */
.bss-fv--pending > .bss-fv__head,
.bss-fv--pending > .bss-fv__stage,
.bss-fv--pending > .cat-carousel-controls,
.bss-fv--pending > .bss-fv__swatches {
    display: none;
}

.bss-fv__sk-block {
    position: relative;
    display: block;
    overflow: hidden;
}

.bss-fv__sk-head {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.bss-fv__sk-head--center {
    align-items: center;
}

.bss-fv__sk-stage {
    width: 100%;
    /* Matches .bss-fv__stage so the swap cannot shift the page. */
    min-height: 160px;
}

.bss-fv__sk-controls {
    display: flex;
    align-items: center;
}

.bss-fv__sk-progress {
    flex: 1 1 auto;
}

.bss-fv__sk-nav {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
}

.bss-fv__sk-swatches {
    display: flex;
}

.bss-fv__img {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

.bss-fv__img--before {
    z-index: 1;
}

.bss-fv__img--after {
    z-index: 2;
    /* Logical inset so the reveal direction follows the document direction. */
    clip-path: inset(0 0 0 var(--fv-pos));
}

[dir="rtl"] .bss-fv__img--after {
    clip-path: inset(0 var(--fv-pos) 0 0);
}

/* No transition while dragging: the position updates every pointermove, and an
   easing curve there reads as lag rather than smoothness. */
.bss-fv__stage:not(.is-dragging) .bss-fv__img--after {
    transition: clip-path 0.12s linear;
}

.bss-fv__label {
    position: absolute;
    top: 12px;
    z-index: 3;
    pointer-events: none;
}

.bss-fv__label--before {
    inset-inline-start: 12px;
}

.bss-fv__label--after {
    inset-inline-end: 12px;
}

/* ---------- handle ---------- */

.bss-fv__handle {
    position: absolute;
    top: 0;
    bottom: 0;
    z-index: 4;
    /* Wider than the visible line so it is comfortable to grab on touch. */
    width: 44px;
    inset-inline-start: var(--fv-pos);
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: ew-resize;
}

[dir="rtl"] .bss-fv__handle {
    transform: translateX(50%);
}

.bss-fv__handle-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #fff;
}

.bss-fv__handle-grip {
    position: relative;
    display: block;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #fff;
}

/* ---------- caption card ---------- */

.bss-fv__caption {
    position: absolute;
    z-index: 3;
    inset-inline-start: 0;
    bottom: 0;
    max-width: min(340px, 70%);
    background: #fff;
}

.bss-fv__caption-link {
    display: inline-block;
}

/* ---------- scene chips ---------- */

.bss-fv__swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.bss-fv__swatch {
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    line-height: 0;
}

.bss-fv__swatch img {
    display: block;
    width: 56px;
    height: 56px;
    object-fit: cover;
}
