/**
 * Dictionary Tooltip Styles
 *
 * Styling for the inline dictionary tooltips.
 *
 * @package Headspin_Dictionary_Tooltip
 */

/* Tooltip trigger element */
.hdt-tooltip {
	cursor: help;
	text-decoration: underline dotted currentColor !important;
	text-decoration-thickness: 2px !important;
	text-underline-offset: 2px !important;
	position: relative;
	font-style: normal;
	display: inline;
}

/* Focus state for keyboard accessibility */
.hdt-tooltip:focus {
	outline: 2px solid #025637;
	outline-offset: 2px;
}

/* Tooltip popup */
.hdt-tooltip-popup {
	position: fixed;
	left: 0;
	top: 0;
	background-color: #fff;
	color: #333;
	padding: 8px 12px;
	border: 1px solid #ccc;
	border-radius: 4px;
	max-width: 300px;
	min-width: 150px;
	z-index: 10000;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
	font-size: 14px;
	line-height: 1.5;
	font-weight: normal;
	text-align: left;
	white-space: normal;
	word-wrap: break-word;
	transform: translateZ(0);
}

/* Tooltip arrow */
.hdt-tooltip-popup::before {
	content: '';
	position: absolute;
	bottom: 100%;
	left: 16px;
	border: 6px solid transparent;
	border-bottom-color: #ccc;
}

.hdt-tooltip-popup::after {
	content: '';
	position: absolute;
	bottom: 100%;
	left: 17px;
	border: 5px solid transparent;
	border-bottom-color: #fff;
}

/* Position adjustments for tooltips near edges — only flip the arrow; left is set by JS */
.hdt-tooltip-popup.hdt-position-right {
	right: auto;
}

.hdt-tooltip-popup.hdt-position-right::before,
.hdt-tooltip-popup.hdt-position-right::after {
	left: auto;
	right: 16px;
}

.hdt-tooltip-popup.hdt-position-right::after {
	right: 17px;
}

/* Above positioning — only flip the arrow; top is set by JS */
.hdt-tooltip-popup.hdt-position-above {
	bottom: auto;
}

.hdt-tooltip-popup.hdt-position-above::before {
	bottom: auto;
	top: 100%;
	border-bottom-color: transparent;
	border-top-color: #ccc;
}

.hdt-tooltip-popup.hdt-position-above::after {
	bottom: auto;
	top: 100%;
	border-bottom-color: transparent;
	border-top-color: #fff;
}

/* Hidden state */
.hdt-tooltip-popup[hidden] {
	display: none;
}

/* Tooltip title - dictionary headword style */
.hdt-tooltip-title {
	margin: 0 0 8px 0;
	padding: 0 0 7px 0;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.04em;
	color: #025637;
	border-bottom: 1px solid #e8ece9;
	line-height: 1.3;
}
.hdt-tooltip-title::first-letter {
	text-transform: uppercase;
}

/* Definition text */
.hdt-tooltip-definition {
	margin: 0;
	font-size: 13.5px;
	line-height: 1.55;
	color: #3a3a3a;
}
.hdt-tooltip-definition::first-letter {
	text-transform: uppercase;
}

/* Footer area - clear separation from content */
.hdt-tooltip-footer {
	margin: 10px -12px -8px;
	padding: 7px 12px 0;
	border-top: 1px solid #e8ece9;
	text-align: right;
}

/* Read more link - compact, right-aligned to avoid misclicks */
.hdt-tooltip-link {
	display: inline-block;
	margin: 0;
	padding: 4px 0;
	border: none;
	font-size: 12px;
	font-weight: 500;
	color: #025637;
	text-decoration: none;
	letter-spacing: 0.01em;
	transition: color 0.15s ease;
}

.hdt-tooltip-link::after {
	content: ' \2192';
	font-size: 13px;
	transition: transform 0.15s ease;
	display: inline-block;
}

.hdt-tooltip-link:hover {
	color: #013d27;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.hdt-tooltip-link:hover::after {
	transform: translateX(2px);
}

.hdt-tooltip-link:focus-visible {
	outline: 2px solid #025637;
	outline-offset: 2px;
	border-radius: 2px;
}

/* Animation — only animate position, never opacity (causes GPU compositing bugs) */
@keyframes hdt-slide-in {
	from {
		transform: translateZ(0) translateY(-4px);
	}
	to {
		transform: translateZ(0) translateY(0);
	}
}

.hdt-tooltip-popup {
	animation: hdt-slide-in 0.15s ease-out;
}

/* Mobile adjustments - uses .hdt-mobile class added by JS */
.hdt-tooltip-popup.hdt-mobile {
	left: 16px;
	right: 16px;
	max-width: none;
	width: auto;
}

.hdt-tooltip-popup.hdt-mobile::before,
.hdt-tooltip-popup.hdt-mobile::after {
	display: none;
}

/* Print styles */
@media print {
	.hdt-tooltip {
		text-decoration: none !important;
	}

	.hdt-tooltip-popup {
		display: none !important;
	}
}
