/* Spotlight Card: a soft wash on the face, with a tighter highlight on the rim. */
[data-spotlight] {
	--spotlight-face: hsl(var(--spotlight-hue) 74% 68% / 0.13);
	--spotlight-rim: hsl(var(--spotlight-hue) 80% 66% / 0.75);
	--spotlight-tip: rgb(239 255 249 / 0.82);
}

[data-theme='light'] [data-spotlight] {
	--spotlight-face: hsl(var(--spotlight-hue) 53% 38% / 0.09);
	--spotlight-rim: hsl(var(--spotlight-hue) 60% 34% / 0.64);
	--spotlight-tip: hsl(var(--spotlight-hue) 58% 28% / 0.55);
}

@media (any-hover: hover) and (any-pointer: fine) and (prefers-reduced-motion: no-preference) {
	:where([data-spotlight]) {
		position: relative;
		isolation: isolate;
	}

	[data-spotlight]::before,
	[data-spotlight]:not([data-spotlight='flat'])::after {
		content: '';
		position: absolute;
		inset: 0;
		border-radius: inherit;
		pointer-events: none;
		opacity: 0;
		transition: opacity 180ms ease-out;
	}

	[data-spotlight]::before {
		z-index: -1;
		background: radial-gradient(200px circle at var(--spotlight-x) var(--spotlight-y), var(--spotlight-face), transparent);
	}

	/* An illustrated/photographic surface has an opaque face of its own. */
	[data-spotlight='media']::before {
		z-index: 1;
	}

	[data-spotlight].has-spotlight::before {
		opacity: 1;
	}

	@supports (mask-composite: exclude) {
		[data-spotlight]:not([data-spotlight='flat'])::after {
			inset: -1px;
			padding: 2px;
			--spotlight-rim-at: calc(var(--spotlight-x) + 1px) calc(var(--spotlight-y) + 1px);
			background:
				radial-gradient(90px circle at var(--spotlight-rim-at), var(--spotlight-tip), transparent),
				radial-gradient(150px circle at var(--spotlight-rim-at), var(--spotlight-rim), transparent);
			mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
			mask-composite: exclude;
		}

		[data-spotlight].has-spotlight:not([data-spotlight='flat'])::after {
			opacity: 1;
		}

		[data-spotlight='media']::after {
			z-index: 2;
		}
	}
}

@media (forced-colors: active) {
	[data-spotlight]::before,
	[data-spotlight]::after {
		display: none;
	}
}
