/**
 * KTG 용어 툴팁 (시대의눈) — 점선 밑줄 + 해설 말풍선
 * 외부 의존성 없음. 본문 텍스트에만 적용된다.
 */

.ktg-tt {
	position: relative;
	display: inline;
	font: inherit;
	line-height: inherit;
	color: inherit;
	cursor: help;
	text-decoration: underline dashed rgba(0, 84, 160, 0.5);
	text-decoration-thickness: 1px;
	text-underline-offset: 3px;
	-webkit-text-decoration: underline dashed rgba(0, 84, 160, 0.5);
	-webkit-tap-highlight-color: rgba(0, 84, 160, 0.12);
	touch-action: manipulation;
}

.ktg-tt:focus {
	outline: none;
}

.ktg-tt:focus-visible {
	outline: 2px solid rgba(0, 84, 160, 0.55);
	outline-offset: 2px;
	border-radius: 2px;
}

.ktg-tt__bubble {
	position: absolute;
	left: 50%;
	bottom: calc(100% + 10px);
	z-index: 99990;
	display: block;
	box-sizing: border-box;
	width: max-content;
	max-width: min(340px, 78vw);
	margin: 0;
	padding: 10px 13px 11px;
	border-radius: 9px;
	background: #101c2e;
	color: #ffffff;
	font-family: inherit;
	font-size: 13px;
	font-weight: 400;
	font-style: normal;
	line-height: 1.6;
	letter-spacing: -0.01em;
	text-align: left;
	text-transform: none;
	white-space: normal;
	word-break: keep-all;
	overflow-wrap: break-word;
	box-shadow: 0 10px 28px rgba(6, 15, 30, 0.28);
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transform: translate(-50%, 4px);
	transition: opacity 0.14s ease, transform 0.14s ease;
}

.ktg-tt__bubble::after {
	content: "";
	position: absolute;
	top: 100%;
	left: calc(50% + var(--ktg-caret, 0px));
	margin-left: -6px;
	border: 6px solid transparent;
	border-top-color: #101c2e;
}

.ktg-tt__bubble--below {
	bottom: auto;
	top: calc(100% + 10px);
}

.ktg-tt__bubble--below::after {
	top: auto;
	bottom: 100%;
	border-top-color: transparent;
	border-bottom-color: #101c2e;
}

/* JS가 화면 좌표로 배치할 때: 기사 영역(overflow:hidden)에 잘리지 않도록 뷰포트 기준 고정 */
.ktg-tt__bubble--fixed {
	position: fixed;
	bottom: auto;
	left: 0;
	top: 0;
	transform: none;
}

.ktg-tt__term {
	display: block;
	margin: 0 0 4px;
	color: #9fd0ff;
	font-size: 12px;
	font-weight: 700;
	line-height: 1.4;
}

.ktg-tt__desc {
	display: block;
	margin: 0;
}

/* 데스크톱: 마우스 오버 / 키보드 포커스 / 모바일 탭(.is-open) */
@media (hover: hover) {
	.ktg-tt:hover .ktg-tt__bubble {
		opacity: 1;
		visibility: visible;
	}

	.ktg-tt:hover .ktg-tt__bubble:not(.ktg-tt__bubble--fixed) {
		transform: translate(-50%, 0);
	}
}

.ktg-tt:focus-visible .ktg-tt__bubble,
.ktg-tt.is-open .ktg-tt__bubble {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
}

.ktg-tt:focus-visible .ktg-tt__bubble:not(.ktg-tt__bubble--fixed),
.ktg-tt.is-open .ktg-tt__bubble:not(.ktg-tt__bubble--fixed) {
	transform: translate(-50%, 0);
}

/* 모바일: 말풍선을 조금 더 읽기 쉽게 */
@media (max-width: 600px) {
	.ktg-tt__bubble {
		max-width: 84vw;
		font-size: 13.5px;
		line-height: 1.62;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ktg-tt__bubble {
		transition: none;
	}
}

/* 인쇄에서는 밑줄과 말풍선을 모두 숨긴다 */
@media print {
	.ktg-tt {
		text-decoration: none;
	}

	.ktg-tt__bubble {
		display: none !important;
	}
}
