/**
 * OD WWL Interactive Map block styles.
 * Uses theme design tokens (var(--od-color-*)) injected globally.
 * Material Icons are loaded globally on singular pages (see od-register-enqueue.php).
 */

.wwl-svg-map-wrapper {
	--wwl-map-radius: 20px;
	--wwl-map-panel-radius: 16px;
	--wwl-map-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.12), 0 4px 6px -4px rgba(0, 0, 0, 0.08);
	--wwl-map-panel-shadow: 0 12px 28px rgba(59, 64, 55, 0.18);
}

/* ---------- SVG path classes ----------
   The source SVG tags each <path> with either .cls-1 (standard land) or
   .cls-2 (very thin strokes for tiny islands). Default fill is light gray;
   rank-based fills (red/orange) are injected inline per-instance by the PHP
   block template using scoped selectors like #wwl-svg-map-wrapper-xxx #AF. */

.wwl-svg-map__svg .cls-1,
.wwl-svg-map__svg .cls-2 {
	fill: var(--od-color-light-gray);
	stroke: #fff;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.wwl-svg-map__svg .cls-1 {
	stroke-width: 0.5px;
}

.wwl-svg-map__svg .cls-2 {
	stroke-width: 0.25px;
}

/* ---------- Map surface ---------- */

.wwl-svg-map-wrapper {
	position: relative;
	overflow: hidden;
	background-color: var(--od-color-dark-gray);
	border-radius: var(--wwl-map-radius);
	box-shadow: var(--wwl-map-shadow);
	/* Beat global body p/button 20px inside the block. */
	font-size: 16px;
	line-height: 1.4;
	/* Layout height = map stage only; panels overlay inside this box. */
}

.wwl-svg-map-wrapper p {
	margin-top: 0;
	font-size: inherit;
	line-height: inherit;
}

.wwl-svg-map__stage {
	position: relative;
	min-height: 360px;
}

.wwl-svg-map__inner {
	position: relative;
	min-height: 360px;
}

.wwl-svg-map__panel-slot {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 25;
	max-height: 90%;
	pointer-events: none;
}

.wwl-svg-map-wrapper--panel-open .wwl-svg-map__panel-slot {
	pointer-events: auto;
}

.wwl-svg-map__svg {
	display: block;
	width: 100%;
	min-height: 360px;
	/* Match the viewBox aspect ratio (1730.4x855.5) so the SVG box always
	   exactly contains the rendered world map. */
	aspect-ratio: 1730.4 / 855.5;
	height: auto;
	max-height: 650px;
}

@media (max-width: 639px) {
	.wwl-svg-map__svg {
		aspect-ratio: 1730.4 / 855.5;
		height: auto;
		max-height: none;
	}
}

@media (min-width: 980px) {
	.wwl-svg-map__svg {
		aspect-ratio: auto;
		height: 500px;
		min-height: 360px;
		max-height: none;
	}
}

.wwl-svg-country {
	transition: opacity 0.2s ease, filter 0.2s ease;
	cursor: pointer;
}

.wwl-map-zoomed {
	opacity: 0.45;
}

.wwl-map-zoomed.wwl-map-selected {
	opacity: 1;
	filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.35));
}

/* ---------- Top-left control bar ---------- */

.wwl-svg-map__controls {
	position: absolute;
	top: 14px;
	left: 14px;
	display: flex;
	gap: 8px;
	z-index: 20;
}

.wwl-svg-map__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border: none;
	border-radius: 50%;
	background-color: #fff;
	color: var(--od-color-purple);
	cursor: pointer;
	box-shadow: 0 2px 8px rgba(59, 64, 55, 0.2);
	transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.wwl-svg-map__btn:hover,
.wwl-svg-map__btn:focus-visible {
	background-color: var(--od-color-purple);
	color: #fff;
	outline: none;
	transform: translateY(-1px);
}

