/* Blocco prima-dopo — slider comparativo */

.b-pd__title {
  margin-bottom: var(--sp-8);
}

.b-pd__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--sp-8);
}

.b-pd__case {
  margin: 0;
}

.b-pd__compare {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  --pos: 50%;
}

.b-pd__after,
.b-pd__before {
  position: absolute;
  inset: 0;
}

.b-pd__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.b-pd__before {
  clip-path: inset(0 calc(100% - var(--pos)) 0 0);
}

.b-pd__handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--pos);
  width: 3px;
  background: #fff;
  translate: -50% 0;
  box-shadow: 0 0 8px rgb(0 0 0 / 0.4);
  pointer-events: none;
}

.b-pd__handle::after {
  content: '⟷';
  position: absolute;
  top: 50%;
  left: 50%;
  translate: -50% -50%;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #fff;
  color: var(--c-primary-dark);
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

.b-pd__tag {
  position: absolute;
  bottom: var(--sp-3);
  padding: 2px 12px;
  border-radius: var(--radius-pill);
  background: rgb(0 0 0 / 0.6);
  color: #fff;
  font-size: var(--fs-sm);
  font-weight: 600;
}

.b-pd__tag--prima {
  left: var(--sp-3);
}

.b-pd__tag--dopo {
  right: var(--sp-3);
}

/* Range invisibile sopra tutto: accessibile da tastiera e touch */
.b-pd__range-label {
  position: absolute;
  inset: 0;
}

.b-pd__range {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: ew-resize;
  margin: 0;
}

.b-pd__range:focus-visible ~ * {
  outline: none;
}

.b-pd__compare:has(.b-pd__range:focus-visible) {
  outline: 3px solid var(--c-primary);
  outline-offset: 3px;
}

.b-pd__caption {
  text-align: center;
  margin-top: var(--sp-3);
  color: var(--c-text-muted);
  font-size: var(--fs-sm);
}
