.method-photo {
  width: min(100%, 760px);
  aspect-ratio: 16 / 9;
  margin: 0 auto 44px;
  overflow: hidden;
  border-radius: 18px;
}

.method-photo img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: 51% center;
}

.before-after {
  --position: 50%;
  position: relative;
  isolation: isolate;
  width: min(100%, 900px);
  aspect-ratio: 16 / 9;
  cursor: ew-resize;
  user-select: none;
  touch-action: pan-y;
}

.before-after-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  pointer-events: none;
}

.comparison-label {
  position: absolute;
  z-index: 4;
  top: clamp(8px, 2vw, 18px);
  padding: .48em .72em;
  border: 1px solid rgba(255, 255, 255, .65);
  border-radius: 999px;
  color: #fff;
  background: rgba(92, 8, 8, .9);
  box-shadow: 0 3px 14px rgba(0, 0, 0, .36);
  font-size: clamp(.75rem, 2vw, 1rem);
  font-weight: 850;
  line-height: 1;
  letter-spacing: .02em;
  white-space: nowrap;
  pointer-events: none;
}

.before-label {
  left: clamp(8px, 2vw, 18px);
}

.after-label {
  right: clamp(8px, 2vw, 18px);
}

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

.before-after-divider {
  position: absolute;
  z-index: 2;
  top: 0;
  bottom: 0;
  left: var(--position);
  width: 3px;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .18), 0 0 18px rgba(0, 0, 0, .45);
  transform: translateX(-50%);
  pointer-events: none;
}

.before-after-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 54px;
  height: 54px;
  border: 3px solid #fff;
  border-radius: 50%;
  color: #fff;
  background: #ca3b2b;
  box-shadow: 0 5px 18px rgba(0, 0, 0, .38);
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  transform: translate(-50%, -50%);
}

.before-after-range {
  position: absolute;
  z-index: 3;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: ew-resize;
}

.before-after:has(.before-after-range:focus-visible) {
  outline: 4px solid rgba(202, 59, 43, .42);
  outline-offset: 4px;
}

.guarantee-badge {
  width: min(100%, 320px);
  margin: 0 auto;
  justify-self: center;
}

.guarantee-badge img {
  width: 100%;
  height: auto;
  display: block;
}

@media (width <= 760px) {
  .method-photo {
    aspect-ratio: 5 / 4;
    margin-bottom: 28px;
    border-radius: 14px;
  }

  .method-photo.before-after {
    aspect-ratio: 4 / 3;
  }

  .before-after-handle {
    width: 44px;
    height: 44px;
    border-width: 2px;
    font-size: 23px;
  }

  .comparison-label {
    top: 7px;
    max-width: calc(50% - 14px);
    padding: .45em .58em;
    font-size: clamp(.75rem, 3.4vw, .875rem);
    letter-spacing: 0;
  }

  .before-label {
    left: 7px;
  }

  .after-label {
    right: 7px;
  }

  .guarantee-badge {
    width: min(78vw, 260px);
  }
}
