/* DiviPerfect Image Comparison. The After image fills the frame; the Before image sits on top, clipped at the divider
   (--dpcmp-pos) or faded (--dpcmp-p in Fade). Everything is placed from those two variables, so the module shows at
   its starting position before the script runs. */
.dp-cmp {
  --dpcmp-pos: 50%;
  --dpcmp-p: 0.5;
  --dpcmp-lw: 2px;
  --dpcmp-hs: 48px;
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: var(--dpcmp-radius, 0);
  isolation: isolate;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: pan-y;
  cursor: ew-resize;
}
.dp-cmp[data-dpcmp-dir="vertical"] { touch-action: pan-x; cursor: ns-resize; }
.dp-cmp[data-dpcmp-style="hover"] { cursor: crosshair; }
.dp-cmp[data-dpcmp-style="fade"],
.dp-cmp[data-dpcmp-style="scroll"] { cursor: default; touch-action: auto; }
.dp-cmp.has-ratio { aspect-ratio: var(--dpcmp-ratio); }

.dp-cmp img.dp-cmp-after,
.dp-cmp img.dp-cmp-before {
  display: block;
  width: 100%;
  max-width: none;
  height: auto;
  margin: 0;
  border: 0;
  border-radius: 0;
  pointer-events: none;
  -webkit-user-drag: none;
}
.dp-cmp img.dp-cmp-before,
.dp-cmp.has-ratio img.dp-cmp-after {
  position: absolute;
  inset: 0;
  height: 100%;
  object-fit: cover;
}
.dp-cmp img.dp-cmp-before { z-index: 1; clip-path: inset(0 calc(100% - var(--dpcmp-pos)) 0 0); }
.dp-cmp[data-dpcmp-dir="vertical"] img.dp-cmp-before { clip-path: inset(0 0 calc(100% - var(--dpcmp-pos)) 0); }
.dp-cmp[data-dpcmp-style="fade"] img.dp-cmp-before { clip-path: none; opacity: calc(1 - var(--dpcmp-p)); }

