/* Pakistan coverage map (homepage, gp-core CoverageMap). Loaded only when the section is shown.
 * 3D comes from CSS perspective on one plane; the raised edge, relief and glow are static SVG drawn once.
 * Continuous motion runs only while the map is on screen (.is-live), not paused, and not under reduced motion. */

.gp-map {
	position: relative;
	isolation: isolate;
	overflow: hidden;
	background:
		radial-gradient(60rem 40rem at 78% 35%, rgb(56 57 141 / calc(var(--gp-map-bg-band, 0.5) * 0.9)), transparent 70%),
		radial-gradient(40rem 30rem at 15% 90%, rgb(3 112 181 / calc(var(--gp-map-bg-band, 0.5) * 0.35)), transparent 70%),
		var(--wp--preset--color--ink);
}

.gp-map::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	background-image:
		linear-gradient(rgb(255 255 255 / 0.05) 1px, transparent 1px),
		linear-gradient(90deg, rgb(255 255 255 / 0.05) 1px, transparent 1px);
	background-size: 48px 48px;
	mask-image: radial-gradient(ellipse at 70% 45%, #000 0%, transparent 70%);
	opacity: var(--gp-map-bg-band, 0.5);
}

.gp-map__inner {
	display: grid;
	gap: var(--wp--preset--spacing--60);
	align-items: center;
}

.gp-map__inner > *,
.gp-map__copy > * {
	margin-block: 0;
}

@media (min-width: 64em) {
	.gp-map__inner {
		grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
	}
}

.gp-map__copy {
	display: grid;
	gap: 1.25rem;
	justify-items: start;
	max-width: 34rem;
}

.gp-map__copy h2 {
	color: var(--wp--preset--color--white);
	font-size: var(--wp--preset--font-size--heading-1);
	line-height: 1.05;
}

.gp-map__lead {
	color: rgb(255 255 255 / 0.78);
	font-size: var(--wp--preset--font-size--lead);
}

.gp-map__list-title {
	margin-top: 0.75rem !important;
	color: rgb(255 255 255 / 0.7);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
}

