/**
 * Component: glow orb.
 *
 * Rounded square (--glow-radius) with an icon centred inside a rotating
 * conic-gradient border, plus a blurred copy behind it for the glow. Markup:
 * cartrack_glow_orb() in inc/components.php. Every corner reads the one
 * token, so the radius changes in tokens.css only.
 *
 * Motion: the gradient angle is animated through the registered property
 * --glow-angle (GPU-friendly, no JS). Browsers without @property show the
 * gradient border static: rotating the pseudo-elements with transform (the
 * old fallback) would spin the square itself. Static under
 * prefers-reduced-motion.
 *
 * @package cartrack
 */

@property --glow-angle {
	syntax: "<angle>";
	inherits: true;
	initial-value: 0deg;
}

.glow-orb {
	--glow-angle: 0deg; /* Needed when @property is unsupported. */

	position: relative;
	isolation: isolate;
	display: grid;
	flex: none;
	place-items: center;
	width: var(--glow-orb-size);
	height: var(--glow-orb-size);
	border-radius: var(--glow-radius);
}

/* ::before = glow, ::after = ring. Both sit behind the icon. */
.glow-orb::before,
.glow-orb::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	border-radius: var(--glow-radius);
	background: conic-gradient(from var(--glow-angle), var(--glow-color-1), var(--glow-color-2), var(--glow-color-1));
	animation: glow-orb-angle var(--glow-orb-duration) linear infinite;
}

.glow-orb::before {
	filter: blur(var(--glow-orb-blur));
	opacity: var(--glow-orb-glow-opacity);
}

.glow-orb__inner {
	display: grid;
	place-items: center;
	width: calc(100% - 2 * var(--glow-orb-border-width));
	height: calc(100% - 2 * var(--glow-orb-border-width));
	border-radius: max(0px, var(--glow-radius) - var(--glow-orb-border-width));
	background-color: var(--color-dark);
}

.glow-orb__icon {
	display: block;
	width: var(--glow-orb-icon-size);
	height: auto;
}

@keyframes glow-orb-angle {
	to {
		--glow-angle: 360deg;
	}
}

@media (prefers-reduced-motion: reduce) {
	.glow-orb::before,
	.glow-orb::after {
		animation: none;
	}
}
