/*
 * Glossary term triggers + definition popover. Colours inherit the active
 * brand via the theme's design tokens (with safe fallbacks).
 */

.cotr-glossary-term {
	all: unset;
	cursor: help;
	font: inherit;
	color: inherit;
	border-bottom: 2px dotted var(--cotr-color-primary, #10c0d9);
	padding-bottom: 1px;
	transition: color 0.15s ease, border-color 0.15s ease;
}
.cotr-glossary-term:hover,
.cotr-glossary-term[aria-expanded="true"] {
	color: var(--cotr-color-primary, #10c0d9);
	border-bottom-style: solid;
}
.cotr-glossary-term:focus-visible {
	outline: 2px solid var(--cotr-color-primary, #10c0d9);
	outline-offset: 2px;
	border-radius: 2px;
}

/* ⓘ card trigger next to linked terms — generous tap target via padding */
.cotr-glossary-info {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	vertical-align: super;
	font-size: 0;
	line-height: 0;
	padding: 7px;
	margin: -5px 0 -5px 1px;
	border-radius: 50%;
	color: var(--cotr-color-primary, #10c0d9);
	opacity: 0.75;
	cursor: pointer;
	transition: opacity 0.15s ease, background 0.15s ease;
}
.cotr-glossary-info:hover,
.cotr-glossary-info[aria-expanded="true"] {
	opacity: 1;
	background: color-mix(in srgb, var(--cotr-color-primary, #10c0d9) 12%, transparent);
}
.cotr-glossary-info:focus-visible {
	outline: 2px solid var(--cotr-color-primary, #10c0d9);
	outline-offset: 1px;
	opacity: 1;
}
.cotr-glossary-info svg {
	pointer-events: none; /* clicks always target the trigger span */
}
/*
 * The ⓘ trigger is a touch affordance: it lets a tap reveal the card without
 * hijacking a linked term's navigation. On hover-capable pointers the card
 * already opens on hover, so the icon is redundant and makes linked terms look
 * inconsistent with plain ones — hide it there. Keyboard access is preserved:
 * the term itself is focusable and shows the card on focus. (Kept in sync with
 * the hoverCapable gate in glossary.js.)
 */
@media (hover: hover) and (pointer: fine) {
	.cotr-glossary-info {
		display: none;
	}
}

.cotr-glossary-pop {
	position: absolute;
	z-index: 60;
	width: min(320px, calc(100vw - 32px));
	background: var(--cotr-color-surface, #fff);
	border-radius: var(--cotr-radius-card, 12px);
	box-shadow: 0 6px 14px rgba(0, 0, 0, 0.1), 0 18px 44px rgba(0, 0, 0, 0.14);
	border: 1px solid var(--cotr-color-border, #e4e6e8);
	padding: 16px 18px 14px;
	opacity: 0;
	transform: translateY(6px) scale(0.98);
	transition: opacity 0.18s ease, transform 0.18s cubic-bezier(0.22, 1, 0.36, 1);
	pointer-events: none;
}
.cotr-glossary-pop::before {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 3px;
	border-radius: 12px 12px 0 0;
	background: linear-gradient(90deg, var(--cotr-color-primary, #10c0d9), var(--cotr-color-accent, #f7418d));
}
.cotr-glossary-pop.is-visible {
	opacity: 1;
	transform: translateY(0) scale(1);
	pointer-events: auto;
}
.cotr-glossary-pop.is-above {
	transform: translateY(-6px) scale(0.98);
}
.cotr-glossary-pop.is-above.is-visible {
	transform: translateY(0) scale(1);
}
@media (prefers-reduced-motion: reduce) {
	.cotr-glossary-pop {
		transition: opacity 0.18s ease;
		transform: none;
	}
}

.cotr-glossary-pop__term {
	display: block;
	font-weight: 700;
	font-size: 0.82rem;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--cotr-color-primary, #10c0d9);
	margin-bottom: 6px;
}
.cotr-glossary-pop__def {
	font-size: 0.9rem;
	line-height: 1.6;
	color: var(--cotr-color-text, #1a1a1a);
	margin: 0;
}
.cotr-glossary-pop__link {
	display: inline-block;
	margin-top: 10px;
	font-size: 0.82rem;
	font-weight: 700;
	color: var(--cotr-color-primary, #10c0d9);
	text-decoration: none;
}
.cotr-glossary-pop__link:hover {
	text-decoration: underline;
}
