@layer norn.components {
		norn-icon {
			display: inline-flex;
			flex: none;
			vertical-align: -0.125em;

			& svg {
				inline-size: var(--norn-ui-icon-s, 1em);
				block-size: var(--norn-ui-icon-s, 1em);

				&[data-size="m"] {
					inline-size: var(--norn-ui-icon-m, 1.25rem);
					block-size: var(--norn-ui-icon-m, 1.25rem);
				}

				&:not([data-project]) {
					fill: none;
					stroke: currentcolor;
					stroke-linecap: round;
					stroke-linejoin: round;
					stroke-width: 2;
				}

				&[data-project] {
					fill: currentcolor;
				}
			}

			& > :not(svg) {
				position: absolute;
				inline-size: 1px;
				block-size: 1px;
				overflow: hidden;
				clip-path: inset(50%);
				white-space: nowrap;
			}

			& [data-fill] {
				fill: currentcolor;
				stroke: none;
			}

			&:dir(rtl) [data-mirror] {
				transform: scaleX(-1);
			}
		}
	}
@layer norn.components {
		norn-segmented-control {
			--_gap: 2px;
			--_current: var(--norn-text-accent, light-dark(oklch(from color-mix(in oklch, var(--norn-ui-accent, #2346d4) 82%, black) min(l, 0.5) c h), oklch(from color-mix(in oklch, var(--norn-ui-accent, #2346d4) 55%, white) max(l, 0.72) c h)));
			display: inline-flex;
			max-inline-size: 100%;

			& fieldset {
				box-sizing: border-box;
				display: grid;
				grid-auto-columns: minmax(0, 1fr);
				grid-auto-flow: column;
				gap: var(--_gap);
				min-inline-size: 0;
				margin: 0;
				padding: var(--_gap);
				border: 0;
				border-radius: var(--norn-ui-border-radius, 6px);
				background: var(--norn-surface-raised, light-dark(hsl(40, 14%, 96%), #242932));
			}

			& legend,
			& [data-icon-only] label > span {
				box-sizing: border-box;
				position: absolute;
				inline-size: 1px;
				block-size: 1px;
				overflow: hidden;
				clip-path: inset(50%);
				white-space: nowrap;
			}

			/* The radio covers its label, so a click anywhere on the option selects it, and the native control keeps the focus. */
			& label {
				--_state: 0%;
				--_tint: transparent;
				box-sizing: border-box;
				position: relative;
				z-index: 0;
				display: inline-flex;
				align-items: center;
				justify-content: center;
				gap: var(--norn-space-2xs, 0.25rem);
				min-inline-size: 2.5rem;
				min-block-size: calc(var(--norn-ui-control-height, 2.25rem) - 2 * var(--_gap));
				padding-inline: var(--norn-space-s, 0.75rem);
				border-radius: calc(var(--norn-ui-border-radius, 6px) - var(--_gap));
				background-color: color-mix(in oklab, currentcolor var(--_state), var(--_tint));
				color: var(--norn-text-muted, light-dark(#4b5160, #a4abba));
				cursor: pointer;
				overflow-wrap: anywhere;
				text-align: center;

				&:hover {
					--_state: var(--norn-ui-state-hover, 8%);
				}

				&:active {
					--_state: var(--norn-ui-state-press, 12%);
				}

				&:has(input:checked) {
					--_tint: color-mix(in oklab, var(--_current) 14%, transparent);
					color: var(--_current);
				}

				/* The ring sits inside the option, clear of the track's edge. */
				&:has(input:focus-visible) {
					outline: var(--norn-ui-focus-width, 2px) solid var(--norn-text-accent, light-dark(oklch(from color-mix(in oklch, var(--norn-ui-accent, #2346d4) 82%, black) min(l, 0.5) c h), oklch(from color-mix(in oklch, var(--norn-ui-accent, #2346d4) 55%, white) max(l, 0.72) c h)));
					outline-offset: calc(-1 * var(--norn-ui-focus-offset, 2px));
				}
			}

			& input {
				box-sizing: border-box;
				position: absolute;
				inset: 0;
				z-index: 1;
				margin: 0;
				opacity: 0;
				cursor: pointer;
			}

			@media (pointer: coarse) {
				& label {
					min-block-size: 2.75rem;
				}
			}

			@media (prefers-reduced-motion: no-preference) {
				& label {
					transition: background-color var(--norn-ui-motion-duration, 150ms) var(--norn-ui-motion-easing, cubic-bezier(0.2, 0, 0, 1)),
						color var(--norn-ui-motion-duration, 150ms) var(--norn-ui-motion-easing, cubic-bezier(0.2, 0, 0, 1));
				}
			}

			/* One fill slides to the checked option: the start edge leads and the end edge trails. Without anchor positioning, or with less motion, the checked option fills itself. */
			@media (prefers-reduced-motion: no-preference) {
				@supports (anchor-name: --a) {
					anchor-scope: --norn-segment;

					& fieldset {
						position: relative;
						isolation: isolate;
					}

					& fieldset::before {
						content: "";
						position: absolute;
						position-anchor: --norn-segment;
						z-index: 0;
						inset-block: anchor(start) anchor(end);
						inset-inline: anchor(start) anchor(end);
						border-radius: calc(var(--norn-ui-border-radius, 6px) - var(--_gap));
						background-color: color-mix(in oklab, var(--_current) 14%, transparent);
						transition: inset-inline-start var(--norn-ui-motion-slide, 200ms) var(--norn-ui-motion-easing, cubic-bezier(0.2, 0, 0, 1)),
							inset-inline-end var(--norn-ui-motion-slide, 200ms) var(--norn-ui-motion-easing, cubic-bezier(0.2, 0, 0, 1)) var(--norn-ui-motion-trail, 90ms);
					}

					& fieldset:not(:has(input:checked))::before {
						display: none;
					}

					& label:has(input:checked) {
						--_tint: transparent;
						anchor-name: --norn-segment;
					}
				}
			}

			/* The checked option fills itself, since the browser replaces the tint. */
			@media (forced-colors: active) {
				& label:has(input:checked) {
					background-color: Highlight;
					color: HighlightText;
					forced-color-adjust: none;
				}

				& label:has(input:focus-visible) {
					outline-color: CanvasText;
				}

				& fieldset::before {
					display: none;
				}
			}
		}
	}
@layer norn.components {
		norn-theme-toggle {
			display: inline-flex;

			&:not(:defined) {
				display: none;
			}
		}
	}