/*
 * Global Reach map — [accelsiors_global_map]
 * Dark navy band (same tone as the previous cover overlay), map + side panel, CTA under it.
 * Desktop: the panel never grows taller than the map (it scrolls inside).
 * Tablet / phone: the panel moves under the map, region tabs become one swipeable row.
 */
.agm {
	--agm-navy: #090025;
	--agm-navy-2: #120a3a;
	--agm-land: #1d1b4b;
	--agm-land-edge: #2c2a66;
	--agm-research: #0181c8;
	--agm-research-hover: #23a3ea;
	--agm-research-edge: #0a6aa3;
	--agm-hq: #a77bdb;
	--agm-office: #ffffff;
	--agm-text: #f3f2fb;
	--agm-muted: #a9a6c9;
	--agm-line: rgba(255, 255, 255, 0.12);
	--agm-card: rgba(255, 255, 255, 0.03);

	position: relative;
	margin-top: 0;
	margin-bottom: 0;
	padding-block: clamp(48px, 7vw, 96px);
	padding-left: var(--accelsiors-page-gutter, 16px);
	padding-right: var(--accelsiors-page-gutter, 16px);
	background: radial-gradient(120% 90% at 70% 0%, var(--agm-navy-2), var(--agm-navy) 60%);
	color: var(--agm-text);
}

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

.agm__inner {
	max-width: var(--wp--style--global--wide-size, 1400px);
	margin: 0 auto;
	display: grid;
	gap: clamp(20px, 3vw, 32px);
}

/* Heading */
.agm__head {
	display: grid;
	justify-items: center;
	gap: 10px;
	text-align: center;
}

.agm__eyebrow {
	font-size: 12px;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--agm-muted);
}

.agm .agm__title {
	margin: 0;
	color: var(--agm-text);
	font-size: clamp(1.75rem, 3.6vw, 2.5rem);
	line-height: 1.15;
	text-wrap: balance;
}

.agm .agm__text {
	margin: 0;
	max-width: 100%;
	color: var(--agm-muted);
	font-size: 1.0625rem;
	text-wrap: balance;
}

/* Tablet and up: the subtitle stays on one line, even if it is wider than the title */
@media (min-width: 768px) {
	.agm .agm__text {
		white-space: nowrap;
	}
}

.agm__stats {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 8px 32px;
	margin: 6px 0 0;
	font-variant-numeric: tabular-nums;
}

.agm__stats > div {
	display: flex;
	flex-direction: column-reverse;
	align-items: center;
}

.agm__stats dt {
	font-size: 12px;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--agm-muted);
}

.agm__stats dd {
	margin: 0;
	font-size: 1.625rem;
	font-weight: 700;
	line-height: 1.2;
}

/* Region tabs */
.agm__tabs {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 6px;
}

.agm .agm__tab {
	font: inherit;
	font-size: 0.8125rem;
	line-height: 1.2;
	color: var(--agm-text);
	background: transparent;
	border: 1px solid var(--agm-line);
	border-radius: 999px;
	padding: 7px 13px;
	cursor: pointer;
	transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

.agm .agm__tab:hover {
	border-color: rgba(255, 255, 255, 0.35);
}

.agm .agm__tab[aria-pressed="true"] {
	background: var(--agm-text);
	border-color: var(--agm-text);
	color: var(--agm-navy);
}

/* Stage: map + side panel */
.agm__stage {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
	gap: 20px;
	align-items: stretch;
}

.agm__mapcol {
	min-width: 0;
}

.agm__map {
	position: relative;
	width: 100%;
	max-width: 100%;
	aspect-ratio: 1000 / 520;
	border-radius: 18px;
	overflow: hidden;
	background: rgba(255, 255, 255, 0.02);
	border: 1px solid var(--agm-line);
}

@supports not (aspect-ratio: 1 / 1) {
	.agm__map {
		height: 0;
		padding-top: 52%;
	}
}

/* Soft placeholder while the SVG loads */
.agm__map:not(.is-ready)::before {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, 0.04) 50%, transparent 80%);
	background-size: 200% 100%;
	animation: agm-shimmer 1.6s linear infinite;
}

@keyframes agm-shimmer {
	from { background-position: 100% 0; }
	to { background-position: -100% 0; }
}

.agm__map svg {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	display: block;
}

.agm__map .tsl-land path {
	fill: var(--agm-land);
	stroke: var(--agm-land-edge);
	stroke-width: 0.5;
	vector-effect: non-scaling-stroke;
	transition: fill 0.25s;
}

