/**
 * Carte des marchés — styles du widget.
 * Toutes les couleurs et dimensions passent par des variables --pdfm-*, réglées par les contrôles Elementor.
 * Les polices sont héritées du thème.
 */

.pdfm {
	--pdfm-ocean: #e6ecee;
	--pdfm-land: #d3d6d1;
	--pdfm-border: #f4f6f5;
	--pdfm-border-width: 0.6;
	--pdfm-home: #efe6d6;
	--pdfm-market: #1f4a6b;
	--pdfm-market-hover: #33739a;
	--pdfm-active: #b08a52;
	--pdfm-dimmed-mix: 35%;
	--pdfm-label: #18242e;
	--pdfm-label-halo: rgba(255, 255, 255, 0.75);
	--pdfm-ink: #18242e;
	--pdfm-ink-soft: #55626c;
	--pdfm-surface: #fff;
	--pdfm-line: #d9dfe2;
	--pdfm-shadow: 0 18px 40px rgba(24, 36, 46, 0.18);
	--pdfm-radius: 6px;
	--pdfm-height: 640px;
	--pdfm-panel-width: 380px;
	--pdfm-badge: var(--pdfm-ink-soft);
	--pdfm-button-bg: var(--pdfm-market);
	--pdfm-button-color: #fff;
	--pdfm-button-bg-hover: var(--pdfm-market-hover);
	--pdfm-button-color-hover: #fff;
	--pdfm-button-radius: 4px;
	--pdfm-ctrl-bg: var(--pdfm-surface);
	--pdfm-ctrl-color: var(--pdfm-ink);
	--pdfm-tooltip-bg: var(--pdfm-surface);
	--pdfm-tooltip-color: var(--pdfm-ink);

	color: var(--pdfm-ink);
}

@media (max-width: 1024px) {
	.pdfm {
		--pdfm-height: 520px;
	}
}

@media (max-width: 767px) {
	.pdfm {
		--pdfm-height: 70vh;
		--pdfm-panel-width: 100%;
		--pdfm-search-width: 100%;
	}
}

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

/* Barre : filtres de zone + recherche de pays */
.pdfm__bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem 1.5rem;
	margin-bottom: 1rem;
}

