/* --- Transitions entre les pages (Chrome, Edge, Safari 18.2+) ------------ */
@view-transition { navigation: auto; }

body.ag-v2 .site-header { view-transition-name: ag-header; }
body.ag-v2.single-post .site-main > article > .wp-post-image { view-transition-name: ag-hero; }

::view-transition-old(root) { animation: 220ms cubic-bezier(.4, 0, 1, 1) both ag-vt-out; }
::view-transition-new(root) { animation: 340ms cubic-bezier(.2, .8, .2, 1) 60ms both ag-vt-in; }
::view-transition-group(ag-hero) { animation-duration: 480ms; animation-timing-function: cubic-bezier(.2, .8, .2, 1); }
::view-transition-old(ag-hero),
::view-transition-new(ag-hero) { height: 100%; object-fit: cover; overflow: clip; }
::view-transition-group(ag-header) { animation: none; }

@keyframes ag-vt-out { to { opacity: 0; transform: translateY(-8px); } }
@keyframes ag-vt-in { from { opacity: 0; transform: translateY(14px); } }

/* --- Héros d'article aux couleurs du jeu -------------------------------- */
body.ag-v2.single-post .site-main > article.type-post {
	box-shadow: 0 30px 80px rgba(0, 0, 0, .5), 0 0 0 1px rgba(255, 255, 255, .06),
		0 -10px 140px -30px color-mix(in srgb, var(--g) 55%, transparent);
}
body.ag-v2.single-post .site-main > article.type-post::before {
	background: linear-gradient(90deg, var(--g), color-mix(in srgb, var(--g) 50%, #22d3ee) 60%, transparent);
}
body.ag-v2.single-post .site-main > article > .wp-post-image {
	box-shadow: 0 22px 50px -10px color-mix(in srgb, var(--g) 45%, rgba(16, 17, 26, .35));
	outline: 1px solid color-mix(in srgb, var(--g) 30%, transparent);
	outline-offset: -1px;
}
body.ag-v2.single-post .entry-content h2:not(.wp-block-post-title)::after,
body.ag-v2.single-post .entry-content h3::after {
	background: linear-gradient(90deg, var(--g), transparent);
}
body.ag-v2.single-post .entry-content h3 { position: relative; }
body.ag-v2.single-post .entry-content > h3::after {
	content: "";
	display: block;
	width: 44px;
	height: 3px;
	margin-top: .3em;
	border-radius: 3px;
}

/* --- Reflet des cartes au survol ---------------------------------------- */
body.ag-v2 .ag-lit { position: relative; }
body.ag-v2 .ag-lit::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 4;
	border-radius: inherit;
	pointer-events: none;
	background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), color-mix(in srgb, var(--g, #fff) 18%, transparent), transparent 60%);
	box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--g, #fff) 35%, transparent);
}

@media (prefers-reduced-motion: no-preference) {
	/* Entrée du héros */
	body.ag-v2.single-post .site-main > article > .wp-post-image {
		animation: ag-hero-in 900ms cubic-bezier(.2, .8, .2, 1) both;
	}
	@keyframes ag-hero-in { from { opacity: 0; transform: scale(1.03); filter: saturate(.6) blur(4px); } }

	/* Apparition des blocs au défilement, sans JavaScript */
	@supports (animation-timeline: view()) {
		body.ag-v2.single-post .entry-content > :is(h3, h2, table, figure, .wp-block-table, ul, ol, blockquote) {
			animation: ag-rise linear both;
			animation-timeline: view();
			animation-range: entry 0% entry 35%;
		}
		@keyframes ag-rise { from { opacity: .15; transform: translateY(18px); } }
	}
}

@media (prefers-reduced-motion: reduce) {
	@view-transition { navigation: none; }
}