.wwl-svg-map__btn:focus-visible {
	outline: 3px solid var(--od-color-wwl-yellow, #eba500);
	outline-offset: 2px;
}

.wwl-svg-map__btn .material-icons {
	font-size: 22px;
	line-height: 1;
}

/* ---------- Tooltip (hover-on-country) ---------- */

.wwl-svg-map__tooltip {
	position: absolute;
	top: 0;
	left: 50%;
	z-index: 30;
	max-width: 280px;
	margin: 0;
	padding: 8px 14px;
	background-color: #fff;
	color: var(--od-color-dark-gray);
	border-radius: 999px;
	box-shadow: var(--wwl-map-panel-shadow);
	font-family: "futura-pt", sans-serif;
	font-size: 15px;
	font-weight: 600;
	text-align: center;
	pointer-events: none;
	transform: translate(-50%, -52px);
}

.wwl-svg-map__tooltip::after {
	content: "";
	position: absolute;
	bottom: -6px;
	left: 50%;
	width: 0;
	border-style: solid;
	border-width: 7px 7px 0;
	border-color: #fff transparent transparent transparent;
	transform: translateX(-50%);
}

/* ---------- Info / country windows ---------- */

/* Panels live in .wwl-svg-map__panel-slot (absolute); they overlay the map, not page content below. */
.wwl-svg-map__window {
	display: none;
	position: relative;
	width: 100%;
	max-height: inherit;
	overflow-x: hidden;
	overflow-y: auto;
	padding: 16px 18px 18px;
	background-color: #fff;
	color: var(--od-color-dark-gray);
	border-radius: var(--wwl-map-panel-radius) var(--wwl-map-panel-radius) 0 0;
	box-shadow: var(--wwl-map-panel-shadow);
	font-size: 16px;
	line-height: 1.4;
	box-sizing: border-box;
	-webkit-overflow-scrolling: touch;
}

.wwl-svg-map__info {
	width: 100%;
}

.wwl-svg-map__info p {
	margin: 0 0 8px;
	font-size: 16px;
	line-height: 1.45;
	color: var(--od-color-dark-gray);
}

.wwl-svg-map__window h2 {
	margin: 0 44px 12px 0;
	padding: 0 0 10px;
	color: var(--od-color-purple);
	font-family: "futura-pt", sans-serif;
	font-size: 22px;
	font-weight: 700;
	line-height: 1.2;
	border-bottom: 2px solid var(--od-color-light-gray, #f5f5f5);
}

.wwl-svg-map__window h2.wwl-svg-map__country-title {
	margin-bottom: 10px;
	padding-bottom: 0;
	border-bottom: none;
}

.wwl-svg-map__window h3 {
	margin: 12px 0 8px;
	color: var(--od-color-dark-gray);
	font-family: "futura-pt", sans-serif;
	font-size: 16px;
	font-weight: 700;
}

.wwl-svg-map__window p {
	margin: 0 0 8px;
	line-height: 1.45;
}

.wwl-svg-map__window .wwl-svg-map__link.button {
	display: block;
	width: 100%;
	margin-bottom: 6px;
	padding: 8px 12px;
	font-size: 15px;
	line-height: 1.2;
	text-align: center;
}

/* Close button (top-right of every window) */
.wwl-svg-map__window-close {
	position: absolute;
	top: 10px;
	right: 10px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	padding: 0;
	border: none;
	border-radius: 50%;
	background-color: var(--od-color-light-gray, #f5f5f5);
	color: var(--od-color-purple);
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.wwl-svg-map__window-close:hover,
.wwl-svg-map__window-close:focus-visible {
	background-color: var(--od-color-purple);
	color: #fff;
	outline: none;
}

.wwl-svg-map__window-close:focus-visible {
	outline: 3px solid var(--od-color-wwl-yellow, #eba500);
	outline-offset: 2px;
}

.wwl-svg-map__window-close .material-icons {
	font-size: 20px;
	line-height: 1;
}

/* ---------- Per-country info window ---------- */

.wwl-svg-map__country-window {
	width: 100%;
}

.wwl-svg-map__country-title {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 10px;
	border-bottom: none;
	padding-bottom: 0;
	margin-bottom: 14px;
}

.wwl-svg-map__country-rank {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 4px 10px;
	background-color: var(--od-color-wwl-red);
	color: #fff;
	border-radius: 999px;
	font-family: "futura-pt", sans-serif;
	font-size: 12px;
	font-weight: 700;
	line-height: 1;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.wwl-svg-map__country-meta {
	margin: 0 0 6px;
	font-size: 15px;
	line-height: 1.35;
}

.wwl-svg-map__country-meta strong {
	display: inline;
	margin-right: 0.35em;
	color: var(--od-color-purple);
	font-family: "futura-pt", sans-serif;
	font-size: inherit;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.03em;
}

.wwl-svg-map__country-actions {
	margin: 16px 0 0;
	text-align: left;
}

body .wwl-svg-map-wrapper .wwl-svg-map__country-link.button {
	width: 100%;
	margin: 0;
	font-size: 14px;
	padding: 8px 14px;
	line-height: 1.15;
}

@media (max-width: 639px) {
	.wwl-svg-map-wrapper {
		font-size: 14px;
	}

	.wwl-svg-map__window {
		padding: 12px 14px 14px;
		font-size: 14px;
	}

	.wwl-svg-map__window h2 {
		margin: 0 36px 8px 0;
		padding: 0 0 6px;
		font-size: 18px;
	}

	.wwl-svg-map__window h2.wwl-svg-map__country-title {
		margin-bottom: 8px;
		padding-bottom: 0;
	}

	.wwl-svg-map__country-title {
		gap: 8px;
	}

	.wwl-svg-map__country-rank {
		padding: 3px 8px;
		font-size: 11px;
	}

	.wwl-svg-map__info p,
	.wwl-svg-map__window p,
	.wwl-svg-map__country-meta {
		margin: 0 0 5px;
		font-size: 13px;
		line-height: 1.35;
	}

	.wwl-svg-map__country-actions {
		margin: 10px 0 0;
	}

	body .wwl-svg-map-wrapper .wwl-svg-map__country-link.button {
		font-size: 13px;
		padding: 7px 12px;
	}

	.wwl-svg-map__window-close {
		top: 8px;
		right: 8px;
		width: 28px;
		height: 28px;
	}

	.wwl-svg-map__window-close .material-icons {
		font-size: 18px;
	}
}

/* Bottom sheet is mobile-only; from 640px the panel floats top-right (controls sit top-left). */
@media (min-width: 640px) {
	.wwl-svg-map__panel-slot {
		top: 14px;
		right: 14px;
		bottom: 14px;
		left: auto;
		width: 380px;
		max-width: calc(100% - 28px);
		max-height: none;
		display: flex;
		flex-direction: column;
		align-items: stretch;
	}

	/* Slot spans the full map height; only the card itself takes clicks. */
	.wwl-svg-map-wrapper--panel-open .wwl-svg-map__panel-slot {
		pointer-events: none;
	}

	.wwl-svg-map__panel-slot .wwl-svg-map__window {
		flex: 0 1 auto;
		max-height: 100%;
		pointer-events: auto;
		padding: 18px 20px 20px;
		font-size: 16px;
		border-radius: var(--wwl-map-panel-radius);
	}
}
