/* Polices Poppins (titres) / Open Sans (corps) : auto-hébergées via « Aegis+ › Réglages généraux »
   (upload de typo, aucun appel à Google Fonts). Sans téléversement : repli sur les polices système. */
/* Aegis-Insta — mur Instagram vidéo. Classes aig-* (jamais celles du thème). Titres Poppins, corps Open Sans, palette maquette. */

.aig-feed {
	--aig-accent: #51B148;
	--aig-ink: #171B1F;
	max-width: 1200px;
	margin: 0 auto;
	font-family: 'Open Sans', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

/* En-tête */
.aig-feed__head {
	text-align: center;
	margin-bottom: 30px;
}
.aig-feed__eyebrow {
	display: inline-flex;
	align-items: center;
	flex-wrap: wrap;
	justify-content: center;
	max-width: 100%;
	gap: 7px;
	margin: 0 0 12px;
	color: var(--aig-accent);
	font-weight: 600;
	font-size: .82rem;
	letter-spacing: .12em;
	text-transform: uppercase;
}
.aig-feed__eyebrow .aig-ig { font-size: 1.15em; }
.aig-feed__title {
	margin: 0 0 12px;
	color: var(--aig-ink);
	font-size: clamp(1.7rem, 3.2vw, 2.6rem);
	font-weight: 800;
	line-height: 1.12;
}
.aig-feed__subtitle {
	margin: 0 auto;
	max-width: 620px;
	color: #5E6468;
	font-size: 1.02rem;
	line-height: 1.5;
}

/* Grille */
.aig-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 22px;
}

/* Carte */
.aig-card {
	position: relative;
	display: block;
	min-width: 0;
	max-width: 100%;
	aspect-ratio: 3 / 4.4;
	border-radius: 18px;
	overflow: hidden;
	background: #EFF2F5;
	box-shadow: 0 10px 26px rgba(15, 23, 42, .10);
	text-decoration: none;
	transition: transform .25s ease, box-shadow .25s ease;
	will-change: transform;
}
.aig-card__img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform .25s ease;
}
/* Vignette = élément vidéo figé sur l'image à 1 s (#t=1). Fond dégradé (et non
   noir pur) : si le poster ne charge pas (ex. lien Instagram expiré/bloqué), la
   carte reste présentable au lieu d'un rectangle noir. */
