/* ==========================================================================
   Vitalum Before / After — image comparison slider.
   Scoped under .vba-wrap so it renders identically regardless of theme.
   ========================================================================== */

.vba-wrap {
    position: relative;
    display: block;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    overflow: hidden;
    border-radius: 8px;
    background: #000;
    line-height: 0;
    user-select: none;
    -webkit-user-select: none;
    touch-action: pan-y;
    outline: none;
    /* --vba-split is set inline (0–100). Fallback: 50. */
}
.vba-wrap.vba-vertical { touch-action: pan-x; }

.vba-wrap * { box-sizing: border-box; }

.vba-img {
    display: block;
    max-width: 100%;
    pointer-events: none;
    -webkit-user-drag: none;
}

/* ---------- AUTO HEIGHT MODE ----------
 * No fixed height on the wrap. Before image sizes itself naturally and drives
 * the container height. After image absolutely covers the same box. */
.vba-wrap:not(.vba-fixed) .vba-img-before {
    position: relative;
    width: 100%;
    height: auto;
    z-index: 1;
}
.vba-wrap:not(.vba-fixed) .vba-img-after {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    z-index: 2;
}

/* ---------- FIXED HEIGHT MODE ----------
 * The wrap gets a fixed height from the widget. BOTH images fill it via
 * object-fit so `cover / contain / fill` behave correctly. */
.vba-wrap.vba-fixed .vba-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    /* object-fit + object-position are set by the widget's selectors so
     * the Elementor controls (Cover / Contain / Fill + Focal Point) win. */
}
.vba-wrap.vba-fixed .vba-img-before { z-index: 1; }
.vba-wrap.vba-fixed .vba-img-after  { z-index: 2; }

/* Clip mask on the after image — same math for both modes. */
.vba-img-after         { clip-path: inset(0 0 0 var(--vba-split, 50%)); }
.vba-vertical .vba-img-after { clip-path: inset(var(--vba-split, 50%) 0 0 0); }

/* Dark overlay on hover — mirrors twentytwenty's dim-on-focus effect */
.vba-wrap::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.45);
    opacity: 0;
    z-index: 5;
    pointer-events: none;
    transition: opacity .3s ease;
}
.vba-wrap:hover::before,
.vba-wrap:focus::before,
.vba-wrap.vba-dragging::before { opacity: 1; }

/* Vertical line at the split point */
.vba-line {
    position: absolute;
    top: 0;
    bottom: 0;
    left: var(--vba-split, 50%);
    width: 2px;
    background: #ffffff;
    transform: translateX(-1px);
    z-index: 6;
    pointer-events: none;
}
.vba-vertical .vba-line {
    top: var(--vba-split, 50%);
    left: 0;
    right: 0;
    bottom: auto;
    width: auto;
    height: 2px;
    transform: translateY(-1px);
}

/* Draggable handle */
.vba-handle {
    position: absolute;
    top: 50%;
    left: var(--vba-split, 50%);
    width: 40px;
    height: 40px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    background: transparent;
    transform: translate(-50%, -50%);
    z-index: 7;
    cursor: ew-resize;
    box-shadow: 0 2px 12px rgba(0,0,0,0.35);
    transition: transform .15s ease, box-shadow .2s ease;
}
.vba-vertical .vba-handle {
    top: var(--vba-split, 50%);
    left: 50%;
    cursor: ns-resize;
}
.vba-handle:hover,
.vba-wrap:focus .vba-handle {
    box-shadow: 0 0 0 6px rgba(255,255,255,0.15), 0 2px 12px rgba(0,0,0,0.35);
}
.vba-handle:active { transform: translate(-50%, -50%) scale(1.05); }

/* Arrows inside the handle */
.vba-handle::before,
.vba-handle::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 8px;
    height: 8px;
    background: transparent;
    border-left: 2px solid #ffffff;
    border-bottom: 2px solid #ffffff;
    transform: translateY(-50%) rotate(45deg);
    transition: border-color .2s ease;
}
.vba-handle::before {
    left: 8px;
}
.vba-handle::after {
    right: 8px;
    transform: translateY(-50%) rotate(225deg);
}
.vba-vertical .vba-handle::before {
    top: 8px;
    left: 50%;
    transform: translate(-50%, 0) rotate(135deg);
}
.vba-vertical .vba-handle::after {
    top: auto;
    bottom: 8px;
    left: 50%;
    right: auto;
    transform: translate(-50%, 0) rotate(-45deg);
}

/* Corner labels — hidden by default, appear on hover (and while dragging). */
.vba-label {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    padding: 6px 14px;
    font-family: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: #ffffff;
    background: rgba(0,0,0,0.55);
    border-radius: 4px;
    line-height: 1;
    z-index: 6;
    pointer-events: none;
    white-space: nowrap;
    opacity: 0;
    transition: opacity .3s ease;
}
.vba-wrap:hover .vba-label,
.vba-wrap:focus .vba-label,
.vba-wrap.vba-dragging .vba-label { opacity: 1; }

.vba-label-before { left: 16px; }
.vba-label-after  { right: 16px; }

.vba-vertical .vba-label { top: auto; transform: translateX(-50%); }
.vba-vertical .vba-label-before { top: 16px;    left: 50%; }
.vba-vertical .vba-label-after  { bottom: 16px; top: auto; left: 50%; }
