/**
 * Gradiente ambientale del corpo + grain (v1, 20/10/2026)
 * Destinazione: mu-plugin rm-theme. Un SOLO layer fisso a tutta pagina.
 * Markup: <div class="ambient" aria-hidden="true"></div> come primo figlio di <body>.
 * La hero e header/footer hanno fondo pieno e lo coprono.
 */

@property --ambient-x { syntax: '<percentage>'; inherits: false; initial-value: 18%; }
@property --ambient-y { syntax: '<percentage>'; inherits: false; initial-value: 12%; }
@property --ambient-angle { syntax: '<angle>'; inherits: false; initial-value: 160deg; }

.ambient {
	position: fixed;
	inset: 0;
	z-index: -1;
	pointer-events: none;
	background:
		radial-gradient(60% 55% at var(--ambient-x) var(--ambient-y), var(--color-ambient-2) 0%, transparent 70%),
		radial-gradient(70% 60% at calc(100% - var(--ambient-x)) calc(100% - var(--ambient-y)), var(--color-ambient-3) 0%, transparent 72%),
		linear-gradient(var(--ambient-angle), var(--color-ambient-1), var(--color-surface));
	animation: ambient-drift var(--duration-ambient) var(--ease-in-out) infinite alternate;
}

/* Grain: texture statica pre-renderizzata (assets/img/grain.png 200×200) */
.ambient::after {
	content: '';
	position: absolute;
	inset: 0;
	background-image: url('../img/grain.png');
	opacity: var(--grain-opacity);
	mix-blend-mode: overlay;
}

@keyframes ambient-drift {
	0%   { --ambient-x: 18%; --ambient-y: 12%; --ambient-angle: 160deg; }
	50%  { --ambient-x: 72%; --ambient-y: 30%; --ambient-angle: 200deg; }
	100% { --ambient-x: 40%; --ambient-y: 64%; --ambient-angle: 140deg; }
}

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

/* Grain anche sulla cornice (header/footer), senza gradiente */
:where(.frame-grain) { position: relative; isolation: isolate; } /* specificità zero */
.frame-grain::after {
	content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
	background-image: url('../img/grain.png'); opacity: 0.07; mix-blend-mode: overlay;
}

/* Grain sulla scritta del footer (MARCACCINI), stessa texture */
.wordmark::after { content: ''; position: absolute; inset: 0; pointer-events: none; background-image: url('../img/grain.png'); opacity: 0.35; mix-blend-mode: overlay; }

/* Grain sulla fascia arancio delle testate dei servizi (hero-band--accent), stessa texture */
.hero-band--accent::after { content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none; background-image: url('../img/grain.png'); opacity: 0.12; mix-blend-mode: multiply; }
