/**
 * AudiencePlayer page-wide effects (issue #39, spec #36).
 *
 * The handoff's reusable visual layers, ported once with the handoff's own
 * values. Later blocks reference these classes rather than redefining them:
 *   - .ap-backdrop / .ap-blob   drifting background blobs (a fixed page layer)
 *   - .ap-glass                 the Glass surface
 *   - .ap-sheen                 the rotating Border sheen (1px conic edge)
 *   - .ap-spotlight             the pointer-following Spotlight (JS-driven)
 *   - .ap-floor-pool            the floor light pool under the hero buttons
 *   - [data-reveal]             scroll reveal, driven by assets/js/effects.js
 *
 * The reveal hidden state applies only once the JS module flags the document
 * with `ap-js`, so without JS — in the editor, or on failure — content stays
 * visible. `prefers-reduced-motion: reduce` disables every animation and shows
 * revealed content immediately.
 */

/* Registered custom properties so they can be animated/transitioned:
     --ap-a  the Border sheen's rotation angle (see .ap-sheen below);
     --o     the per-element hover light-wash opacity (0 -> .75/1) that later
             card/row blocks transition on hover. */
@property --ap-a {
	syntax: "<angle>";
	inherits: false;
	initial-value: 0deg;
}
@property --o {
	syntax: "<number>";
	inherits: true;
	initial-value: 0;
}

@keyframes apDrift {
	0%,
	100% {
		transform: translate(0, 0) scale(1);
	}
	33% {
		transform: translate(80px, -50px) scale(1.15);
	}
	66% {
		transform: translate(-60px, 40px) scale(0.95);
	}
}

@keyframes apSpin {
	to {
		--ap-a: 360deg;
	}
}

/* Pulsing opacity for the small "live" status dot used by later blocks. */
@keyframes apPulse {
	0%,
	100% {
		opacity: 0.55;
	}
	50% {
		opacity: 1;
	}
}

/* The page content sits above the fixed backdrop. Overflow is clipped at the
   viewport edge (not per block) so decorative elements that bleed off-screen, like
   the sector hero's angled screen, run to the screen edge without causing
   horizontal page scroll. `clip` makes no scroll container, so sticky and shadows
   keep working. */
.wp-site-blocks {
	position: relative;
	z-index: 1;
	overflow-x: clip;
}

/* Background blobs: a fixed layer with two slowly drifting blurred blobs
   (red and violet) plus a soft vignette, matching the handoff's backdrop. */
.ap-backdrop {
	position: fixed;
	inset: 0;
	z-index: 0;
	overflow: hidden;
	pointer-events: none;
}

.ap-blob {
	position: absolute;
	border-radius: 50%;
	filter: blur(80px);
	will-change: transform;
}

.ap-blob--red {
	left: -10%;
	top: -15%;
	width: 900px;
	height: 700px;
	background: radial-gradient(circle, rgba(227, 43, 38, 0.2), transparent 62%);
	animation: apDrift 18s ease-in-out infinite;
}

.ap-blob--violet {
	right: -8%;
	top: 10%;
	width: 700px;
	height: 600px;
	background: radial-gradient(circle, oklch(0.5 0.18 295 / 0.26), transparent 62%);
	animation: apDrift 24s ease-in-out infinite reverse;
}

.ap-backdrop__vignette {
	position: absolute;
	inset: 0;
	background: radial-gradient(ellipse at 50% 30%, transparent 40%, rgba(20, 18, 24, 0.06) 100%);
}

/* Glass surface. */
.ap-glass {
	background: rgba(255, 255, 255, 0.7);
	backdrop-filter: blur(24px) saturate(1.5);
	-webkit-backdrop-filter: blur(24px) saturate(1.5);
	border: 1px solid rgba(20, 18, 24, 0.1);
}

/* Border sheen: a 1px conic-gradient border, masked to the edge, with the
   registered angle rotating a full turn over 7s (10s for the slow variant). */
