/* images-wipe.css: the catch band's wipe on Images (lib/site/parts/wipe.ts, lib/site/pages/imagery.ts CATCH_WIPE, the
   right column of #catch since go-live; go-live A3, Sarah sNgnLIiwfPqu). js/pages/images-wipe.js drives it. Every rule
   is under .im-wipe or .im-wipe__brand, which only that part prints.

   As printed (no script, reduced motion) the flagged and the repaired frame stand one above the other, each with its
   label under it. Live (.is-live), the two share one box: the flagged frame is clipped to the left of the divider at
   --x, the handle rides the divider, and the labels sit at their own ends under the box.

   Size: never wider than 892px, the narrower file's own width, so neither frame is drawn above its pixels; and short
   enough that a whole frame and its labels fit in the window under the header, but never under 300px wide. The
   example label over the box (.im-wipe__brand, the part's `brand` option) takes the same width, so it starts at the
   frame's left edge however narrow the box gets. */

.im-wipe,
.im-wipe__brand {
  width: min(100%, 892px, max(300px, calc((100vh - 190px) * 896 / 1200)));
  max-width: 892px;
  margin-inline: auto;
}
@supports (height: 100svh) {
  .im-wipe,
  .im-wipe__brand { width: min(100%, 892px, max(300px, calc((100svh - 190px) * 896 / 1200))); }
}
/* the kit's .fp-brand margin (feature.css, loaded after this sheet) would undo the centring: same space under it */
.im-wipe__brand.fp-brand { margin: 0 auto 10px; }
.im-wipe {
  --x: 50%;
  --wipe-tag: 40px;
  display: grid;
  gap: clamp(20px, 3vw, 32px);
}
.im-wipe__frame { margin: 0; min-width: 0; }
.im-wipe__img {
  display: block; width: 100%; height: auto; aspect-ratio: var(--wipe-ratio, 896 / 1200); object-fit: cover;
  border-radius: var(--radius); background: var(--studio-2);
}
.im-wipe__tag { margin: 10px 0 0; display: flex; }
.im-wipe__handle { display: none; }

/* live: one box, the flagged frame over the repaired one */
.im-wipe.is-live {
  position: relative; gap: 0;
  touch-action: pan-y; user-select: none; -webkit-user-select: none; cursor: ew-resize;
}
.im-wipe.is-live .im-wipe__frame { grid-area: 1 / 1; }
.im-wipe.is-live .im-wipe__frame[data-side="before"] { position: relative; z-index: 2; }
.im-wipe.is-live .im-wipe__frame[data-side="before"] .im-wipe__img { clip-path: inset(0 calc(100% - var(--x)) 0 0); background: none; }
.im-wipe.is-live .im-wipe__tag { height: var(--wipe-tag); margin: 0; align-items: flex-end; }
.im-wipe.is-live .im-wipe__frame[data-side="after"] .im-wipe__tag { justify-content: flex-end; }
.im-wipe.is-live .im-wipe__img { -webkit-user-drag: none; pointer-events: none; }

/* the handle: a 44px-wide button riding the divider; the line and the grip are drawn inside it. pan-y like the box, so a
   swipe up or down that starts on it still scrolls the page; images-wipe.js turns a sideways finger into the drag */
.im-wipe.is-live .im-wipe__handle {
  display: block; position: absolute; z-index: 3; top: 0; bottom: var(--wipe-tag); left: var(--x);
  width: 44px; margin: 0 0 0 -22px; padding: 0; border: 0; background: none; cursor: ew-resize; outline: none;
  touch-action: pan-y;
}
.im-wipe.is-live .im-wipe__handle::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; margin-left: -1px;
  background: var(--paper, #f6f3ec); box-shadow: 0 0 0 1px rgba(21, 23, 28, .35);
}
.im-wipe__grip {
  position: absolute; top: 50%; left: 50%; width: 40px; height: 40px; margin: -20px 0 0 -20px; border-radius: 50%;
  background: var(--ink); box-shadow: 0 0 0 2px var(--paper, #f6f3ec), 0 6px 18px -6px rgba(17, 22, 39, .5);
}
/* two small arrows, pointing out */
.im-wipe__grip::before,
.im-wipe__grip::after {
  content: ""; position: absolute; top: 50%; width: 0; height: 0; margin-top: -5px;
  border-top: 5px solid transparent; border-bottom: 5px solid transparent;
}
.im-wipe__grip::before { left: 9px; border-right: 7px solid var(--paper, #f6f3ec); }
.im-wipe__grip::after { right: 9px; border-left: 7px solid var(--paper, #f6f3ec); }
.im-wipe.is-live .im-wipe__handle:focus-visible .im-wipe__grip { box-shadow: 0 0 0 2px var(--paper, #f6f3ec), 0 0 0 5px var(--sapphire); }

/* reduced motion: the script never goes live; if it ever did, nothing would be clipped or moved */
@media (prefers-reduced-motion: reduce) {
  .im-wipe.is-live { gap: clamp(20px, 3vw, 32px); cursor: default; }
  .im-wipe.is-live .im-wipe__frame { grid-area: auto; }
  .im-wipe.is-live .im-wipe__frame[data-side="before"] .im-wipe__img { clip-path: none; }
  .im-wipe.is-live .im-wipe__handle { display: none; }
}
