/**
 * Rich hover/focus tooltips for AI labels. Loaded only by AI Content Flag Pro;
 * without it the free plugin falls back to the browser's native title tooltip.
 */

.aicft-badge--has-tooltip,
.aicft-bg-host > .aicft-badge--has-tooltip,
.pswp__zoom-wrap > .aicft-badge--has-tooltip,
.pswp__content > .aicft-badge--has-tooltip,
.pswp__item > .aicft-badge--has-tooltip,
.aicft-pswp-host > .aicft-badge--has-tooltip,
#photoswipe-fullscreen-dialog .aicft-badge--has-tooltip {
	pointer-events: auto;
	cursor: help;
}

.aicft-disclosure__text,
.aicft-badge__tooltip {
	position: absolute;
	left: 0;
	top: calc(100% + 0.45rem);
	z-index: 20;
	box-sizing: border-box;
	width: max-content;
	max-width: min(22rem, 80vw);
	padding: 0.55rem 0.75rem;
	border-radius: 4px;
	background: #111;
	color: #fff;
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	font-size: 13px;
	font-weight: 400;
	line-height: 1.45;
	letter-spacing: 0;
	overflow-wrap: break-word;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transform: translateY(-4px);
	transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
}

/*
 * Product galleries (and other overflow:hidden media frames) clip a 22rem tooltip.
 * Stretch only the hover target into a transparent slot the width of the image,
 * then cap the tooltip at 100% of that slot so the sentence wraps instead of
 * disappearing past the photo edge. The visible pill stays on the inner label.
 */
.aicft-badge--has-tooltip.aicft-badge--top-left,
.aicft-badge--has-tooltip.aicft-badge--top-right,
.aicft-badge--has-tooltip.aicft-badge--bottom-left,
.aicft-badge--has-tooltip.aicft-badge--bottom-right {
	left: 0.5rem;
	right: 0.5rem;
	width: auto;
	display: flex;
	flex-direction: row;
	align-items: center;
	justify-content: flex-start;
	padding: 0;
	background: transparent;
	box-shadow: none;
	pointer-events: none;
}

.aicft-badge--has-tooltip.aicft-badge--top-right,
.aicft-badge--has-tooltip.aicft-badge--bottom-right {
	justify-content: flex-end;
}

.aicft-badge--has-tooltip .aicft-badge__text {
	pointer-events: auto;
	padding: 0.35em 0.65em;
	border-radius: 2px;
	background: #111;
	color: #fff;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.aicft-badge--has-tooltip img.aicft-badge__icon {
	pointer-events: auto;
}

.aicft-badge--has-tooltip:focus {
	outline: none;
}

.aicft-badge--has-tooltip:focus-visible .aicft-badge__text,
.aicft-badge--has-tooltip:focus-visible img.aicft-badge__icon {
	box-shadow: 0 0 0 2px #fff, 0 0 0 4px #111;
}

.aicft-badge--has-tooltip .aicft-badge__tooltip {
	max-width: 100%;
}

.aicft-disclosure__text::before,
.aicft-badge__tooltip::before {
	content: "";
	position: absolute;
	left: 0.9rem;
	top: -6px;
	border: 6px solid transparent;
	border-top-width: 0;
	border-bottom-color: #111;
}

.aicft-disclosure:hover .aicft-disclosure__text,
.aicft-disclosure:focus .aicft-disclosure__text,
.aicft-disclosure:focus-within .aicft-disclosure__text,
.aicft-badge--has-tooltip:hover .aicft-badge__tooltip,
.aicft-badge--has-tooltip:focus .aicft-badge__tooltip,
.aicft-badge--has-tooltip:focus-within .aicft-badge__tooltip {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.aicft-badge--top-right .aicft-badge__tooltip,
.aicft-badge--bottom-right .aicft-badge__tooltip {
	left: auto;
	right: 0;
}

.aicft-badge--top-right .aicft-badge__tooltip::before,
.aicft-badge--bottom-right .aicft-badge__tooltip::before {
	left: auto;
	right: 0.9rem;
}

.aicft-badge--bottom-left .aicft-badge__tooltip,
.aicft-badge--bottom-right .aicft-badge__tooltip {
	top: auto;
	bottom: calc(100% + 0.45rem);
	transform: translateY(4px);
}

.aicft-badge--bottom-left .aicft-badge__tooltip::before,
.aicft-badge--bottom-right .aicft-badge__tooltip::before {
	top: auto;
	bottom: -6px;
	border-top-width: 6px;
	border-bottom-width: 0;
	border-top-color: #111;
	border-bottom-color: transparent;
}

@media (hover: none) {
	.aicft-disclosure__text {
		position: static;
		width: auto;
		max-width: 100%;
		margin-top: 0.45rem;
		opacity: 1;
		visibility: visible;
		transform: none;
		pointer-events: auto;
	}

	.aicft-disclosure__text::before {
		display: none;
	}

	.aicft-disclosure {
		display: flex;
		flex-wrap: wrap;
		align-items: flex-start;
	}
}
