/* ASG Actus — grilles d'actualités */

.asg-actus {
	--asg-accent: #0b6e4f;
	--asg-text: #14201b;
	--asg-muted: #5d6b65;
	--asg-surface: #ffffff;
	--asg-border: rgba(20, 32, 27, 0.08);
	--asg-radius: 18px;
	--asg-gap: clamp(16px, 2.2vw, 28px);
	--asg-ratio: 4/3;
	--asg-shadow: 0 1px 2px rgba(16, 24, 20, 0.04), 0 8px 24px -12px rgba(16, 24, 20, 0.18);
	--asg-shadow-hover: 0 2px 4px rgba(16, 24, 20, 0.05), 0 24px 48px -18px rgba(16, 24, 20, 0.32);
	--asg-ease: cubic-bezier(0.22, 1, 0.36, 1);
	color: var(--asg-text);
	margin-block: 1.5em;
}

.asg-actus *,
.asg-actus *::before,
.asg-actus *::after { box-sizing: border-box; }

/* ---------- Filtres ---------- */
.asg-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: calc(var(--asg-gap) * 1.1);
}
.asg-filter {
	appearance: none;
	border: 1px solid var(--asg-border);
	background: var(--asg-surface);
	color: var(--asg-text);
	font: inherit;
	font-size: 0.875rem;
	font-weight: 500;
	padding: 0.55em 1.15em;
	border-radius: 999px;
	cursor: pointer;
	transition: background 0.25s, color 0.25s, border-color 0.25s, transform 0.25s var(--asg-ease);
}
.asg-filter:hover { border-color: var(--asg-accent); color: var(--asg-accent); }
.asg-filter.is-active { background: var(--asg-accent); border-color: var(--asg-accent); color: #fff; }
.asg-filter:focus-visible { outline: 2px solid var(--asg-accent); outline-offset: 2px; }

/* ---------- Grille ---------- */
.asg-grid {
	display: grid;
	grid-template-columns: repeat(var(--asg-cols, 3), minmax(0, 1fr));
	gap: var(--asg-gap);
}
@media (max-width: 1024px) {
	.asg-grid { grid-template-columns: repeat(min(var(--asg-cols, 3), 2), minmax(0, 1fr)); }
}
@media (max-width: 640px) {
	.asg-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Carte (base) ---------- */
.asg-card {
	position: relative;
	display: flex;
	flex-direction: column;
	background: var(--asg-surface);
	border-radius: var(--asg-radius);
	overflow: hidden;
	box-shadow: var(--asg-shadow);
	isolation: isolate;
	transition: transform 0.5s var(--asg-ease), box-shadow 0.5s var(--asg-ease), opacity 0.35s;
	animation: asg-in 0.6s var(--asg-ease) both;
}
.asg-card:hover { transform: translateY(-4px); box-shadow: var(--asg-shadow-hover); }
.asg-card.is-hidden { display: none; }

@keyframes asg-in {
	from { opacity: 0; transform: translateY(14px); }
	to { opacity: 1; transform: none; }
}

.asg-card__media {
	position: relative;
	aspect-ratio: var(--asg-ratio);
	overflow: hidden;
	background: #e9eeeb;
}
.asg-card__img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.9s var(--asg-ease);
}
.asg-card:hover .asg-card__img { transform: scale(1.06); }
.asg-card__img--empty {
	background:
		radial-gradient(120% 80% at 0% 0%, color-mix(in srgb, var(--asg-accent) 45%, transparent), transparent 60%),
		linear-gradient(135deg, color-mix(in srgb, var(--asg-accent) 80%, #000), var(--asg-accent));
}

/* Zone cliquable lightbox */
.asg-card__zoom {
	position: absolute;
	inset: 0;
	z-index: 2;
	appearance: none;
	border: 0;
	padding: 0;
	margin: 0;
	background: transparent;
	cursor: zoom-in;
}
.asg-card__zoom--video { cursor: pointer; }

/* Pictos (texte, photos) en haut à droite */
.asg-card__tools {
	position: absolute;
	top: 14px;
	right: 14px;
	z-index: 3;
	display: flex;
	gap: 6px;
}
.asg-card__tool {
	appearance: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	min-width: 34px;
	height: 34px;
	margin: 0;
	padding: 0 10px;
	border: 0;
	border-radius: 999px;
	font: inherit;
	font-size: 0.8rem;
	font-weight: 600;
	line-height: 1;
	color: #fff;
	background: rgba(10, 16, 13, 0.55);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	cursor: pointer;
	transition: background 0.3s, transform 0.3s var(--asg-ease);
}
.asg-card__tool--text { padding: 0; width: 34px; }
.asg-card__tool:hover,
.asg-card__zoom--gallery:hover ~ .asg-card__tools .asg-card__tool--gallery { background: var(--asg-accent); }
.asg-card__tool:hover { transform: translateY(-1px); }
.asg-card__tool:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* Bouton lecture vidéo */
.asg-card__play {
	position: absolute;
	top: 50%;
	left: 50%;
	z-index: 3;
	appearance: none;
	display: grid;
	place-items: center;
	width: 68px;
	height: 68px;
	margin: 0;
	padding: 0 0 0 4px;
	border: 0;
	border-radius: 50%;
	color: #fff;
	background: rgba(10, 16, 13, 0.45);
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
	box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85) inset, 0 10px 30px -8px rgba(0, 0, 0, 0.5);
	transform: translate(-50%, -50%);
	cursor: pointer;
	transition: background 0.3s, transform 0.4s var(--asg-ease);
}
.asg-card__play::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: 50%;
	box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.5);
	animation: asg-pulse 2.4s ease-out infinite;
	pointer-events: none;
}
.asg-card__play:hover,
.asg-card:hover .asg-card__play { background: var(--asg-accent); transform: translate(-50%, -50%) scale(1.08); }
.asg-card__play:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }

@keyframes asg-pulse {
	0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.45); }
	70%, 100% { box-shadow: 0 0 0 18px rgba(255, 255, 255, 0); }
}

/* Badge date */
.asg-card__date {
	position: absolute;
	top: 14px;
	left: 14px;
	z-index: 3;
	display: flex;
	flex-direction: column;
	align-items: center;
	min-width: 56px;
	padding: 8px 10px 7px;
	border-radius: 12px;
	background: rgba(255, 255, 255, 0.92);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	color: var(--asg-text);
	line-height: 1;
	pointer-events: none;
	box-shadow: 0 4px 14px -6px rgba(0, 0, 0, 0.3);
}
.asg-card__day { font-size: 1.45rem; font-weight: 700; letter-spacing: -0.02em; }
.asg-card__month { margin-top: 3px; font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--asg-accent); }
.asg-card__year { margin-top: 3px; font-size: 0.62rem; color: var(--asg-muted); }

.asg-card__body {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 10px;
	flex: 1;
	padding: 20px 22px 22px;
}
.asg-card__cat {
	font-size: 0.72rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.1em;
	color: var(--asg-accent);
}
.asg-card__title {
	margin: 0;
	font-size: clamp(1.05rem, 1.2vw + 0.6rem, 1.3rem);
	line-height: 1.3;
	font-weight: 650;
	letter-spacing: -0.01em;
	color: inherit;
	text-wrap: balance;
}
.asg-card__btn {
	position: relative;
	z-index: 3;
	margin-top: auto;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 0.7em 1.2em;
	border-radius: 999px;
	background: var(--asg-accent);
	color: #fff !important;
	font-size: 0.9rem;
	font-weight: 600;
	text-decoration: none !important;
	transition: gap 0.3s var(--asg-ease), filter 0.3s, transform 0.3s var(--asg-ease);
}
.asg-card__btn:hover { gap: 12px; filter: brightness(1.08); }
.asg-card__btn:active { transform: scale(0.97); }
.asg-card__btn:focus-visible { outline: 2px solid var(--asg-accent); outline-offset: 3px; }
.asg-card__btn--pdf svg { transition: transform 0.3s var(--asg-ease); }
.asg-card__btn--pdf:hover svg { transform: translateY(2px); }

/* ---------- Style : minimal ---------- */
.asg-actus--minimal .asg-card { background: transparent; box-shadow: none; overflow: visible; }
.asg-actus--minimal .asg-card:hover { transform: none; box-shadow: none; }
.asg-actus--minimal .asg-card__media { border-radius: var(--asg-radius); }
.asg-actus--minimal .asg-card__body { padding: 16px 2px 0; }
.asg-actus--minimal .asg-card__btn {
	background: none;
	color: var(--asg-accent) !important;
	padding: 0;
	border-bottom: 2px solid currentColor;
	border-radius: 0;
	padding-bottom: 2px;
}

