/* =========================================================================
   Agenda municipal — styles front
   Préfixe .agm — couleurs pilotées par variables CSS, redéfinissables
   dans le thème enfant.
   ====================================================================== */

.agm, .agm-fiche {
	--agm-accent:      #1f5c8b;
	--agm-accent-doux: #e7eef5;
	--agm-texte:       #1c2530;
	--agm-texte-doux:  #5b6672;
	--agm-trait:       #dde1e6;
	--agm-fond:        #fff;
	--agm-rayon:       8px;
}

.agm {
	container-type: inline-size;
	margin: 0 0 2.5rem;
}

/* --- Barre de filtres ------------------------------------------------- */

.agm-barre {
	display: flex;
	flex-wrap: wrap;
	gap: 14px;
	align-items: flex-start;
	justify-content: space-between;
	margin-bottom: 12px;
}

.agm-filtres {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	flex: 1 1 400px;
}

.agm-filtre {
	font: inherit;
	font-size: 0.875rem;
	padding: 7px 14px;
	border: 1px solid var(--agm-trait);
	border-radius: 999px;
	background: transparent;
	color: var(--agm-texte-doux);
	cursor: pointer;
	transition: background-color .15s, border-color .15s, color .15s;
}

.agm-filtre:hover { border-color: var(--agm-accent); color: var(--agm-accent); }

.agm-filtre.is-actif {
	background: var(--agm-accent);
	border-color: var(--agm-accent);
	color: #fff;
}

.agm-recherche { flex: 0 1 240px; }

.agm-champ {
	width: 100%;
	font: inherit;
	font-size: 0.9375rem;
	padding: 8px 14px;
	border: 1px solid var(--agm-trait);
	border-radius: 999px;
	background: #fff;
	color: var(--agm-texte);
}

.agm-champ:focus { outline: 2px solid var(--agm-accent); outline-offset: 1px; }

.agm-compteur {
	font-size: 0.8125rem;
	color: var(--agm-texte-doux);
	margin: 0 0 16px;
	min-height: 1.2em;
}

/* --- Titre de mois ---------------------------------------------------- */

.agm-mois {
	font-size: 0.8125rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: .1em;
	color: var(--agm-texte-doux);
	margin: 26px 0 10px;
	padding-bottom: 6px;
	border-bottom: 1px solid var(--agm-trait);
}

.agm-mois:first-child { margin-top: 0; }

/* --- Liste ------------------------------------------------------------ */

.agm--liste .agm-item {
	display: grid;
	grid-template-columns: 64px 1fr;
	gap: 16px;
	align-items: start;
	padding: 16px 0;
	border-bottom: 1px solid var(--agm-trait);
}

.agm--liste .agm-visuel { display: none; }

/* --- Grille ----------------------------------------------------------- */

.agm--grille .agm-liste {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
	gap: 20px;
}

.agm--grille .agm-mois { grid-column: 1 / -1; }

.agm--grille .agm-item {
	display: flex;
	flex-direction: column;
	background: var(--agm-fond);
	border: 1px solid var(--agm-trait);
	border-radius: var(--agm-rayon);
	overflow: hidden;
	position: relative;
	transition: border-color .15s, box-shadow .15s;
}

.agm--grille .agm-item:hover {
	border-color: var(--agm-accent);
	box-shadow: 0 4px 18px rgb(0 0 0 / .07);
}

.agm--grille .agm-visuel {
	aspect-ratio: 16 / 10;
	overflow: hidden;
	background: var(--agm-accent-doux);
}

.agm--grille .agm-visuel img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.agm--grille .agm-date {
	position: absolute;
	top: 10px;
	left: 10px;
	z-index: 2;
	background: #fff;
	box-shadow: 0 2px 8px rgb(0 0 0 / .14);
}

.agm--grille .agm-corps { padding: 14px 16px 18px; }

.agm-item[hidden] { display: none; }

/* --- Pastille de date ------------------------------------------------- */

.agm-date {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	width: 64px;
	padding: 8px 4px;
	border-radius: var(--agm-rayon);
	background: var(--agm-accent-doux);
	color: var(--agm-accent);
	line-height: 1.05;
}

.agm-date__jour { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }

.agm-date__mois {
	font-size: 0.6875rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: .07em;
}

.agm-date__an { font-size: 0.625rem; opacity: .7; margin-top: 2px; }

/* --- Corps de l'événement --------------------------------------------- */

.agm-corps { min-width: 0; }

.agm-titre {
	font-size: 1.0625rem;
	line-height: 1.32;
	margin: 0 0 5px;
	color: var(--agm-texte);
	overflow-wrap: anywhere;
}

.agm-titre a { color: inherit; text-decoration: none; }
.agm-titre a:hover, .agm-titre a:focus-visible { color: var(--agm-accent); text-decoration: underline; }

