.fba-slider {
    --fba-position: 50%;
    --fba-glow: #54d9ff;
    --fba-glow-size: 14px;
    --fba-divider-width: 2px;
    --fba-radius: 18px;
    position: relative;
    display: block;
    width: 100%;
    height: 520px;
    max-width: 100%;
    isolation: isolate;
    overflow: hidden;
    border-radius: var(--fba-radius);
    background: #0b1018;
    box-sizing: border-box;
}

.fba-slider,
.fba-slider * {
    box-sizing: border-box;
}

.fba-stage {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    cursor: ew-resize;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.fba-direction-vertical .fba-stage {
    cursor: ns-resize;
}

.fba-layer {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.fba-image {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
    object-position: center;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
}

.fba-layer-before {
    z-index: 1;
}

.fba-layer-after {
    z-index: 2;
    clip-path: inset(0 0 0 var(--fba-position));
    transition: clip-path 120ms ease-out;
}

.fba-direction-vertical .fba-layer-after {
    clip-path: inset(var(--fba-position) 0 0 0);
}

.fba-is-dragging ~ .fba-layer-after,
.fba-stage:active .fba-layer-after {
    transition: none;
}

.fba-overlay {
    position: absolute;
    z-index: 3;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 50% 50%, rgba(84, 217, 255, 0.08), transparent 42%),
        linear-gradient(120deg, rgba(3, 8, 18, 0.10), transparent 45%, rgba(3, 8, 18, 0.14));
    mix-blend-mode: screen;
}

.fba-divider {
    --fba-divider-width: 2px;
    position: absolute;
    z-index: 5;
    background: #fff;
    opacity: 0.9;
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.18), 0 0 20px var(--fba-glow);
    pointer-events: none;
    transition: left 120ms ease-out, top 120ms ease-out;
}

.fba-direction-horizontal .fba-divider {
    top: 0;
    bottom: 0;
    left: var(--fba-position);
    width: var(--fba-divider-width);
    transform: translateX(calc(var(--fba-divider-width) / -2));
}

.fba-direction-vertical .fba-divider {
    left: 0;
    right: 0;
    top: var(--fba-position);
    height: var(--fba-divider-width);
    width: auto;
    transform: translateY(calc(var(--fba-divider-width) / -2));
}

.fba-handle {
    --fba-glow-size: 14px;
    position: absolute;
    z-index: 6;
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    padding: 0;
    color: #fff;
    background: #101826;
    border: 1px solid #8ee8ff;
    border-radius: 50%;
    box-shadow:
        0 0 var(--fba-glow-size) var(--fba-glow),
        0 8px 24px rgba(0, 0, 0, 0.28),
        inset 0 0 0 1px rgba(255, 255, 255, 0.08);
    outline: none;
    cursor: grab;
    transform-origin: center;
    transition: transform 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

.fba-direction-horizontal .fba-handle {
    top: 50%;
    left: var(--fba-position);
    transform: translate(-50%, -50%);
}

.fba-direction-vertical .fba-handle {
    left: 50%;
    top: var(--fba-position);
    transform: translate(-50%, -50%);
}

.fba-handle:hover,
.fba-handle:focus-visible,
.fba-handle.fba-is-dragging {
    background: #162237;
    box-shadow:
        0 0 calc(var(--fba-glow-size) + 8px) var(--fba-glow),
        0 10px 28px rgba(0, 0, 0, 0.32),
        inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.fba-handle:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 4px;
}

.fba-handle.fba-is-dragging {
    cursor: grabbing;
}

.fba-handle-icon {
    display: block;
    width: 24px;
    height: 24px;
    color: currentColor;
}

.fba-direction-vertical .fba-handle-icon {
    transform: rotate(90deg);
}

.fba-label {
    position: absolute;
    z-index: 7;
    top: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    max-width: calc(50% - 36px);
    padding: 8px 12px;
    color: #fff;
    background: rgba(11, 18, 32, 0.80);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.20);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
}

.fba-label-before {
    left: 18px;
}

.fba-label-after {
    right: 18px;
}

.fba-label-position-middle .fba-label {
    top: 50%;
    transform: translateY(-50%);
}

.fba-label-position-bottom .fba-label {
    top: auto;
    bottom: 18px;
}


.fba-placeholder {
    display: grid;
    place-items: center;
    min-height: 220px;
    padding: 32px;
    color: #6b7280;
    border: 1px dashed #cbd5e1;
    border-radius: 14px;
    background: #f8fafc;
    text-align: center;
}

.fba-fit-cover .fba-image {
    object-fit: cover;
}

.fba-fit-contain .fba-image {
    object-fit: contain;
}

.fba-fit-fill .fba-image {
    object-fit: fill;
}

@media (max-width: 767px) {
    .fba-slider {
        height: 420px;
        --fba-radius: 14px;
    }

    .fba-handle {
        width: 48px;
        height: 48px;
    }

    .fba-label {
        top: 12px;
        max-width: calc(50% - 28px);
        padding: 7px 9px;
        font-size: 10px;
    }

    .fba-label-before {
        left: 12px;
    }

    .fba-label-after {
        right: 12px;
    }

    .fba-label-position-bottom .fba-label {
        top: auto;
        bottom: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .fba-slider *,
    .fba-slider *::before,
    .fba-slider *::after {
        transition: none !important;
        animation: none !important;
    }
}

/* Vertical mode: Before image is on the top half, After image on the bottom half. */
.fba-direction-vertical .fba-label,
.fba-direction-vertical.fba-label-position-middle .fba-label,
.fba-direction-vertical.fba-label-position-bottom .fba-label {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    max-width: calc(100% - 36px);
}

.fba-direction-vertical .fba-label-before {
    top: 18px;
    bottom: auto;
}

.fba-direction-vertical .fba-label-after {
    top: auto;
    bottom: 18px;
}

@media (max-width: 767px) {
    .fba-direction-vertical .fba-label-before { top: 12px; }
    .fba-direction-vertical .fba-label-after { bottom: 12px; }
}
