/* SLU Toolkit — Before / After Slider */

.slu-ba-wrap {
    position: relative;
    display: block;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    font-size: 0;
    line-height: 0;
}

.slu-ba-wrap.is-h { cursor: col-resize; }
.slu-ba-wrap.is-v { cursor: row-resize; }

/* ── Images ─────────────────────────────────────────────────────────────
   Both images are stacked via CSS grid in the same cell.
   No absolute positioning needed — both occupy the same space.
   The before image uses clip-path to reveal only its portion.
   ──────────────────────────────────────────────────────────────────────── */

.slu-ba-images {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
    width: 100%;
}

.slu-ba-after,
.slu-ba-before {
    grid-area: 1 / 1;
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    line-height: 0;
    font-size: 0;
}

.slu-ba-after  { z-index: 1; }
.slu-ba-before { z-index: 2; }

.slu-ba-after img,
.slu-ba-before img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    pointer-events: none;
    user-select: none;
    vertical-align: bottom;
}

/* After image: in normal flow, sets the container height */
.slu-ba-after img {
    height: auto;
    object-fit: unset;
}

/* Horizontal clip — reveal left portion */
.slu-ba-wrap.is-h .slu-ba-before {
    clip-path: inset(0 50% 0 0);
}

/* Vertical clip — reveal top portion */
.slu-ba-wrap.is-v .slu-ba-before {
    clip-path: inset(0 0 50% 0);
}

/* ── Divider ─────────────────────────────────────────────────────────── */

.slu-ba-divider {
    position: absolute;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
}

.slu-ba-wrap.is-h .slu-ba-divider {
    top: 0;
    bottom: 0;
    left: 50%;
    width: 2px;
    transform: translateX(-50%);
    flex-direction: column;
    cursor: col-resize;
}

.slu-ba-wrap.is-v .slu-ba-divider {
    left: 0;
    right: 0;
    top: 50%;
    height: 2px;
    transform: translateY(-50%);
    flex-direction: row;
    cursor: row-resize;
}

/* ── Handle ──────────────────────────────────────────────────────────── */

.slu-ba-handle {
    position: relative;
    z-index: 5;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #fff;
    border: none;
    cursor: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
    box-shadow: 0 2px 12px rgba(0,0,0,.25);
    transition: transform .15s, box-shadow .15s;
}

.slu-ba-handle:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 20px rgba(0,0,0,.35);
}

.slu-ba-handle svg {
    width: 55%;
    height: 55%;
    fill: #111;
    pointer-events: none;
}

/* ── Labels ──────────────────────────────────────────────────────────── */

.slu-ba-label {
    position: absolute;
    z-index: 3;
    font-size: 13px;
    font-weight: 600;
    background: rgba(0,0,0,.5);
    color: #fff;
    padding: 6px 12px;
    border-radius: 4px;
    pointer-events: none;
    white-space: nowrap;
    line-height: 1;
}

/* Horizontal */
.slu-ba-wrap.is-h .slu-ba-label-before { left: 12px; }
.slu-ba-wrap.is-h .slu-ba-label-after  { right: 12px; }
.slu-ba-wrap.is-h .slu-ba-label-pos-top    { top: 12px; }
.slu-ba-wrap.is-h .slu-ba-label-pos-bottom { bottom: 12px; }
.slu-ba-wrap.is-h .slu-ba-label-pos-middle { top: 50%; transform: translateY(-50%); }

/* Vertical */
.slu-ba-wrap.is-v .slu-ba-label-before { top: 12px;    left: 12px; }
.slu-ba-wrap.is-v .slu-ba-label-after  { bottom: 12px; left: 12px; }
.slu-ba-wrap.is-v .slu-ba-label-pos-top    { left: 12px; }
.slu-ba-wrap.is-v .slu-ba-label-pos-bottom { right: 12px; }
.slu-ba-wrap.is-v .slu-ba-label-pos-middle { left: 50%; transform: translateX(-50%); }

/* ── Transitions ─────────────────────────────────────────────────────── */

.slu-ba-before  { transition: clip-path 0s; }
.slu-ba-divider { transition: left 0s, top 0s; }

.slu-ba-wrap.is-animating .slu-ba-before  { transition: clip-path .35s ease; }
.slu-ba-wrap.is-animating .slu-ba-divider { transition: left .35s ease, top .35s ease; }
