/* Before/After slider (portfolio only)
   Brand anchors:
   - Teal #1A6C77
   - Black #000
   - Off-white #FAF9F7
   - Dark gray #3A3E3F
   - Warm neutral #C9B27F
*/

.ba-grid {
  display: grid;
  gap: 1.25rem;
}

.ba-figure {
  margin: 0;
}

.ba-caption {
  margin-top: 0.75rem;
  color: #3A3E3F;
  line-height: 1.35;
}

.ba-slider {
  --ba-pos: 50%;
  position: relative;
  border-radius: 1.25rem;
  overflow: hidden;
  background: #FAF9F7;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.10);
  touch-action: none;
}

.ba-image {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
}

.ba-after {
  position: absolute;
  inset: 0;
  width: var(--ba-pos);
  overflow: hidden;
}

.ba-label {
  position: absolute;
  top: 0.85rem;
  z-index: 3;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  background: rgba(250, 249, 247, 0.92);
  color: #000000;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.ba-label-before {
  left: 0.85rem;
}

.ba-label-after {
  right: 0.85rem;
}

.ba-range {
  position: absolute;
  inset: 0;
  z-index: 5;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: ew-resize;
}

.ba-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--ba-pos);
  transform: translateX(-50%);
  z-index: 4;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.ba-handle-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(0, 0, 0, 0.35);
}

.ba-handle-knob {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: #1A6C77;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
  border: 2px solid rgba(250, 249, 247, 0.9);
  position: relative;
}

.ba-handle-knob::before,
.ba-handle-knob::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 10px;
  height: 10px;
  border-top: 2px solid rgba(250, 249, 247, 0.95);
  border-right: 2px solid rgba(250, 249, 247, 0.95);
  transform: translateY(-50%) rotate(45deg);
  opacity: 0.95;
}

.ba-handle-knob::before {
  left: 12px;
  transform: translateY(-50%) rotate(225deg);
}

.ba-handle-knob::after {
  right: 12px;
  transform: translateY(-50%) rotate(45deg);
}

/* Focus: make range focus visible via the slider container */
.ba-slider:has(.ba-range:focus-visible) {
  outline: 3px solid rgba(26, 108, 119, 0.55);
  outline-offset: 4px;
}

/* Gentle interaction */
.ba-slider.is-dragging .ba-handle-knob {
  transform: scale(1.04);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .ba-slider.is-dragging .ba-handle-knob {
    transform: none;
  }
}

/* Desktop layout */
@media (min-width: 900px) {
  .ba-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
  }
}
