/*
 * Swatch tooltips (spec 7.5). One tooltip, fixed to the viewport and placed
 * by assets/js/swatches-tooltips.js, so it never shifts the page.
 * Colours come from the Tooltips settings as --wcsw-tooltip-background and
 * --wcsw-tooltip-color. It shows fully opaque, with no fade, so its text
 * keeps the contrast of those colours from the first frame.
 */
.wcsw-tooltip {
	position: fixed;
	top: 0;
	left: 0;
	z-index: 999999;
	box-sizing: border-box;
	max-width: min(280px, calc(100vw - 8px));
	padding: 6px 10px;
	border-radius: 4px;
	background: var(--wcsw-tooltip-background, #333);
	color: var(--wcsw-tooltip-color, #fff);
	font-size: 13px;
	line-height: 1.35;
	text-align: center;
	overflow-wrap: anywhere;
	white-space: normal;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.wcsw-tooltip[hidden] {
	display: none;
}

/* A tooltip shown by a tap lets the next tap reach the swatch under it. */
.wcsw-tooltip--touch {
	pointer-events: none;
}

.wcsw-tooltip--image {
	padding: 6px;
}

.wcsw-tooltip img {
	display: block;
	max-width: 100%;
	height: auto;
	margin: 0 auto 4px;
	border-radius: 2px;
}

.wcsw-tooltip::after {
	content: "";
	position: absolute;
	left: var(--wcsw-tooltip-arrow, 50%);
	width: 0;
	height: 0;
	border: 6px solid transparent;
	transform: translateX(-50%);
}

.wcsw-tooltip--top::after {
	top: 100%;
	border-top-color: var(--wcsw-tooltip-background, #333);
}

.wcsw-tooltip--bottom::after {
	bottom: 100%;
	border-bottom-color: var(--wcsw-tooltip-background, #333);
}

/* The swatch's description: read by assistive technology, never shown. */
.wcsw-tooltip-text {
	display: none !important;
}