.agm-quand {
	font-size: 0.875rem;
	color: var(--agm-accent);
	font-weight: 500;
	margin: 0 0 3px;
}

.agm-lieu {
	font-size: 0.875rem;
	color: var(--agm-texte-doux);
	margin: 0 0 6px;
	position: relative;
	padding-left: 19px;
}

.agm-lieu::before {
	content: "";
	position: absolute;
	left: 0; top: .22em;
	width: 14px; height: 14px;
	background: currentColor;
	opacity: .6;
	-webkit-mask: var(--pin) center / contain no-repeat;
	mask: var(--pin) center / contain no-repeat;
	--pin: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a7 7 0 0 0-7 7c0 5.25 7 13 7 13s7-7.75 7-13a7 7 0 0 0-7-7Zm0 9.5A2.5 2.5 0 1 1 12 6.5a2.5 2.5 0 0 1 0 5Z'/%3E%3C/svg%3E");
}

.agm-etiquettes {
	display: flex;
	flex-wrap: wrap;
	gap: 5px;
	margin: 0 0 6px;
}

.agm-cat, .agm-tarif {
	font-size: 0.6875rem;
	text-transform: uppercase;
	letter-spacing: .06em;
	padding: 3px 8px;
	border-radius: 4px;
	background: var(--agm-accent-doux);
	color: var(--agm-accent);
}

.agm-tarif {
	background: transparent;
	border: 1px solid var(--agm-trait);
	color: var(--agm-texte-doux);
}

.agm-chapo {
	font-size: 0.875rem;
	line-height: 1.5;
	color: var(--agm-texte-doux);
	margin: 0;
}

/* --- Pied et états ---------------------------------------------------- */

.agm-pied { margin-top: 22px; }

.agm-lien-passes {
	font-size: 0.875rem;
	color: var(--agm-accent);
}

.agm-aucun, .agm-vide {
	padding: 26px;
	text-align: center;
	color: var(--agm-texte-doux);
	border: 1px dashed var(--agm-trait);
	border-radius: var(--agm-rayon);
	margin: 0;
}

.agm-aucun[hidden] { display: none; }

/* --- Fiche événement -------------------------------------------------- */

.agm-fiche {
	background: var(--agm-accent-doux);
	border-radius: var(--agm-rayon);
	padding: 20px 22px;
	margin: 0 0 26px;
}

.agm-fiche__liste { margin: 0; }

.agm-fiche__ligne {
	display: grid;
	grid-template-columns: 130px 1fr;
	gap: 10px;
	padding: 7px 0;
	border-bottom: 1px solid rgb(0 0 0 / .07);
}

.agm-fiche__ligne:last-child { border-bottom: none; }

.agm-fiche__ligne dt {
	font-size: 0.75rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: .07em;
	color: var(--agm-texte-doux);
	margin: 0;
	padding-top: 2px;
}

.agm-fiche__ligne dd {
	margin: 0;
	color: var(--agm-texte);
	overflow-wrap: anywhere;
}

.agm-fiche__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin: 18px 0 0;
}

.agm-bouton {
	display: inline-block;
	font-size: 0.875rem;
	font-weight: 500;
	padding: 10px 18px;
	border-radius: 999px;
	background: var(--agm-accent);
	color: #fff;
	text-decoration: none;
	border: 1px solid var(--agm-accent);
}

.agm-bouton:hover, .agm-bouton:focus-visible { background: #16456a; color: #fff; }

.agm-bouton--second {
	background: transparent;
	color: var(--agm-accent);
}

.agm-bouton--second:hover, .agm-bouton--second:focus-visible {
	background: var(--agm-accent);
	color: #fff;
}

/* --- Accessibilité ---------------------------------------------------- */

.agm :focus-visible, .agm-fiche :focus-visible {
	outline: 2px solid var(--agm-accent);
	outline-offset: 2px;
}

.agm .screen-reader-text, .agm-fiche .screen-reader-text {
	position: absolute !important;
	width: 1px; height: 1px;
	padding: 0; margin: -1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

@media (prefers-reduced-motion: reduce) {
	.agm-item, .agm-filtre { transition: none; }
}

@container (max-width: 460px) {
	.agm--liste .agm-item { grid-template-columns: 52px 1fr; gap: 12px; }
	.agm-date { width: 52px; }
	.agm-date__jour { font-size: 1.25rem; }
	.agm-fiche__ligne { grid-template-columns: 1fr; gap: 2px; }
}

/* --- Impression ------------------------------------------------------- */

@media print {
	.agm-barre, .agm-compteur, .agm-pied, .agm-fiche__actions { display: none; }
	.agm-item { break-inside: avoid; }
}
