.polishing-comparison {
  min-width: 0;
}

.polishing-compare {
  margin: 0;
}

.polishing-compare__viewport {
  --comparison-position: 50%;
  position: relative;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--paper);
  isolation: isolate;
}

.polishing-compare__viewport:not(.is-pointer-input):has(.polishing-compare__range:focus-visible) .polishing-compare__handle {
  outline: 2px solid var(--ink);
  outline-offset: 4px;
}

.polishing-compare__image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
}

.polishing-compare__image--before {
  position: absolute;
  inset: 0;
  clip-path: inset(0 calc(100% - var(--comparison-position)) 0 0);
}

.polishing-compare__label {
  position: absolute;
  top: 20px;
  z-index: 1;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.94);
  font-size: 14px;
  line-height: 1.2;
  font-weight: 600;
  pointer-events: none;
}

.polishing-compare__label--before {
  left: 20px;
}

.polishing-compare__label--after {
  right: 20px;
}

.polishing-compare__divider {
  position: absolute;
  inset: 0 auto 0 var(--comparison-position);
  z-index: 2;
  width: 2px;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(19, 47, 60, 0.12);
  transform: translateX(-50%);
  pointer-events: none;
}

.polishing-compare__handle {
  position: absolute;
  top: 50%;
  left: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 6px 24px rgba(19, 47, 60, 0.2);
  transform: translate(-50%, -50%);
}

.polishing-compare__arrow { display: flex; align-items: center; color: var(--ink); transition: color 160ms ease; }
.polishing-compare__arrow .soto-icon { width: 14px; height: 14px; }
.polishing-compare__viewport:hover .polishing-compare__arrow,
.polishing-compare__viewport.is-dragging .polishing-compare__arrow { color: var(--red); }
.polishing-compare__viewport.is-pointer-input .polishing-compare__handle { outline: none; }
.polishing-compare__range:focus { outline: none; }

.polishing-compare__range {
  position: absolute;
  inset: 0;
  z-index: 3;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  opacity: 0;
  cursor: ew-resize;
  touch-action: pan-y;
}


@media (max-width: 560px) {
  .polishing-compare__label {
    top: 12px;
    padding: 8px 10px;
    font-size: 12px;
  }

  .polishing-compare__label--before {
    left: 12px;
  }

  .polishing-compare__label--after {
    right: 12px;
  }

  .polishing-compare__handle {
    width: 48px;
    height: 48px;
  }
}
