/* Starmaker Toolkit 前後對比滑桿。
   「治療後」的圖在下層並決定高度；「治療前」疊在上層，用 clip-path 只露出分隔線左邊。
   分隔線位置是 --sm-ba-pos，由 before-after.js 更新。 */
.sm-ba{
	position:relative;
	overflow:hidden;
	box-sizing:border-box;
	width:100%;
	border-radius:var(--sm-ba-radius,0);
	line-height:0;
	/* 觸控時左右拖曳給滑桿，上下仍可捲動頁面。 */
	touch-action:pan-y pinch-zoom;
	user-select:none;
	-webkit-user-select:none;
	-webkit-tap-highlight-color:transparent;
	cursor:ew-resize;
}
.sm-ba *,.sm-ba *::before,.sm-ba *::after{box-sizing:border-box}

.sm-ba .sm-ba-img{
	display:block;
	width:100%;
	max-width:none;
	height:auto;
	margin:0;
	border:0;
	border-radius:0;
	box-shadow:none;
	pointer-events:none;
	-webkit-user-drag:none;
}
.sm-ba .sm-ba-before{
	position:absolute;
	inset:0;
	clip-path:inset(0 calc(100% - var(--sm-ba-pos,50%)) 0 0);
}
.sm-ba .sm-ba-before .sm-ba-img{height:100%;object-fit:cover}

/* 覆蓋色：一直有的與滑過時的 */
.sm-ba::after{
	content:"";
	position:absolute;
	inset:0;
	z-index:1;
	background-color:var(--sm-ba-overlay,transparent);
	pointer-events:none;
	transition:background-color .5s;
}
@media (hover:hover){
	.sm-ba:hover::after{background-color:var(--sm-ba-overlay-hover,var(--sm-ba-overlay,transparent))}
}

/* 標籤：外層蓋滿高度負責上中下位置，內層文字負責底色、內距與圓角。 */
.sm-ba .sm-ba-label{
	position:absolute;
	z-index:2;
	top:var(--sm-ba-label-inset,10px);
	bottom:var(--sm-ba-label-inset,10px);
	display:flex;
	align-items:var(--sm-ba-label-y,flex-start);
	line-height:normal;
	pointer-events:none;
	transition:opacity .3s;
}
.sm-ba .sm-ba-label-before{left:var(--sm-ba-label-inset,10px)}
.sm-ba .sm-ba-label-after{right:var(--sm-ba-label-inset,10px)}
.sm-ba .sm-ba-label-text{
	padding:var(--sm-ba-label-pad,0 20px);
	border-radius:var(--sm-ba-label-radius,2px);
	background-color:var(--sm-ba-label-bg,rgba(255,255,255,.2));
	color:var(--sm-ba-label-fg,#fff);
	font-size:13px;
	letter-spacing:.1em;
	line-height:38px;
	white-space:nowrap;
}
.sm-ba-labels-hover .sm-ba-label{opacity:0}
.sm-ba-labels-hover:focus-within .sm-ba-label{opacity:1}
@media (hover:hover){
	.sm-ba-labels-hover:hover .sm-ba-label{opacity:1}
}
@media (hover:none){
	.sm-ba-labels-hover .sm-ba-label{opacity:1}
}

/* 分隔線與把手 */
.sm-ba .sm-ba-handle{
	position:absolute;
	z-index:3;
	top:0;
	bottom:0;
	left:var(--sm-ba-pos,50%);
	display:flex;
	align-items:center;
	justify-content:center;
	width:0;
	outline:0;
	cursor:ew-resize;
}
/* 線分成上下兩段，在圓圈處斷開，和 UAEL 一樣不穿過圓圈。 */
.sm-ba .sm-ba-handle::before,
.sm-ba .sm-ba-handle::after{
	content:"";
	position:absolute;
	left:calc(var(--sm-ba-line,3px) / -2);
	width:var(--sm-ba-line,3px);
	background-color:var(--sm-ba-handle,#fff);
}
.sm-ba .sm-ba-handle::before{top:0;bottom:calc(50% + var(--sm-ba-circle,44px) / 2)}
.sm-ba .sm-ba-handle::after{top:calc(50% + var(--sm-ba-circle,44px) / 2);bottom:0}
.sm-ba .sm-ba-circle{
	position:relative;
	display:flex;
	flex:none;
	align-items:center;
	justify-content:center;
	gap:calc(var(--sm-ba-tri,6px) * 1.2);
	width:var(--sm-ba-circle,44px);
	height:var(--sm-ba-circle,44px);
	border:var(--sm-ba-circle-bw,3px) solid var(--sm-ba-handle,#fff);
	border-radius:50%;
	background-color:var(--sm-ba-circle-bg,transparent);
	box-shadow:var(--sm-ba-shadow,none);
}
.sm-ba .sm-ba-handle:focus-visible .sm-ba-circle{outline:2px solid var(--sm-ba-handle,#fff);outline-offset:3px}
.sm-ba .sm-ba-tri{
	width:0;
	height:0;
	border:var(--sm-ba-tri,6px) solid transparent;
}
.sm-ba .sm-ba-tri-l{border-left-width:0;border-right-color:var(--sm-ba-handle,#fff)}
.sm-ba .sm-ba-tri-r{border-right-width:0;border-left-color:var(--sm-ba-handle,#fff)}