/* ---------- Style : overlay & magazine ---------- */
.asg-actus--overlay .asg-card,
.asg-actus--magazine .asg-card {
	color: #fff;
	min-height: 0;
}
.asg-actus--overlay .asg-card__media,
.asg-actus--magazine .asg-card__media {
	position: absolute;
	inset: 0;
	aspect-ratio: auto;
}
.asg-actus--overlay .asg-card__media::after,
.asg-actus--magazine .asg-card__media::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
	background: linear-gradient(180deg, rgba(5, 10, 8, 0) 35%, rgba(5, 10, 8, 0.55) 65%, rgba(5, 10, 8, 0.88) 100%);
	pointer-events: none;
	transition: opacity 0.5s;
}
.asg-actus--overlay .asg-card__body,
.asg-actus--magazine .asg-card__body {
	position: relative;
	z-index: 3;
	justify-content: flex-end;
	aspect-ratio: var(--asg-ratio);
	padding: 24px;
	pointer-events: none;
}
.asg-actus--overlay .asg-card__btn,
.asg-actus--magazine .asg-card__btn { pointer-events: auto; margin-top: 4px; }
.asg-actus--overlay .asg-card__cat,
.asg-actus--magazine .asg-card__cat {
	color: #fff;
	background: color-mix(in srgb, var(--asg-accent) 85%, transparent);
	padding: 5px 10px;
	border-radius: 999px;
	letter-spacing: 0.08em;
}
.asg-actus--overlay .asg-card__title,
.asg-actus--magazine .asg-card__title { color: #fff; text-shadow: 0 1px 12px rgba(0, 0, 0, 0.25); }

/* Bouton révélé au survol (desktop) */
@media (hover: hover) {
	.asg-actus--overlay .asg-card__btn,
	.asg-actus--magazine .asg-card__btn {
		opacity: 0;
		transform: translateY(10px);
		transition: opacity 0.4s var(--asg-ease), transform 0.4s var(--asg-ease), gap 0.3s var(--asg-ease);
	}
	.asg-actus--overlay .asg-card:hover .asg-card__btn,
	.asg-actus--overlay .asg-card:focus-within .asg-card__btn,
	.asg-actus--magazine .asg-card:hover .asg-card__btn,
	.asg-actus--magazine .asg-card:focus-within .asg-card__btn { opacity: 1; transform: none; }
}

/* Magazine : 1re carte mise en avant */
.asg-actus--magazine .asg-grid { grid-auto-flow: dense; }
@media (min-width: 641px) {
	.asg-actus--magazine .asg-card:first-child:not(.is-hidden) { grid-column: span 2; grid-row: span 2; }
	.asg-actus--magazine .asg-card:first-child .asg-card__body { aspect-ratio: auto; height: 100%; padding: clamp(24px, 3vw, 40px); }
	.asg-actus--magazine .asg-card:first-child .asg-card__title { font-size: clamp(1.4rem, 2.2vw + 0.6rem, 2.2rem); max-width: 22ch; }
}

/* ---------- Lightbox ---------- */
.asg-lb {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: grid;
	grid-template-rows: 1fr auto;
	background: rgba(8, 12, 10, 0.94);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
	color: #fff;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.35s var(--asg-ease, ease), visibility 0s 0.35s;
}
.asg-lb.is-open { opacity: 1; visibility: visible; transition: opacity 0.35s ease; }
.asg-lb__stage {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 0;
	padding: 64px clamp(12px, 6vw, 96px) 12px;
	touch-action: pan-y;
}
.asg-lb__figure {
	margin: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
	max-width: 100%;
	max-height: 100%;
}
.asg-lb__img {
	display: block;
	max-width: 100%;
	max-height: calc(100vh - 200px);
	max-height: calc(100dvh - 200px);
	width: auto;
	height: auto;
	object-fit: contain;
	border-radius: 8px;
	box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.6);
	transition: opacity 0.3s, transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.asg-lb__img.is-loading { opacity: 0; transform: scale(0.98); }
.asg-lb__caption { font-size: 0.9rem; opacity: 0.85; text-align: center; max-width: 70ch; }
.asg-lb__caption:empty { display: none; }

.asg-lb__btn {
	position: absolute;
	appearance: none;
	display: grid;
	place-items: center;
	width: 48px;
	height: 48px;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.1);
	color: #fff;
	cursor: pointer;
	transition: background 0.25s, transform 0.25s;
}
.asg-lb__btn:hover { background: rgba(255, 255, 255, 0.22); }
.asg-lb__btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.asg-lb__btn[hidden] { display: none; }
.asg-lb__close { top: 12px; right: 12px; }
.asg-lb__prev { left: clamp(8px, 2vw, 24px); top: 50%; transform: translateY(-50%); }
.asg-lb__next { right: clamp(8px, 2vw, 24px); top: 50%; transform: translateY(-50%); }
.asg-lb__counter {
	position: absolute;
	top: 24px;
	left: 24px;
	font-size: 0.85rem;
	font-variant-numeric: tabular-nums;
	opacity: 0.75;
}