.agm__map .tsl-land path.is-research {
	fill: var(--agm-research);
	stroke: var(--agm-research-edge);
	cursor: pointer;
}

.agm__map .tsl-land path.is-research:hover,
.agm__map .tsl-land path.is-research.is-hot {
	fill: var(--agm-research-hover);
}

.agm__map.is-filtered .tsl-land path.is-research {
	fill: var(--agm-land);
	stroke: var(--agm-land-edge);
}

.agm__map.is-filtered .tsl-land path.is-research.in-region {
	fill: var(--agm-research);
	stroke: var(--agm-research-edge);
}

.agm__map.is-filtered .tsl-land path.is-research.in-region:hover,
.agm__map.is-filtered .tsl-land path.is-research.in-region.is-hot {
	fill: var(--agm-research-hover);
}

.agm__pin {
	cursor: pointer;
	outline: none;
}

.agm__pin .agm__pulse {
	fill: var(--agm-office);
	opacity: 0.35;
	transform-origin: 0 0;
	animation: agm-pulse 2.2s ease-out infinite;
}

.agm__pin .agm__core {
	fill: var(--agm-office);
	stroke: var(--agm-navy);
	stroke-width: 1.5;
}

.agm__pin.is-hq .agm__pulse,
.agm__pin.is-hq .agm__core {
	fill: var(--agm-hq);
}

.agm__pin:focus-visible .agm__core {
	stroke: var(--agm-research-hover);
	stroke-width: 2.5;
}

@keyframes agm-pulse {
	from { transform: scale(0.5); opacity: 0.5; }
	to { transform: scale(2.6); opacity: 0; }
}