.ap-sheen {
	position: absolute;
	inset: 0;
	z-index: 2;
	padding: 1px;
	border-radius: inherit;
	pointer-events: none;
	background: conic-gradient(
		from var(--ap-a),
		transparent 0 62%,
		rgba(255, 106, 100, 0.7) 78%,
		rgba(20, 18, 24, 1) 82%,
		rgba(255, 106, 100, 0.7) 86%,
		transparent 100%
	);
	-webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
	-webkit-mask-composite: xor;
	mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
	mask-composite: exclude;
	animation: apSpin 7s linear infinite;
}

.ap-sheen--slow {
	background: conic-gradient(
		from var(--ap-a),
		transparent 0 62%,
		oklch(0.72 0.17 295 / 0.75) 78%,
		rgba(20, 18, 24, 1) 82%,
		oklch(0.72 0.17 295 / 0.75) 86%,
		transparent 100%
	);
	animation-duration: 10s;
}

/* Spotlight: a radial glow that eases toward the pointer inside its container
   only (the JS module moves .ap-spotlight__glow and toggles its opacity). */
.ap-spotlight {
	position: absolute;
	inset: 0;
	overflow: hidden;
	pointer-events: none;
}

.ap-spotlight__glow {
	position: absolute;
	left: -500px;
	top: -420px;
	width: 1000px;
	height: 840px;
	border-radius: 50%;
	background: radial-gradient(
		closest-side,
		rgba(255, 255, 255, 0.72),
		rgba(255, 238, 230, 0.32) 42%,
		rgba(227, 43, 38, 0.035) 66%,
		transparent 86%
	);
	filter: blur(36px);
	opacity: 0;
	transform: translate(760px, 300px);
	transition: opacity 0.8s ease;
	will-change: transform, opacity;
}

/* Floor light pool: a blurred warm radial under the hero buttons. */
.ap-floor-pool {
	position: relative;
	width: min(900px, 98%);
	height: 170px;
	pointer-events: none;
}

.ap-floor-pool::before {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: 50%;
	background: radial-gradient(
		50% 50% at 50% 50%,
		rgba(255, 252, 248, 1) 0%,
		rgba(255, 238, 226, 0.75) 30%,
		rgba(255, 226, 205, 0.35) 50%,
		rgba(20, 18, 24, 0.05) 72%,
		rgba(20, 18, 24, 0.02) 84%,
		rgba(20, 18, 24, 0) 96%
	);
	filter: blur(24px);
}

.ap-floor-pool::after {
	content: "";
	position: absolute;
	left: 28%;
	right: 28%;
	top: 38%;
	height: 34%;
	border-radius: 50%;
	background: radial-gradient(
		closest-side,
		rgba(255, 255, 255, 1),
		rgba(255, 250, 245, 0.6) 50%,
		rgba(255, 255, 255, 0)
	);
	filter: blur(10px);
}

/* Scroll reveal. The hidden start state applies only once the JS module has
   flagged the document with `ap-js`; the module then sets each element's
   staggered transition inline and reveals it on intersection. Variants:
   default (up), left, right and zoom. */
.ap-js [data-reveal] {
	opacity: 0;
	transform: translate3d(0, 32px, 0);
}

.ap-js [data-reveal="left"] {
	transform: translate3d(-36px, 0, 0);
}

.ap-js [data-reveal="right"] {
	transform: translate3d(36px, 0, 0);
}

.ap-js [data-reveal="zoom"] {
	opacity: 1;
	transform: scale(1.1);
}

[data-reveal].is-revealed {
	opacity: 1;
	transform: none;
}

/* Reduced motion: disable every page-wide animation and reveal immediately. */
@media (prefers-reduced-motion: reduce) {
	.ap-blob,
	.ap-sheen {
		animation: none !important;
	}

	.ap-js [data-reveal] {
		opacity: 1 !important;
		transform: none !important;
	}

	.ap-spotlight__glow {
		display: none;
	}
}
