.pspa-comparison {
  isolation: isolate;
  color: white;
  background: #152739;
  border-radius: var(--ps-radius, 12px);
  --before: 0%;
  --hidden-before: 100%;
  --after-shift: 0%;
  --before-shift: -100%;
}

.pspa-comparison [hidden] { display: none !important; }

.pspa-comparison .pspa-comparison-surface,
.pspa-comparison .pspa-comparison-surface img {
  position: absolute;
  inset: 0;
  height: 100%;
  width: 100%;
}

.pspa-comparison .pspa-comparison-surface {
  overflow: hidden;
  touch-action: pan-y pinch-zoom;
  user-select: none;
  -webkit-user-select: none;
}

.pspa-comparison .pspa-comparison-surface img {
  object-fit: cover;
  pointer-events: none;
  transform: none;
  transition: none;
}

.pspa-comparison[data-ready] .pspa-comparison-surface { cursor: ew-resize; }
.pspa-comparison[data-ready][data-pspa-comparison="vertical"] .pspa-comparison-surface { cursor: ns-resize; }

.pspa-comparison[data-pspa-comparison="swipe"] .pspa-before { transform: translateX(var(--before-shift)); }
.pspa-comparison[data-pspa-comparison="swipe"] .pspa-after { transform: translateX(var(--after-shift)); }
.pspa-comparison[data-pspa-comparison="vertical"] .pspa-before { clip-path: inset(var(--hidden-before) 0 0 0); }
.pspa-comparison[data-pspa-comparison="slice"] .pspa-before { clip-path: inset(0 var(--hidden-before) 0 0); }

.pspa-comparison .pspa-divider {
  display: none;
  pointer-events: none;
}

.pspa-comparison[data-ready][data-pspa-comparison="slice"] .pspa-divider,
.pspa-comparison[data-ready][data-pspa-comparison="vertical"] .pspa-divider {
  display: block;
  position: absolute;
  z-index: 1;
}

/* Keep the touch grip inside the picture at both end stops. */
.pspa-comparison[data-pspa-comparison="slice"] .pspa-divider {
  top: 0;
  bottom: 0;
  left: clamp(23px, var(--before), calc(100% - 23px));
}
.pspa-comparison[data-pspa-comparison="vertical"] .pspa-divider {
  left: 0;
  right: 0;
  bottom: clamp(23px, var(--before), calc(100% - 23px));
}
.pspa-comparison[data-partial] .pspa-divider::before {
  content: "";
  position: absolute;
  display: block;
  background: white;
  box-shadow: 0 0 2px #112037;
}
.pspa-comparison[data-partial][data-pspa-comparison="slice"] .pspa-divider { left: var(--before); }
.pspa-comparison[data-partial][data-pspa-comparison="vertical"] .pspa-divider { bottom: var(--before); }
.pspa-comparison[data-pspa-comparison="slice"] .pspa-divider::before { inset: 0 auto 0 -1px; width: 2px; }
.pspa-comparison[data-pspa-comparison="vertical"] .pspa-divider::before { inset: auto 0 -1px; height: 2px; }

.pspa-comparison .pspa-grip {
  position: absolute;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  touch-action: none;
  font: 700 19px/1 system-ui, sans-serif;
}

.pspa-comparison .pspa-grip::before {
  content: "";
  position: absolute;
  inset: 6px;
  background: #172d43;
  border: 1.5px solid #fff;
  border-radius: 50%;
  box-shadow: 0 1px 7px #14233888;
  z-index: -1;
}

.pspa-comparison[data-pspa-comparison="slice"] .pspa-grip { top: 49%; left: 0; }
.pspa-comparison[data-pspa-comparison="vertical"] .pspa-grip { left: 54%; top: 0; }
.pspa-comparison[data-pspa-comparison="slice"] .pspa-divider { height: 100%; }
.pspa-comparison[data-pspa-comparison="vertical"] .pspa-divider { width: 100%; }

.pspa-comparison .pspa-photo-period,
.pspa-comparison .pspa-compare-switch,
.pspa-comparison .pspa-compare-fallback {
  position: absolute;
  z-index: 2;
  margin: 0;
  color: #fff;
  font-family: var(--sans, system-ui, sans-serif);
  font-weight: 700;
  text-transform: none;
  letter-spacing: normal;
  background: #11273dee;
  border-radius: 999px;
}
.pspa-comparison .pspa-photo-period {
  left: 12px;
  top: 12px;
  padding: 5px 10px;
  font-size: 12px;
  line-height: 1.4;
  pointer-events: none;
}
.pspa-comparison .pspa-compare-switch,
.pspa-comparison .pspa-compare-fallback {
  border: 1px solid #ffffffb3;
  bottom: 10px;
  left: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  min-height: 44px;
  padding: 0 .8rem;
  font-size: 13px;
  line-height: 1.1;
  cursor: pointer;
  text-decoration: none;
  touch-action: manipulation;
}
.pspa-comparison .pspa-compare-switch > [aria-hidden] { font-size: 1.12rem; }
.pspa-comparison .pspa-compare-switch:hover { background: #203c56; }
.pspa-comparison .pspa-comparison-surface:focus-visible,
.pspa-comparison .pspa-compare-switch:focus-visible,
.pspa-comparison .pspa-compare-fallback:focus-visible {
  outline: 3px solid white;
  outline-offset: -5px;
  box-shadow: inset 0 0 0 7px #253b58;
}
.pspa-comparison .pspa-comparison-surface:focus-visible { z-index: 1; }
.pspa-comparison .pspa-compare-switch:focus-visible { outline-offset: 2px; box-shadow: 0 0 0 6px #253b58; }

@media (prefers-reduced-motion: no-preference) {
  .pspa-comparison[data-ready]:not([data-dragging]) .pspa-comparison-surface img {
    transition: transform .25s ease-out, clip-path .25s ease-out;
  }
}

.pspa-comparison .pspa-compare-open {
  position: absolute;
  z-index: 2;
  right: 9px;
  bottom: 9px;
  min-height: 44px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  text-decoration: none;
  border-radius: 999px;
  touch-action: manipulation;
}

.pspa-comparison .pspa-compare-open .card-photo-count {
  position: static;
  border: 1px solid #ffffff85;
  line-height: 1.4;
  white-space: nowrap;
}

.pspa-comparison .pspa-compare-open:hover .card-photo-count { background: #203c56; }
.pspa-comparison .pspa-compare-open:focus-visible { outline: 3px solid white; outline-offset: -2px; box-shadow: 0 0 0 2px #253b58; }

/* Make room for the full work-in-progress button and the vertical touch grip. */
.pspa-comparison[data-pspa-comparison="vertical"][data-before-label="In progress"] .pspa-grip { left: 83%; }
.pspa-comparison[data-pspa-comparison="vertical"][data-before-label="In progress"] > .card-photo-count,
.pspa-comparison[data-pspa-comparison="vertical"][data-before-label="In progress"] .pspa-compare-open { bottom: auto; top: 8px; }
.pspa-comparison[data-start="before"]:not([data-ready]) .pspa-before{transform:none;clip-path:none}
