/* ============================================================
   Before-After Slider Component
   Draggable image comparison with clip-path masking.
   ============================================================ */

.ba-slider {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-md, 8px);
  touch-action: pan-y; /* Allow vertical scroll but handle horizontal */
  cursor: ew-resize;
}

.ba-slider.is-dragging {
  user-select: none;
  cursor: ew-resize;
}

/* ── Image container ── */
.ba-slider__images {
  position: relative;
  aspect-ratio: 16 / 9;
}

.ba-slider__before,
.ba-slider__after {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* After image uses clip-path controlled by JS */
.ba-slider__after {
  clip-path: inset(0 0 0 50%);
  transition: clip-path 0.05s linear;
  will-change: clip-path;
}

.ba-slider.is-dragging .ba-slider__after {
  transition: none; /* Remove delay during active drag */
}

/* ── Before / After labels ── */
.ba-slider__label {
  position: absolute;
  top: 12px;
  padding: 4px 12px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 4px;
  pointer-events: none;
  z-index: 2;
  transition: opacity 0.2s ease;
}

.ba-slider__label--before { left:  12px; }
.ba-slider__label--after  { right: 12px; }

/* Fade labels when slider is near an edge */

/* ── Handle ── */
.ba-slider__handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  z-index: 3;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /* Move by JS — transition synced with clip-path */
  transition: left 0.05s linear;
  will-change: left;
}

.ba-slider.is-dragging .ba-slider__handle {
  transition: none;
}

/* Vertical divider line */
.ba-slider__line {
  position: absolute;
  inset: 0 auto;
  width: 3px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 6px rgba(0,0,0,0.4);
}

/* Circular grip */
.ba-slider__grip {
  position: relative;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 2px 10px rgba(0,0,0,0.35);
  color: var(--color-gray-700, #374151);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  z-index: 1;
}

.ba-slider.is-dragging .ba-slider__grip,
.ba-slider__handle:hover .ba-slider__grip {
  transform: scale(1.12);
  box-shadow: 0 4px 16px rgba(0,0,0,0.45);
}

/* Focus indicator */
.ba-slider__handle:focus-visible {
  outline: none;
}

.ba-slider__handle:focus-visible .ba-slider__grip {
  outline: 3px solid var(--color-accent, #c9a227);
  outline-offset: 2px;
}

/* ── Expand button (shown on renovation cards) ── */
.ba-card__expand {
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  z-index: 5;
  transition: background 0.2s ease;
}

.ba-card__expand:hover {
  background: rgba(0, 0, 0, 0.8);
}

.ba-card__expand:focus-visible {
  outline: 2px solid var(--color-accent, #c9a227);
  outline-offset: 2px;
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .ba-slider__after,
  .ba-slider__handle {
    transition: none;
  }
}
