/**
 * Fons fix amb textura animada; el contingut desplaça per sobre.
 */
#espai42-fixed-bg {
	position: fixed;
	inset: 0;
	z-index: 0;
	pointer-events: none;
	overflow: hidden;
	background-color: #faf3e0;
	background-image: linear-gradient(165deg, #faf3e0 0%, #fff9ef 40%, #f4e8d8 100%);
}

/* Textura tipus moiré / grain suau (fons “viu” sense video) */
#espai42-fixed-bg::before {
	content: "";
	position: absolute;
	inset: -40%;
	width: 180%;
	height: 180%;
	opacity: 0.55;
	background-image:
		repeating-linear-gradient(
			0deg,
			transparent,
			transparent 3px,
			rgba(38, 180, 180, 0.04) 3px,
			rgba(38, 180, 180, 0.04) 4px
		),
		repeating-linear-gradient(
			90deg,
			transparent,
			transparent 3px,
			rgba(244, 121, 32, 0.03) 3px,
			rgba(244, 121, 32, 0.03) 4px
		);
	animation: espai42-moire-drift 28s linear infinite;
}

#espai42-fixed-bg::after {
	content: "";
	position: absolute;
	inset: 0;
	background:
		radial-gradient(ellipse 70% 50% at 15% 25%, rgba(38, 180, 180, 0.18), transparent 55%),
		radial-gradient(ellipse 60% 45% at 85% 75%, rgba(244, 121, 32, 0.14), transparent 50%),
		radial-gradient(ellipse 50% 40% at 50% 50%, rgba(19, 168, 81, 0.08), transparent 60%);
	animation: espai42-bg-glow-shift 14s ease-in-out infinite alternate;
}

@keyframes espai42-moire-drift {
	0% {
		transform: translate(0, 0) rotate(0deg);
	}
	100% {
		transform: translate(-3%, -2%) rotate(0.8deg);
	}
}

@keyframes espai42-bg-glow-shift {
	0% {
		opacity: 0.85;
		transform: scale(1);
	}
	100% {
		opacity: 1;
		transform: scale(1.05);
	}
}

/* Video de fons opcional (afegir URL a espai42-bg-video quan en tingueu un) */
#espai42-fixed-bg .espai42-bg-video {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	opacity: 0.22;
	filter: saturate(0.85) contrast(1.05);
}

#espai42-fixed-bg .espai42-cursor-glow {
	z-index: 2;
}

html {
	background: transparent;
}

body.espai42-fixed-bg-active {
	background: transparent !important;
}

body.espai42-fixed-bg-active #page,
body.espai42-fixed-bg-active .site,
body.espai42-fixed-bg-active .site-content,
body.espai42-fixed-bg-active .ast-separate-container,
body.espai42-fixed-bg-active .ast-plain-container {
	position: relative;
	z-index: 2;
	background: transparent !important;
}

/* Per defecte: seccions transparents (no tapar imatges de fons del kit) */
body.espai42-fixed-bg-active.elementor-page .elementor-top-section {
	background-color: transparent !important;
	backdrop-filter: none !important;
	-webkit-backdrop-filter: none !important;
}

/* Seccions amb imatge de fons: sense overlay crema */
body.espai42-fixed-bg-active .elementor-top-section.espai42-has-bg-image {
	background-color: transparent !important;
}

body.espai42-fixed-bg-active .elementor-top-section.espai42-has-bg-image > .elementor-background-overlay {
	opacity: 0.45 !important;
}

/* Seccions fosques del kit (testimonials, etc.) */
body.espai42-fixed-bg-active .elementor-top-section.espai42-section-dark {
	background-color: #1a2332 !important;
}

/* Hero primera secció: parallax imatge */
body.espai42-fixed-bg-active.elementor-page .elementor-top-section:first-of-type.espai42-has-bg-image {
	background-attachment: fixed !important;
	background-size: cover !important;
	background-position: center center !important;
}

@media (prefers-reduced-motion: reduce) {
	#espai42-fixed-bg::before,
	#espai42-fixed-bg::after {
		animation: none;
	}
}