.gp-map__list {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.gp-map__list li {
	margin: 0;
}

.gp-map__chip {
	min-height: 2.5rem;
	padding: 0.35rem 0.9rem;
	border: 1px solid rgb(255 255 255 / 0.2);
	border-radius: var(--wp--custom--radius--pill);
	background: rgb(255 255 255 / 0.04);
	color: var(--wp--preset--color--white);
	font: 600 0.875rem / 1.2 var(--wp--preset--font-family--display);
	cursor: pointer;
	transition: background var(--wp--custom--motion--fast) ease, border-color var(--wp--custom--motion--fast) ease;
}

.gp-map__chip:hover,
.gp-map__chip[aria-expanded="true"] {
	border-color: var(--wp--preset--color--amber);
	background: rgb(243 177 37 / 0.12);
}

/* ---------- Stage and 3D plane ---------- */

.gp-map__stage {
	--gp-map-rx: 0deg;
	--gp-map-ry: 0deg;
	--gp-map-py: 0px;
	position: relative;
	perspective: 1500px;
	perspective-origin: 50% 20%;
	padding-block: 1rem 2.5rem;
	min-width: 0;
}

.gp-map__plane {
	position: relative;
	width: 100%;
	max-width: 46rem;
	margin-inline: auto;
	transform-style: preserve-3d;
	transform-origin: 50% 60%;
	transform: translateY(var(--gp-map-py)) rotateX(calc(var(--gp-map-tilt) + var(--gp-map-rx))) rotateY(var(--gp-map-ry));
	transition: transform 700ms var(--wp--custom--motion--ease);
}

.gp-map__land,
.gp-map__net {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	overflow: visible;
}

/* Routes and the moving light repaint while animating: their own layer keeps the shaded map from repainting. */
.gp-map__net {
	will-change: transform;
	pointer-events: none;
}

.gp-map__relief {
	opacity: calc(var(--gp-map-light) * 0.8);
	mix-blend-mode: overlay;
}

.gp-map__edge-glow {
	opacity: var(--gp-map-glow);
}

.gp-map__glint {
	opacity: calc(0.4 + var(--gp-map-light) * 0.6);
	transform-box: fill-box;
}

/* ---------- Routes ---------- */

.gp-map__route path {
	fill: none;
	stroke-linecap: round;
}

.gp-map__route-glow {
	stroke: #4EA3E6;
	stroke-width: 12;
	opacity: calc(var(--gp-map-route-glow) * 0.35);
}

.gp-map__route-line {
	stroke: #8EC1F0;
	stroke-width: 2.4;
	opacity: 0.75;
}

.gp-map__route.is-thin .gp-map__route-line { stroke-width: 1.5; }
.gp-map__route.is-thick .gp-map__route-line { stroke-width: 3.6; }
.gp-map__route.is-thin .gp-map__route-glow { stroke-width: 8; }
.gp-map__route.is-thick .gp-map__route-glow { stroke-width: 16; }

.gp-map__route.is-dashed .gp-map__route-line {
	stroke-dasharray: 8 9;
}

.gp-map__route-pulse {
	stroke: var(--wp--preset--color--amber);
	stroke-width: 4;
	stroke-dasharray: 5 95;
	stroke-dashoffset: 100;
	opacity: 0;
}

.gp-map__route-label {
	fill: rgb(255 255 255 / 0.75);
	font: 600 15px var(--wp--preset--font-family--display);
	text-anchor: middle;
	paint-order: stroke;
	stroke: rgb(21 22 58 / 0.85);
	stroke-width: 4px;
	display: none;
}

.has-labels .gp-map__route-label {
	display: inline;
}

/* ---------- Markers ---------- */

.gp-map__pins {
	position: absolute;
	inset: 0;
	margin: 0;
	padding: 0;
	list-style: none;
	transform-style: preserve-3d;
}

/* Markers and names stand upright above the surface: lifted off the plane, then turned back by the map's tilt. */
.gp-map__pin {
	position: absolute;
	margin: 0;
	transform: translate3d(-50%, -50%, 26px) rotateX(calc(-1 * (var(--gp-map-tilt) + var(--gp-map-rx))));
	transform-origin: 50% 50%;
	z-index: 1;
}

.gp-map__pin:is(:hover, :focus-within, .is-active) {
	z-index: 3;
}

.gp-map__dot {
	--gp-dot: calc(13px * var(--gp-map-marker));
	position: relative;
	display: grid;
	place-items: center;
	width: max(28px, calc(var(--gp-dot) + 14px));
	height: max(28px, calc(var(--gp-dot) + 14px));
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	cursor: pointer;
}

.gp-map__dot::before {
	content: "";
	width: var(--gp-dot);
	height: var(--gp-dot);
	border-radius: 50%;
	background: radial-gradient(circle at 35% 30%, #FFE3A3, var(--wp--preset--color--amber) 55%, #B57A08);
	box-shadow: 0 0 0 2px rgb(21 22 58 / 0.9), 0 0 14px 3px rgb(243 177 37 / 0.55);
	transition: scale var(--wp--custom--motion--fast) ease;
}

.gp-map__pin.is-highlight .gp-map__dot {
	--gp-dot: calc(18px * var(--gp-map-marker));
}

.gp-map__pin.is-highlight .gp-map__dot::before {
	box-shadow: 0 0 0 2px rgb(21 22 58 / 0.9), 0 0 0 5px rgb(243 177 37 / 0.35), 0 0 20px 5px rgb(243 177 37 / 0.6);
}

.gp-map__pin.is-subtle .gp-map__dot {
	--gp-dot: calc(9px * var(--gp-map-marker));
}

.gp-map__pin.is-subtle .gp-map__dot::before {
	background: var(--wp--preset--color--white);
	box-shadow: 0 0 0 2px rgb(21 22 58 / 0.9), 0 0 10px 2px rgb(255 255 255 / 0.45);
}

/* Phones: smaller markers keep the north (Islamabad, Rawalpindi, Peshawar, Lahore) readable.
 * Every location also has a full-size button in the list above the map (WCAG 2.5.8 equivalent control). */
@media (max-width: 47.99em) {
	.gp-map__dot {
		--gp-dot: calc(10px * var(--gp-map-marker));
		/* 26px so the target stays above 24px after the 3D tilt foreshortens it. */
		width: 26px;
		height: 26px;
	}

	.gp-map__pin.is-highlight .gp-map__dot {
		--gp-dot: calc(13px * var(--gp-map-marker));
	}

	.gp-map__pin.is-subtle .gp-map__dot {
		--gp-dot: calc(7px * var(--gp-map-marker));
	}
}

.gp-map__dot:hover::before,
.gp-map__pin.is-active .gp-map__dot::before {
	scale: 1.25;
}

.gp-map__dot:focus-visible {
	outline: 3px solid var(--wp--preset--color--white);
	outline-offset: 2px;
}

.gp-map__ring {
	position: absolute;
	inset: 50% auto auto 50%;
	width: var(--gp-dot);
	height: var(--gp-dot);
	margin: calc(var(--gp-dot) / -2) 0 0 calc(var(--gp-dot) / -2);
	border: 2px solid var(--wp--preset--color--amber);
	border-radius: 50%;
	opacity: 0;
	pointer-events: none;
}

.gp-map__pin.is-subtle .gp-map__ring {
	border-color: var(--wp--preset--color--white);
}

.gp-map__label {
	position: absolute;
	top: 50%;
	left: calc(100% - 4px);
	translate: 0 -50%;
	display: none;
	padding: 0.15rem 0.45rem;
	border-radius: var(--wp--custom--radius--small);
	color: var(--wp--preset--color--white);
	font: 600 0.8125rem / 1.25 var(--wp--preset--font-family--display);
	white-space: nowrap;
	text-shadow: 0 1px 6px rgb(21 22 58 / 0.9);
	pointer-events: none;
}

.gp-map__pin.is-label-left .gp-map__label {
	left: auto;
	right: calc(100% - 4px);
}

.gp-map__pin.is-label-below .gp-map__label {
	top: calc(100% - 6px);
	left: 50%;
	translate: -50% 0;
	text-align: center;
}

.gp-map__label small {
	display: none;
	color: var(--wp--preset--color--amber);
	font-size: 0.6875rem;
	font-weight: 600;
}

/* Names on the map from tablet width (when switched on); everywhere a hovered, focused or selected marker shows its name and type. */
@media (min-width: 48em) {
	.has-labels .gp-map__label {
		display: block;
	}
}

.gp-map__pin:is(:hover, :focus-within, .is-active) .gp-map__label {
	display: block;
	background: rgb(21 22 58 / 0.9);
}

.gp-map__pin:is(:hover, :focus-within, .is-active) .gp-map__label small {
	display: block;
}

/* ---------- Information card ---------- */

.gp-map__card {
	position: absolute;
	inset: auto 0 0 0;
	z-index: 5;
	display: grid;
	gap: 0.35rem;
	padding: 1rem 2.75rem 1.1rem 1.1rem;
	border: 1px solid rgb(255 255 255 / 0.16);
	border-radius: var(--wp--custom--radius--medium);
	background: rgb(21 22 58 / 0.94);
	box-shadow: 0 24px 48px -20px rgb(0 0 0 / 0.7);
	color: var(--wp--preset--color--white);
}

.gp-map__card[hidden] {
	display: none;
}

.gp-map__card > * {
	margin: 0;
}

@media (min-width: 48em) {
	.gp-map__card {
		inset: auto;
		width: 17rem;
	}
}

.gp-map__card-type {
	color: var(--wp--preset--color--amber);
	font: 600 0.8125rem / 1.3 var(--wp--preset--font-family--display);
}

.gp-map__card-title {
	color: var(--wp--preset--color--white);
	font-size: var(--wp--preset--font-size--heading-4);
}

.gp-map__card-title:focus {
	outline: none;
}

.gp-map__card-title:focus-visible {
	outline: 2px solid var(--wp--preset--color--white);
	outline-offset: 2px;
}

.gp-map__card-text {
	color: rgb(255 255 255 / 0.8);
	font-size: var(--wp--preset--font-size--small);
}

.gp-map__card-link {
	justify-self: start;
	color: var(--wp--preset--color--white);
	font-weight: 600;
	text-decoration-color: var(--wp--preset--color--amber);
	text-underline-offset: 0.25em;
}

.gp-map__close {
	position: absolute;
	top: 0.35rem;
	right: 0.35rem;
	width: 2.25rem;
	height: 2.25rem;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--wp--preset--color--white);
	font-size: 1.4rem;
	line-height: 1;
	cursor: pointer;
}

.gp-map__close:hover {
	background: rgb(255 255 255 / 0.1);
}

.gp-map__pause {
	position: absolute;
	right: 0;
	bottom: 0;
	min-height: 2.25rem;
	padding: 0.35rem 0.8rem;
	border: 1px solid rgb(255 255 255 / 0.2);
	border-radius: var(--wp--custom--radius--pill);
	background: rgb(21 22 58 / 0.6);
	color: rgb(255 255 255 / 0.85);
	font: 600 0.75rem / 1 var(--wp--preset--font-family--display);
	cursor: pointer;
}

.gp-map__pause:hover {
	color: var(--wp--preset--color--white);
	border-color: rgb(255 255 255 / 0.45);
}

/* ---------- Motion (on screen, not paused, motion allowed) ---------- */

@media (prefers-reduced-motion: no-preference) {
	body:not(.gp-motion-off) .gp-map__stage.is-live:not(.is-paused).is-animated .gp-map__plane {
		animation: gp-map-float calc(9s * var(--gp-map-speed)) ease-in-out infinite;
	}

	body:not(.gp-motion-off) .gp-map__stage.is-live:not(.is-paused).is-animated .gp-map__glint {
		animation: gp-map-glint calc(16s * var(--gp-map-speed)) ease-in-out infinite alternate;
	}

	body:not(.gp-motion-off) .gp-map__stage.is-live:not(.is-paused).has-pulse .gp-map__ring {
		animation: gp-map-ring calc(2.8s * var(--gp-map-speed)) ease-out infinite;
		animation-delay: calc(var(--gp-pin-i) * -0.45s);
	}

	body:not(.gp-motion-off) .gp-map__stage.is-live:not(.is-paused).has-route-motion .gp-map__route-pulse {
		opacity: 1;
		animation: gp-map-route var(--gp-route-dur) linear infinite;
		animation-delay: var(--gp-route-delay);
	}
}

@keyframes gp-map-float {
	0%, 100% { translate: 0 0; }
	50% { translate: 0 -10px; }
}

@keyframes gp-map-glint {
	from { transform: translate(-120px, -60px); }
	to { transform: translate(520px, 520px); }
}

@keyframes gp-map-ring {
	0% { scale: 1; opacity: 0.75; }
	100% { scale: 2.8; opacity: 0; }
}

@keyframes gp-map-route {
	from { stroke-dashoffset: 100; }
	to { stroke-dashoffset: 0; }
}
