/* Before/after stage. split-stage.js writes --mw-split (0..1, the divider's
   distance from the left edge) on .mw-split and builds .mw-split__ui (the line
   and the slider handle). Every .mw-split__before and .mw-split__after layer
   fills the stage, so the two insets meet exactly at the divider.
   Tokens:
     --mw-split-line         divider colour (default #fff)
     --mw-split-line-edge    hairline on both sides of it, for light media
     --mw-split-handle-bg    handle fill (#fff)
     --mw-split-handle-fg    chevrons and ring (#121212)
     --mw-split-handle-y     vertical position of the handle (50%)
   Without JavaScript: a static 50/50 stage, call to action shown. Needs
   runway.css when the stage is pinned. */

.mw-split {
  --mw-split-line: #fff;
  --mw-split-line-edge: rgb(0 0 0 / .55);
  --mw-split-handle-bg: #fff;
  --mw-split-handle-fg: #121212;
  position: relative;
}
.mw-split:not(.mw-runway),
.mw-split > .mw-runway__stage { isolation: isolate; }

.mw-split__before,
.mw-split__after {
  position: absolute;
  inset: 0;
}
.mw-split__before { clip-path: inset(0 calc((1 - var(--mw-split, .5)) * 100%) 0 0); }
.mw-split__after { clip-path: inset(0 0 0 calc(var(--mw-split, .5) * 100%)); }

.mw-split__ui {
  position: absolute;
  inset: 0;
  z-index: 4;
  overflow: hidden;
  overflow: clip;
  pointer-events: none;
}

.mw-split__line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -1.5px;
  width: 3px;
  background: var(--mw-split-line);
  box-shadow: 0 0 0 1px var(--mw-split-line-edge);
}

/* 52 px: a target larger than 44 px that the thumb can find while scrolling. */
.mw-split__handle {
  position: absolute;
  top: calc(var(--mw-split-handle-y, 50%) - 26px);
  left: -26px;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--mw-split-handle-bg);
  color: var(--mw-split-handle-fg);
  box-shadow: 0 0 0 2px var(--mw-split-handle-fg), var(--mw-split-handle-shadow, 0 12px 32px -10px rgb(0 0 0 / .55));
  cursor: grab;
  pointer-events: auto;
  touch-action: none;
  transition: scale .25s var(--mw-ease, cubic-bezier(.16, 1, .3, 1));
}
.mw-split__handle:hover { scale: 1.06; }
.mw-split--dragging .mw-split__handle { cursor: grabbing; scale: 1.08; }
/* Dark, light, dark: the ring reads on any media behind it. */
.mw-split__handle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--mw-split-handle-fg), 0 0 0 5px var(--mw-split-handle-bg), 0 0 0 8px var(--mw-split-handle-fg);
}

/* Call to action of the after side: shown at the end of the sweep, under
   reduced motion and without JavaScript. The swap is a class with a timed
   fade, never an opacity that follows the scroll. */
.mw-split__cta {
  transition: opacity .5s var(--mw-ease, cubic-bezier(.16, 1, .3, 1)), translate .5s var(--mw-ease, cubic-bezier(.16, 1, .3, 1)), visibility 0s;
}
.mw-split--live:not(.mw-split--end) .mw-split__cta {
  opacity: 0;
  translate: 0 14px;
  visibility: hidden;
  transition: opacity .25s ease, translate .25s ease, visibility 0s linear .25s;
}

@media (prefers-reduced-motion: reduce) {
  .mw-split__handle,
  .mw-split__cta { transition: none; }
}
