/* @svelte-lean/styles — breadcrumb (Tier 0, <nav> + <ol> + aria-current="page").
 * Markup: <nav aria-label="Breadcrumb" data-slean="breadcrumb"> <ol> <li><a href="/">Home</a></li>
 * … <li><a href="…" aria-current="page">Current</a></li> </ol> </nav>. The separator is the
 * chevron icon masked on li + li::before: generated content with no text, so it is never
 * announced; it points to the inline end and is mirrored under :dir(rtl). The current item is
 * aria-current="page". Rules use child combinators (nav > ol > li > a), so a list nested in an
 * item, such as a popover of collapsed levels, keeps its own styles. */
@layer slean.reset, slean.tokens, slean.base, slean.components, slean.compositions, slean.utilities;

@layer slean.components {
	:where([data-slean='breadcrumb']) {
		color: var(--slean-fg-muted);
		font-size: var(--slean-text-sm);
		line-height: var(--slean-leading);
	}

	:where([data-slean='breadcrumb'] > ol) {
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		gap: var(--slean-space-1) var(--slean-space-2);
		margin: 0;
		padding: 0;
		list-style: none;
	}

	:where([data-slean='breadcrumb'] > ol > li) {
		display: inline-flex;
		align-items: center;
		gap: var(--slean-space-2);
		min-inline-size: 0;
	}

	:where([data-slean='breadcrumb'] > ol > li + li)::before {
		content: '';
		flex: none;
		inline-size: 0.875rem;
		block-size: 0.875rem;
		background: currentColor;
		mask: var(--slean-icon-chevron-right) center / contain no-repeat;
		opacity: 0.7;
	}

	:where([data-slean='breadcrumb']:dir(rtl) > ol > li + li)::before {
		scale: -1 1;
	}

	:where([data-slean='breadcrumb'] > ol > li > a) {
		border-radius: var(--slean-radius-sm);
		color: inherit;
		text-decoration: none;
		text-underline-offset: 0.2em;
		overflow-wrap: anywhere;
	}

	@media (hover: hover) {
		:where([data-slean='breadcrumb'] > ol > li > a[href]:hover) {
			color: var(--slean-fg);
			text-decoration-line: underline;
		}
	}

	:where([data-slean='breadcrumb'] > ol > li > [aria-current='page']) {
		color: var(--slean-fg);
		font-weight: var(--slean-font-weight-medium);
	}

	@media (hover: hover) {
		:where([data-slean='breadcrumb'] > ol > li > a[aria-current='page']:hover) {
			text-decoration-line: none;
		}
	}

	:where([data-slean='breadcrumb'] > ol > li > a:focus-visible) {
		outline: var(--slean-focus-ring);
		outline-offset: var(--slean-focus-ring-offset);
	}

	/* On a coarse pointer each link is as tall as the small control height. */
	@media (pointer: coarse) {
		:where([data-slean='breadcrumb'] > ol > li > a) {
			display: inline-flex;
			align-items: center;
			min-block-size: var(--slean-control-height-sm);
		}
	}

	@media (forced-colors: active) {
		:where([data-slean='breadcrumb'] > ol > li + li)::before {
			forced-color-adjust: none;
			background: CanvasText;
			opacity: 1;
		}

		:where([data-slean='breadcrumb'] > ol > li > a) {
			color: LinkText;
		}

		:where([data-slean='breadcrumb'] > ol > li > [aria-current='page']) {
			color: CanvasText;
		}
	}
}
