/**
 * 3D 地图地球 —— 舞台与标签
 *
 * 地球画在 canvas 上（map-globe.js）；这里负责区块外壳、舞台尺寸、
 * HTML 标签胶囊（位置由 JS 写 transform，尖角方向由 data-pos 决定）。
 */

.mgw-globe {
	--mgw-globe-stage-h: 520px;
	--mgw-globe-label-bg: #1f4fd8;
	--mgw-globe-label-color: #ffffff;
	--mgw-globe-label-tag: rgba(255, 255, 255, 0.72);
	--mgw-globe-label-size: 11px;
	/* 认证标识的默认值必须放在 .mgw-globe 上：Elementor 颜色控件写的就是这一层，
	   放在 .mgw-globe__badges 上会把控件的值覆盖掉，导致颜色改不了 */
	--mgw-globe-badge-ring: rgba(31, 79, 216, 0.28);
	--mgw-globe-badge-icon: #1f4fd8;
	--mgw-globe-badge-text: #3a3d42;
	--mgw-globe-badge-circle: 42px;
	--mgw-globe-badge-gap: 44px;

	position: relative;
	box-sizing: border-box;
	padding: 40px 20px;
}

.mgw-globe *,
.mgw-globe *::before,
.mgw-globe *::after {
	box-sizing: border-box;
}

.mgw-globe__stage {
	position: relative;
	width: 100%;
	max-width: 860px;
	height: var(--mgw-globe-stage-h);
	margin: 0 auto;
	/* 地图数据就绪前先隐藏，避免闪一下空画布 */
	opacity: 0;
	transition: opacity 0.7s ease;
}

.mgw-globe.is-ready .mgw-globe__stage {
	opacity: 1;
}

.mgw-globe__canvas {
	display: block;
	width: 100%;
	height: 100%;
	outline: none;
	cursor: grab;
	touch-action: pan-y;
	-webkit-user-select: none;
	user-select: none;
	-webkit-tap-highlight-color: transparent;
}

.mgw-globe.is-dragging .mgw-globe__canvas {
	cursor: grabbing;
}

/* ==================== HTML 标签 ==================== */
.mgw-globe__labels {
	position: absolute;
	inset: 0;
	pointer-events: none;
	overflow: hidden;
}

.mgw-globe__label {
	position: absolute;
	left: 0;
	top: 0;
	display: inline-flex;
	align-items: baseline;
	gap: 5px;
	padding: 4px 9px;
	border-radius: 4px;
	/* 定位完全由 JS 的 translate3d 给出（左上角坐标），这里不要加 margin */
	margin: 0;
	pointer-events: none;
	background-color: var(--mgw-globe-label-bg);
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: var(--mgw-globe-label-size, 11px);
	font-weight: 700;
	line-height: 1;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	white-space: nowrap;
	color: var(--mgw-globe-label-color);
	box-shadow: 0 6px 16px rgba(17, 24, 39, 0.18);
	opacity: 0;
	will-change: transform, opacity;
	transition: opacity 0.35s ease;
}

.mgw-globe__label-tag {
	font-weight: 600;
	letter-spacing: 0.04em;
	color: var(--mgw-globe-label-tag);
}

.mgw-globe__label-tag:empty {
	display: none;
}

/* 小尖角，指向标记点；默认标签在点位上方 */
.mgw-globe__label::after {
	content: "";
	position: absolute;
	left: 50%;
	top: 100%;
	width: 0;
	height: 0;
	margin-left: -4px;
	border: 4px solid transparent;
	border-top-color: var(--mgw-globe-label-bg);
}

.mgw-globe__label[data-pos="below"]::after {
	top: auto;
	bottom: 100%;
	border-top-color: transparent;
	border-bottom-color: var(--mgw-globe-label-bg);
}

.mgw-globe__label[data-pos="right"]::after,
.mgw-globe__label[data-pos="left"]::after {
	top: 50%;
	margin-left: 0;
	margin-top: -4px;
	border-top-color: transparent;
}

.mgw-globe__label[data-pos="right"]::after {
	left: auto;
	right: 100%;
	border-right-color: var(--mgw-globe-label-bg);
}

.mgw-globe__label[data-pos="left"]::after {
	left: 100%;
	border-left-color: var(--mgw-globe-label-bg);
}

/* ==================== 底部提示文字 ==================== */
.mgw-globe__hint {
	margin-top: 6px;
	text-align: center;
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 12px;
	line-height: 1.5;
	letter-spacing: 0.04em;
	color: #8b8f95;
}

/* ==================== 底部认证标识 ==================== */
.mgw-globe__badges {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	justify-content: center;
	gap: var(--mgw-globe-badge-gap);
	max-width: 900px;
	margin: 26px auto 0;
	padding-top: 24px;
	border-top: 1px solid rgba(17, 24, 39, 0.1);
}

.mgw-globe__badge {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 9px;
	min-width: 70px;
	text-align: center;
	transition: transform 0.3s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.mgw-globe__badge-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: var(--mgw-globe-badge-circle);
	height: var(--mgw-globe-badge-circle);
	border: 1px solid var(--mgw-globe-badge-ring);
	border-radius: 999px;
	color: var(--mgw-globe-badge-icon);
	font-size: calc(var(--mgw-globe-badge-circle) * 0.42);
	line-height: 1;
	transition: border-color 0.25s ease, background-color 0.25s ease;
}

.mgw-globe__badge-icon svg {
	width: 1em;
	height: 1em;
	fill: currentColor;
}

.mgw-globe__badge-icon i {
	line-height: 1;
}

.mgw-globe__badge-text {
	font-size: 12.5px;
	line-height: 1.4;
	color: var(--mgw-globe-badge-text);
	word-break: keep-all;
}

@media (hover: hover) {
	.mgw-globe__badge:hover {
		transform: translateY(-3px);
	}

	.mgw-globe__badge:hover .mgw-globe__badge-icon {
		border-color: var(--mgw-globe-badge-icon);
		background-color: rgba(31, 79, 216, 0.06);
		background-color: color-mix(in srgb, var(--mgw-globe-badge-icon) 7%, transparent);
	}
}

/* ==================== 响应式 ==================== */
@media (max-width: 767px) {
	.mgw-globe {
		padding: 28px 14px;
	}

	.mgw-globe__label {
		font-size: 10px;
		padding: 3px 7px;
	}

	.mgw-globe__badges {
		gap: 18px 22px;
		margin-top: 20px;
		padding-top: 18px;
	}

	.mgw-globe__badge {
		min-width: 62px;
		gap: 7px;
	}

	.mgw-globe__badge-text {
		font-size: 11.5px;
	}
}

/* ==================== 降低动效 ==================== */
@media (prefers-reduced-motion: reduce) {
	.mgw-globe__stage,
	.mgw-globe__label {
		transition: none;
	}
}
