.brandtastic-before-after {
    --brandtastic-before-after-position: 50%;
    position: relative;
    width: 100%;
    overflow: hidden;
    isolation: isolate;
    direction: ltr;
}

.brandtastic-before-after .brandtastic-before-after__image {
    display: block;
    width: 100%;
    max-width: none;
    height: auto;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.brandtastic-before-after__labels,
.brandtastic-before-after__divider {
    display: none;
}

.brandtastic-before-after.is-ready {
    user-select: none;
    touch-action: pan-y;
}

.brandtastic-before-after.is-ready .brandtastic-before-after__before {
    position: relative;
    z-index: 1;
    clip-path: inset(0 calc(100% - var(--brandtastic-before-after-position)) 0 0);
}

.brandtastic-before-after.is-ready .brandtastic-before-after__after {
    position: absolute;
    inset: 0;
    height: 100%;
    object-fit: cover;
}

.brandtastic-before-after.is-ready .brandtastic-before-after__divider {
    display: block;
    position: absolute;
    z-index: 3;
    top: 0;
    bottom: 0;
    left: var(--brandtastic-before-after-position);
    width: 3px;
    background: #fff;
    transform: translateX(-50%);
    box-shadow: 0 0 12px rgb(0 0 0 / 30%);
    pointer-events: none;
}

.brandtastic-before-after__handle {
    position: absolute;
    box-sizing: border-box;
    top: 50%;
    left: 50%;
    width: 44px;
    height: 44px;
    border: 3px solid #fff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 12px rgb(0 0 0 / 30%);
}

.brandtastic-before-after__handle::before,
.brandtastic-before-after__handle::after {
    content: '';
    position: absolute;
    top: 50%;
    border: 6px solid transparent;
    transform: translateY(-50%);
}

.brandtastic-before-after__handle::before {
    right: 50%;
    margin-right: 3px;
    border-right-color: #fff;
}

.brandtastic-before-after__handle::after {
    left: 50%;
    margin-left: 3px;
    border-left-color: #fff;
}

.brandtastic-before-after.is-ready .brandtastic-before-after__range {
    display: block;
    position: absolute;
    z-index: 4;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    opacity: 0;
    cursor: ew-resize;
    touch-action: pan-y;
    direction: ltr;
}

.brandtastic-before-after.is-ready .brandtastic-before-after__labels {
    display: flex;
    position: absolute;
    z-index: 2;
    inset: 0;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    background: rgb(0 0 0 / 35%);
    opacity: 0;
    transition: opacity .2s;
    pointer-events: none;
}

.brandtastic-before-after__labels span {
    padding: 10px 16px;
    border-radius: 2px;
    background: rgb(255 255 255 / 20%);
    color: #fff;
    font: 13px/1.4 sans-serif;
    letter-spacing: .1em;
}

.brandtastic-before-after:hover .brandtastic-before-after__labels,
.brandtastic-before-after:focus-within .brandtastic-before-after__labels {
    opacity: 1;
}

.brandtastic-before-after:focus-within .brandtastic-before-after__handle {
    outline: 3px solid #171717;
    outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
    .brandtastic-before-after__labels { transition: none; }
}
