/* ================================================================
   Before After Image Stacker — Frontend Styles
   Sticky Stacking Cards  ·  Before/After Slider
   ================================================================ */

/* ── Wrapper ───────────────────────────────────────────────────── */
.rtxbas-stacker-wrap {
    position: relative;
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
}

/* ── Per-card wrapper: sticky + stacking
     Each wrapper is taller than the card itself so the page has
     enough scroll distance. Height is injected inline via PHP.     */
.rtxbas-card-wrapper {
    position: relative;          /* NOT sticky — wrapper is the scroll spacer */
    width: 100%;
    /* height injected inline: card_gap px per card */
}

/* ── The visual card sticks inside its wrapper ────────────────── */
.rtxbas-card {
    position: sticky;            /* sticks WITHIN the wrapper */
    width: 100%;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.13);
    overflow: hidden;
    will-change: transform;
    /* top is injected inline via PHP from settings */
}

.rtxbas-card-inner {
    position: relative;
    width: 100%;
}

/* ── Spacer after all cards ─────────────────────────────────────── */
.rtxbas-scroll-spacer {
    height: 60px;
}

/* ── Card title — overlay on image bottom ───────────────────────── */
.rtxbas-card-title {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 40px 22px 18px;
    background: linear-gradient(to top, rgba(0,0,0,0.68) 0%, rgba(0,0,0,0) 100%);
    pointer-events: none;
    z-index: 5;
    border-radius: 0 0 18px 18px;
}

.rtxbas-card-title h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.01em;
    text-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

/* ── Before/After Slider ────────────────────────────────────────── */
.rtxbas-slider {
    position: relative;
    width: 100%;
    height: 420px;
    overflow: hidden;
    cursor: col-resize;
    border-radius: 18px;
    user-select: none;
    -webkit-user-select: none;
}

/* Images use <img> tags now for correct aspect ratio — no zoom/crop */
.rtxbas-before,
.rtxbas-after {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.rtxbas-before img,
.rtxbas-after img {
    width: 100%;
    height: 100%;
    object-fit: contain;         /* no zoom / no crop */
    object-position: center;
    display: block;
    background: #0e0e0e;         /* letterbox bg colour */
    pointer-events: none;
    -webkit-user-drag: none;
    user-select: none;
}

/* After image sits on top, clipped from the LEFT — reveals right side as handle moves right */
.rtxbas-after {
    clip-path: inset(0 0 0 50%);
}

/* ── Labels ─────────────────────────────────────────────────────── */
.rtxbas-label {
    position: absolute;
    top: 14px;
    background: rgba(0,0,0,0.55);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 20px;
    backdrop-filter: blur(4px);
    pointer-events: none;
}

.rtxbas-label-before { left: 14px; top: 14px; }
.rtxbas-label-after  { right: 14px; top: 14px; }

/* ── Drag handle ─────────────────────────────────────────────────── */
.rtxbas-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 44px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 10;
}

.rtxbas-handle-line {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    background: rgba(255,255,255,0.85);
    box-shadow: 0 0 6px rgba(0,0,0,0.35);
}

.rtxbas-handle-knob {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 16px rgba(0,0,0,0.22);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    flex-shrink: 0;
    color: #6c47ff;
    transition: transform .15s ease;
}

.rtxbas-handle-knob svg {
    width: 18px;
    height: 18px;
}

.rtxbas-slider:active .rtxbas-handle-knob {
    transform: scale(1.15);
}

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .rtxbas-slider {
        height: 260px;
    }

    .rtxbas-card {
        border-radius: 12px;
    }

    .rtxbas-slider {
        border-radius: 12px;
    }

    .rtxbas-card-title {
        padding: 30px 16px 14px;
        border-radius: 0 0 12px 12px;
    }

    .rtxbas-card-title h3 {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .rtxbas-slider {
        height: 210px;
    }

    .rtxbas-handle-knob {
        width: 32px;
        height: 32px;
    }

    .rtxbas-handle-knob svg {
        width: 14px;
        height: 14px;
    }
}

.rtxbas-empty {
    text-align: center;
    padding: 40px;
    color: #999;
}
