/* Grille d'archive — styles front */

.hsag__grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 18px;
}

.hsag__heading {
	margin: 0 0 20px;
	color: #111;
	font-size: 28px;
	font-weight: 700;
	line-height: 1.2;
	text-transform: uppercase;
}

/* Le terme recherché peut être mis en valeur séparément. */
.hsag__query {
	color: inherit;
}

.hsag__card {
	position: relative;
	display: flex;
	min-height: 380px;
	overflow: hidden;
	background-color: #101418;
	isolation: isolate;
}

.hsag__media {
	position: absolute;
	inset: 0;
	z-index: 0;
}

/* Deux classes : indispensable pour passer devant « .elementor img { height: auto } ». */
.hsag__media .hsag__img {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	object-position: center center;
	transition: transform 500ms ease;
}

.hsag--zoom .hsag__card:hover .hsag__media .hsag__img,
.hsag--zoom .hsag__card:focus-within .hsag__media .hsag__img {
	transform: scale(1.04);
}

.hsag__overlay {
	--hsag-overlay: rgba(0, 0, 0, 0.35);
	position: absolute;
	inset: 0;
	background-color: var(--hsag-overlay);
}

/* --- Contenu -------------------------------------------------------------- */

.hsag__inner {
	position: relative;
	z-index: 1;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	gap: 20px;
	width: 100%;
	padding: 22px 22px 20px;
	transition: opacity 220ms ease;
}

/* Catégorie maintenue en haut : display:contents sort le surtitre et le titre
   de leur conteneur, la marge automatique repousse le reste vers le bas. */
.hsag--eyebrow-top .hsag__head {
	display: contents;
}

.hsag--eyebrow-top .hsag__eyebrow {
	margin-bottom: auto;
}

.hsag__eyebrow {
	margin: 0 0 8px;
	color: #f5b301;
	font-size: 14px;
	font-weight: 700;
	letter-spacing: 1px;
	text-transform: uppercase;
}

.hsag__eyebrow a {
	position: relative;
	z-index: 3;
	color: inherit;
	text-decoration: none;
}

.hsag__eyebrow a:hover,
.hsag__eyebrow a:focus-visible {
	text-decoration: underline;
	text-underline-offset: 3px;
}

.hsag__title {
	margin: 0;
	color: #fff;
	font-size: 17px;
	font-weight: 600;
	line-height: 1.3;
	text-transform: uppercase;
	text-wrap: balance;
}

.hsag__permalink {
	color: inherit;
	text-decoration: none;
}

/* Toute la carte est cliquable sans imbriquer de lien. */
.hsag__permalink::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 2;
}

.hsag__permalink:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 4px;
}

.hsag__cta {
	display: inline-flex;
	align-items: center;
	gap: 0.5em;
	color: #fff;
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 1px;
	text-transform: uppercase;
}

.hsag__arrow {
	transition: transform 200ms ease;
}

.hsag__card:hover .hsag__arrow {
	transform: translateX(4px);
}

/* --- Chapeau au survol ----------------------------------------------------- */

.hsag__chapeau {
	position: absolute;
	inset: 0;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 0;
	padding: 24px;
	background-color: rgba(0, 0, 0, 0.72);
	color: #fff;
	font-size: 16px;
	line-height: 1.5;
	text-align: center;
	opacity: 0;
	pointer-events: none;
	transition: opacity 220ms ease;
}

.hsag__card:hover .hsag__chapeau,
.hsag__card:focus-within .hsag__chapeau {
	opacity: 1;
}

/* Le titre laisse la place au chapeau pendant le survol. */
.hsag--swap .hsag__card:hover .hsag__head,
.hsag--swap .hsag__card:focus-within .hsag__head {
	opacity: 0;
}

.hsag__head {
	transition: opacity 220ms ease;
}

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

.hsag__pagination {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 32px;
	margin-top: 32px;
	color: #111;
	font-size: 15px;
	font-weight: 600;
	letter-spacing: 1px;
	text-transform: uppercase;
}

.hsag__page {
	color: inherit;
	text-decoration: none;
}

.hsag__page:hover,
.hsag__page:focus-visible {
	text-decoration: underline;
	text-underline-offset: 4px;
}

.hsag__page.is-disabled {
	opacity: 0.35;
}

.hsag__count {
	font-weight: 400;
	letter-spacing: 0;
	text-transform: none;
}

.hsag-empty {
	padding: 24px;
	border: 1px dashed #c3c4c7;
	color: #50575e;
	text-align: center;
}

/* --- Tablettes et mobiles -------------------------------------------------- */

@media (max-width: 1024px) {
	.hsag__pagination {
		gap: 20px;
	}

	/* Texte calé en haut, la carte étant plus basse. */
	.hsag--m-top .hsag__inner {
		justify-content: flex-start;
	}

	/* Lien masqué visuellement, toujours accessible au clavier. */
	.hsag--m-no-cta .hsag__cta {
		position: absolute;
		width: 1px;
		height: 1px;
		margin: -1px;
		padding: 0;
		overflow: hidden;
		clip: rect(0 0 0 0);
		clip-path: inset(50%);
		white-space: nowrap;
	}

	.hsag--m-no-cta .hsag__cta:focus-visible {
		position: static;
		width: auto;
		height: auto;
		margin: 0;
		clip: auto;
		clip-path: none;
	}

	/* Sans survol au doigt, le chapeau ne s'afficherait jamais. */
	.hsag--m-chapeau .hsag__chapeau {
		position: static;
		background-color: transparent;
		padding: 0;
		text-align: left;
		opacity: 1;
	}

	.hsag--m-chapeau .hsag__inner {
		gap: 12px;
	}

	.hsag--m-chapeau.hsag--swap .hsag__card:hover .hsag__head {
		opacity: 1;
	}
}

@media (prefers-reduced-motion: reduce) {
	.hsag__chapeau,
	.hsag__head,
	.hsag__inner,
	.hsag__arrow,
	.hsag__media .hsag__img {
		transition: none;
	}
}

/* Un widget Elementor est un élément flex : sans min-width, il s'élargit à la
   taille de son contenu, et une zone à défilement horizontal fait alors
   déborder toute la page. */
.elementor-widget-hsa_archive_grid {
	min-width: 0;
	max-width: 100%;
}

.hsag,
.hsag__grid {
	max-width: 100%;
	min-width: 0;
}
