/* ============================================================
   Signature Homeworx — Before/After widget.
   Brand tokens: edit this block to re-skin.
   ============================================================ */
.shx-ba {
  --pos: 50%;
  --posn: 0.5;
  --shxba-navy: #0D0040;
  --shxba-navy-hover: #251a5e;
  --shxba-white: #ffffff;
  --shxba-font: 'Outfit', system-ui, sans-serif;
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  line-height: 0;
  user-select: none;
  -webkit-user-select: none;
}

.shx-ba__after { display: block; width: 100%; height: auto; }

.shx-ba__before-wrap {
  position: absolute;
  inset: 0;
  clip-path: inset(0 calc(100% - var(--pos)) 0 0);
}
.shx-ba__before { display: block; width: 100%; height: 100%; object-fit: cover; }

.shx-ba__divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--pos);
  width: 2px;
  margin-left: -1px;
  background: var(--shxba-white);
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.35);
}
.shx-ba__handle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--shxba-navy);
  color: var(--shxba-white);
  display: flex;
  align-items: center;
  justify-content: center;
  font: 700 18px/1 Arial, sans-serif;
  letter-spacing: 2px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s, background 0.15s;
}
.shx-ba:hover .shx-ba__handle { background: var(--shxba-navy-hover); }
.shx-ba:active .shx-ba__handle { transform: translate(-50%, -50%) scale(1.12); }

.shx-ba__label {
  position: absolute;
  top: 12px;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(13, 0, 64, 0.85);
  color: var(--shxba-white);
  font-family: var(--shxba-font);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.08em;
  transition: opacity 0.25s;
}
/* Each label fades out as the divider pushes into its side. */
.shx-ba__label--before { left: 12px; opacity: clamp(0, (var(--posn) - 0.08) * 12.5, 1); }
.shx-ba__label--after { right: 12px; opacity: clamp(0, (0.92 - var(--posn)) * 12.5, 1); }
.shx-ba--nolabels .shx-ba__label { display: none; }

.shx-ba__range {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: ew-resize;
  -webkit-appearance: none;
  appearance: none;
}

/* Focus ring for keyboard users (focus-within fallback, :focus-visible where supported) */
.shx-ba:focus-within { outline: 3px solid var(--shxba-navy-hover); outline-offset: 2px; }
@supports selector(:has(*)) {
  .shx-ba:focus-within { outline: none; }
  .shx-ba:has(.shx-ba__range:focus-visible) { outline: 3px solid var(--shxba-navy-hover); outline-offset: 2px; }
}

@media (prefers-reduced-motion: reduce) {
  .shx-ba__handle, .shx-ba__label { transition: none; }
}
