/* ══ Image compare ════════════════════════════════════════ */
/* Bencho's "Image compare" (MIT, bencho.dev/licence); js/ux/image-compare.js builds it. The prefix is .icmp: .cmp is the Compare sheet's class on #sheet.
   Bencho's tokens are mapped once here, on the root, so nothing leaks out:
     --fill-on, as the ground under the pictures  → --mf-ground-dark (the app's full-screen dark ground)
     --fill-slab / --card, the knob               → --primary-bg (the one bright surface in R13)
     --fill-on / --ink, the glyph on the knob     → --primary-fg
     --signal, the focus ring                     → --primary-bg (the app has no colour accent: silver)
     --font-ui                                    → --sans
   The R13 tokens fall back to their own values, because ?r13=0 removes them. */
.icmp {
  --icmp-ground: var(--mf-ground-dark, #0e0e10);
  --icmp-slab: var(--primary-bg, #f5f5f7);
  --icmp-on: var(--primary-fg, #1d1d1f);
  --icmp-signal: var(--primary-bg, #f5f5f7);
  position: relative;
  overflow: hidden;
  touch-action: none;
  cursor: ew-resize;
  outline: none;
  user-select: none;
  -webkit-user-select: none;
  background: var(--icmp-ground);}

.icmp-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  -webkit-user-drag: none;}

/* no drift now: two separate photographs have to stay exactly in
   register, or the x-ray stops lining up with the picture */
.icmp-before { position: absolute; inset: 0; will-change: clip-path; }

/* the app's photo-label smoke, without Bencho's backdrop blur: the line sweeps under the tags every frame, and the performance budget
   (css/tokens.css) keeps labels free of backdrop-filter */
.icmp-tag {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--mf-smoke-photo, rgba(23, 24, 26, 0.56));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12);
  color: #fff;
  font-family: var(--sans);
  font-size: max(12px, .75rem);
  font-weight: 500;
  pointer-events: none;
  letter-spacing: 0em;}

.icmp-tag.icmp-right { left: auto; right: 12px; }

/* the line is drawn, so it can bend: a 2px white curve with a
   soft glow, over the whole block. The glow is two wide faint strokes rather than Bencho's filter: drop-shadow, which would
   redraw across the whole stage every frame on the showroom's tablets (no live filters: the performance budget) */
.icmp-line {
  position: absolute;
  inset: 0;
  overflow: visible;
  pointer-events: none;}

.icmp-line path { fill: none; stroke: #fff; }
.icmp-line .icmp-core { stroke-width: 2; }
.icmp-line .icmp-glow-n { stroke-width: 5; stroke-opacity: .16; }
.icmp-line .icmp-glow-w { stroke-width: 11; stroke-opacity: .08; }

.icmp-grip { position: absolute; top: 0; bottom: 0; left: 0; width: 0; pointer-events: none; will-change: transform; }

.icmp-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 36px;
  height: 36px;
  translate: -50% -50%;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--icmp-slab);
  color: var(--icmp-on);
  box-shadow: 0 2px 12px rgba(23, 24, 26, 0.25);
  transition: scale 220ms cubic-bezier(0.24, 1.34, 0.38, 1);}

.icmp:hover .icmp-knob { scale: 1.08; }

.icmp[data-held] .icmp-knob { scale: 0.9; }

/* the block fills the stage here, so a ring around it would sit off screen: the knob wears it instead */
.icmp:focus-visible .icmp-knob { box-shadow: 0 0 0 2px var(--icmp-ground), 0 0 0 4px var(--icmp-signal), 0 2px 12px rgba(23, 24, 26, 0.25); }

@media (hover: none) { .icmp:hover .icmp-knob { scale: none; } .icmp[data-held] .icmp-knob { scale: 0.9; } }

@media (prefers-reduced-motion: reduce) {
  .icmp-knob { transition: none; }
  .icmp:hover .icmp-knob, .icmp[data-held] .icmp-knob { scale: none; }
}

/* ---------- in the Today <-> On completion sheet ---------- */
#sheet .ux-w .icmp-tag { top: 1.4rem; padding: .5rem 1rem; line-height: 1; }
#sheet .ux-w .icmp-tag:not(.icmp-right) { left: 1.6rem; }
#sheet .ux-w .icmp-tag.icmp-right { right: 5.4rem; }   /* clear of the sheet's close button */