/* Filtres */
.pdfm__filters {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

/* Recherche de pays (§ 17). Largeur réglable par appareil (px, %, em, rem, vw) ; 100 % par défaut sur mobile. */
.pdfm__search {
	position: relative;
	width: var(--pdfm-search-width, 280px);
	max-width: 100%;
	margin-left: auto;
}

/* Recherche superposée à la carte : en haut à gauche (ou à droite), à 20 px des bords par défaut.
   Au-dessus du canevas, des contrôles et de l'infobulle, sous le panneau (z-index 5). */
.pdfm--search-overlay .pdfm__map .pdfm__search {
	position: absolute;
	top: var(--pdfm-search-y, 20px);
	left: var(--pdfm-search-x, 20px);
	z-index: 4;
	max-width: calc(100% - 2 * var(--pdfm-search-x, 20px));
	margin: 0;
}

.pdfm--search-right .pdfm__map .pdfm__search {
	left: auto;
	right: var(--pdfm-search-x, 20px);
}

.pdfm__search-input {
	box-sizing: border-box;
	width: 100%;
	font: inherit;
	font-size: 0.95rem;
}

/* Aspect du champ, identique au repos et au focus (souris comme clavier). Spécificité supérieure aux styles
   de formulaire du kit Elementor (« .elementor-kit-N input:focus:not([type="button"])… »), qui ne s'appliquent
   donc pas ; les réglages Style du widget (sélecteurs {{WRAPPER}}, plus forts encore) remplacent ces valeurs. */
.pdfm :is(.pdfm__bar, .pdfm__map) .pdfm__search input.pdfm__search-input,
.pdfm :is(.pdfm__bar, .pdfm__map) .pdfm__search input.pdfm__search-input:focus {
	padding: 0.5rem 0.9rem;
	border: 1px solid var(--pdfm-search-border, var(--pdfm-line));
	border-radius: 999px;
	background: var(--pdfm-search-bg, var(--pdfm-surface));
	color: var(--pdfm-ink);
	box-shadow: none;
	outline: none;
}

.pdfm__search-list {
	position: absolute;
	top: calc(100% + 0.35rem);
	left: 0;
	right: 0;
	z-index: 10;
	max-height: 16rem;
	overflow-y: auto;
	margin: 0;
	padding: 0.35rem 0;
	list-style: none;
	background: var(--pdfm-search-bg, var(--pdfm-surface));
	border: 1px solid var(--pdfm-search-border, var(--pdfm-line));
	border-radius: var(--pdfm-radius);
	box-shadow: var(--pdfm-shadow);
}

.pdfm__search-list[hidden] {
	display: none;
}

.pdfm__search-option {
	padding: 0.45rem 0.9rem;
	cursor: pointer;
	color: var(--pdfm-ink);
}

.pdfm__search-option.is-active {
	background: var(--pdfm-search-active, color-mix(in srgb, var(--pdfm-market) 12%, var(--pdfm-surface)));
}

.pdfm__chip {
	font: inherit;
	font-size: 0.92rem;
	line-height: 1.3;
	padding: 0.45rem 1rem;
	border-radius: 999px;
	border: 1px solid var(--pdfm-line);
	background: var(--pdfm-surface);
	color: var(--pdfm-ink);
	cursor: pointer;
	transition-property: color, background-color, border-color, box-shadow;
	transition-duration: 0.2s;
}

.pdfm__chip:hover {
	border-color: var(--pdfm-market);
}

/* Spécificité renforcée : le survol des boutons du kit Elementor ne doit pas masquer l'état sélectionné.
   Les réglages « Boutons de filtre » du widget passent encore devant (sélecteur {{WRAPPER}}). */
.pdfm .pdfm__chip[aria-pressed="true"] {
	background: var(--pdfm-market);
	border-color: var(--pdfm-market);
	color: #fff;
}

.pdfm__chip:focus-visible,
.pdfm__ctrl:focus-visible,
.pdfm__panel-close:focus-visible,
.pdfm__panel a:focus-visible,
.pdfm__list a:focus-visible {
	outline: 2px solid var(--pdfm-active);
	outline-offset: 2px;
}

/* Carte */
.pdfm__map {
	position: relative;
	height: var(--pdfm-height);
	min-height: 320px;
	background: var(--pdfm-ocean);
	border-radius: var(--pdfm-radius);
	overflow: hidden;
}

.pdfm__svg {
	display: block;
	width: 100%;
	height: 100%;
}

/* Carte en tuiles : le moteur GL crée .pdfm__gl et masque le SVG (spec § 18.4). */
.pdfm__gl {
	position: absolute;
	inset: 0;
}

.pdfm.is-gl .pdfm__svg {
	display: none;
}

/* Un doigt fait défiler la page ; le pincement à deux doigts zoome (spec § 14.5). */
.pdfm__map.is-zoomable .pdfm__svg {
	cursor: grab;
	touch-action: pan-y;
}

.pdfm__map.is-zoomable .pdfm__svg:active {
	cursor: grabbing;
}

.pdfm__country {
	fill: var(--pdfm-land);
	stroke: var(--pdfm-border);
	stroke-width: var(--pdfm-border-width);
	vector-effect: non-scaling-stroke;
}

.pdfm__country.is-home {
	fill: var(--pdfm-home);
}

.pdfm__country.is-market {
	fill: var(--pdfm-country-color, var(--pdfm-market));
	cursor: pointer;
	transition: fill 0.18s ease;
}

.pdfm__country.is-market:hover,
.pdfm__country.is-market:focus {
	fill: var(--pdfm-market-hover);
	outline: none;
}

.pdfm__country.is-market:focus-visible {
	stroke: var(--pdfm-active);
	stroke-width: 2.5;
}

.pdfm__country.is-dimmed {
	fill: color-mix(in srgb, var(--pdfm-country-color, var(--pdfm-market)) var(--pdfm-dimmed-mix), var(--pdfm-land));
}

.pdfm__country.is-active,
.pdfm__country.is-active:hover {
	fill: var(--pdfm-active);
}

/* Contrôles de zoom */
.pdfm__ctrls {
	position: absolute;
	left: 1rem;
	bottom: 1rem;
	display: flex;
	flex-direction: column;
	border-radius: var(--pdfm-radius);
	overflow: hidden;
	box-shadow: var(--pdfm-shadow);
	z-index: 2;
}

.pdfm--ctrls-right .pdfm__ctrls {
	left: auto;
	right: 1rem;
}

/* Spécificité doublée (.pdfm .pdfm__ctrl) et remise à zéro complète : les styles « button » du thème
   et du kit Elementor (padding, min-width, bordure, fond au survol…) décentraient les icônes. */
.pdfm .pdfm__ctrl,
.pdfm .pdfm__ctrl:hover,
.pdfm .pdfm__ctrl:focus {
	width: 2.5rem;
	height: 2.5rem;
	min-width: 0;
	min-height: 0;
	margin: 0;
	padding: 0;
	border: 0;
	border-bottom: 1px solid var(--pdfm-line);
	border-radius: 0;
	background: var(--pdfm-ctrl-bg);
	color: var(--pdfm-ctrl-color);
	box-shadow: none;
	font-size: 0;
	line-height: 0;
	text-transform: none;
	letter-spacing: 0;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}

.pdfm .pdfm__ctrl:hover {
	background: color-mix(in srgb, var(--pdfm-ctrl-color) 8%, var(--pdfm-ctrl-bg));
}

.pdfm .pdfm__ctrl:last-child {
	border-bottom: 0;
}

.pdfm .pdfm__ctrl svg {
	display: block;
	flex: none;
	width: 1rem;
	height: 1rem;
	margin: 0;
}

/* Bouton à plat / globe : l'icône montre la vue vers laquelle il bascule. */
.pdfm .pdfm__ctrl--projection .pdfm__ico-flat,
.pdfm .pdfm__ctrl--projection[aria-pressed="true"] .pdfm__ico-globe {
	display: none;
}

.pdfm .pdfm__ctrl--projection[aria-pressed="true"] .pdfm__ico-flat {
	display: block;
}

/* Légende */
.pdfm__legend {
	position: absolute;
	left: 4.5rem;
	bottom: 1rem;
	display: flex;
	flex-wrap: wrap;
	gap: 1rem;
	font-size: 0.82rem;
	color: var(--pdfm-ink-soft);
	background: color-mix(in srgb, var(--pdfm-surface) 85%, transparent);
	padding: 0.4rem 0.75rem;
	border-radius: var(--pdfm-radius);
	z-index: 1;
}

.pdfm--ctrls-right .pdfm__legend,
.pdfm--no-zoom .pdfm__legend {
	left: 1rem;
}

/* Sans zoom mais avec le bouton à plat / globe (mode tuiles) : la légende laisse la place aux boutons. */
.pdfm--no-zoom .pdfm__ctrls ~ .pdfm__legend {
	left: 4.5rem;
}

.pdfm__legend span {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
}

.pdfm__swatch {
	display: inline-block;
	width: 0.8rem;
	height: 0.8rem;
	border-radius: 2px;
}

.pdfm__swatch--market {
	background: var(--pdfm-market);
}

.pdfm__swatch--home {
	background: var(--pdfm-home);
	outline: 1px solid var(--pdfm-line);
}

/* Infobulle */
.pdfm__tooltip {
	position: absolute;
	pointer-events: none;
	background: var(--pdfm-tooltip-bg);
	color: var(--pdfm-tooltip-color);
	font-size: 1.05rem;
	font-weight: 600;
	padding: 0.3rem 0.75rem;
	border-radius: 4px;
	box-shadow: var(--pdfm-shadow);
	white-space: nowrap;
	transform: translate(-50%, calc(-100% - 12px));
	opacity: 0;
	transition: opacity 0.12s ease;
	z-index: 3;
}

.pdfm__tooltip.is-visible {
	opacity: 1;
}

/* Panneau */
.pdfm__panel {
	position: absolute;
	top: 0;
	right: 0;
	height: 100%;
	width: min(var(--pdfm-panel-width), 100%);
	background: var(--pdfm-surface);
	box-shadow: var(--pdfm-shadow);
	transform: translateX(105%);
	transition: transform 0.32s cubic-bezier(0.2, 0.7, 0.2, 1);
	display: flex;
	flex-direction: column;
	z-index: 5;
}

.pdfm__panel.is-open {
	transform: translateX(0);
}

.pdfm__panel-media {
	position: relative;
	aspect-ratio: 16 / 9;
	background: var(--pdfm-market);
	overflow: hidden;
	flex-shrink: 0;
}

.pdfm__panel-media svg,
.pdfm__panel-media img {
	display: block;
	width: 100%;
	height: 100%;
}

.pdfm__panel-media img {
	object-fit: cover;
}

.pdfm__panel-media path {
	fill: rgba(255, 255, 255, 0.92);
}

/* Même protection que les boutons de zoom contre les styles « button » du thème. */
.pdfm .pdfm__panel-close,
.pdfm .pdfm__panel-close:hover,
.pdfm .pdfm__panel-close:focus {
	position: absolute;
	top: 0.75rem;
	right: 0.75rem;
	width: 2.25rem;
	height: 2.25rem;
	min-width: 0;
	min-height: 0;
	margin: 0;
	padding: 0;
	border-radius: 50%;
	border: 0;
	background: var(--pdfm-close-bg, var(--pdfm-surface));
	color: var(--pdfm-close-color, var(--pdfm-ink));
	font-size: 0;
	line-height: 0;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
	z-index: 1;
}

.pdfm .pdfm__panel-close:hover {
	background: color-mix(in srgb, var(--pdfm-close-color, var(--pdfm-ink)) 8%, var(--pdfm-close-bg, var(--pdfm-surface)));
}

.pdfm .pdfm__panel-close svg {
	display: block;
	flex: none;
	width: 0.9rem;
	height: 0.9rem;
	margin: 0;
}

.pdfm__panel-body {
	padding: 1.4rem 1.5rem 1.6rem;
	overflow-y: auto;
	flex: 1;
}

.pdfm__panel-region {
	display: inline-block;
	font-size: 0.82rem;
	color: var(--pdfm-badge);
	border: 1px solid var(--pdfm-line);
	border-radius: 999px;
	padding: 0.1rem 0.7rem;
	text-decoration: none;
}

a.pdfm__panel-region[href]:hover {
	border-color: var(--pdfm-market);
	color: var(--pdfm-ink);
}

.pdfm__panel-title {
	font-size: 2rem;
	font-weight: 700;
	line-height: 1.1;
	margin: 0.6rem 0;
	color: var(--pdfm-ink);
}

.pdfm__panel-teaser {
	margin: 0 0 1.25rem;
	color: var(--pdfm-ink-soft);
	line-height: 1.6;
}

.pdfm__figures {
	margin: 0 0 1.5rem;
	padding: 0;
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 1rem 1.25rem;
}

.pdfm__figures div {
	border-top: 1px solid var(--pdfm-line);
	padding-top: 0.6rem;
}

.pdfm__figures dt {
	font-size: 0.82rem;
	color: var(--pdfm-ink-soft);
}

.pdfm__figures dd {
	margin: 0.1rem 0 0;
	font-size: 1.5rem;
	font-weight: 600;
	line-height: 1.1;
}

.pdfm__panel-cta {
	display: block;
	text-align: center;
	background: var(--pdfm-button-bg);
	color: var(--pdfm-button-color);
	text-decoration: none;
	padding: 0.85rem 1rem;
	border-radius: var(--pdfm-button-radius);
	font-weight: 500;
}

.pdfm__panel-cta:hover,
.pdfm__panel-cta:focus {
	background: var(--pdfm-button-bg-hover);
	color: var(--pdfm-button-color-hover);
}

/* Statut (erreur de chargement) */
.pdfm__status:empty {
	display: none;
}

.pdfm__status {
	position: absolute;
	inset: 50% 1rem auto;
	transform: translateY(-50%);
	text-align: center;
	color: var(--pdfm-ink-soft);
}

/* Liste des marchés */
.pdfm__list {
	margin-top: 1.5rem;
}

.pdfm__list ul {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 1.25rem;
}

.pdfm__list a {
	color: var(--pdfm-ink);
	text-decoration: none;
	border-bottom: 1px solid var(--pdfm-line);
}

.pdfm__list a:hover {
	border-color: var(--pdfm-active);
}

/* Liste regroupée : zones empilées, un titre par zone (polices du kit pour h2…h6, valeurs de repli ci-dessous) */
.pdfm__groups {
	display: grid;
	gap: 1.4rem;
}

.pdfm__list-title {
	margin: 0 0 0.6rem;
	padding-bottom: 0.45rem;
	border-bottom: 1px solid var(--pdfm-line);
	font-size: 1.2rem;
	font-weight: 600;
	line-height: 1.25;
	color: var(--pdfm-ink);
}

/* Mobile : recherche alignée à gauche (pleine largeur par défaut, cf. --pdfm-search-width), panneau en bas */
@media (max-width: 767px) {
	.pdfm__search {
		margin-left: 0;
	}

	.pdfm__panel {
		top: auto;
		bottom: 0;
		height: auto;
		max-height: 62%;
		border-radius: 12px 12px 0 0;
		transform: translateY(105%);
	}

	.pdfm__panel.is-open {
		transform: translateY(0);
	}

	.pdfm__panel-media {
		aspect-ratio: 4 / 1;
	}

	.pdfm__panel-body {
		padding: 1rem 1.25rem 1.25rem;
	}

	.pdfm__panel-title {
		font-size: 1.6rem;
		margin: 0.4rem 0;
	}

	.pdfm__figures {
		gap: 0.75rem 1rem;
		margin-bottom: 1.1rem;
	}

	.pdfm__figures dd {
		font-size: 1.3rem;
	}

	.pdfm__legend {
		display: none;
	}

	.pdfm__ctrls {
		left: 0.75rem;
		bottom: 0.75rem;
	}

	.pdfm--ctrls-right .pdfm__ctrls {
		right: 0.75rem;
	}
}

/* Texte réservé aux lecteurs d'écran */
.pdfm__sr {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Modèle de panneau (Élément de boucle Elementor, § 16) */
.pdfm__panel-template {
	flex: 1;
	overflow-y: auto;
}

.pdfm__panel-template[hidden] {
	display: none;
}

.pdfm__skeleton {
	display: grid;
	gap: 0.9rem;
	padding: 4rem 1.5rem 1.5rem;
}

.pdfm__skeleton i {
	display: block;
	height: 1rem;
	border-radius: 4px;
	background: linear-gradient(90deg, var(--pdfm-line) 25%, color-mix(in srgb, var(--pdfm-line) 40%, var(--pdfm-surface)) 50%, var(--pdfm-line) 75%);
	background-size: 200% 100%;
	animation: pdfm-shimmer 1.2s linear infinite;
}

.pdfm__skeleton i:first-of-type {
	height: 9rem;
}

.pdfm__skeleton i:nth-of-type(2) {
	width: 60%;
	height: 2rem;
}

.pdfm__skeleton i:last-of-type {
	width: 80%;
}

@keyframes pdfm-shimmer {
	to {
		background-position: -200% 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.pdfm__panel,
	.pdfm__country.is-market,
	.pdfm__tooltip {
		transition: none;
	}

	.pdfm__skeleton i {
		animation: none;
	}
}
