/* ================================================
   imagemochi — Before/After Comparison Slider
   Reusable component for hero demo + tool results
   ================================================ */

.ba-slider {
    position: relative;
    width: 100%;
    max-width: 560px;
    aspect-ratio: 16 / 10;
    border-radius: var(--radius);
    overflow: hidden;
    cursor: col-resize;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    box-shadow: 0 8px 40px rgba(0,0,0,0.10), 0 0 0 1px var(--border);
    background: var(--surface-2);
}

/* Before (underneath) */
.ba-before,
.ba-after {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.ba-before img,
.ba-after img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

/* After (clipped) — sits on top */
.ba-after {
    clip-path: inset(0 0 0 50%);
    transition: clip-path 0ms;
}

/* Labels — positioned on .ba-slider root (NOT inside clipped panels) */
.ba-label {
    position: absolute;
    bottom: 12px;
    padding: 4px 12px;
    font-family: var(--sans);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    border-radius: 20px;
    pointer-events: none;
    z-index: 6;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.ba-label-before {
    left: 12px;
    background: rgba(0,0,0,0.5);
    color: rgba(255,255,255,0.9);
}

.ba-label-after {
    right: 12px;
    background: rgba(255,126,179,0.85);
    color: #fff;
    box-shadow: 0 2px 12px rgba(255,126,179,0.3);
}

/* Divider line */
.ba-divider {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 3px;
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    z-index: 4;
    pointer-events: none;
    box-shadow: 0 0 12px rgba(0,0,0,0.25);
}

/* Handle (draggable circle) */
.ba-handle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid var(--accent);
    box-shadow: 0 2px 16px rgba(255,126,179,0.35), 0 0 0 4px rgba(255,255,255,0.3);
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    transition: transform 0.15s var(--ease-spring), box-shadow 0.2s;
}

.ba-slider:active .ba-handle {
    transform: translate(-50%, -50%) scale(1.12);
    box-shadow: 0 4px 24px rgba(255,126,179,0.5), 0 0 0 6px rgba(255,255,255,0.4);
}

/* Arrows inside handle */
.ba-handle svg {
    width: 20px;
    height: 20px;
    color: var(--accent);
    flex-shrink: 0;
}

/* Auto-play pulse glow — attracts attention */
.ba-slider[data-autoplay="true"] .ba-handle {
    animation: baHandlePulse 2s ease-in-out infinite;
}
@keyframes baHandlePulse {
    0%, 100% { box-shadow: 0 2px 16px rgba(255,126,179,0.35), 0 0 0 4px rgba(255,255,255,0.3); }
    50% { box-shadow: 0 4px 24px rgba(255,126,179,0.55), 0 0 0 8px rgba(255,126,179,0.15); }
}

/* Responsive */
@media (max-width: 640px) {
    .ba-slider {
        max-width: 100%;
        border-radius: var(--radius-sm);
    }
    .ba-handle {
        width: 36px;
        height: 36px;
    }
    .ba-label {
        font-size: 10px;
        padding: 3px 8px;
    }
}

/* ── Accessibility: respect user's reduced-motion preference (WCAG 2.3.3) ── */
@media (prefers-reduced-motion: reduce) {
    .ba-slider[data-autoplay="true"] .ba-handle,
    .ba-slider,
    .ba-handle,
    .ba-before,
    .ba-after,
    .ba-divider {
        animation: none !important;
        transition-duration: 0.01ms !important;
    }
}
