/* ==========================================================================
   compare.css
   Before / after slider. Loaded only by the pages that use one.
   ========================================================================== */

/* --------------------------------------------------------------------------
   11a. Before / after comparison slider
   --------------------------------------------------------------------------
   One base image; the annotation layer sits on top at full size and is
   revealed with clip-path. Clipping avoids any layout work per frame and
   never squashes the artwork, which a width-based reveal would.
   -------------------------------------------------------------------------- */
.compare {
  --split: 50%;
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 11;
  border-radius: var(--radius-media);
  overflow: hidden;
  background: #efe3ea;
  cursor: ew-resize;
  user-select: none;
  -webkit-user-select: none;
  /* Vertical page scrolling must still win on touch. */
  touch-action: pan-y;
  isolation: isolate;
}

.compare__img,
.compare__overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background-size: cover;
  background-position: center;
  pointer-events: none;
}

.compare__overlay {
  clip-path: inset(0 0 0 var(--split));
}

.compare__label {
  position: absolute;
  top: 14px;
  z-index: 3;
  padding: 6px 12px;
  border-radius: 999px;
  font-family: 'Kumbh Sans', sans-serif;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(12, 21, 32, 0.62);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  pointer-events: none;
  transition: opacity 0.25s var(--ease);
}
.compare__label--before { left: 14px; }
.compare__label--after  { right: 14px; }

/* The divider and its grip travel together. */
.compare__handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--split);
  z-index: 4;
  width: 44px;
  translate: -50% 0;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: ew-resize;
  display: grid;
  place-items: center;
}
.compare__handle::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  translate: -50% 0;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 0 1px rgba(12, 21, 32, 0.18);
}
.compare__grip {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #fff;
  color: var(--navy);
  display: grid;
  place-items: center;
  box-shadow: 0 4px 16px rgba(12, 21, 32, 0.28);
  transition: transform 0.2s var(--ease);
}
.compare:hover .compare__grip { transform: scale(1.06); }
.compare.is-dragging .compare__grip { transform: scale(0.96); }
/* Promoted only for the duration of a drag, not for the life of the page. */
.compare.is-dragging .compare__overlay { will-change: clip-path; }
.compare.is-dragging { cursor: grabbing; }
.compare__grip svg { width: 20px; height: 20px; }

.compare__handle:focus-visible .compare__grip {
  outline: 3px solid var(--crimson);
  outline-offset: 3px;
}

.compare__hint {
  position: absolute;
  left: 50%;
  bottom: 14px;
  translate: -50% 0;
  z-index: 3;
  font-size: 12px;
  font-family: 'Kumbh Sans', sans-serif;
  color: rgba(255, 255, 255, 0.92);
  background: rgba(12, 21, 32, 0.55);
  padding: 5px 12px;
  border-radius: 999px;
  pointer-events: none;
  transition: opacity 0.3s var(--ease);
}
.compare.is-dragging .compare__hint { opacity: 0; }

@media (max-width: 620px) {
  .compare__label { font-size: 11px; padding: 5px 9px; }
  .compare__hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .compare__grip, .compare__hint { transition: none; }
}
