/* ============================================================================
   GARAGE GALS . BEFORE / AFTER REVEAL
   ----------------------------------------------------------------------------
   The signature draggable reveal. After image sits beneath; a clip layer shows
   the Before; a lens handle drags the divide. A range input drives it for
   keyboard + screen-reader users. JS in js/before-after.js wires the pointer.
   ============================================================================ */

.ba {
  --pos: 50%;
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  background: var(--ink-800);
  cursor: ew-resize;
  isolation: isolate;
  touch-action: pan-y;
  user-select: none;
}
.ba__img {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  pointer-events: none;
}
.ba__after { z-index: 1; }
.ba__clip {
  position: absolute;
  inset: 0;
  z-index: 2;
  overflow: hidden;
  /* clip from the right so the Before shows up to the handle position */
  clip-path: inset(0 calc(100% - var(--pos)) 0 0);
  will-change: clip-path;
}
.ba__clip .ba__img { width: 100%; height: 100%; object-fit: cover; }

/* Labels */
.ba__label {
  position: absolute;
  bottom: var(--space-sm);
  z-index: 4;
  padding: 0.4rem 0.85rem;
  border-radius: var(--r-pill);
  font-family: var(--font-mono);
  font-size: var(--fs-caption);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--cream-50);
  background: rgba(5,5,5,0.55);
  -webkit-backdrop-filter: blur(var(--blur-sm));
  backdrop-filter: blur(var(--blur-sm));
  pointer-events: none;
}
.ba__label--before { left: var(--space-sm); }
.ba__label--after  { right: var(--space-sm); background: var(--grad-red-flare); }

/* The drag handle / reveal lens */
.ba__handle {
  position: absolute;
  top: 0; bottom: 0;
  left: var(--pos);
  z-index: 5;
  width: 3px;
  margin-left: -1.5px;
  background: var(--cream-50);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.15), 0 0 14px rgba(0,0,0,0.4);
  pointer-events: none;
}
.ba__grip {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 3.25rem; height: 3.25rem;
  border-radius: 50%;
  background: var(--cream-50);
  display: grid;
  place-items: center;
  color: var(--ink-800);
  box-shadow: var(--shadow-3);
  transition: transform var(--dur-2) var(--ease-out-back);
}
.ba:hover .ba__grip,
.ba.is-dragging .ba__grip { transform: translate(-50%, -50%) scale(1.08); }
.ba.is-dragging .ba__grip { background: var(--red-500); color: var(--cream-50); }
.ba__grip svg { width: 1.3rem; height: 1.3rem; }

/* Accessible range slider overlay */
.ba__range {
  position: absolute;
  inset: 0;
  z-index: 6;
  width: 100%; height: 100%;
  margin: 0;
  opacity: 0;
  cursor: ew-resize;
}
.ba__range:focus-visible + .ba__handle .ba__grip { box-shadow: var(--focus-ring); }

/* A subtle "drag me" hint that fades once interacted */
.ba__hint {
  position: absolute;
  top: var(--space-sm);
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  padding: 0.4rem 0.9rem;
  border-radius: var(--r-pill);
  background: rgba(5,5,5,0.5);
  -webkit-backdrop-filter: blur(var(--blur-sm));
  backdrop-filter: blur(var(--blur-sm));
  color: var(--cream-50);
  font-family: var(--font-mono);
  font-size: var(--fs-caption);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  transition: opacity var(--dur-3);
}
.ba.is-touched .ba__hint { opacity: 0; }
.ba__hint .pulse-dot {
  width: 0.5rem; height: 0.5rem; border-radius: 50%;
  background: var(--red-400);
  animation: pulse-glow 2s ease-in-out infinite;
}
