/**
 * AfroMag - Cartes magazine, Hero, grille homepage, widgets.
 */

/* ---------- Ticker animé ---------- */
.afromag-ticker__track {
	animation: afromag-ticker-scroll linear infinite;
	animation-duration: var(--afromag-ticker-speed, 60s);
}

.afromag-ticker:hover .afromag-ticker__track {
	animation-play-state: paused;
}

@keyframes afromag-ticker-scroll {
	from { transform: translateX(0); }
	to { transform: translateX(-50%); }
}

@media (prefers-reduced-motion: reduce) {
	.afromag-ticker__track {
		animation: none;
	}
}

/* ==========================================================
   Grille de la page d'accueil.
   Un seul CSS Grid nommé accueille TOUS les blocs (hero, à la une,
   publicités, articles populaires, suivez-nous, vidéo, podcasts).
   Cela permet un ordre totalement différent en mobile et en desktop
   sans dupliquer le HTML : cf. maquette fournie (mobile : à la une →
   vidéo → podcasts → pub → populaires → suivez-nous ; desktop : hero +
   colonne pubs/populaires/suivez-nous, puis à la une + vidéo/podcasts).
   ========================================================== */
/* Bannière publicitaire pleine largeur, juste avant le hero. */
.afromag-home-top-banner {
	margin-top: var(--afromag-gap);
}

.afromag-home-grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: var(--afromag-gap);
	padding-block: var(--afromag-gap);
	grid-template-areas:
		"hero"
		"alaune"
		"video"
		"podcast"
		"sqads"
		"populaires"
		"suivez";
}

.afromag-home-item--hero { grid-area: hero; }
.afromag-home-item--alaune { grid-area: alaune; }
.afromag-home-item--sqads { grid-area: sqads; }
.afromag-home-item--populaires { grid-area: populaires; }
.afromag-home-item--suivez { grid-area: suivez; }
.afromag-home-item--video { grid-area: video; }
.afromag-home-item--podcast { grid-area: podcast; }

/* Sur mobile, une seule publicité carrée suffit (cf. maquette) : on masque
   la bannière et le second carré plutôt que de les retirer du DOM. */
.afromag-home-item--sqads .afromag-ad-square-row {
	grid-template-columns: 1fr;
	max-width: 220px;
	margin-inline: auto;
}

.afromag-home-item--sqads .afromag-ad-square-row > :nth-child(2) {
	display: none;
}

@media (min-width: 1024px) {
	.afromag-home-grid {
		grid-template-columns: minmax(0, 1fr) 320px;
		align-items: start;
		grid-template-areas:
			"hero    sqads"
			"hero    populaires"
			"hero    suivez"
			"alaune  video"
			"alaune  podcast";
	}

	.afromag-home-item--sqads .afromag-ad-square-row {
		grid-template-columns: 1fr 1fr;
		max-width: none;
		margin-inline: 0;
	}

	.afromag-home-item--sqads .afromag-ad-square-row > :nth-child(2) {
		display: block;
	}
}

.afromag-ad-square-row {
	display: grid;
	gap: 14px;
}

.afromag-section-title {
	margin-top: 0;
}

.afromag-see-all {
	font-size: 0.85rem;
	font-weight: 600;
}

.afromag-see-all--mobile {
	display: inline-block;
	margin-top: 16px;
}

@media (min-width: 768px) {
	.afromag-see-all--mobile {
		display: none;
	}
}

/* ---------- Hero éditorial ---------- */
.afromag-hero {
	position: relative;
	border-radius: var(--afromag-radius);
	overflow: hidden;
	min-height: 420px;
	display: flex;
	align-items: flex-end;
	background-size: cover;
	background-position: center;
	background-color: var(--afromag-color-black);
}

.afromag-hero::before {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.15) 60%, transparent 100%);
}

.afromag-hero__content {
	position: relative;
	z-index: 1;
	padding: 32px;
	color: var(--afromag-color-white);
	max-width: 780px;
}

