/* ==========================================================================
   Bloc Carte Interactive — Carte pleine largeur + Card flottante
   ========================================================================== */

.bloc-carte {
	position: relative;
	height: var(--carte-hauteur, 55rem);
	border-radius: 3px;
	overflow: hidden;
	max-width: 1350px;
	margin: 3rem auto;
	margin-left: max(10px, calc((100% - 1350px) / 2));
	margin-right: max(10px, calc((100% - 1350px) / 2));
}


/* ---- Carte pleine largeur ---- */

.bloc-carte__leaflet {
	width: 100%;
	height: 100%;
}

.bloc-carte__image-map {
	position: relative;
	width: 100%;
	height: 100%;
	overflow: hidden;
}

.bloc-carte__fond {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}


/* ---- Leaflet popups ---- */

.bloc-carte .leaflet-popup-content-wrapper {
	border-radius: 3px;
	font-family: inherit;
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

.bloc-carte .leaflet-popup-content {
	font-size: 1.4rem;
	font-weight: 600;
	color: #181818;
	margin: 8px 14px;
}


/* ---- Pin / Marqueurs image ---- */

.bloc-carte__pin {
	position: absolute;
	transform: translate(-50%, -100%);
	border: none;
	background: none;
	padding: 0;
	cursor: pointer;
	z-index: 2;
	transition: z-index 0s;
}

.bloc-carte__pin img {
	width: 3.2rem;
	height: auto;
	transition: width 0.25s ease, filter 0.25s ease;
	pointer-events: none;
}

.bloc-carte__pin:hover img,
.bloc-carte__pin.active img {
	width: 4.4rem;
}

.bloc-carte__pin.active {
	z-index: 5;
}

.bloc-carte__pin:hover {
	z-index: 4;
}

.bloc-carte__pin.active img {
	filter: drop-shadow(0 3px 6px rgba(232, 121, 43, 0.45));
}

.bloc-carte__pin:focus-visible {
	outline: 2px solid #4F877C;
	outline-offset: 4px;
	border-radius: 50%;
}


/* ---- Marqueur Leaflet actif ---- */

.bloc-carte .leaflet-marker-icon {
	transition: filter 0.25s ease;
}

.bloc-carte .leaflet-marker-icon.marker-active {
	z-index: 1000 !important;
	filter: drop-shadow(0 4px 10px rgba(232, 121, 43, 0.55));
}

/* Animation bounce au clic */
.bloc-carte .leaflet-marker-icon.marker-bounce {
	animation: markerBounce 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes markerBounce {
	0%   { transform: scale(1) translateY(0); }
	30%  { transform: scale(1.3) translateY(-12px); }
	50%  { transform: scale(1.2) translateY(0); }
	70%  { transform: scale(1.25) translateY(-5px); }
	100% { transform: scale(1.2) translateY(0); }
}

/* Etat stable apres bounce */
.bloc-carte .leaflet-marker-icon.marker-active.marker-bounce {
	transform: scale(1.2) translateY(0);
}


/* ---- Masque territoire ---- */

.bloc-carte .leaflet-maskPane-pane {
	pointer-events: none;
}


/* ==========================================================================
   Card flottante
   ========================================================================== */

.bloc-carte__card {
	position: absolute;
	top: 2rem;
	right: 2rem;
	bottom: 2rem;
	width: 36rem;
	max-width: calc(100% - 4rem);
	background: #fff;
	border-radius: 3px;
	box-shadow:
		0 8px 32px rgba(0, 0, 0, 0.18),
		0 2px 8px rgba(0, 0, 0, 0.08);
	z-index: 800;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	animation: blocCarteCardIn 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.bloc-carte__card[hidden] {
	display: none;
}

@keyframes blocCarteCardIn {
	from {
		opacity: 0;
		transform: translateX(20px) scale(0.96);
	}
	to {
		opacity: 1;
		transform: translateX(0) scale(1);
	}
}


/* ---- Bouton fermer ---- */

.bloc-carte__card-close {
	position: absolute;
	top: 1rem;
	right: 1rem;
	width: 3.2rem;
	height: 3.2rem;
	border-radius: 50%;
	border: none;
	background: rgba(255, 255, 255, 0.92);
	backdrop-filter: blur(4px);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 2;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
	transition: background 0.2s, transform 0.2s;
	padding: 0;
}

.bloc-carte__card-close:hover {
	background: #fff;
	transform: scale(1.1);
}

.bloc-carte__card-close svg {
	width: 1.6rem;
	height: 1.6rem;
	fill: #333;
}


/* ---- Image ---- */

.bloc-carte__card-img {
	flex: 0 0 auto;
	height: 20rem;
	overflow: hidden;
}

.bloc-carte__card-img:empty {
	display: none;
}

.bloc-carte__card-img img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}


/* ---- Corps texte ---- */

.bloc-carte__card-body {
	padding: 2rem 2.4rem;
	flex: 1;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
}

.bloc-carte__card-titre {
	color: #4F877C;
	font-family: Gravity, sans-serif;
	font-size: 2rem;
	font-weight: 600;
	margin: 0 0 1rem 0;
	line-height: 1.3;
}

.bloc-carte__card-desc {
	color: #181818;
	font-size: 1.4rem;
	line-height: 1.6;
	margin-bottom: 1.5rem;
}

.bloc-carte__card-desc p {
	margin: 0 0 0.6rem 0;
}

.bloc-carte__card-lien {
	margin-top: auto;
	align-self: flex-start;
	font-size: 1.3rem;
	padding: 10px 22px;
	display: inline-flex;
	align-items: center;
	gap: 0.8rem;
	border-radius: 3px;
	transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

.bloc-carte__card-lien[hidden] {
	display: none;
}

.bloc-carte__card-lien-arrow {
	width: 1.4rem;
	height: 1.4rem;
	flex: 0 0 auto;
	transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
	will-change: transform;
}


/* ---- Wrapper cliquable (titre + desc + CTA) ---- */

.bloc-carte__card-link {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	flex: 1;
	min-height: 0;
	text-align: left;
	text-decoration: none;
	color: inherit;
	border-radius: 3px;
	padding: 0.6rem 0.8rem;
	margin: -0.6rem -0.8rem;
	cursor: pointer;
	position: relative;
	transition: background 0.35s ease, transform 0.35s ease;
	-webkit-tap-highlight-color: transparent;
}

.bloc-carte__card-link::before {
	content: '';
	position: absolute;
	inset: 0;
	border-radius: 3px;
	background: linear-gradient(135deg, rgba(79, 135, 124, 0.05), rgba(79, 135, 124, 0.12));
	opacity: 0;
	transition: opacity 0.35s ease;
	pointer-events: none;
	z-index: 0;
}

.bloc-carte__card-link > * {
	position: relative;
	z-index: 1;
}

.bloc-carte__card-link .bloc-carte__card-titre,
.bloc-carte__card-link .bloc-carte__card-desc {
	width: 100%;
	text-align: left;
}

.bloc-carte__card-link:hover::before,
.bloc-carte__card-link:focus-visible::before {
	opacity: 1;
}

.bloc-carte__card-link:hover .bloc-carte__card-titre {
	color: #3D6F66;
}

.bloc-carte__card-titre {
	transition: color 0.3s ease;
}

/* Effet supplementaire sur le CTA quand le wrapper est survole */
.bloc-carte__card-link:hover .bloc-carte__card-lien {
	background: #4F877C;
	border-color: #4F877C;
	color: #fff;
	border-radius: 3px;
	transform: translateX(2px);
	box-shadow: 0 4px 14px rgba(79, 135, 124, 0.28);
}

.bloc-carte__card-link:hover .bloc-carte__card-lien-arrow {
	transform: translateX(6px);
}

.bloc-carte__card-link:focus-visible {
	outline: 2px solid #4F877C;
	outline-offset: 3px;
}

/* Etat desactive : pas de lien associe au point */
.bloc-carte__card-link.is-disabled {
	cursor: default;
	pointer-events: none;
}

.bloc-carte__card-link.is-disabled .bloc-carte__card-lien {
	display: none;
}


/* ---- Navigation prev/next dans la Card ---- */

.bloc-carte__card-nav {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 1rem;
	padding: 1rem 2rem 1.4rem;
	border-top: 1px solid #eee;
}

.bloc-carte__card-nav-btn {
	width: 3rem;
	height: 3rem;
	border-radius: 50%;
	border: 2px solid #4F877C;
	background: #fff;
	color: #4F877C;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s, color 0.2s;
	padding: 0;
}

.bloc-carte__card-nav-btn:hover {
	background: #4F877C;
	color: #fff;
}

.bloc-carte__card-nav-btn:disabled {
	opacity: 0.3;
	cursor: default;
	pointer-events: none;
}

.bloc-carte__card-nav-btn svg {
	width: 1.2rem;
	height: 1.2rem;
	fill: currentColor;
}

.bloc-carte__card-counter {
	font-size: 1.2rem;
	color: #666;
	font-weight: 600;
	min-width: 4rem;
	text-align: center;
}


/* ==========================================================================
   Responsive
   ========================================================================== */

@media only screen and (max-width: 1023px) {
	.bloc-carte {
		height: 50rem;
		margin: 2rem 0;
	}

	.bloc-carte__card {
		width: 32rem;
		top: 1.5rem;
		right: 1.5rem;
		bottom: 1.5rem;
	}

	.bloc-carte__card-img {
		height: 16rem;
	}
}

@media only screen and (max-width: 767px) {
	.bloc-carte {
		height: 50rem;
		min-height: 0;
		margin: 1.5rem 0;
		margin-left: 10px;
		margin-right: 10px;
	}

	/* Card en bas sur mobile, hauteur fixe pour ne pas trop cacher la carte */
	.bloc-carte__card {
		top: auto;
		right: 0.8rem;
		bottom: 0.8rem;
		left: 0.8rem;
		width: auto;
		max-width: none;
		height: 22rem;
		max-height: 22rem;
		flex-direction: row;
		animation-name: blocCarteCardInMobile;
	}

	@keyframes blocCarteCardInMobile {
		from {
			opacity: 0;
			transform: translateY(20px);
		}
		to {
			opacity: 1;
			transform: translateY(0);
		}
	}

	.bloc-carte__card-img {
		height: auto;
		width: 11rem;
		flex: 0 0 11rem;
	}

	.bloc-carte__card-img:empty {
		display: none;
	}

	.bloc-carte__card-body {
		padding: 1.2rem 1.4rem;
		min-width: 0;
		flex: 1;
	}

	.bloc-carte__card-titre {
		font-size: 1.5rem;
		margin-bottom: 0.4rem;
	}

	.bloc-carte__card-desc {
		font-size: 1.2rem;
		line-height: 1.4;
		margin-bottom: 0.8rem;
		max-height: 6rem;
		overflow: hidden;
		display: -webkit-box;
		-webkit-line-clamp: 3;
		-webkit-box-orient: vertical;
	}

	.bloc-carte__card-lien {
		font-size: 1.1rem;
		padding: 6px 14px;
	}

	.bloc-carte__card-nav {
		position: absolute;
		bottom: 0.5rem;
		right: 0.8rem;
		padding: 0;
		border-top: none;
		gap: 0.6rem;
		background: transparent;
	}

	.bloc-carte__card-nav-btn {
		width: 2.6rem;
		height: 2.6rem;
		border-width: 1.5px;
	}

	.bloc-carte__card-nav-btn svg {
		width: 1rem;
		height: 1rem;
	}

	.bloc-carte__card-counter {
		font-size: 1.1rem;
		min-width: 3rem;
	}

	.bloc-carte__card-close {
		top: 0.5rem;
		right: 0.5rem;
		width: 2.6rem;
		height: 2.6rem;
	}

	.bloc-carte__card-close svg {
		width: 1.3rem;
		height: 1.3rem;
	}

	.bloc-carte__pin img {
		width: 2.6rem;
	}

	.bloc-carte__pin:hover img,
	.bloc-carte__pin.active img {
		width: 3.4rem;
	}
}


/* ---- Reduced motion ---- */

@media (prefers-reduced-motion: reduce) {
	.bloc-carte__card {
		animation: none;
	}

	.bloc-carte__pin img,
	.bloc-carte .leaflet-marker-icon {
		transition: none;
	}
}