.asg-lb__thumbs {
	display: flex;
	justify-content: center;
	gap: 8px;
	padding: 12px 16px 18px;
	overflow-x: auto;
	scrollbar-width: none;
}
.asg-lb__thumbs::-webkit-scrollbar { display: none; }
.asg-lb__thumb {
	flex: 0 0 auto;
	width: 64px;
	height: 48px;
	padding: 0;
	border: 2px solid transparent;
	border-radius: 6px;
	overflow: hidden;
	background: none;
	cursor: pointer;
	opacity: 0.5;
	transition: opacity 0.25s, border-color 0.25s;
}
.asg-lb__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.asg-lb__thumb:hover { opacity: 0.85; }
.asg-lb__thumb.is-active { opacity: 1; border-color: #fff; }

@media (max-width: 640px) {
	.asg-lb__prev, .asg-lb__next { display: none; }
	.asg-lb__thumb { width: 52px; height: 40px; }
}

html.asg-lb-open { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
	.asg-actus *, .asg-lb, .asg-lb * { animation: none !important; transition: none !important; }
}
.asg-lb__thumbs[hidden] { display: none; }

/* ---------- Popup : modes texte et vidéo ---------- */
.asg-lb__panel { display: none; }
.asg-lb:not([data-mode="gallery"]) .asg-lb__figure,
.asg-lb:not([data-mode="gallery"]) .asg-lb__prev,
.asg-lb:not([data-mode="gallery"]) .asg-lb__next,
.asg-lb:not([data-mode="gallery"]) .asg-lb__counter,
.asg-lb:not([data-mode="gallery"]) .asg-lb__thumbs { display: none; }
.asg-lb:not([data-mode="gallery"]) .asg-lb__panel { display: block; }
.asg-lb:not([data-mode="gallery"]) .asg-lb__stage { padding-bottom: 48px; }

/* Texte */
.asg-lb[data-mode="text"] .asg-lb__panel {
	width: min(720px, 100%);
	max-height: 100%;
	overflow-y: auto;
	overscroll-behavior: contain;
	background: #fff;
	color: #14201b;
	border-radius: 18px;
	box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.6);
	animation: asg-pop 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.asg-text { padding: clamp(24px, 5vw, 48px); }
.asg-text__meta {
	margin: 0 0 10px;
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	font-size: 0.75rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.1em;
	color: var(--asg-accent, #0b6e4f);
}
.asg-text__title {
	margin: 0 0 18px;
	font-size: clamp(1.35rem, 2vw + 0.8rem, 2rem);
	line-height: 1.2;
	letter-spacing: -0.015em;
	color: inherit;
	text-wrap: balance;
}
.asg-text__content { font-size: 1rem; line-height: 1.7; color: #33413b; }
.asg-text__content > :first-child { margin-top: 0; }
.asg-text__content > :last-child { margin-bottom: 0; }
.asg-text__content a { color: var(--asg-accent, #0b6e4f); }

/* Vidéo */
.asg-lb[data-mode="video"] .asg-lb__panel {
	width: min(1100px, 100%, calc((100dvh - 140px) * 16 / 9));
	animation: asg-pop 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.asg-lb__video {
	position: relative;
	aspect-ratio: 16 / 9;
	border-radius: 12px;
	overflow: hidden;
	background: #000;
	box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.7);
}
.asg-lb__video iframe,
.asg-lb__video video {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
	background: #000;
}

@keyframes asg-pop {
	from { opacity: 0; transform: translateY(16px) scale(0.98); }
	to { opacity: 1; transform: none; }
}
