/* Landing hero's before/after slider (templates/core/partials/landing_hero.html). --x is the
   handle's position: the original shows left of it, the finished photo right of it.
   static/js/landing-hero.js moves it with scroll; it rests at 50% otherwise. */

.compare {
  --x: 50%;
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  background: var(--muted);
  isolation: isolate;
}
.compare > svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.compare-after {
  clip-path: inset(0 0 0 var(--x));
}
.compare-line {
  position: absolute;
  inset-block: 0;
  left: var(--x);
  width: 2px;
  translate: -50% 0;
  background: var(--background);
  pointer-events: none;
}
/* The knob follows the line but stays inside the photo at either end. */
.compare-knob {
  position: absolute;
  top: 50%;
  left: clamp(1.0625rem, var(--x), calc(100% - 1.0625rem));
  pointer-events: none;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  translate: -50% -50%;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--background);
  color: var(--muted-foreground);
  box-shadow: 0 1px 3px rgb(15 23 42 / 0.12);
}
.compare-tag {
  position: absolute;
  top: 0.75rem;
  padding: 0.125rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 4px);
  background: var(--background);
  color: var(--muted-foreground);
  font-size: 0.75rem;
  pointer-events: none;
}
.compare-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: ew-resize;
}
.compare:has(.compare-input:focus-visible) {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

/* The steps under the photo tick on as the wipe passes them. */
.compare-step {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted-foreground);
  transition: color 200ms ease;
}
.compare-step svg {
  color: var(--border);
  transition: color 200ms ease;
}
.compare-step[data-done] {
  color: var(--foreground);
}
.compare-step[data-done] svg {
  color: var(--primary);
}
