/*
 * 코치 마크(x-ui.coach-mark · public/js/coach-mark.js) — 화면의 한 곳을 빨간 화살표 · 테두리 · 고리 하나 · 말풍선으로 짚는다
 * (SSOT 11절 "무료 체험 예약 따라하기", 2026-11-17 사용자 지시 "빨간색 화살표로 어디를 누르라고 강하게").
 * 맨 위 층(popover)에 화면 전체 크기로 놓고 눌리지 않는다(pointer-events: none) — 짚은 것은 그대로 눌린다.
 * 자리는 JS 가 --coach-* (화면 좌표 px)로 넣는다. 좌표가 물리 좌표라 방향은 늘 ltr 이고, 말풍선 글만 그 언어의 방향을 따른다.
 * 움직임은 화살표의 튐과 고리 하나뿐 — 몇 번 하고 멈춘다(JS 가 몇 초마다 다시 시작). 움직임 줄이기에서는 가만히 서 있다.
 */
.coach-mark {
	/* 빨강은 팔레트 값 — 테마의 위험 색(danger)은 다크에서 옅은 분홍이라 "빨간 화살표"가 되지 않는다(2026-11-17 실측). 세 테마에서 같은 빨강이다 */
	--coach-color: color-mix(in srgb, var(--wa-color-red-40) 50%, var(--wa-color-red-50));
	--coach-on: var(--wa-color-red-95);
	--coach-size: 3.5rem;
	position: fixed;
	inset: 0;
	inline-size: 100%;
	block-size: 100%;
	max-inline-size: none;
	max-block-size: none;
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	pointer-events: none;
	overflow: hidden;
	direction: ltr;
}
.coach-mark > span { position: absolute; }
.coach-mark[data-off] > span { visibility: hidden; }
/* 짚은 것의 테두리(가만히) · 그 위에서 한 번씩 퍼지는 고리 하나 */
.coach-mark-ring,
.coach-mark-pulse {
	box-sizing: border-box;
	inset-inline-start: var(--coach-x, 0);
	inset-block-start: var(--coach-y, 0);
	inline-size: var(--coach-w, 0);
	block-size: var(--coach-h, 0);
	border: 3px solid var(--coach-color);
	border-radius: var(--coach-radius, var(--wa-border-radius-l));
}
.coach-mark-ring { box-shadow: 0 0 0 4px color-mix(in srgb, var(--coach-color) 24%, transparent); }
.coach-mark-pulse { opacity: 0; }
/* 화살표 — 끝이 짚은 곳(--coach-tip-*)에 닿는다. 위에서 내려 짚는 것이 기본, data-side="bottom" 이면 아래에서 올려 짚는다 */
.coach-mark-arrow {
	inset-inline-start: var(--coach-tip-x, 0);
	inset-block-start: var(--coach-tip-y, 0);
	translate: -50% -100%;
	color: var(--coach-color);
	font-size: var(--coach-size);
	line-height: 1;
	filter: drop-shadow(0 0 2px var(--coach-on)) drop-shadow(0 0 2px var(--coach-on)) drop-shadow(0 4px 6px color-mix(in srgb, var(--wa-color-text-normal) 35%, transparent));
}
.coach-mark[data-side='bottom'] .coach-mark-arrow { translate: -50% 0; rotate: 180deg; }
.coach-mark-arrow > i { display: block; }
/* 말풍선 — 화살표 꼬리 쪽. 빨간 바탕 · 흰 굵은 글자 */
.coach-mark-bubble {
	box-sizing: border-box;
	inset-inline-start: var(--coach-bubble-x, 0);
	inset-block-start: var(--coach-bubble-y, 0);
	max-inline-size: min(21rem, calc(100vw - 1rem));
	padding: var(--wa-space-xs) var(--wa-space-m);
	border: 2px solid var(--coach-on);
	border-radius: var(--wa-border-radius-l);
	background: var(--coach-color);
	color: var(--coach-on);
	font-size: var(--wa-font-size-m);
	font-weight: var(--wa-font-weight-bold);
	line-height: 1.35;
	text-align: center;
	text-wrap: balance;
	box-shadow: var(--wa-shadow-l);
}
:lang(ko) .coach-mark-bubble { word-break: keep-all; }
.coach-mark-bubble > span { display: block; }
.coach-mark-bubble:has(> span:empty) { display: none; }

@media (prefers-reduced-motion: no-preference) {
	.coach-mark.is-pointing .coach-mark-arrow > i { animation: coach-mark-bounce 0.9s cubic-bezier(0.3, 0, 0.3, 1) 4; }
	.coach-mark.is-pointing .coach-mark-pulse { animation: coach-mark-pulse 1.8s ease-out 2; }
	.coach-mark.is-pointing .coach-mark-bubble { animation: coach-mark-pop 0.45s cubic-bezier(0.2, 1.4, 0.4, 1) 1; }
}
/* 화살표는 꼬리 쪽으로 물러났다가 짚은 곳을 콕 찍는다(아래에서 올려 짚을 때는 요소가 뒤집혀 있어 같은 키프레임이 반대로 움직인다) */
@keyframes coach-mark-bounce {
	0%, 100% { translate: 0 0; }
	45% { translate: 0 -1.5rem; }
	80% { translate: 0 0.25rem; }
}
@keyframes coach-mark-pulse {
	0% { opacity: 0.9; scale: 1; }
	100% { opacity: 0; scale: 1.18 1.45; }
}
@keyframes coach-mark-pop {
	0% { opacity: 0; scale: 0.6; }
	100% { opacity: 1; scale: 1; }
}
@media (max-width: 48rem) {
	.coach-mark { --coach-size: 2.75rem; }
	.coach-mark-bubble { font-size: var(--wa-font-size-s); }
}