.afromag-hero__title {
	color: var(--afromag-color-white);
	font-size: clamp(1.6rem, 3.2vw, 2.6rem);
	margin: 12px 0;
}

.afromag-hero__title a {
	color: inherit;
}

.afromag-hero__excerpt {
	color: #E5E5E5;
	margin-bottom: 12px;
}

.afromag-hero__meta {
	display: flex;
	gap: 16px;
	font-size: 0.85rem;
	color: #CFCFCF;
}

/* ---------- Grille "À la une" ---------- */
.afromag-featured-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: var(--afromag-gap);
	margin-top: var(--afromag-gap);
}

@media (min-width: 640px) {
	.afromag-featured-grid {
		grid-template-columns: repeat(3, 1fr);
	}
}

@media (min-width: 1024px) {
	.afromag-featured-grid--list {
		grid-template-columns: 1fr;
	}
}

/* Grille asymétrique : première carte plus grande */
.afromag-featured-grid--asymmetric .afromag-card:first-child {
	grid-column: span 2;
}

@media (max-width: 639px) {
	.afromag-featured-grid--asymmetric .afromag-card:first-child {
		grid-column: span 2;
	}
	.afromag-featured-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

/* Sur mobile, la section "À la une" de la homepage passe en liste
   (image à gauche, texte à droite) et n'affiche que les 3 premiers
   articles, un lien "Voir toutes les actualités" remplaçant la grille
   complète — cf. maquette mobile. */
@media (max-width: 767px) {
	.afromag-home-item--alaune .afromag-featured-grid {
		grid-template-columns: 1fr;
	}

	.afromag-home-item--alaune .afromag-featured-grid .afromag-card {
		flex-direction: row;
		align-items: flex-start;
		gap: 14px;
	}

	.afromag-home-item--alaune .afromag-featured-grid .afromag-card__image {
		width: 92px;
		flex-shrink: 0;
		aspect-ratio: 1 / 1;
	}

	.afromag-home-item--alaune .afromag-featured-grid .afromag-card__badge {
		display: none;
	}

	.afromag-home-item--alaune .afromag-featured-grid .afromag-card:nth-child(n+4) {
		display: none;
	}

	.afromag-home-item--alaune .afromag-load-more {
		display: none;
	}
}

/* ---------- Carte article ---------- */
.afromag-card {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.afromag-card__image {
	position: relative;
	border-radius: var(--afromag-radius);
	overflow: hidden;
	aspect-ratio: 4 / 3;
}

.afromag-card__image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.afromag-card__badge {
	position: absolute;
	top: 10px;
	left: 10px;
}

.afromag-card__title {
	font-size: 1rem;
	margin: 0;
}

.afromag-card__title a {
	color: var(--afromag-color-black);
}

.afromag-card__meta {
	font-size: 0.8rem;
	color: var(--afromag-color-gray-medium);
}

/* Variante "liste" : image à gauche, texte à droite (utile aussi en mobile) */
.afromag-card--list {
	flex-direction: row;
	align-items: flex-start;
	gap: 14px;
}

.afromag-card--list .afromag-card__image {
	width: 110px;
	flex-shrink: 0;
	aspect-ratio: 1 / 1;
}

/* ---------- Colonne Vidéo / Podcasts ---------- */
.afromag-video-feature {
	position: relative;
	border-radius: var(--afromag-radius);
	overflow: hidden;
	aspect-ratio: 16 / 9;
}

.afromag-video-feature img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.afromag-video-feature__play {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
}

.afromag-video-feature__play svg {
	filter: drop-shadow(0 2px 6px rgba(0,0,0,0.5));
}

.afromag-video-feature__duration {
	position: absolute;
	bottom: 10px;
	right: 10px;
	background: rgba(0,0,0,0.75);
	color: var(--afromag-color-white);
	font-size: 0.75rem;
	padding: 2px 6px;
	border-radius: 3px;
}

.afromag-podcast-item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 0;
	border-bottom: 1px solid var(--afromag-color-gray-light);
}

.afromag-podcast-item:last-of-type {
	border-bottom: none;
}

.afromag-podcast-item__thumb {
	width: 44px;
	height: 44px;
	border-radius: 50%;
	overflow: hidden;
	flex-shrink: 0;
}

.afromag-podcast-item__thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.afromag-podcast-item__title {
	font-size: 0.9rem;
	font-weight: 600;
	margin: 0;
}

.afromag-podcast-item__duration {
	font-size: 0.75rem;
	color: var(--afromag-color-gray-medium);
	margin-left: auto;
}

/* ---------- Bloc "Suivez-nous" (mise en avant podcasts, sidebar homepage/article) ---------- */
.afromag-follow-item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 0;
	border-bottom: 1px solid var(--afromag-color-gray-light);
}

