/* ===== Before / After Carousel ===== */

.ba-head {
  text-align: center;
  max-width: 760px;
  margin: 0 auto 34px;
  padding: 0 16px;
}

.ba-kicker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  margin-bottom: 14px;
  border-radius: 999px;
  background: rgba(13, 116, 242, 0.08);
  color: #0d74f2;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ba-head h2 {
  margin: 0 0 14px;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.08;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #101828;
}

.ba-head h2 span {
  color: #0d74f2;
}

.ba-head p {
  margin: 0 auto;
  max-width: 620px;
  font-size: 17px;
  line-height: 1.8;
  color: #667085;
}

/* ===== Carousel ===== */

.ba-carousel {
  position: relative;
  margin-top: 14px;
}

.ba-track {
  display: flex;
  gap: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 0;
  margin: 0;
  align-items: flex-start;
}

.ba-track::-webkit-scrollbar {
  height: 0;
}

.ba-slide {
  flex: 0 0 100%;
  width: 100%;
  scroll-snap-align: center;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 0 12px;
  box-sizing: border-box;
  position: relative;
}

.ba-card {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  position: relative;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(6, 22, 44, 0.12);
  border-radius: 20px;
  box-shadow: 0 14px 34px rgba(2, 12, 27, 0.07);
  overflow: hidden;
}

.ba-card--landscape {
  max-width: 1120px;
}

.ba-card--portrait {
  max-width: 680px;
}

/* ===== Compare area ===== */

.ba-compare {
  position: relative;
  width: 100%;
  overflow: hidden;
  --split: 55%;
  border-radius: 24px;
  background: #f7f9fc;
  box-shadow: 0 18px 50px rgba(16, 24, 40, 0.1);
}

.ba-compare--landscape {
  aspect-ratio: 16 / 9;
  width: 100%;
  background: linear-gradient(135deg, #eef3fb, #e3ebf7);
}

.ba-compare--portrait {
  aspect-ratio: 4 / 5;
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  background: #eef3f8;
}

.ba-base,
.ba-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.ba-base {
  z-index: 1;
}

.ba-overlay {
  z-index: 2;
  overflow: hidden;
  clip-path: inset(0 calc(100% - var(--split)) 0 0);
  will-change: clip-path;
}

.ba-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-position: center center;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
  transition: transform 0.35s ease, filter 0.35s ease, opacity 0.25s ease;
}

.ba-compare--landscape .ba-img,
.ba-compare--portrait .ba-img {
  object-fit: cover;
  object-position: center;
}

.ba-compare,
.ba-compare * {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.ba-drag {
  position: absolute;
  inset: 0;
  cursor: ew-resize;
  touch-action: none;
  background: transparent;
  z-index: 4;
}

.ba-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--split);
  width: 2px;
  background: rgba(6, 22, 44, 0.65);
  transform: translateX(-1px);
  z-index: 8;
  will-change: left, transform;
  cursor: ew-resize;
}

.ba-handle::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 44px;
  height: 44px;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(6, 22, 44, 0.18);
  box-shadow: 0 10px 22px rgba(2, 12, 27, 0.14);
  transition: transform 0.22s ease, box-shadow 0.22s ease, background 0.22s ease;
  cursor: ew-resize;
}

.ba-handle::after {
  content: "⇆";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-weight: 800;
  font-size: 14px;
  color: rgba(6, 22, 44, 0.85);
}

.ba-label {
  position: absolute;
  top: 12px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(6, 22, 44, 0.12);
  color: rgba(6, 22, 44, 0.9);
  z-index: 6;
}

.ba-label--before {
  left: 12px;
}

.ba-label--after {
  right: 12px;
}

/* ===== Hint / glow ===== */

.ba-compare::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.ba-compare.is-hinting::after {
  opacity: 1;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.16) 45%,
    rgba(255, 255, 255, 0.34) 50%,
    rgba(255, 255, 255, 0.16) 55%,
    rgba(255, 255, 255, 0) 100%
  );
  animation: baSweep 1.6s ease-in-out infinite;
}

.ba-swipe-hint {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 7;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(6, 22, 44, 0.78);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.2px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.ba-compare.is-hinting .ba-swipe-hint {
  opacity: 1;
  transform: translateX(-50%) translateY(-2px);
}

.ba-swipe-hint::before {
  content: "⇆";
  display: inline-block;
  margin-right: 8px;
  animation: baNudge 1s ease-in-out infinite;
}

.ba-wow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  opacity: 0;
  background: radial-gradient(circle at var(--split) 50%, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0) 32%);
  transition: opacity 0.22s ease;
}

.ba-compare.is-wowing .ba-wow {
  opacity: 1;
}

.ba-compare.is-dragging .ba-handle {
  transform: translateX(-1px) scale(1.08);
}

.ba-compare.is-dragging .ba-handle::before,
.ba-compare.is-wowing .ba-handle::before {
  box-shadow: 0 18px 38px rgba(2, 12, 27, 0.24);
  background: rgba(255, 255, 255, 0.98);
}