/* Divider */
.dp-cmp .dp-cmp-line {
  position: absolute;
  z-index: 2;
  top: 0;
  bottom: 0;
  left: var(--dpcmp-pos);
  width: var(--dpcmp-lw);
  transform: translateX(-50%);
  background: var(--dpcmp-line, #fff);
  box-shadow: 0 0 12px rgba(6, 6, 6, 0.25);
  pointer-events: none;
}
.dp-cmp[data-dpcmp-dir="vertical"] .dp-cmp-line {
  top: var(--dpcmp-pos);
  bottom: auto;
  left: 0;
  right: 0;
  width: auto;
  height: var(--dpcmp-lw);
  transform: translateY(-50%);
}
.dp-cmp[data-dpcmp-style="fade"] .dp-cmp-line { display: none; }

/* Handle */
.dp-cmp .dp-cmp-handle {
  position: absolute;
  z-index: 4;
  top: 50%;
  left: var(--dpcmp-pos);
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: var(--dpcmp-hs);
  height: var(--dpcmp-hs);
  margin: 0;
  padding: 0;
  border-radius: 50%;
  background: var(--dpcmp-handle, var(--dp-g-accent, #2c59fa));
  color: var(--dpcmp-icon, #fff);
  box-shadow: var(--dp-sh, 0 6px 20px rgba(6, 6, 6, 0.28));
  transform: translate(-50%, -50%);
  cursor: inherit;
  outline: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.dp-cmp[data-dpcmp-style="scroll"] .dp-cmp-handle,
.dp-cmp[data-dpcmp-style="hover"] .dp-cmp-handle { cursor: grab; }
.dp-cmp.is-dragging .dp-cmp-handle { transform: translate(-50%, -50%) scale(1.08); }
.dp-cmp .dp-cmp-handle:focus-visible { box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--dpcmp-handle, var(--dp-g-accent, #2c59fa)); }
.dp-cmp[data-dpcmp-dir="vertical"] .dp-cmp-handle { top: var(--dpcmp-pos); left: 50%; }
.dp-cmp .dp-cmp-arrows {
  width: 50%;
  height: 50%;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}
.dp-cmp[data-dpcmp-dir="vertical"] .dp-cmp-arrows { transform: rotate(90deg); }
.dp-cmp[data-dpcmp-handle="pill"] .dp-cmp-handle { width: calc(var(--dpcmp-hs) * 0.7); height: calc(var(--dpcmp-hs) * 1.3); border-radius: 999px; }
.dp-cmp[data-dpcmp-dir="vertical"][data-dpcmp-handle="pill"] .dp-cmp-handle { width: calc(var(--dpcmp-hs) * 1.3); height: calc(var(--dpcmp-hs) * 0.7); }
.dp-cmp[data-dpcmp-handle="pill"] .dp-cmp-arrows { width: 70%; height: 70%; }
.dp-cmp[data-dpcmp-handle="square"] .dp-cmp-handle { border-radius: calc(var(--dpcmp-hs) * 0.2); }
.dp-cmp[data-dpcmp-handle="line"] .dp-cmp-handle {
  width: calc(var(--dpcmp-lw) + 10px);
  height: calc(var(--dpcmp-hs) * 1.2);
  border-radius: 999px;
}
.dp-cmp[data-dpcmp-dir="vertical"][data-dpcmp-handle="line"] .dp-cmp-handle { width: calc(var(--dpcmp-hs) * 1.2); height: calc(var(--dpcmp-lw) + 10px); }
.dp-cmp[data-dpcmp-handle="line"] .dp-cmp-arrows { display: none; }
/* Line only: the handle is an invisible, easy-to-grab strip on the divider (still focusable for the keyboard). */
.dp-cmp[data-dpcmp-handle="none"] .dp-cmp-handle { width: 32px; height: 100%; top: 0; transform: translateX(-50%); border-radius: 0; background: none; box-shadow: none; }
.dp-cmp[data-dpcmp-dir="vertical"][data-dpcmp-handle="none"] .dp-cmp-handle { width: 100%; height: 32px; left: 0; top: var(--dpcmp-pos); transform: translateY(-50%); }
.dp-cmp[data-dpcmp-handle="none"] .dp-cmp-arrows { display: none; }
.dp-cmp[data-dpcmp-handle="none"] .dp-cmp-handle:focus-visible { box-shadow: inset 0 0 0 2px var(--dpcmp-line, #fff); }
.dp-cmp[data-dpcmp-handle="none"].is-dragging .dp-cmp-handle { transform: translateX(-50%); }
.dp-cmp[data-dpcmp-dir="vertical"][data-dpcmp-handle="none"].is-dragging .dp-cmp-handle { transform: translateY(-50%); }

/* Fade: the handle runs along a track at the bottom (10% to 90% of the width, as compare.js measures it). */
.dp-cmp .dp-cmp-track { display: none; }
.dp-cmp[data-dpcmp-style="fade"] .dp-cmp-track {
  position: absolute;
  z-index: 3;
  left: 10%;
  right: 10%;
  bottom: calc(var(--dpcmp-hs) / 2 + 16px);
  display: block;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  box-shadow: 0 0 10px rgba(6, 6, 6, 0.25);
  transform: translateY(50%);
  cursor: pointer;
}
.dp-cmp[data-dpcmp-style="fade"] .dp-cmp-track::before {
  content: "";
  position: absolute;
  inset: -14px 0;
}
.dp-cmp[data-dpcmp-style="fade"] .dp-cmp-handle {
  top: auto;
  bottom: 16px;
  left: calc(10% + 0.8 * var(--dpcmp-pos));
  transform: translateX(-50%);
  cursor: grab;
}
.dp-cmp[data-dpcmp-style="fade"].is-dragging .dp-cmp-handle { transform: translateX(-50%) scale(1.08); cursor: grabbing; }

/* Labels */
.dp-cmp .dp-cmp-label {
  position: absolute;
  z-index: 3;
  top: 16px;
  box-sizing: border-box;
  max-width: 40%;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(6, 6, 6, 0.6);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.dp-cmp .dp-cmp-label[hidden] { display: none; }
.dp-cmp .dp-cmp-label-before { left: 16px; }
.dp-cmp .dp-cmp-label-after { right: 16px; }
.dp-cmp[data-dpcmp-place="center"] .dp-cmp-label { top: 50%; transform: translateY(-50%); }
.dp-cmp[data-dpcmp-place="end"] .dp-cmp-label { top: auto; bottom: 16px; }
.dp-cmp[data-dpcmp-dir="vertical"] .dp-cmp-label-before { top: 16px; bottom: auto; transform: none; }
.dp-cmp[data-dpcmp-dir="vertical"] .dp-cmp-label-after { top: auto; bottom: 16px; right: auto; left: 16px; transform: none; }
.dp-cmp[data-dpcmp-dir="vertical"][data-dpcmp-place="center"] .dp-cmp-label { left: 50%; transform: translateX(-50%); }
.dp-cmp[data-dpcmp-dir="vertical"][data-dpcmp-place="end"] .dp-cmp-label { left: auto; right: 16px; }
/* Fade keeps its labels clear of the track. */
.dp-cmp[data-dpcmp-style="fade"][data-dpcmp-place="end"] .dp-cmp-label { bottom: calc(var(--dpcmp-hs) + 32px); }

/* Split Labels: the labels ride on either side of the divider. */
.dp-cmp[data-dpcmp-style="labels"] .dp-cmp-label-before { left: var(--dpcmp-pos); right: auto; transform: translateX(calc(-100% - 12px)); }
.dp-cmp[data-dpcmp-style="labels"] .dp-cmp-label-after { left: var(--dpcmp-pos); right: auto; transform: translateX(12px); }
.dp-cmp[data-dpcmp-style="labels"][data-dpcmp-place="center"] .dp-cmp-label { top: calc(50% - var(--dpcmp-hs) / 2 - 12px); transform: translate(calc(-100% - 12px), -100%); }
.dp-cmp[data-dpcmp-style="labels"][data-dpcmp-place="center"] .dp-cmp-label-after { transform: translate(12px, -100%); }
.dp-cmp[data-dpcmp-style="labels"][data-dpcmp-dir="vertical"] .dp-cmp-label { left: 16px; right: auto; bottom: auto; top: var(--dpcmp-pos); }
.dp-cmp[data-dpcmp-style="labels"][data-dpcmp-dir="vertical"] .dp-cmp-label-before { transform: translateY(calc(-100% - 12px)); }
.dp-cmp[data-dpcmp-style="labels"][data-dpcmp-dir="vertical"] .dp-cmp-label-after { transform: translateY(12px); }
.dp-cmp[data-dpcmp-style="labels"][data-dpcmp-dir="vertical"][data-dpcmp-place="center"] .dp-cmp-label { left: calc(50% + var(--dpcmp-hs) / 2 + 12px); }
.dp-cmp[data-dpcmp-style="labels"][data-dpcmp-dir="vertical"][data-dpcmp-place="end"] .dp-cmp-label { left: auto; right: 16px; }

@media (prefers-reduced-motion: reduce) {
  .dp-cmp .dp-cmp-handle { transition: none; }
}

/* A Box Shadow chosen for this element in the Design tab (None included) replaces its built-in shadow. */
.dp-sh-cmphandle .dp-cmp-handle { --dp-sh: none; --dp-sh-o: 0 0 #0000; }

/* Background defaults for the elements with a Background setting in the Design tab, as Divi gives its own
   modules (Cover, centred, no repeat): Divi only prints these when they are changed. Low priority, so any value set wins. */
:where(.dp-cmp-label):not(#dp) { background-size: cover; background-position: 50%; background-repeat: no-repeat; }
