/**
 * Bloc : Hero Posts (ri-hero-posts)
 */

/* ── Base ── */

.ri-hero-posts {
	position: relative;
	width: 100%;
	padding-block: var(--ri-block-padding-xl);
	overflow: hidden;
}

.ri-hero-posts > .overlay {
	position: absolute;
	inset: 0;
	z-index: 1;
	background: var(--ri-color-white);
	pointer-events: none;
}

.ri-hero-posts > .network-decoration {
	position: absolute;
	left: calc(50% + var(--ri-container-width) / 2);
	bottom: calc(var(--ri-block-padding) + var(--ri-space-lg) + 16px);
	z-index: 1;
	pointer-events: none;
	height: auto;
	max-height: 80%;
}

/* ── Hero header ── */

.ri-hero-posts .hero {
	position: relative;
	z-index: 2;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: var(--ri-space-sm);
	padding-bottom: 80px;
}

.ri-hero-posts .titre {
	line-height: 1.1;
	max-width: 710px;
}

/* ── Content wrapper ── */

.ri-hero-posts .content-wrapper {
	position: relative;
	z-index: 2;
}

.ri-hero-posts .section-titre {
	margin: 0 0 var(--ri-space-lg);
	font: 700 var(--ri-size-title-h2) / 1.4 var(--ri-font-1);
}

/* ── Grille ── */

.ri-hero-posts .grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	grid-template-rows: 1fr 1fr;
	gap: 16px;
	height: 364px;
}

/* ── Carte — base commune ── */

.ri-hero-posts .ri-card {
	position: relative;
	overflow: hidden;
	box-shadow: 0 4px 20px rgba(208, 208, 208, 0.5);
}

.ri-hero-posts .card-link {
	display: flex;
	width: 100%;
	height: 100%;
	text-decoration: none;
	color: inherit;
	transition: box-shadow var(--ri-transition-base);
}

.ri-hero-posts .card-link:hover,
.ri-hero-posts .card-link:focus-visible {
	box-shadow: var(--ri-shadow-lg);
}

/* ── Carte featured (gauche, pleine hauteur) ──
   Image en background, overlay gradient, contenu en bas */

.ri-hero-posts .ri-card--featured {
	grid-column: 1;
	grid-row: 1 / -1;
}

.ri-hero-posts .ri-card--featured .card-link {
	flex-direction: column;
	justify-content: flex-end;
	padding: 24px;
}

.ri-hero-posts .ri-card--featured .card-image {
	position: absolute;
	inset: 0;
}

.ri-hero-posts .ri-card--featured .card-image .card-img,
.ri-hero-posts .ri-card--secondary .card-image .card-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform var(--ri-transition-slow);
}

.ri-hero-posts .ri-card--secondary .card-image .card-img {
	position: absolute;
	inset: 0;
}

.ri-hero-posts .ri-card--featured .card-link:hover .card-img {
	transform: scale(1.05);
}

