/* DEPLA before/after. Reference: docs/referenz/messestaende/1440-full.png ("Wie gezeichnet, so gebaut!").
   Before image on the left, after image on the right, white 2px line, round handle without fill. */
.c-beforeafter {
  --ba-pos: 50%;
  --ba-line: 2px;
  --ba-handle: 44px;
  position: relative;
  overflow: hidden;
  touch-action: pan-y;
  user-select: none;
  cursor: ew-resize;
}
.c-beforeafter img { display: block; width: 100%; height: auto; max-width: none; -webkit-user-drag: none; pointer-events: none; }
.c-beforeafter__before {
  position: absolute;
  inset: 0;
  clip-path: inset(0 calc(100% - var(--ba-pos)) 0 0);
}
.c-beforeafter__before img { width: 100%; height: 100%; object-fit: cover; }
.c-beforeafter__handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--ba-pos);
  width: var(--ba-line);
  margin-left: calc(var(--ba-line) / -2);
  /* line stops at the circle like live, no line through the arrows */
  background: linear-gradient(to bottom,
    var(--color-white) calc(50% - var(--ba-handle) / 2),
    transparent 0 calc(50% + var(--ba-handle) / 2),
    var(--color-white) 0);
  pointer-events: none;
  z-index: 3;
}
.c-beforeafter__handle::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--ba-handle);
  height: var(--ba-handle);
  box-sizing: border-box;
  border: 3px solid var(--color-white);
  border-radius: var(--radius-circle);
  box-shadow: var(--shadow-compare-handle);
  transform: translate(-50%, -50%);
}
/* arrows inside the circle like live (twentytwenty): two 6px triangles, 10px gap in the middle */
.c-beforeafter__handle::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 34px;
  height: 12px;
  background: var(--color-white);
  clip-path: polygon(0 50%, 6px 0, 6px 100%, 0 50%, 100% 50%, calc(100% - 6px) 0, calc(100% - 6px) 100%, 100% 50%);
  transform: translate(-50%, -50%);
}
/* range stays in the DOM for keyboard and screen readers, visually hidden */
.c-beforeafter__range {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
  opacity: 0;
}
.c-beforeafter:not(.is-ready) .c-beforeafter__range { display: none; }
.c-beforeafter:has(.c-beforeafter__range:focus-visible) .c-beforeafter__handle::before {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}
.c-beforeafter:not(.is-ready) { cursor: default; }
