/* Afripoli Innovation Map — colours and fonts from the Elementor global styles, with design-system fallbacks */

.afp-map {
	--m-brand: var(--e-global-color-accent, #182145);
	--m-secondary: var(--e-global-color-text, #324A6D);
	--m-accent: var(--e-global-color-dd618f9, #F7652D);
	--m-muted: var(--e-global-color-3b80b3a, #6B7280);
	--m-lines: var(--e-global-color-958a145, #E5E7EB);
	--m-light: var(--e-global-color-secondary, #F5F5F5);
	--m-white: var(--e-global-color-a01d281, #FFFFFF);
	--m-land: #E5E7EB;
	--m-serif: var(--e-global-typography-text-font-family, "PT Serif"), Georgia, serif;
	--m-sans: var(--e-global-typography-0b3f4f6-font-family, "Montserrat"), Arial, sans-serif;
	width: 100%;
	max-width: 1240px;
	margin: 0 auto;
	font-family: var(--m-serif);
	color: var(--m-brand);
}

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

/* Neutralise theme button styles (Hello Elementor sets nowrap, padding, colours) */
.afp-map button,
.afp-map button:hover,
.afp-map button:focus,
.afp-map button:active {
	white-space: normal;
	box-shadow: none;
	text-transform: none;
	letter-spacing: normal;
	min-height: 0;
}

/* Header ------------------------------------------------------------- */

.afp-map__head {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 1.5rem 3rem;
	flex-wrap: wrap;
	margin-bottom: 1.5rem;
}

.afp-map__intro {
	max-width: 38rem;
}

.afp-map .afp-map__title {
	/* Same look whether rendered as h1, h2 or h3 (theme heading styles must not leak in) */
	font-family: var(--m-serif);
	font-style: normal;
	font-weight: 400;
	text-transform: none;
	padding: 0;
	font-size: clamp(2rem, 4.2vw, 3.25rem);
	line-height: 1.05;
	letter-spacing: -0.01em;
	color: var(--m-brand);
	margin: 0 0 0.6rem;
}

.afp-map .afp-map__subtitle {
	font-size: 18px;
	line-height: 1.5;
	color: var(--m-secondary);
	margin: 0;
}

.afp-map__layers {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	border: 0;
	margin: 0;
	padding: 0;
}

.afp-map__layer {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.45rem 0.9rem 0.45rem 0.7rem;
	border: 1px solid var(--m-lines);
	border-radius: 999px;
	font-family: var(--m-sans);
	font-size: 13px;
	font-weight: 600;
	color: var(--m-brand);
	cursor: pointer;
	user-select: none;
}

.afp-map__layer input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.afp-map__layer::before {
	content: "";
	width: 11px;
	height: 11px;
	border-radius: 50%;
	flex: none;
}

.afp-map__layer--energy::before {
	background: var(--m-accent);
	box-shadow: 0 0 0 2px var(--m-white), 0 0 0 3px var(--m-accent);
}

.afp-map__layer--digital::before {
	background: var(--m-white);
	box-shadow: 0 0 0 2.5px var(--m-brand);
}

.afp-map__layer:has(input:not(:checked)) {
	color: var(--m-muted);
	background: var(--m-light);
}

.afp-map__layer:has(input:not(:checked))::before {
	opacity: 0.35;
}

.afp-map__layer:has(input:focus-visible) {
	outline: 2px solid var(--m-accent);
	outline-offset: 2px;
}

/* Body: map + panel -------------------------------------------------- */

.afp-map__body {
	display: grid;
	/* Map column as wide as the map needs at this screen height; the profile gets the rest */
	grid-template-columns: minmax(0, min(56%, calc((100vh - 10.5rem) * 0.976))) minmax(360px, 1fr);
	gap: 2.5rem;
	align-items: start;
}

.afp-map__stage {
	position: relative;
}

@media (min-width: 961px) {
	/* The map stays in view while the profile is scrolled */
	.afp-map__stage {
		position: sticky;
		top: 8.5rem;
	}
}

.afp-map__svg {
	display: block;
	width: 100%;
	height: auto;
	max-height: calc(100vh - 12rem);
}

.afp-map .afp-map__caption {
	margin: 0.5rem 0 0;
	font-family: var(--m-sans);
	font-size: 12px;
	line-height: 1.4;
	color: var(--m-muted);
}

.afp-map__country {
	fill: var(--m-land);
	stroke: var(--m-white);
	stroke-width: 1;
	stroke-linejoin: round;
	vector-effect: non-scaling-stroke;
}

.afp-map__country--profile {
	fill: var(--m-secondary);
	cursor: pointer;
	transition: fill 0.15s ease;
}

.afp-map .afp-map__country,
.afp-map .afp-map__country:focus,
.afp-map .afp-map__pin,
.afp-map .afp-map__pin:focus {
	outline: none;
}

.afp-map .afp-map__country--profile:focus-visible {
	stroke: var(--m-accent);
	stroke-width: 2;
}

.afp-map__country--profile:hover,
.afp-map__country--profile:focus-visible {
	fill: var(--m-brand);
}

.afp-map__country--profile.is-active {
	fill: var(--m-brand);
	stroke: var(--m-accent);
	stroke-width: 2.5;
}

.afp-map__country--na {
	/* Territories without a profile: part of the land mass, but no interaction */
	pointer-events: none;
}

.afp-map__hatch-bg {
	fill: var(--m-secondary);
	fill-opacity: 0.45;
}

.afp-map__dashed {
	/* Blue dashes over the white border read as a dashed boundary (UN practice for boundaries not finally agreed) */
	fill: none;
	stroke: var(--m-secondary);
	stroke-width: 1.6;
	stroke-dasharray: 3 3;
	vector-effect: non-scaling-stroke;
	pointer-events: none;
}

.afp-map__stage .afp-map__reset,
.afp-map__stage .afp-map__reset:hover,
.afp-map__stage .afp-map__reset:focus {
	position: absolute;
	top: 0.5rem;
	left: 0.5rem;
	z-index: 3;
	padding: 0.45rem 0.9rem 0.45rem 0.75rem;
	background: var(--m-white);
	color: var(--m-brand);
	border: 1px solid var(--m-lines);
	border-radius: 999px;
	font-family: var(--m-sans);
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
}

.afp-map__stage .afp-map__reset::before {
	content: "‹ ";
}

.afp-map__stage .afp-map__reset:hover {
	border-color: var(--m-brand);
}

.afp-map__stage .afp-map__reset[hidden] {
	display: none;
}

/* Motion: one entrance, a gentle pulse until the first click, responses to actions */

.afp-map__pin-pulse {
	fill: none;
	stroke-width: 1.5;
	opacity: 0;
	transform-box: fill-box;
	transform-origin: center;
	pointer-events: none;
}

.afp-map__pin--energy .afp-map__pin-pulse {
	stroke: var(--m-accent);
}

.afp-map__pin--digital .afp-map__pin-pulse {
	/* Digital pins sit on dark-blue profile countries, so their pulse is white */
	stroke: var(--m-white);
	stroke-width: 2;
}

.afp-map:not(.is-waiting):not(.is-entering) .afp-map__pins:not(.has-focus) .afp-map__pin-pulse {
	animation: afp-wave 6s ease-out infinite;
	animation-delay: var(--d, 0s);
}

@keyframes afp-wave {
	0% { opacity: 0.75; transform: scale(0.9); }
	22% { opacity: 0; transform: scale(2.8); }
	100% { opacity: 0; transform: scale(2.8); }
}

@keyframes afp-pulse {
	0% { opacity: 0.8; transform: scale(1); }
	100% { opacity: 0; transform: scale(3.2); }
}

.afp-map.is-waiting .afp-map__country--profile {
	fill: var(--m-land);
}

.afp-map.is-waiting .afp-map__pin {
	opacity: 0;
}

.afp-map.is-entering .afp-map__country--profile {
	animation: afp-fill 0.7s ease backwards;
	/* --d: north-to-south delay set per country (0–1.2s), so the fill finishes within the entrance */
	animation-delay: var(--d, 0s);
}

@keyframes afp-fill {
	from { fill: var(--m-land); }
}

.afp-map__pin-dot,
.afp-map__pin-halo {
	transform-box: fill-box;
	transform-origin: center;
}

.afp-map.is-entering .afp-map__pin-dot,
.afp-map.is-entering .afp-map__pin-halo {
	animation: afp-pop 0.5s cubic-bezier(0.3, 1.6, 0.5, 1) backwards;
	/* Pins pop north to south (--d is 0–1.8s), all within the 2.2s entrance */
	animation-delay: calc(0.7s + var(--d, 0s) * 0.55);
}

@keyframes afp-pop {
	from { transform: scale(0); }
}

.afp-map__card {
	transition: opacity 0.25s ease, transform 0.25s ease;
}

.afp-map__card.is-entering {
	opacity: 0;
	transform: translateY(6px);
	transition: none;
}

.afp-map__hatch-line {
	stroke: var(--m-secondary);
	stroke-width: 1.6;
}

.afp-map__hatch-bg,
.afp-map__hatch-line {
	transition: fill 0.7s ease 0.9s, fill-opacity 0.7s ease 0.9s, stroke 0.7s ease 0.9s;
}

.afp-map.is-waiting .afp-map__hatch-bg {
	fill: var(--m-land);
	fill-opacity: 1;
}

.afp-map.is-waiting .afp-map__hatch-line {
	stroke: var(--m-land);
}

.afp-map__pin {
	cursor: pointer;
	outline: none;
}

.afp-map__pin-hit {
	fill: transparent;
}

.afp-map__pin-halo {
	fill: var(--m-white);
	opacity: 0;
}

.afp-map__pin--digital .afp-map__pin-halo {
	opacity: 1;
}

.afp-map__pin-dot {
	transition: transform 0.15s ease;
}

.afp-map__pin--energy .afp-map__pin-dot {
	fill: var(--m-accent);
	stroke: var(--m-white);
}

.afp-map__pin--digital .afp-map__pin-dot {
	fill: var(--m-white);
	stroke: var(--m-brand);
}

.afp-map__pin:hover .afp-map__pin-dot,
.afp-map__pin:focus-visible .afp-map__pin-dot {
	transform: scale(1.35);
}

/* Selected project: bigger, ringed, pulsing; other pins step back */
.afp-map__pin.is-active .afp-map__pin-dot,
.afp-map__pin.is-active .afp-map__pin-halo {
	transform: scale(1.6);
}

.afp-map__pin-ring {
	fill: rgba(247, 101, 45, 0.15);
	stroke: var(--m-accent);
	transform-box: fill-box;
	transform-origin: center;
	pointer-events: none;
	animation: afp-breathe 2.4s ease-in-out infinite alternate;
}

@keyframes afp-breathe {
	from { transform: scale(0.85); opacity: 1; }
	to { transform: scale(1.15); opacity: 0.55; }
}

.afp-map__pin.is-active .afp-map__pin-pulse {
	animation: afp-pulse 2.4s ease-out infinite;
	animation-delay: 0s;
	stroke: var(--m-accent);
	stroke-width: 2;
}

.afp-map__pins.has-focus .afp-map__pin:not(.is-active) {
	opacity: 0.35;
}

.afp-map__pins.has-focus .afp-map__pin:not(.is-active):hover {
	opacity: 1;
}

.afp-map__pin:focus-visible .afp-map__pin-hit {
	stroke: var(--m-accent);
	stroke-width: 2;
}

.afp-map__tip {
	position: absolute;
	transform: translate(-50%, calc(-100% - 14px));
	max-width: 260px;
	padding: 0.4rem 0.7rem;
	background: var(--m-brand);
	color: var(--m-white);
	font-family: var(--m-sans);
	font-size: 12px;
	font-weight: 600;
	line-height: 1.3;
	text-align: center;
	border-radius: 3px;
	pointer-events: none;
	z-index: 2;
	transition: background-color 0.25s ease;
}

.afp-map__tip.is-pin {
	transform: translate(-50%, calc(-100% - 16px));
}

.afp-map__tip.is-pin::after {
	content: "";
	position: absolute;
	left: calc(50% + var(--arrow, 0px));
	bottom: -5px;
	margin-left: -5px;
	border: 5px solid transparent;
	border-bottom: 0;
	border-top-color: var(--m-brand);
	transition: border-top-color 0.25s ease;
}

.afp-map__tip.is-active {
	background: var(--m-accent);
	font-weight: 700;
}

.afp-map__tip.is-active::after {
	border-top-color: var(--m-accent);
}

.afp-map__tip[hidden] {
	display: none;
}

.afp-map__picker {
	display: none;
}

/* Panel -------------------------------------------------------------- */

.afp-map__card {
	background: var(--m-light);
	border-radius: 4px;
	padding: 1.75rem 1.75rem 1.5rem;
}

.afp-map .afp-map__lead {
	font-size: 17px;
	line-height: 1.55;
	margin: 0 0 1.25rem;
}

.afp-map__legend {
	list-style: none;
	margin: 0 0 1.5rem;
	padding: 0;
	font-family: var(--m-sans);
	font-size: 13px;
	color: var(--m-secondary);
}

.afp-map__legend li {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	margin: 0 0 0.5rem;
}

.afp-map__key {
	width: 12px;
	height: 12px;
	border-radius: 50%;
	flex: none;
}

.afp-map__key--country {
	border-radius: 2px;
	background: var(--m-secondary);
}

.afp-map__key--energy {
	background: var(--m-accent);
}

.afp-map__key--digital {
	background: var(--m-white);
	box-shadow: inset 0 0 0 2.5px var(--m-brand);
}

.afp-map__countrylist {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
}

.afp-map .afp-map__chip {
	font-family: var(--m-serif);
	font-size: 15px;
	color: var(--m-brand);
	background: var(--m-white);
	border: 1px solid var(--m-lines);
	border-radius: 999px;
	padding: 0.3rem 0.8rem;
	cursor: pointer;
	line-height: 1.4;
}

.afp-map .afp-map__chip:hover,
.afp-map .afp-map__chip:focus-visible {
	border-color: var(--m-brand);
	background: var(--m-white);
	color: var(--m-brand);
}

.afp-map .afp-map__region {
	font-family: var(--m-sans);
	font-size: 12px;
	font-weight: 600;
	color: var(--m-muted);
	margin: 0 0 0.35rem;
}

.afp-map .afp-map__region--energy {
	color: #B9461A;
}

.afp-map .afp-map__name {
	font-family: var(--m-serif);
	font-weight: 400;
	font-size: 34px;
	line-height: 1.1;
	color: var(--m-brand);
	margin: 0 0 0.9rem;
}

.afp-map .afp-map__name--project {
	font-size: 26px;
}

.afp-map .afp-map__why {
	font-size: 16px;
	line-height: 1.6;
	margin: 0 0 1.25rem;
	color: var(--m-brand);
}

.afp-map__stats {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 1px;
	margin: 0 0 1rem;
	background: var(--m-lines);
	border: 1px solid var(--m-lines);
}

.afp-map__stats div {
	background: var(--m-white);
	padding: 0.65rem 0.8rem;
}

.afp-map__stats div:last-child:nth-child(odd) {
	grid-column: 1 / -1;
}

.afp-map__stats dt,
.afp-map__facts dt {
	font-family: var(--m-sans);
	font-size: 11px;
	font-weight: 600;
	color: var(--m-muted);
	margin: 0 0 0.15rem;
}

.afp-map__stats dd {
	font-size: 20px;
	margin: 0;
	color: var(--m-brand);
}

.afp-map__year {
	font-size: 12px;
	color: var(--m-muted);
}

.afp-map .afp-map__mix {
	font-size: 14px;
	line-height: 1.5;
	color: var(--m-secondary);
	margin: 0 0 1.5rem;
}

.afp-map .afp-map__section {
	font-family: var(--m-sans);
	font-size: 13px;
	font-weight: 700;
	color: var(--m-brand);
	margin: 1.5rem 0 0.6rem;
	padding-top: 1.1rem;
	border-top: 1px solid var(--m-lines);
}

.afp-map__projects,
.afp-map__briefs {
	list-style: none;
	margin: 0;
	padding: 0;
}

.afp-map .afp-map__project,
.afp-map .afp-map__project:hover,
.afp-map .afp-map__project:focus {
	background: transparent;
	color: var(--m-brand);
	border-top: 0;
	border-right: 0;
	border-bottom: 0;
	border-radius: 0;
}

.afp-map .afp-map__project {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 0.75rem;
	width: 100%;
	padding: 0.6rem 0 0.6rem 0.9rem;
	background: none;
	border: 0;
	border-left: 3px solid var(--m-accent);
	margin: 0 0 0.35rem;
	text-align: left;
	font-family: var(--m-serif);
	font-size: 16px;
	line-height: 1.35;
	color: var(--m-brand);
	cursor: pointer;
}

.afp-map .afp-map__project-name {
	flex: 1 1 auto;
	min-width: 0;
}

.afp-map .afp-map__project--digital {
	border-left-color: var(--m-brand);
}

.afp-map .afp-map__project:hover .afp-map__project-name,
.afp-map .afp-map__project:focus-visible .afp-map__project-name {
	text-decoration: underline;
	text-underline-offset: 3px;
}

.afp-map__status {
	flex: none;
	font-family: var(--m-sans);
	font-size: 11px;
	font-weight: 600;
	padding: 0.15rem 0.5rem;
	border-radius: 999px;
	background: var(--m-white);
	border: 1px solid var(--m-lines);
	color: var(--m-secondary);
	white-space: nowrap;
}

.afp-map__status--operational {
	border-color: var(--m-secondary);
	color: var(--m-brand);
}

.afp-map__status--under-construction {
	border-color: var(--m-accent);
	color: #B9461A;
}

.afp-map .afp-map__empty {
	font-style: italic;
	font-size: 15px;
	color: var(--m-muted);
	margin: 0;
}

/* Project accordion */

.afp-map__item {
	margin: 0 0 0.35rem;
}

.afp-map .afp-map__item .afp-map__project {
	margin: 0;
}

.afp-map__detail {
	display: grid;
	grid-template-rows: 0fr;
	transition: grid-template-rows 0.3s ease;
	border-left: 3px solid var(--m-accent);
}

.afp-map__item .afp-map__project--digital + .afp-map__detail {
	border-left-color: var(--m-brand);
}

.afp-map__item.is-open .afp-map__detail {
	grid-template-rows: 1fr;
}

.afp-map__detail-inner {
	overflow: hidden;
	padding-left: 0.9rem;
}

.afp-map .afp-map__desc {
	font-size: 15px;
	line-height: 1.55;
	margin: 0.15rem 0 0.75rem;
	color: var(--m-brand);
}

.afp-map__detail .afp-map__facts {
	margin: 0 0 0.25rem;
}

.afp-map__detail .afp-map__facts div {
	padding: 0.45rem 0;
}

.afp-map__detail .afp-map__facts dd {
	font-size: 14px;
}

.afp-map__detail .afp-map__sources {
	margin: 0.5rem 0 1rem;
}

.afp-map__item.is-open .afp-map__project-name {
	font-weight: 700;
}

.afp-map__item.is-open .afp-map__project {
	padding-bottom: 0.35rem;
}

.afp-map__briefs li {
	margin: 0 0 0.65rem;
}

.afp-map .afp-map__briefs a {
	display: block;
	font-size: 16px;
	line-height: 1.35;
	color: var(--m-brand);
	text-decoration: none;
}

.afp-map .afp-map__briefs a:hover {
	text-decoration: underline;
	text-underline-offset: 3px;
}

.afp-map__briefs span {
	font-size: 13px;
	font-style: italic;
	color: var(--m-muted);
}

.afp-map .afp-map__more {
	display: inline-block;
	margin-top: 0.25rem;
	font-family: var(--m-sans);
	font-size: 13px;
	font-weight: 600;
	color: var(--m-brand);
}

.afp-map .afp-map__cta {
	display: table;
	margin-top: 1.75rem;
	padding: 0.8rem 1.4rem;
	background: var(--m-brand);
	color: var(--m-white);
	font-family: var(--m-serif);
	font-size: 16px;
	text-decoration: none;
	border-radius: 2px;
}

.afp-map .afp-map__cta:hover,
.afp-map .afp-map__cta:focus-visible {
	background: var(--m-accent);
	color: var(--m-white);
}

.afp-map .afp-map__sources {
	margin: 1.25rem 0 0;
	font-size: 13px;
	line-height: 1.5;
	color: var(--m-muted);
}

.afp-map .afp-map__sources strong {
	font-family: var(--m-sans);
	font-weight: 600;
}

.afp-map__facts {
	margin: 0;
}

.afp-map__facts div {
	padding: 0.6rem 0;
	border-top: 1px solid var(--m-lines);
}

.afp-map__facts dd {
	margin: 0;
	font-size: 15px;
	line-height: 1.45;
}

.afp-map .afp-map__back {
	background: none;
	border: 0;
	padding: 0;
	margin: 0 0 1rem;
	font-family: var(--m-sans);
	font-size: 13px;
	font-weight: 600;
	color: var(--m-secondary);
	cursor: pointer;
}

.afp-map .afp-map__back::before {
	content: "‹ ";
}

.afp-map .afp-map__back:hover,
.afp-map .afp-map__back:focus {
	color: var(--m-accent);
	background: none;
	border: 0;
}

.afp-map button:focus-visible,
.afp-map a:focus-visible {
	outline: 2px solid var(--m-accent);
	outline-offset: 2px;
}

/* Responsive --------------------------------------------------------- */

@media (max-width: 960px) {
	.afp-map__body {
		grid-template-columns: 1fr;
		gap: 1.5rem;
	}

	.afp-map__picker {
		display: block;
		margin-bottom: 0.75rem;
	}

	.afp-map__picker select {
		width: 100%;
		padding: 0.7rem 0.8rem;
		font-family: var(--m-serif);
		font-size: 16px;
		color: var(--m-brand);
		border: 1px solid var(--m-lines);
		border-radius: 4px;
		background: var(--m-white);
	}

	.afp-map__svg {
		max-height: none;
	}

	.afp-map__tip {
		display: none;
	}
}

@media (max-width: 600px) {
	.afp-map__card {
		padding: 1.25rem;
	}

	.afp-map .afp-map__name {
		font-size: 28px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.afp-map__country--profile,
	.afp-map__hatch-bg,
	.afp-map__hatch-line,
	.afp-map__pin-dot,
	.afp-map__card,
	.afp-map__detail {
		transition: none;
	}

	.afp-map .afp-map__pin-pulse,
	.afp-map .afp-map__pin-ring,
	.afp-map .afp-map__pin-dot,
	.afp-map .afp-map__pin-halo,
	.afp-map .afp-map__country--profile {
		animation: none;
	}
}

.afp-map .screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}
