/* ==========================================================================
   MDTP - Actualités / Filtre + Grille
   ========================================================================== */

.ma-showcase {
	--ma-columns: 3;
}

/* ---------- Filtre horizontal ---------- */

.ma-filter {
	position: relative;
	background: #f0f0f0;
	border-radius: 16px;
	margin: 0 0 32px;
	overflow: visible; /* les items agrandis (hover/actif) doivent pouvoir dépasser de l'ul */
}

.ma-filter__list {
	position: relative;
	display: flex;
	list-style: none;
	margin: 0;
	padding: 0;
	z-index: 2;
}

.ma-filter__item {
	flex: 1 1 0;
	min-width: 0;
	height: 78px; /* hauteur fixe de la barre, indépendante de l'agrandissement au survol */
	position: relative;
	z-index: 2;
}

.ma-filter__item:hover,
.ma-filter__item.is-active {
	z-index: 3; /* passe au-dessus des items voisins quand il dépasse verticalement */
}

.ma-filter__item a {
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 3px;
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	padding: 16px 20px;
	text-decoration: none;
	color: #191919;
	border-radius: 12px;
	cursor: pointer;
	transition: color .3s ease, background-color .3s ease, top .35s cubic-bezier(.34, 1.56, .64, 1), bottom .35s cubic-bezier(.34, 1.56, .64, 1);
}

/* Item plus grand en hauteur que l'ul, au survol ou à l'état actif */
.ma-filter__item:hover a,
.ma-filter__item.is-active a {
	top: -14px;
	bottom: -14px;
}

.ma-filter__label {
	font-weight: 700;
	font-size: 14px;
	text-transform: uppercase;
	letter-spacing: .03em;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.ma-filter__desc {
	font-size: 12.5px;
	font-weight: 400;
	line-height: 1.3;
	opacity: .85;
}

/* Couleur de survol propre à chaque item (définie via le champ ACF "couleur"),
   appliquée aussi à l'état actif : le background de .is-active suit celui du survol. */
.ma-filter__item.is-active a,
.ma-filter__item:hover a {
	background-color: var(--ma-item-color, #191919);
	color: #fff;
}

/* Indicateur qui glisse d'un item à l'autre avec un effet "élastique" */
.ma-filter__indicator {
	position: absolute;
	top: 0;
	left: 0;
	height: 100%;
	width: 0;
	background: #0b3d6d;
	border-radius: 12px;
	z-index: 1;
	transition:
		transform .55s cubic-bezier(.34, 1.56, .64, 1),
		width .55s cubic-bezier(.34, 1.56, .64, 1);
	will-change: transform, width;
}

@media (max-width: 992px) {
	.ma-filter__desc { display: none; }
}

@media (max-width: 700px) {
	.ma-filter__list { flex-wrap: wrap; }
	.ma-filter__item { flex: 1 1 45%; }
	.ma-filter { border-radius: 12px; }
	.ma-filter__indicator { display: none; } /* le wrap casse le calcul de position, on masque proprement */
}

/* ---------- Grille des actualités (cartes) ---------- */

.ma-grid {
	position: relative;
	display: grid;
	grid-template-columns: repeat(var(--ma-columns), 1fr);
	gap: 24px;
	transition: opacity .25s ease;
}

.ma-grid.is-loading {
	opacity: .4;
	pointer-events: none;
}

.ma-item {
	display: flex;
	flex-direction: column;
	border-radius: 6px;
	overflow: hidden;
}

/* Image en avant, ratio 4/3, ne se superpose pas avec le bloc de texte */
.ma-item__thumb {
	display: block;
	position: relative;
	aspect-ratio: 4 / 3;
	overflow: hidden;
	background: #eaeaea;
}

.ma-item__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform .5s ease;
}

.ma-item__img--placeholder {
	background: linear-gradient(135deg, #dcdcdc, #efefef);
}

.ma-item:hover .ma-item__img {
	transform: scale(1.06);
}

/* Bloc de texte sous l'image */
.ma-item__body {
	background: #f3f3f3;
	padding: 20px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	flex: 1;
}

.ma-item__title {
	margin: 0;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.35;
}

.ma-item__title a {
	color: #191919;
	text-decoration: none;
}

.ma-item__title a:hover {
	text-decoration: underline;
}

.ma-item__excerpt {
	margin: 0;
	font-size: 14px;
	line-height: 1.55;
	color: #555;
}

.ma-item__more {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin-top: auto;
	padding-top: 4px;
	color: #afcb24;
	font-size: 14px;
	font-weight: 700;
	text-decoration: none;
}

.ma-item__more svg {
	flex-shrink: 0;
	transition: transform .25s ease;
}

.ma-item__more:hover {
	text-decoration: underline;
}

.ma-item__more:hover svg {
	transform: translateX(3px);
}

.ma-grid__empty {
	grid-column: 1 / -1;
	text-align: center;
	color: #777;
	padding: 40px 0;
}

@media (max-width: 992px) {
	.ma-grid { grid-template-columns: repeat(2, 1fr) !important; }
}

@media (max-width: 600px) {
	.ma-grid { grid-template-columns: 1fr !important; }
}

/* ---------- Pagination ---------- */

.ma-pagination-wrapper {
	display: flex;
	justify-content: center;
	margin-top: 36px;
	transition: opacity .25s ease;
}

.ma-pagination-wrapper.is-loading {
	opacity: .4;
	pointer-events: none;
}

.ma-pagination {
	display: flex;
	align-items: center;
	gap: 8px;
}

.ma-pagination__list {
	display: flex;
	align-items: center;
	gap: 4px;
	list-style: none;
	margin: 0;
	padding: 0;
}

.ma-pagination__num,
.ma-pagination__arrow {
	min-width: 36px;
	height: 36px;
	padding: 0 10px;
	border: none;
	background: #f0f0f0;
	color: #191919;
	border-radius: 8px;
	font-weight: 600;
	font-size: 14px;
	line-height: 1;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: background-color .25s ease, color .25s ease;
}

.ma-pagination__arrow {
	font-size: 18px;
}

.ma-pagination__num:hover,
.ma-pagination__arrow:hover:not(:disabled) {
	background: #191919;
	color: #fff;
}

.ma-pagination__num.is-active {
	background: #0b3d6d;
	color: #fff;
	cursor: default;
}

.ma-pagination__arrow:disabled {
	opacity: .35;
	cursor: not-allowed;
}

.ma-pagination__ellipsis {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 24px;
	color: #999;
}

@media (max-width: 480px) {
	.ma-pagination__num,
	.ma-pagination__arrow {
		min-width: 32px;
		height: 32px;
		font-size: 13px;
	}
}