.afromag-follow-item:last-child {
	border-bottom: none;
}

.afromag-follow-item__avatar {
	width: 44px;
	height: 44px;
	border-radius: 50%;
	overflow: hidden;
	flex-shrink: 0;
	background-color: var(--afromag-color-gray-light);
}

.afromag-follow-item__avatar img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.afromag-follow-item__body {
	flex: 1;
	min-width: 0;
}

.afromag-follow-item__title {
	margin: 0;
	font-size: 0.88rem;
	font-weight: 600;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.afromag-follow-item__title a {
	color: var(--afromag-color-black);
}

.afromag-follow-item__subtitle {
	margin: 2px 0 6px;
	font-size: 0.76rem;
	color: var(--afromag-color-gray-medium);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.afromag-follow-item__progress {
	height: 4px;
	border-radius: 2px;
	background: var(--afromag-color-gray-light);
	overflow: hidden;
}

.afromag-follow-item__progress span {
	display: block;
	height: 100%;
	width: 35%;
	background: var(--afromag-color-red);
	border-radius: 2px;
}

.afromag-follow-item__duration {
	flex-shrink: 0;
	font-size: 0.72rem;
	color: var(--afromag-color-gray-medium);
	font-variant-numeric: tabular-nums;
}

/* ---------- Widget Articles populaires ---------- */
.afromag-popular-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.afromag-popular-list__item {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	padding: 10px 0;
	border-bottom: 1px solid var(--afromag-color-gray-light);
}

.afromag-popular-list__item:last-child {
	border-bottom: none;
}

.afromag-popular-list__rank {
	font-family: var(--afromag-font-heading);
	font-weight: 700;
	color: var(--afromag-color-red);
	font-size: 1.1rem;
	line-height: 1;
	flex-shrink: 0;
}

.afromag-popular-list__title {
	display: block;
	font-size: 0.9rem;
	font-weight: 600;
	color: var(--afromag-color-black);
}

.afromag-views {
	display: block;
	font-size: 0.78rem;
	color: var(--afromag-color-gray-medium);
	margin-top: 2px;
}

/* ---------- Widget générique (sidebar/footer) ---------- */
.afromag-widget {
	background: var(--afromag-color-white);
}

.afromag-widget-title {
	font-size: 1rem;
	text-transform: uppercase;
	letter-spacing: 0.02em;
	border-bottom: 2px solid var(--afromag-color-red);
	padding-bottom: 8px;
	margin-bottom: 12px;
}

.afromag-widget-list {
	display: flex;
	flex-direction: column;
	gap: 14px;
}

/* Bouton "Charger plus d'articles" */
.afromag-load-more {
	display: block;
	margin: 24px auto 0;
	padding: 12px 28px;
	background-color: var(--afromag-color-red);
	color: var(--afromag-color-white);
	font-weight: 600;
	text-transform: uppercase;
	font-size: 0.85rem;
	letter-spacing: 0.03em;
	border-radius: var(--afromag-radius);
	border: none;
}

.afromag-load-more:hover {
	background-color: var(--afromag-color-red-dark);
	color: var(--afromag-color-white);
}

.afromag-load-more[aria-busy="true"] {
	opacity: 0.6;
	cursor: wait;
}
