
/* =========================================
   MAUU.DESIGN — BEFORE / AFTER COMPARISON
========================================= */

.mauu-comparison-slider {
  --cmp-handle-size: 48px;
  --cmp-divider-width: 3px;
  --cmp-divider-color: #fff;

  position: relative;
  display: block;
  width: 100%;
  margin-top: 36px;
  overflow: hidden;
  isolation: isolate;
  border-radius: 16px;
  background: #eee;
  cursor: ew-resize;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  outline: none;
}

.mauu-comparison-slider.ratio-16-9 {
  aspect-ratio: 16 / 9;
}

.mauu-comparison-slider.ratio-1-1 {
  aspect-ratio: 1 / 1;
}

/* Both images occupy the exact same space */

.mauu-comparison-slider .mauu-cmp-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  will-change: clip-path;
}

.mauu-comparison-slider .mauu-cmp-layer img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: center;
  pointer-events: auto;
}

.mauu-comparison-slider .mauu-cmp-before {
  z-index: 1;
  clip-path: inset(0 50% 0 0);
}

.mauu-comparison-slider .mauu-cmp-after {
  z-index: 2;
  clip-path: inset(0 0 0 50%);
}

/* Before / After labels */

.mauu-comparison-slider .mauu-cmp-label {
  position: absolute;
  z-index: 3;
  top: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  background: rgba(8, 8, 8, 0.58);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #fff;
  font-family: 'Nunito Sans', sans-serif;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  pointer-events: none;
}

.mauu-comparison-slider .mauu-cmp-before .mauu-cmp-label {
  left: 22px;
}

.mauu-comparison-slider .mauu-cmp-after .mauu-cmp-label {
  right: 22px;
}

/* Divider track */

.mauu-comparison-slider .mauu-cmp-divider {
  position: absolute;
  z-index: 4;
  inset: 0 auto 0 0;
  width: 0;
  height: 100%;
  pointer-events: none;
  transform: translate3d(0, 0, 0);
  will-change: left;
}

.mauu-comparison-slider .mauu-cmp-line {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--cmp-divider-width);
  height: 100%;
  transform: translateX(-50%);
  background: linear-gradient(
    to bottom,
    transparent 4%,
    var(--cmp-divider-color) 18%,
    var(--cmp-divider-color) 82%,
    transparent 96%
  );
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.35);
}

/* Circular draggable handle */

.mauu-comparison-slider .mauu-cmp-handle {
  position: absolute;
  top: 50%;
  left: 0;
  display: grid;
  place-items: center;
  width: var(--cmp-handle-size);
  height: var(--cmp-handle-size);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: #fff;
  color: #111;
  box-shadow:
    0 10px 34px rgba(0, 0, 0, 0.34),
    0 0 0 1px rgba(255, 255, 255, 0.34);
  pointer-events: none;
  transition: scale 180ms ease;
}

.mauu-comparison-slider .mauu-cmp-handle svg {
  display: block;
  width: 52%;
  height: 52%;
}

.mauu-comparison-slider[data-dragging="true"]
.mauu-cmp-handle {
  scale: 1.08;
}

/* Keyboard accessibility */

.mauu-comparison-slider:focus-visible {
  box-shadow:
    0 0 0 3px #e30613,
    0 0 0 6px rgba(227, 6, 19, 0.2);
}

/* Responsive */

@media (max-width: 767px) {

  .mauu-comparison-slider {
    --cmp-handle-size: 42px;
    margin-top: 26px;
    border-radius: 12px;
  }

  .mauu-comparison-slider .mauu-cmp-label {
    top: 12px;
    padding: 7px 9px;
    font-size: 10px;
  }

  .mauu-comparison-slider .mauu-cmp-before .mauu-cmp-label {
    left: 12px;
  }

  .mauu-comparison-slider .mauu-cmp-after .mauu-cmp-label {
    right: 12px;
  }

}

/* Reduced motion */

@media (prefers-reduced-motion: reduce) {

  .mauu-comparison-slider .mauu-cmp-handle {
    transition: none;
  }

}
