.three-way-comparison {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  cursor: ew-resize;
  background: #111;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  border-radius: var(--normal-border-radius);
  --twc-pct1: 33%;
  --twc-pct2: 66%;
}

.three-way-comparison .twc-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

/* img1 (bottom): always fully visible — no clip needed */

/* img2 (middle): covers img1 from handle 1 onward */
.three-way-comparison .twc-img2 {
  clip-path: inset(0 0 0 var(--twc-pct1));
}

/* img3 (top): covers img2 from handle 2 onward */
.three-way-comparison .twc-img3 {
  clip-path: inset(0 0 0 var(--twc-pct2));
}

/* ── Handles ──────────────────────────────────────────────────────────── */

.twc-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 0;
  background: transparent;
  transform: translateX(-50%);
  pointer-events: none;
  cursor: ew-resize;
  z-index: 5;
}

.twc-handle-1 {
  left: var(--twc-pct1, 33%);
}

.twc-handle-2 {
  left: var(--twc-pct2, 66%);
}

.twc-handle::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 50px;
  height: 50px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 50%;
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  z-index: 6;
  pointer-events: none;
}

.twc-handle::after {
  content: "\276E\00A0\276F";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -51%);
  font-size: 16px;
  color: #ffffff;
  font-weight: bold;
  letter-spacing: 4px;
  z-index: 7;
  pointer-events: none;
}

/* ── Labels ───────────────────────────────────────────────────────────── */

.twc-label {
  position: absolute;
  font-family: Bahnschrift, 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-size: var(--twc-label-font-size, 1.25rem);
  font-weight: 600;
  padding: 1rem 1.5rem;
  pointer-events: none;
  z-index: 10;
  bottom: 1rem;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
  color: var(--twc-label-color, #ffffff);
}

.twc-label-left {
  left: 1rem;
}

.twc-label-center {
  left: 50%;
  transform: translateX(-50%);
}

.twc-label-right {
  right: 1rem;
}

.twc-label-top {
  bottom: auto;
  top: 1rem;
}

/* ── Expand button ────────────────────────────────────────────────────── */

.three-way-comparison .comparison-expand-btn {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 20;
  opacity: 0;
  transition: opacity 0.2s ease, background 0.2s ease;
  pointer-events: all;
}

.three-way-comparison:hover .comparison-expand-btn {
  opacity: 1.0;
}

.three-way-comparison .comparison-expand-btn:hover {
  opacity: 1 !important;
  background: var(--dark-back-hover, rgba(0, 0, 0, 0.45));
}
