/*
 * Annuaire VDN/CAN - "Trouver mon service d'eau potable"
 * Styles de la vue carte (template Address/Water.html, section "Search").
 * Conçu pour la conformité RGAA 4.1 : contrastes AA, focus visible,
 * cible non uniquement colorée, utilitaire de masquage accessible.
 */

.water-finder {
	--water-ink: #1b1b35;
	--water-muted: #55566d;
	--water-primary: #17348a;
	--water-primary-strong: #0f2560;
	--water-border: #d7dbe8;
	--water-surface: #ffffff;
	--water-surface-alt: #f4f6fb;
	--water-focus: #0b5fff;

	color: var(--water-ink);
	margin: 1.5em 0 2.5em;
	font-size: 1em;
	line-height: 1.5;
}

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

.water-finder__title {
	font-size: clamp(1.4em, 1em + 1.6vw, 2em);
	color: var(--water-primary);
	margin: 0 0 0.35em;
}

.water-finder__intro {
	max-width: 60ch;
	color: var(--water-muted);
	margin: 0 0 1.5em;
}

/* ------- Mise en page 2 colonnes ------- */
.water-finder__layout {
	display: grid;
	grid-template-columns: 1fr;
	gap: 1.75em;
	align-items: start;
}

@media (min-width: 62em) {
	.water-finder__layout {
		grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	}
}

/* ------- Colonne carte ------- */
.water-finder__field {
	margin-bottom: 1em;
}

.water-finder__label {
	display: block;
	font-weight: 700;
	margin-bottom: 0.4em;
}

.water-finder__select {
	width: 100%;
	max-width: 100%;
	padding: 0.6em 0.75em;
	font-size: 1em;
	color: var(--water-ink);
	background-color: var(--water-surface);
	border: 1px solid var(--water-border);
	border-radius: 8px;
	line-height: 1.3;
}

.water-finder__help {
	margin: 0.45em 0 0;
	font-size: 0.9em;
	color: var(--water-muted);
}

.water-finder__map-head {
	margin: 1.25em 0 0;
}

.water-finder__map {
	height: clamp(360px, 55vh, 560px);
	width: 100%;
	margin-top: 0.75em;
	background-color: var(--water-surface-alt);
	border: 1px solid var(--water-border);
	border-radius: 10px;
	overflow: hidden;
	z-index: 0; /* garde les panneaux Leaflet sous d'éventuels menus du site */
}

.water-finder__map-msg {
	margin: 0.75em 0 0;
	padding: 0.75em 1em;
	background-color: #fdf3e7;
	border: 1px solid #e6a23c;
	border-radius: 8px;
	color: #6b4a12;
	font-size: 0.95em;
}

.water-finder__map-help {
	margin: 0.6em 0 0;
	font-size: 0.85em;
	color: var(--water-muted);
}

.water-finder__result {
	margin: 1em 0 0;
	min-height: 1.5em;
	font-weight: 600;
}

.water-finder__result:not(:empty) {
	padding: 0.65em 0.9em;
	background-color: var(--water-surface-alt);
	border-left: 4px solid var(--water-primary);
	border-radius: 4px;
}

/* ------- Légende ------- */
.water-finder__legend {
	margin-top: 1.5em;
}

.water-finder__legend-title {
	font-size: 1em;
	margin: 0 0 0.5em;
}

.water-finder__legend-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 0.4em 1.25em;
}

.water-legend__item {
	display: flex;
	align-items: center;
	gap: 0.5em;
	font-size: 0.92em;
}

.water-legend__swatch {
	display: inline-block;
	width: 1.05em;
	height: 1.05em;
	flex: 0 0 auto;
	border: 1px solid rgba(0, 0, 0, 0.35);
	border-radius: 3px;
	background-color: #d9d9e3;
}

.water-finder__disclaimer {
	margin: 1.5em 0 0;
	font-size: 0.8em;
	color: var(--water-muted);
	font-style: italic;
}

/* ------- Colonne fiches ------- */
.water-finder__list-title {
	font-size: 1.15em;
	color: var(--water-primary);
	margin: 0 0 1em;
}

.water-finder__cards {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: 1fr;
	gap: 1em;
}

@media (min-width: 30em) {
	.water-finder__cards {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

.water-card {
	--water-accent: var(--water-primary);
	display: flex;
	flex-direction: column;
	gap: 0.5em;
	padding: 1em;
	background-color: var(--water-surface);
	border: 1px solid var(--water-border);
	border-top: 4px solid var(--water-accent);
	border-radius: 10px;
	box-shadow: 0 1px 2px rgba(20, 25, 60, 0.06);
	scroll-margin-top: 1em;
}

.water-card.is-active {
	box-shadow: 0 0 0 3px rgba(23, 52, 138, 0.35);
	border-color: var(--water-primary);
}

.water-card__logo {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 3em;
}

.water-card__logo img {
	max-width: 100%;
	max-height: 84px;
	height: auto;
	width: auto;
}

.water-card__title {
	font-size: 1.05em;
	margin: 0;
	color: var(--water-ink);
}

.water-card__url {
	margin: 0;
	font-size: 0.85em;
	color: var(--water-muted);
	word-break: break-word;
}

.water-card__details {
	list-style: none;
	margin: 0.25em 0 0;
	padding: 0;
	font-size: 0.9em;
	color: var(--water-muted);
}

.water-card__details li {
	margin: 0.15em 0;
}

.water-card__details a {
	color: var(--water-primary);
}

.water-card__link {
	margin-top: auto;
	align-self: flex-start;
	display: inline-block;
	padding: 0.55em 1.1em;
	background-color: var(--water-primary);
	color: #ffffff;
	text-decoration: none;
	font-weight: 600;
	border-radius: 8px;
	border: 1px solid var(--water-primary);
}

.water-card__link:hover,
.water-card__link:focus {
	background-color: var(--water-primary-strong);
	border-color: var(--water-primary-strong);
	color: #ffffff;
	text-decoration: underline;
}

/* ------- Focus visible (RGAA 10.7) ------- */
.water-finder a:focus-visible,
.water-finder select:focus-visible,
.water-finder .water-card:focus-visible,
.water-finder .leaflet-container:focus-visible {
	outline: 3px solid var(--water-focus);
	outline-offset: 2px;
}

/* Repli pour navigateurs sans :focus-visible */
.water-finder a:focus,
.water-finder select:focus {
	outline: 3px solid var(--water-focus);
	outline-offset: 2px;
}

.water-card:focus {
	outline: 3px solid var(--water-focus);
	outline-offset: 2px;
}

/* ------- Utilitaire de masquage accessible ------- */
.water-finder .visually-hidden {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ------- Contrôles Leaflet : contraste renforcé ------- */
.water-finder .leaflet-bar a {
	color: var(--water-ink);
}

.water-finder .leaflet-container a.leaflet-popup-close-button {
	color: var(--water-muted);
}

@media (prefers-reduced-motion: reduce) {
	.water-finder * {
		scroll-behavior: auto !important;
	}
}