.ba-compare.is-dragging .ba-img--before,
.ba-compare.is-dragging .ba-img--after {
  filter: saturate(1.04) contrast(1.02);
}

/* ===== Caption ===== */

.ba-caption {
  padding: 14px 16px;
  text-align: center;
  color: #475467;
  font-size: 15px;
}

.ba-caption strong {
  color: #101828;
  font-weight: 700;
}

.ba-caption .muted {
  color: #98a2b3;
}

/* ===== Dots ===== */

.ba-dots {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 56px;
  z-index: 25;
  display: flex;
  gap: 8px;
  justify-content: center;
  background: rgba(255, 255, 255, 0.88);
  padding: 6px 10px;
  border-radius: 999px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  margin-top: 0;
}

.ba-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(6, 22, 44, 0.25);
  border: none;
  cursor: pointer;
  transition: width 0.2s ease, background 0.2s ease;
}

.ba-dot.is-active {
  width: 18px;
  background: rgba(13, 116, 242, 0.75);
}

/* ===== Controls ===== */

.ba-controls {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  transform: translateY(-50%);
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
  padding: 0 14px;
  z-index: 30;
}

.ba-btn {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 132px;
  height: 52px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #101828;
  font-weight: 700;
  font-size: 15px;
  box-shadow: 0 12px 30px rgba(16, 24, 40, 0.16);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
  cursor: pointer;
}

.ba-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 34px rgba(16, 24, 40, 0.18);
  background: #ffffff;
}

.ba-btn:active {
  transform: translateY(0);
}

.ba-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.ba-btn:focus-visible {
  outline: 3px solid rgba(13, 116, 242, 0.22);
  outline-offset: 3px;
}

.ba-btn-prev {
  margin-right: auto;
}

.ba-btn-next {
  margin-left: auto;
}

/* ===== Animations ===== */

@keyframes baSweep {
  0% {
    transform: translateX(-32%);
  }
  50% {
    transform: translateX(32%);
  }
  100% {
    transform: translateX(-32%);
  }
}

@keyframes baNudge {
  0%, 100% {
    transform: translateX(0);
  }
  50% {
    transform: translateX(4px);
  }
}

/* ===== Tablet ===== */

@media (max-width: 1200px) {
  .ba-controls {
    padding: 0 10px;
  }

  .ba-btn {
    min-width: 120px;
    height: 48px;
    font-size: 14px;
  }
}

@media (max-width: 991px) {
  .ba-card--landscape .ba-compare {
    min-height: 360px;
  }

  .ba-controls {
    top: calc(50% - 8px);
  }

  .ba-dots {
    bottom: 52px;
  }
}

/* ===== Mobile ===== */

@media (max-width: 767px) {
  .ba-head {
    margin-bottom: 24px;
  }

  .ba-head p {
    font-size: 15px;
    line-height: 1.7;
  }

  .ba-slide {
    padding: 0 8px;
  }

  .ba-card--portrait,
  .ba-compare--portrait {
    max-width: 100%;
  }

  .ba-caption {
    padding: 12px 14px;
    font-size: 14px;
  }

  .ba-controls {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    margin-top: 0;
    justify-content: space-between;
    gap: 0;
    padding: 0 8px;
    z-index: 30;
    pointer-events: none;
  }

  .ba-btn {
    pointer-events: auto;
    min-width: 92px;
    height: 40px;
    padding: 0 12px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    border-radius: 999px;
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.96);
    color: #101828;
    box-shadow: 0 8px 20px rgba(16, 24, 40, 0.16);
  }

  .ba-dots {
    bottom: 48px;
    padding: 6px 10px;
  }

  .ba-swipe-hint {
    font-size: 11px;
    bottom: 12px;
    padding: 7px 12px;
  }

  .ba-compare {
    touch-action: none;
  }

  .ba-drag {
    pointer-events: none;
  }

  .ba-handle {
    width: 3px;
    z-index: 12;
  }

  .ba-handle::before {
    width: 54px;
    height: 54px;
    box-shadow: 0 14px 30px rgba(2, 12, 27, 0.2);
    transition: none;
  }

  .ba-handle::after {
    font-size: 16px;
  }

  .ba-compare.is-dragging .ba-handle {
    transform: translateX(-1px) scale(1.12);
  }

  .ba-img {
    transition: none;
  }
}

/* ===== Very short landscape phones ===== */

@media (max-height: 520px) and (orientation: landscape) {
  .ba-controls {
    top: 46%;
  }

  .ba-btn {
    height: 44px;
    min-width: 112px;
    font-size: 13px;
  }

  .ba-card--landscape .ba-compare {
    min-height: 300px;
  }

  .ba-dots {
    bottom: 42px;
  }
}

/* ===== Reduced motion ===== */

@media (prefers-reduced-motion: reduce) {
  .ba-overlay,
  .ba-handle,
  .ba-img,
  .ba-compare::after,
  .ba-swipe-hint,
  .ba-swipe-hint::before,
  .ba-wow,
  .ba-btn,
  .ba-dot {
    transition: none !important;
    animation: none !important;
  }
}