/*
 * masterE Core — shared "ⓘ" info icon + pop-up (v0.7.0).
 * Every value is a --mastere-tip-* variable; the fallback IS the approved
 * look (Hagai 2026-11-10 mockup). Plugins write the vars on {{WRAPPER}};
 * the JS copies them onto the portaled pop-up.
 */

.mastere-tip-wrap {
	display: inline-flex;
	align-items: center;
	vertical-align: middle;
	margin-inline-start: var(--mastere-tip-gap, 0.35em);
	line-height: 1;
}

/* Theme-proofed: the kit's generic button{} rules must never reach the icon. */
.mastere-tip-wrap .mastere-tip,
.mastere-tip-wrap .mastere-tip:hover,
.mastere-tip-wrap .mastere-tip:focus {
	appearance: none !important;
	-webkit-appearance: none !important;
	box-sizing: border-box !important;
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	inline-size: auto !important;
	block-size: auto !important;
	min-inline-size: 0 !important;
	min-block-size: 0 !important;
	margin: 0 !important;
	padding: 0.1em !important;
	border: 0 !important;
	border-radius: 50% !important;
	box-shadow: none !important;
	text-transform: none !important;
	letter-spacing: normal !important;
	line-height: 1 !important;
	font-size: var(--mastere-tip-size, 15px) !important;
	color: var(--mastere-tip-color, #6c7781) !important;
	background: transparent !important;
	cursor: pointer;
	transition: color 0.15s ease, background-color 0.15s ease;
}

.mastere-tip-wrap .mastere-tip:hover,
.mastere-tip-wrap .mastere-tip:focus-visible,
.mastere-tip-wrap .mastere-tip[aria-expanded="true"] {
	color: var(--mastere-tip-color-active, #007c79) !important;
	background: var(--mastere-tip-bg-active, #f0faf9) !important;
}

.mastere-tip-wrap .mastere-tip:focus-visible {
	outline: 2px solid var(--mastere-tip-color-active, #007c79) !important;
	outline-offset: 1px;
}

.mastere-tip-glyph {
	display: block;
	inline-size: 1em;
	block-size: 1em;
	pointer-events: none;
}

.mastere-tip-text[hidden] {
	display: none !important;
}

/* ── The pop-up (one element, portaled to <body>) ─────────────────────── */

.mastere-tip-pop {
	position: fixed;
	z-index: 100000;
	box-sizing: border-box;
	inline-size: max-content;
	max-inline-size: min(var(--mastere-tip-pop-width, 280px), calc(100vw - 16px));
	padding: var(--mastere-tip-pop-padding, 0.7em 0.85em);
	background: var(--mastere-tip-pop-bg, #ffffff);
	color: var(--mastere-tip-pop-color, #1d2327);
	border: 1px solid var(--mastere-tip-pop-border, #dcdcde);
	border-radius: var(--mastere-tip-pop-radius, 8px);
	box-shadow: var(--mastere-tip-pop-shadow, 0 2px 8px rgba(0, 0, 0, 0.06));
	font-family: var(--mastere-tip-pop-font-family, inherit);
	font-size: var(--mastere-tip-pop-font-size, 13.5px);
	font-weight: var(--mastere-tip-pop-font-weight, 400);
	line-height: var(--mastere-tip-pop-line-height, 1.55);
	text-align: start;
	white-space: normal;
	overflow-wrap: anywhere;
	opacity: 0;
	transform: translateY(-3px);
	transition: opacity 0.14s ease, transform 0.14s ease;
	pointer-events: none;
}

.mastere-tip-pop.is-above {
	transform: translateY(3px);
}

.mastere-tip-pop.is-open {
	opacity: 1;
	transform: none;
	pointer-events: auto;
}

.mastere-tip-pop[hidden] {
	display: none !important;
}

.mastere-tip-pop .mastere-tip-p {
	display: block;
}

.mastere-tip-pop .mastere-tip-p + .mastere-tip-p {
	margin-block-start: 0.5em;
}

/* Numbers / codes keep LTR order inside RTL text (design-system rule). */
.mastere-tip-pop .mvs-w-ltr,
.mastere-tip-pop .mcm-ltr,
.mastere-tip-pop [dir="ltr"] {
	direction: ltr;
	unicode-bidi: embed;
}

.mastere-tip-pop a {
	color: var(--mastere-tip-color-active, #007c79);
}

/*
 * Arrow — a rotated square sharing the pop-up's bg + border. PHYSICAL
 * properties on purpose: the JS measures the icon's centre against the
 * pop-up's LEFT edge (getBoundingClientRect is physical in RTL too), and the
 * top+left borders rotated 45° form the up-pointing tip in every direction.
 */
.mastere-tip-pop .mastere-tip-arrow {
	position: absolute;
	width: 10px;
	height: 10px;
	top: -6px;
	left: var(--mastere-tip-arrow-x, 12px);
	margin-left: -5px;
	background: var(--mastere-tip-pop-bg, #ffffff);
	border-top: 1px solid var(--mastere-tip-pop-border, #dcdcde);
	border-left: 1px solid var(--mastere-tip-pop-border, #dcdcde);
	transform: rotate(45deg);
}

.mastere-tip-pop.is-above .mastere-tip-arrow {
	top: auto;
	bottom: -6px;
	transform: rotate(225deg);
}

@media (prefers-reduced-motion: reduce) {
	.mastere-tip-pop,
	.mastere-tip-wrap .mastere-tip {
		transition: none;
	}
}
