/* --- Befor After
-------------------------------------------------------- */
.before-after-section .wp-block-columns {
    gap: 0;
}

.before-after-section .wp-block-column.is-vertically-aligned-center.wp-block-text-content {
    padding: var(--wp--custom--spacing--section-block-bottom) var(--wp--custom--spacing--outer);
    max-width: 100%;
    box-sizing: border-box;
}

.wp-before-after-block {
    position: relative;
    width: 100%;
    overflow: hidden;
    height: 320px;
}

.wp-before-after-block .wp-before-image,
.wp-before-after-block .wp-after-image {
    position: absolute;
    inset: 0;
    margin: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;

    &::before {
        position: absolute;
        content: 'BEFORE';
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        /* Flip vertically */
        z-index: 9;
        font-weight: bold;
        opacity: 0;
    }
}

.wp-before-after-block .wp-after-image::before {
    content: 'AFTER';

}


.wp-before-after-block .wp-before-image img,
.wp-before-after-block .wp-after-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.wp-before-after-block .wp-after-image {
    z-index: 2;
}

.wp-before-after-block .ba-slider {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 4px;
    background: #fff;
    z-index: 99;
    cursor: ew-resize;
    margin: 0;
    transform: translateX(-2px);
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.3);
}


.wp-before-after-block,
.wp-before-after-block * {
    user-select: none;
    -webkit-user-drag: none;
    /* Optional: for images */
}

.ba-slider::before,
.ba-slider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 32px;
    height: 32px;
    background-size: contain;
    background-repeat: no-repeat;
    transform: translateY(-50%);
    opacity: 0.8;
}

.ba-slider::before {
    left: -30px;
    z-index: 9;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 640 640'%3E%3Cpath d='M164.7 331.3C158.5 325.1 158.5 314.9 164.7 308.7L372.7 100.7C378.9 94.5 389.1 94.5 395.3 100.7C401.5 106.9 401.5 117.1 395.3 123.3L198.6 320L395.3 516.7C401.5 522.9 401.5 533.1 395.3 539.3C389.1 545.5 378.9 545.5 372.7 539.3L164.7 331.3z' fill='black'/%3E%3C/svg%3E");


}

.ba-slider::after {
    right: -30px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 640 640'%3E%3Cpath d='M475.3 308.7C481.5 314.9 481.5 325.1 475.3 331.3L267.3 539.3C261.1 545.5 250.9 545.5 244.7 539.3C238.5 533.1 238.5 522.9 244.7 516.7L441.4 320L244.7 123.3C238.5 117.1 238.5 106.9 244.7 100.7C250.9 94.5 261.1 94.5 267.3 100.7L475.3 308.7z' fill='black'/%3E%3C/svg%3E");




}

span.ba-slider-handle {
    width: 90px;
    height: 90px;
    display: block;
    background: #fff;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.block-editor-block-list__block.wp-before-after-block {
    display: flex;
}

.block-editor-block-list__block.wp-before-after-block>* {
    flex: 1;
}

.block-editor-block-list__block.wp-before-after-block .wp-before-image,
.block-editor-block-list__block.wp-before-after-block .wp-after-image {
    position: relative;
}

.block-editor-block-list__block.wp-before-after-block .wp-before-image::before,
.block-editor-block-list__block.wp-before-after-block .wp-after-image::before {
    opacity: 1;
}