.agm__tip {
	position: absolute;
	z-index: 2;
	pointer-events: none;
	transform: translate(-50%, calc(-100% - 12px));
	padding: 7px 10px;
	border-radius: 8px;
	background: #ffffff;
	color: #120a3a;
	font-size: 13px;
	line-height: 1.3;
	white-space: nowrap;
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.agm__tip small {
	display: block;
	color: #5b587d;
	font-size: 11px;
}

.agm__legend {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 16px;
	padding: 10px 4px 0;
	font-size: 12px;
	color: var(--agm-muted);
}

.agm__legend i,
.agm__dot {
	display: inline-block;
	width: 9px;
	height: 9px;
	border-radius: 50%;
	margin-right: 7px;
	vertical-align: 0;
}

.agm__legend .is-hq,
.agm__dot.is-hq { background: var(--agm-hq); }
.agm__legend .is-office,
.agm__dot.is-office { background: var(--agm-office); }
.agm__legend .is-research { background: var(--agm-research); }

/* Side panel */
.agm__side {
	position: relative;
	min-width: 0;
}

.agm__panel {
	position: absolute;
	inset: 0;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 0 4px 28px 0;
	scrollbar-width: thin;
	scrollbar-color: var(--agm-line) transparent;
	-webkit-mask-image: linear-gradient(#000 calc(100% - 28px), transparent);
	mask-image: linear-gradient(#000 calc(100% - 28px), transparent);
}

.agm__view {
	display: grid;
	gap: 14px;
	align-content: start;
}

.agm__view[hidden] {
	display: none;
}

.agm__card {
	display: grid;
	gap: 4px;
	padding: 14px 16px;
	border: 1px solid var(--agm-line);
	border-radius: 14px;
	background: var(--agm-card);
	min-width: 0;
}

.agm .agm__card-title {
	margin: 0;
	color: var(--agm-muted);
	font-size: 0.8125rem;
	font-weight: 600;
	letter-spacing: 0.08em;
	line-height: 1.4;
	text-transform: uppercase;
}

.agm .agm__card-title--sub {
	margin-top: 12px;
}

.agm .agm__office-name {
	margin: 0;
	color: var(--agm-text);
	font-weight: 700;
	font-size: 1rem;
}

.agm__address {
	font-style: normal;
	color: var(--agm-muted);
	font-size: 0.875rem;
	line-height: 1.5;
}

.agm__rows {
	list-style: none;
	margin: 2px 0 0;
	padding: 0;
	display: grid;
}

.agm__rows button {
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 8px 2px;
	border: 0;
	border-top: 1px solid var(--agm-line);
	border-radius: 0;
	background: none;
	color: var(--agm-text);
	font: inherit;
	font-size: 0.875rem;
	line-height: 1.35;
	text-align: left;
	cursor: pointer;
}

.agm__rows li:first-child button {
	border-top: 0;
}

.agm__rows button span:last-child {
	color: var(--agm-muted);
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.agm__rows button:hover span:first-child,
.agm__rows button:focus-visible span:first-child {
	color: var(--agm-research-hover);
}

.agm .agm__back {
	justify-self: start;
	padding: 0;
	border: 0;
	background: none;
	color: var(--agm-muted);
	font: inherit;
	font-size: 0.8125rem;
	cursor: pointer;
}

.agm .agm__back:hover,
.agm .agm__back:focus-visible {
	color: var(--agm-text);
}

.agm__chips {
	list-style: none;
	margin: 4px 0 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.agm__chips li {
	margin: 0;
	padding: 4px 9px;
	border-radius: 6px;
	background: rgba(1, 129, 200, 0.18);
	color: #cfe9f8;
	font-size: 0.8125rem;
	line-height: 1.35;
	transition: background-color 0.2s, color 0.2s;
}

.agm__chips li.is-hot {
	background: var(--agm-research);
	color: #ffffff;
}

.agm .agm__tab:focus-visible,
.agm__rows button:focus-visible,
.agm .agm__back:focus-visible {
	outline: 2px solid var(--agm-research-hover);
	outline-offset: 2px;
}

/* CTA keeps the existing outline button look */
.agm__cta {
	display: flex;
	justify-content: center;
	margin: 0;
}

.agm__cta.wp-block-buttons {
	justify-content: center !important;
}

.agm__cta .wp-block-button__link {
	display: inline-block;
	padding: 0.8em 1.75em;
	border: 1px solid var(--agm-text) !important;
	border-radius: 1em 0 1em 0 !important;
	background: transparent !important;
	color: var(--agm-text) !important;
	font-weight: 600;
	text-decoration: none;
	transition: background-color 0.2s, color 0.2s;
}

.agm__cta .wp-block-button__link:hover,
.agm__cta .wp-block-button__link:focus-visible {
	background: var(--agm-text) !important;
	color: var(--agm-navy) !important;
}

.agm .agm__notice {
	margin: 0;
	padding: 10px 14px;
	border: 1px dashed #f5c26b;
	border-radius: 8px;
	color: #f5c26b;
	font-size: 0.8125rem;
}

/* Versions without the side column: the map takes the full width of the content area */
.agm--no-sidebar .agm__stage {
	grid-template-columns: minmax(0, 1fr);
	width: 100%;
	max-width: var(--wp--style--global--content-size, 1180px);
	margin-inline: auto;
}

.agm--no-sidebar .agm__legend {
	justify-content: center;
}

/* No region buttons and no side column: countries and pins only show their name */
.agm--static .agm__map .tsl-land path.is-research,
.agm--static .agm__pin {
	cursor: default;
}

/* The tip on touch screens appears on tap; keep it inside the map */
.agm__tip {
	max-width: calc(100% - 24px);
}

/* Large screens: a little more room for the panel */
@media (min-width: 1500px) {
	.agm__stage {
		grid-template-columns: minmax(0, 1fr) 360px;
	}
}

/* Tablet & phone: panel under the map, tabs swipe sideways */
@media (max-width: 960px) {
	.agm__stage {
		grid-template-columns: minmax(0, 1fr);
	}

	.agm__panel {
		position: static;
		overflow: visible;
		padding: 0;
		-webkit-mask-image: none;
		mask-image: none;
	}

	.agm__view {
		grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
		align-items: start;
	}

	.agm__view > .agm__back {
		grid-column: 1 / -1;
	}

	.agm__tabs {
		flex-wrap: nowrap;
		justify-content: flex-start;
		overflow-x: auto;
		margin-inline: calc(var(--accelsiors-page-gutter, 16px) * -1);
		padding: 2px var(--accelsiors-page-gutter, 16px);
		scrollbar-width: none;
		-webkit-overflow-scrolling: touch;
	}

	.agm__tabs::-webkit-scrollbar {
		display: none;
	}

	.agm .agm__tab {
		flex: 0 0 auto;
		padding: 9px 14px; /* bigger tap target */
	}

	.agm__rows button {
		padding-block: 11px;
	}
}

@media (max-width: 480px) {
	.agm__map {
		border-radius: 12px;
	}

	.agm__stats {
		gap: 6px 22px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.agm__pin .agm__pulse {
		animation: none;
		opacity: 0.25;
	}

	.agm__map:not(.is-ready)::before {
		animation: none;
	}
}