.ri-hero-posts .ri-card--featured .card-link::before {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(180deg, rgba(33, 75, 77, 0) 45%, rgba(33, 75, 77, 0.05) 55%, rgba(33, 75, 77, 0.35) 70%, rgba(33, 75, 77, 0.75) 85%, #214b4d 100%);
	box-shadow: 0 4px 20px 0 rgba(208, 208, 208, 0.5);
	pointer-events: none;
	z-index: 1;
}

.ri-hero-posts .ri-card--featured .card-content {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 8px;
	z-index: 2;
}

.ri-hero-posts .ri-card--featured .card-meta {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: var(--ri-space-sm);
}

.ri-hero-posts .ri-card--featured .card-date {
	font: 400 12px/1 var(--ri-font-1);
	color: var(--ri-color-white);
	white-space: nowrap;
	flex-shrink: 0;
}

.ri-hero-posts .ri-card--featured .tag {
	padding: 2px 8px;
	background-color: var(--ri-color-yellow);
	font: 700 12px/1 var(--ri-font-1);
}

.ri-hero-posts .ri-card--featured .card-title {
	margin: 0;
	font: 700 var(--ri-size-text-body-sm) / 1.4 var(--ri-font-1);
	color: var(--ri-color-white);
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
	line-clamp: 3;
	overflow: hidden;
}

/* ── Cartes secondary (droite, empilées) ── */

.ri-hero-posts .ri-card--secondary {
	grid-column: 2;
}

.ri-hero-posts .ri-card--secondary:nth-child(2) {
	grid-row: 1;
}

.ri-hero-posts .ri-card--secondary:nth-child(3) {
	grid-row: 2;
}

.ri-hero-posts .ri-card--secondary .card-link {
	flex-direction: row;
	align-items: stretch;
}

.ri-hero-posts .ri-card--secondary .card-image {
	flex: 0 0 50%;
	overflow: hidden;
	position: relative;
}

.ri-hero-posts .ri-card--secondary .card-link:hover .card-img {
	transform: scale(1.05);
}

.ri-hero-posts .ri-card--secondary .card-content {
	flex: 0 0 50%;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	padding: 24px;
	background-color: var(--ri-color-grey-soft);
}

.ri-hero-posts .ri-card--secondary .card-meta {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: var(--ri-space-sm);
}

.ri-hero-posts .ri-card--secondary .card-date {
	font: 400 12px/1 var(--ri-font-1);
	white-space: nowrap;
	flex-shrink: 0;
}

.ri-hero-posts .ri-card--secondary .tag {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	font: 700 12px/1 var(--ri-font-1);
}

.ri-hero-posts .ri-card--secondary .tag::before {
	content: "";
	display: inline-block;
	width: 12px;
	height: 12px;
	border-radius: 50%;
	background-color: var(--ri-color-teal);
	flex-shrink: 0;
}

/* Tag événement — dot jaune */
.ri-hero-posts .ri-card--secondary .tag.is-event::before {
	background-color: var(--ri-color-yellow);
}

.ri-hero-posts .ri-card--secondary .card-title {
	margin: 0;
	font: 700 var(--ri-size-text-body-sm) / 1.4 var(--ri-font-1);
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
	line-clamp: 3;
	overflow: hidden;
}

/* ── Badge Nova ── */

.ri-hero-posts .badge-nova {
	position: absolute;
	top: 8px;
	right: 8px;
	padding: 2px 8px;
	background-color: var(--ri-color-violet-dark);
	border-radius: 240px;
	font: 700 12px/1 var(--ri-font-1);
	color: var(--ri-color-white);
	pointer-events: none;
	display: none;
}

/* ── Footer — lien archive ── */

.ri-hero-posts .footer {
	display: flex;
	justify-content: flex-end;
	margin-top: var(--ri-space-lg);
}

.ri-hero-posts .footer .archive-link {
	text-decoration: none;
}

/* ── Page load animation ──
   Éléments cachés par défaut, visibles dès que .page-loaded
   est posé sur <body>. Pas d'impact en preview Gutenberg. */

.ri-hero-posts .surtitre,
.ri-hero-posts .titre,
.ri-hero-posts .section-titre,
.ri-hero-posts .ri-card,
.ri-hero-posts .footer {
	opacity: 0;
}

.page-loaded .ri-hero-posts .surtitre {
	animation: ri-hero-in 0.4s cubic-bezier(0.22, 1, 0.36, 1) 0.05s both;
}

.page-loaded .ri-hero-posts .titre {
	animation: ri-hero-in 0.4s cubic-bezier(0.22, 1, 0.36, 1) 0.15s both;
}

.page-loaded .ri-hero-posts .section-titre {
	animation: ri-hero-in 0.4s cubic-bezier(0.22, 1, 0.36, 1) 0.25s both;
}

.page-loaded .ri-hero-posts .ri-card:nth-child(1) {
	animation: ri-hero-in 0.4s cubic-bezier(0.22, 1, 0.36, 1) 0.3s both;
}

.page-loaded .ri-hero-posts .ri-card:nth-child(2) {
	animation: ri-hero-in 0.4s cubic-bezier(0.22, 1, 0.36, 1) 0.38s both;
}

.page-loaded .ri-hero-posts .ri-card:nth-child(3) {
	animation: ri-hero-in 0.4s cubic-bezier(0.22, 1, 0.36, 1) 0.46s both;
}

.page-loaded .ri-hero-posts .footer {
	animation: ri-hero-in 0.4s cubic-bezier(0.22, 1, 0.36, 1) 0.5s both;
}

.ri-hero-posts .network-fill-1,
.ri-hero-posts .network-fill-2 {
	opacity: 0;
}

.page-loaded .ri-hero-posts .network-fill-1 {
	animation: ri-hero-in 0.8s ease 0.5s both;
}

.page-loaded .ri-hero-posts .network-fill-2 {
	animation: ri-hero-in 0.8s ease 0.65s both;
}

/* ── Placeholder éditeur ── */

.ri-hero-posts.is-placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 300px;
	padding: var(--ri-space-lg);
	background-color: var(--ri-color-grey-soft);
	border: 2px dashed var(--ri-color-grey-mid);
	text-align: center;
}

/* ── Responsive ── */

@media (max-width: 782px) {

	.ri-hero-posts {
		padding-block: 80px var(--ri-block-padding-xl);
	}

	.ri-hero-posts .hero {
		padding-bottom: var(--ri-space-lg);
	}

	.ri-hero-posts > .network-decoration {
		display: none;
	}

	.ri-hero-posts .grid {
		grid-template-columns: 1fr;
		grid-template-rows: auto;
		height: auto;
	}

	.ri-hero-posts .ri-card--featured,
	.ri-hero-posts .ri-card--secondary,
	.ri-hero-posts .ri-card--secondary:nth-child(2),
	.ri-hero-posts .ri-card--secondary:nth-child(3) {
		grid-column: 1;
		grid-row: auto;
	}

	/* Featured mobile : en premier */
	.ri-hero-posts .ri-card--featured {
		order: -1;
	}

	/* Featured mobile : pleine largeur, hauteur fixe, overlay diagonal */
	.ri-hero-posts .ri-card--featured .card-link {
		height: 317px;
		padding: 12px 16px;
	}

	.ri-hero-posts .ri-card--featured .card-link::before {
		background: linear-gradient(229deg, rgba(33, 75, 77, 0) 0%, var(--ri-color-teal) 100%);
	}

	.ri-hero-posts .ri-card--featured .card-content {
		gap: 4px;
	}

	/* Secondary mobile : image fixe à gauche ~106px, contenu à droite */
	.ri-hero-posts .ri-card--secondary .card-link {
		min-height: unset;
	}

	.ri-hero-posts .ri-card--secondary .card-image {
		flex: 0 0 106px;
		width: 106px;
	}

	.ri-hero-posts .ri-card--secondary .card-content {
		flex: 1;
		padding: 16px 16px 16px 0;
		gap: 12px;
		justify-content: flex-start;
		padding-left: 16px;
	}

	.ri-hero-posts .ri-card--secondary .card-date {
		display: none;
	}
}