video.aig-card__img {
	background: linear-gradient(160deg, #3a4551 0%, #232a31 55%, #171b1f 100%);
	pointer-events: none;
}
.aig-card__img--empty {
	background: linear-gradient(160deg, #3a4551 0%, #232a31 55%, #171b1f 100%);
}
.aig-card__overlay {
	position: absolute;
	inset: 0;
	background: linear-gradient(to top, rgba(10, 12, 16, .78) 0%, rgba(0, 0, 0, 0) 62%);
	pointer-events: none;
}
.aig-card__play {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 64px;
	height: 64px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #fff;
	border-radius: 50%;
	box-shadow: 0 6px 18px rgba(0, 0, 0, .25);
	transition: transform .2s ease;
}
.aig-card__play svg { fill: var(--aig-accent); margin-left: 6%; }
.aig-card:hover .aig-card__play { transform: translate(-50%, -50%) scale(1.08); }
.aig-card__caption {
	position: absolute;
	left: 16px;
	right: 44px;
	bottom: 14px;
	color: #fff;
	font-size: .95rem;
	font-weight: 600;
	line-height: 1.25;
	text-shadow: 0 1px 6px rgba(0, 0, 0, .35);
}
.aig-card__ig {
	position: absolute;
	right: 14px;
	bottom: 13px;
	color: rgba(255, 255, 255, .92);
	font-size: 18px;
	line-height: 0;
}

/* Bouton profil */
.aig-feed__cta-wrap { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: center; margin-top: 34px; }
/* Facebook : bleu de la marque (spécificité renforcée pour battre .aig-feed__cta). */
.aig-feed__cta.aig-feed__cta--fb { background: #1877F2; color: #fff; box-shadow: 0 10px 24px rgba(24, 119, 242, .32); }
.aig-feed__cta.aig-feed__cta--fb:hover { background: #1668d6; }
.aig-feed__cta .aig-fb { font-size: 1.15em; }
.aig-feed__cta {
	display: inline-flex;
	align-items: center;
	gap: 9px;
	padding: 13px 28px;
	/* Instagram : dégradé de la marque Instagram. */
	background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
	color: #fff;
	font-weight: 600;
	font-size: 1rem;
	border-radius: 999px;
	text-decoration: none;
	box-shadow: 0 10px 24px rgba(214, 41, 118, .32);
	transition: background .2s ease, transform .2s ease, box-shadow .2s ease;
}
.aig-feed__cta:hover { transform: translateY(-2px); filter: brightness(.96); }
.aig-feed__cta .aig-ig { font-size: 1.15em; }

/* Effets de survol harmonisés */
.aig-hover-zoom .aig-img-fx:hover,
.aig-hover-lift-zoom .aig-card-fx:hover .aig-img-fx { transform: scale(1.06); }
.aig-hover-zoom .aig-card-fx:hover .aig-img-fx { transform: scale(1.06); }

/* Style minimal : retire la déco de base, garde la mise en page */
.aig-bare .aig-card { background: none; box-shadow: none; }
.aig-bare .aig-feed__cta { background: none; box-shadow: none; }

/* Responsive de secours (si pas de réglage colonnes Elementor) */
@media (max-width: 1024px) { .aig-grid { grid-template-columns: repeat(2, 1fr); } }
/* Téléphones : force 2 colonnes en !important pour battre la règle Elementor
   « colonnes » (générée sans media query, donc héritée par le mobile → débordement). */
@media (max-width: 600px)  { .aig-grid { grid-template-columns: repeat(2, 1fr) !important; } }

/* ----------------------------------------------------------------- Carrousel */
.aig-carousel {
	position: relative;
	--aig-spv: 3;
	--aig-gap: 22px;
}
.aig-grid--carousel {
	display: flex;
	grid-template-columns: none; /* neutralise le réglage « Colonnes » de la grille */
	flex-wrap: nowrap;
	gap: var(--aig-gap, 22px);
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;      /* Firefox */
	-ms-overflow-style: none;   /* IE/Edge */
	padding: 6px 2px 10px;
	cursor: grab;               /* PC : signale le glisser-déposer à la souris */
	user-select: none;          /* évite la sélection de texte pendant le glissement */
	-webkit-user-select: none;
}
.aig-grid--carousel::-webkit-scrollbar { width: 0; height: 0; display: none; }
.aig-grid--carousel > .aig-card {
	flex: 0 0 calc((100% - (var(--aig-spv, 3) - 1) * var(--aig-gap, 22px)) / var(--aig-spv, 3));
	scroll-snap-align: center;
}
/* Empêche le fantôme de glisser-déposer natif (image/lien) qui cassait le drag PC. */
.aig-grid--carousel > .aig-card,
.aig-grid--carousel .aig-card__img {
	-webkit-user-drag: none;
}
.aig-grid--carousel.is-dragging { scroll-snap-type: none; cursor: grabbing; }

/* Effet 3D (coverflow) : la perspective est portée par la piste, les transforms
   sont appliquées par le JS carte par carte selon la distance au centre. */
.aig-carousel.is-3d .aig-grid--carousel { perspective: 1200px; }
.aig-carousel.is-3d .aig-grid--carousel > .aig-card {
	transform-style: preserve-3d;
	transition: none; /* le JS pilote transform à chaque frame */
}

/* Flèches */
.aig-carousel__arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 6;
	width: 44px;
	height: 44px;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: #fff;
	color: var(--aig-ink, #171B1F);
	box-shadow: 0 6px 18px rgba(15, 23, 42, .20);
	cursor: pointer;
	transition: background .2s ease, transform .2s ease;
}
.aig-carousel__arrow:hover { background: #f4f6f8; }
.aig-carousel__arrow:active { transform: translateY(-50%) scale(.94); }
.aig-carousel__arrow[hidden] { display: none; }
.aig-carousel__arrow--prev { left: -10px; }
.aig-carousel__arrow--next { right: -10px; }

/* Points */
.aig-carousel__dots {
	display: flex;
	justify-content: center;
	flex-wrap: wrap;
	gap: 9px;
	margin-top: 18px;
}
.aig-carousel__dot {
	width: 9px;
	height: 9px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(23, 27, 31, .22);
	cursor: pointer;
	transition: background .2s ease, transform .2s ease;
}
.aig-carousel__dot.is-active {
	background: var(--aig-accent, #51B148);
	transform: scale(1.35);
}

/* Accessibilité : pas d'animation 3D ni de défilement fluide si l'utilisateur le refuse. */
@media (prefers-reduced-motion: reduce) {
	.aig-grid--carousel { scroll-behavior: auto; }
	.aig-carousel.is-3d .aig-grid--carousel > .aig-card {
		transform: none !important;
		opacity: 1 !important;
	}
}

/* Lightbox */
.aig-lightbox {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	background: rgba(8, 10, 14, .82);
	opacity: 0;
	visibility: hidden;
	transition: opacity .2s ease, visibility .2s ease;
}
.aig-lightbox.is-open { opacity: 1; visibility: visible; }
.aig-lightbox__inner {
	position: relative;
	width: 100%;
	max-width: 480px;
}
.aig-lightbox__video {
	display: block;
	width: 100%;
	max-height: 86vh;
	border: 0;
	border-radius: 14px;
	background: #000;
}
.aig-lightbox__close {
	position: absolute;
	top: -44px;
	right: 0;
	width: 36px;
	height: 36px;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, .15);
	color: #fff;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
}
.aig-lightbox__close:hover { background: rgba(255, 255, 255, .3); }

/* Spinner de chargement (le nôtre) : visible seulement pendant le chargement, et
   TOUJOURS retiré ensuite (lecture démarrée, erreur, ou délai de sécurité) — jamais
   de rotation infinie. Masque le spinner natif tant qu'on ne sait pas si ça joue. */
.aig-lightbox__spinner {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 46px;
	height: 46px;
	margin: -23px 0 0 -23px;
	border-radius: 50%;
	border: 4px solid rgba(255, 255, 255, .25);
	border-top-color: var(--aig-accent, #51B148);
	animation: aig-spin .8s linear infinite;
	display: none;
	pointer-events: none;
	z-index: 3;
}
.aig-lightbox.is-loading .aig-lightbox__spinner { display: block; }
@keyframes aig-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
	.aig-lightbox__spinner { animation-duration: 1.6s; }
}

/* Repli : affiché si la vidéo est illisible (codec audio non pris en charge sur PC —
   HE-AAC —, réseau HS…). Couvre le lecteur pour stopper le spinner natif. */
.aig-lightbox.has-error .aig-lightbox__video { visibility: hidden; }
.aig-lightbox__fallback {
	display: none;
	position: absolute;
	inset: 0;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 18px;
	padding: 28px;
	text-align: center;
	background: #000;
	border-radius: 14px;
	z-index: 4;
}
.aig-lightbox.has-error .aig-lightbox__fallback { display: flex; }
.aig-lightbox__fallback-msg {
	margin: 0;
	color: #fff;
	font-size: 1.02rem;
	line-height: 1.45;
	max-width: 28ch;
	font-family: 'Open Sans', system-ui, -apple-system, sans-serif;
}
.aig-lightbox__fallback-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	justify-content: center;
}
.aig-lightbox__fallback-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 11px 22px;
	border-radius: 999px;
	background: var(--aig-accent, #51B148);
	color: #fff;
	font-weight: 600;
	font-size: .95rem;
	text-decoration: none;
	transition: filter .2s ease, transform .2s ease;
}
.aig-lightbox__fallback-btn:hover { filter: brightness(.94); transform: translateY(-1px); }
.aig-lightbox__fallback-btn--ig {
	background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
}

/* Médias : jamais plus larges que leur conteneur (anti-débordement horizontal). */
.aig-feed img,
.aig-feed video,
.aig-lightbox__video,
.aig-lightbox__inner {
	max-width: 100%;
}
.aig-lightbox__video { height: auto; }

/* Téléphones : le lightbox tient dans le viewport, bouton fermer accessible. */
@media (max-width: 600px) {
	.aig-lightbox { padding: 16px; }
	.aig-lightbox__inner { max-width: 100%; }
	.aig-lightbox__video { max-height: 74vh; }
	/* Croix ramenée à l'intérieur : à -44px elle sortait de l'écran en haut. */
	.aig-lightbox__close {
		top: 8px;
		right: 8px;
		background: rgba(0, 0, 0, .55);
	}
}

.aig-feed__title, .aig-feed__subtitle { font-family: 'Poppins', system-ui, -apple-system, sans-serif; }
