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

.comparison .comparison-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  object-fit: cover;
  user-select: none;
  pointer-events: none;
}

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

.comparison-divider {
  position: absolute;
  z-index: 3;
  top: 0;
  bottom: 0;
  left: var(--position);
  width: 3px;
  background: #fff;
  transform: translateX(-50%);
  box-shadow: 0 0 12px rgba(8, 41, 67, .35);
  pointer-events: none;
}

.comparison-divider span {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #fff;
  color: var(--navy);
  font-size: 1.25rem;
  font-weight: 900;
  box-shadow: 0 7px 22px rgba(8, 41, 67, .28);
}

.comparison-range {
  position: absolute;
  z-index: 5;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: ew-resize;
  touch-action: pan-y;
}

.comparison:has(.comparison-range:focus-visible) {
  outline: 3px solid var(--amber);
  outline-offset: 5px;
}

.comparison .tag {
  z-index: 4;
  pointer-events: none;
}

@media (max-width: 650px) {
  .comparison-divider span {
    width: 42px;
    height: 42px;
  }
}
