/*
 * ------------------------------------------------------------------------
 * Before/After 比較スライダー（共通コンポーネント）
 * 使用箇所: lp-kyousei 症例枠 / 診療内容ページ フェイススキャン
 * JS: js/oc-before-after.js
 * ------------------------------------------------------------------------
 */
.oc-ba {
	--oc-ba-pos: 50%;
	position: relative;
	/* 内部の重なり順をスライダー内に限定する */
	isolation: isolate;
	display: block;
	width: 100%;
	overflow: hidden;
	background-color: #e9eef2;
	cursor: ew-resize;
	/* 横方向の操作だけを受け取り、縦スクロールはブラウザに任せる */
	touch-action: pan-y;
	-webkit-user-select: none;
	user-select: none;
	-webkit-tap-highlight-color: transparent;
}
.oc-ba__img {
	display: block;
	width: 100%;
	height: auto;
	margin: 0;
	pointer-events: none;
	-webkit-user-drag: none;
}
/* After は通常フローで枠の高さを決める */
.oc-ba__img--after {
	position: relative;
}
/* Before は同じ大きさで上に重ね、見える範囲だけを切り取る（画像は伸縮しない） */
.oc-ba__img--before {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	-webkit-clip-path: inset(0 calc(100% - var(--oc-ba-pos)) 0 0);
	clip-path: inset(0 calc(100% - var(--oc-ba-pos)) 0 0);
}
/* 境界線 */
.oc-ba::before {
	content: "";
	position: absolute;
	top: 0;
	bottom: 0;
	left: var(--oc-ba-pos);
	width: 2px;
	margin-left: -1px;
	background-color: #fff;
	box-shadow: 0 0 4px rgba(0, 0, 0, 0.35);
	pointer-events: none;
	z-index: 2;
}
/* つまみ */
.oc-ba__handle {
	position: absolute;
	top: 50%;
	left: var(--oc-ba-pos);
	z-index: 3;
	width: 44px;
	height: 44px;
	margin: -22px 0 0 -22px;
	padding: 0;
	border: 2px solid #fff;
	border-radius: 50%;
	background-color: rgba(255, 255, 255, 0.5);
	box-shadow: 0 1px 6px rgba(0, 0, 0, 0.3);
	cursor: ew-resize;
	touch-action: pan-y;
	-webkit-appearance: none;
	appearance: none;
}
.oc-ba__handle::before,
.oc-ba__handle::after {
	content: "";
	position: absolute;
	top: 50%;
	width: 9px;
	height: 9px;
	border-top: 2px solid #444;
	border-left: 2px solid #444;
}
.oc-ba__handle::before {
	left: 11px;
	transform: translateY(-50%) rotate(-45deg);
}
.oc-ba__handle::after {
	right: 11px;
	transform: translateY(-50%) rotate(135deg);
}
.oc-ba__handle:focus {
	outline: none;
}
.oc-ba__handle:focus-visible {
	outline: 2px solid #6a99dc;
	outline-offset: 2px;
}
.oc-ba.is-dragging .oc-ba__handle {
	background-color: rgba(255, 255, 255, 0.75);
}
/* Before / After ラベル（左上・右上に常時表示） */
.oc-ba__label {
	position: absolute;
	top: 8px;
	z-index: 2;
	padding: 2px 8px;
	border-radius: 2px;
	background-color: rgba(0, 0, 0, 0.45);
	color: #fff;
	font-size: 11px;
	font-weight: 500;
	line-height: 1.6;
	letter-spacing: 0.06em;
	white-space: nowrap;
	pointer-events: none;
}
.oc-ba__label--before {
	left: 8px;
}
.oc-ba__label--after {
	right: 8px;
}
@media (prefers-reduced-motion: no-preference) {
	.oc-ba:not(.is-dragging) .oc-ba__img--before,
	.oc-ba:not(.is-dragging)::before,
	.oc-ba:not(.is-dragging) .oc-ba__handle {
		transition: clip-path 0.12s ease-out, left 0.12s ease-out;
	}
}
