/* No.16 ビフォーアフター比較スライダー */

.ba-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(28px, 5vw, 64px) clamp(16px, 4vw, 48px) clamp(36px, 6vw, 72px);
  background:
    radial-gradient(circle at 12% 0%, rgba(83, 169, 175, 0.1), transparent 42%),
    var(--surface-1);
}

.ba-wrap { width: min(940px, 100%); }

.ba-frame {
  --pos: 50%;
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  border-radius: 4px 22px 22px 22px;
  box-shadow: 0 22px 56px rgba(40, 107, 112, 0.16);
  touch-action: pan-y;
  user-select: none;
  cursor: ew-resize;
  background: var(--surface-2);
}

.ba-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

/* 「補正前」の見え方をこの見本のためにCSSで再現する（詳細はページ下部の注記） */
.ba-img-before {
  filter: saturate(0.28) brightness(0.66) contrast(0.82) sepia(0.3) blur(1px);
}

.ba-after {
  position: absolute;
  inset: 0;
  clip-path: inset(0 0 0 var(--pos));
}

.ba-tag {
  position: absolute;
  top: 16px;
  z-index: 3;
  padding: 6px 13px;
  border-radius: 999px;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  pointer-events: none;
}
.ba-tag-before {
  left: 16px;
  color: #fffdf8;
  background: rgba(63, 70, 72, 0.62);
}
.ba-tag-after {
  right: 16px;
  color: #fffdf8;
  background: rgba(40, 107, 112, 0.78);
}

.ba-handle {
  position: absolute;
  top: 0;
  left: var(--pos);
  z-index: 4;
  width: 0;
  height: 100%;
  pointer-events: none;
}
.ba-handle-line {
  position: absolute;
  top: 0;
  left: -1.5px;
  width: 3px;
  height: 100%;
  background: rgba(255, 253, 248, 0.94);
  box-shadow: 0 0 14px rgba(40, 107, 112, 0.4);
}
.ba-handle-grip {
  position: absolute;
  top: 50%;
  left: 0;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin: -26px 0 0 -26px;
  color: var(--brand-deep);
  background: rgba(255, 253, 248, 0.96);
  border-radius: 50%;
  box-shadow: 0 8px 22px rgba(40, 107, 112, 0.3);
  transition: transform 0.25s ease;
}
.ba-frame.is-dragging .ba-handle-grip { transform: scale(1.12); }

/* キーボード操作とスクリーンリーダーのための実体。見た目は透明にして枠全体に重ねる */
.ba-range {
  position: absolute;
  inset: 0;
  z-index: 5;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  opacity: 0;
  cursor: ew-resize;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
}
.ba-range:focus-visible { outline: none; }
.ba-frame:has(.ba-range:focus-visible) {
  outline: 3px solid rgba(83, 169, 175, 0.55);
  outline-offset: 4px;
}

.ba-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.ba-note {
  margin: 22px 0 0;
  color: var(--text-2);
  font-size: 14.9px;
  text-align: center;
}
.ba-disclaimer {
  max-width: 640px;
  margin: 10px auto 0;
  color: var(--text-3);
  font-size: 13px;
  line-height: 1.75;
  text-align: center;
}

@media (max-width: 600px) {
  .ba-frame { aspect-ratio: 4 / 3.4; border-radius: 4px 16px 16px 16px; }
  .ba-handle-grip { width: 44px; height: 44px; margin: -22px 0 0 -22px; }
  .ba-tag { top: 12px; font-size: 11px; padding: 5px 10px; }
  .ba-tag-before { left: 12px; }
  .ba-tag-after { right: 12px; }
}
