sh-scroll-spy {
	--sh-scroll-spy-color: var(--sh-color-neutral-30);
	--sh-scroll-spy-current-color: var(--sh-color-neutral-0);
	--sh-scroll-spy-indicator-color: var(--sh-color-neutral-0);

	--indent: var(--sh-space-md);

	line-height: 1.4;

	/* Links are light DOM children: the focus ring comes from core/elements */
	& a {
		display: block;
		padding-block: var(--sh-space-xs);
		padding-inline-start: var(--sh-space-sm);
		color: var(--sh-scroll-spy-color);
		text-decoration: none;
		border-inline-start: 3px solid transparent;
	}

	& a:hover {
		color: var(--sh-scroll-spy-current-color);
		text-decoration: underline;
	}

	/*
	 * The current link: color and bar, with a fixed weight so the text does not reflow.
	 *
	 * With native tracking `:target-current` is live but `aria-current` lags until the scroll settles,
	 * so the attribute is not styled there: two links would light up.
	 */
	& a[aria-current="true"] {
		color: var(--sh-scroll-spy-current-color);
		border-inline-start-color: var(--sh-scroll-spy-indicator-color);
	}

	@supports (scroll-target-group: auto) and selector(:target-current) {
		& a[aria-current="true"] {
			color: var(--sh-scroll-spy-color);
			border-inline-start-color: transparent;
		}

		& a:target-current {
			color: var(--sh-scroll-spy-current-color);
			border-inline-start-color: var(--sh-scroll-spy-indicator-color);
		}
	}
}

@media (prefers-reduced-motion: no-preference) {
	sh-scroll-spy a {
		transition:
			color 100ms ease,
			border-color 100ms ease;
	}
}
