@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-side-nav {
			display: flex;
			flex-direction: column;
			min-block-size: 0;
			font-size: var(--norn-font-size-s, 0.875rem);

			& nav {
				display: flex;
				flex-direction: column;
				gap: var(--norn-space-s, 0.75rem);
				min-block-size: 0;
			}

			& nav > [data-label] {
				position: absolute;
				inline-size: 1px;
				block-size: 1px;
				overflow: hidden;
				clip-path: inset(50%);
				white-space: nowrap;
			}

			& nav > ul,
			& nav > ul ul {
				display: flex;
				flex-direction: column;
				gap: var(--norn-space-2xs, 0.25rem);
				margin: 0;
				padding: 0;
				list-style: none;
			}

			/* Padding with an equal negative margin keeps focus rings inside the scroll box, which would clip them. */
			& nav > ul {
				box-sizing: border-box;
				min-block-size: 0;
				margin: -6px;
				padding: 6px;
				overflow-y: auto;
				overscroll-behavior: contain;
			}

			/* An item with a nested list stacks them with the list's gap, and keeps a little room below. */
			& nav > ul li:has(> ul) {
				display: flex;
				flex-direction: column;
				gap: var(--norn-space-2xs, 0.25rem);
				padding-block-end: var(--norn-space-xs, 0.5rem);
			}

			& nav > ul ul {
				margin-inline: var(--norn-space-s, 0.75rem) 0;
			}

			& nav > ul a {
				--_state: 0%;
				--_tint: transparent;
				box-sizing: border-box;
				display: flex;
				align-items: center;
				gap: var(--norn-space-xs, 0.5rem);
				padding: var(--norn-space-2xs, 0.25rem) var(--norn-space-xs, 0.5rem);
				border-radius: var(--norn-ui-radius-s, 4px);
				background-color: color-mix(in oklab, currentcolor var(--_state), var(--_tint));
				color: var(--norn-text-muted, light-dark(#4b5160, #a4abba));
				text-decoration: none;
				overflow-wrap: anywhere;

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

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

				&[aria-current="page"] {
					--_tint: color-mix(in oklab, 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))) var(--norn-ui-state-press, 12%), transparent);
					color: 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)));
				}
			}

			& nav > ul norn-icon {
				flex: none;
				color: 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)));
			}

			@media (pointer: coarse) {
				& nav > ul a {
					min-block-size: 2.75rem;
				}
			}

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

			/* The current page fills itself, since the browser replaces the tint. */
			@media (forced-colors: active) {
				& nav > ul a[aria-current="page"] {
					background-color: Highlight;
					color: HighlightText;
					forced-color-adjust: none;

					& norn-icon {
						color: HighlightText;
					}
				}

				& nav > ul a:focus-visible {
					outline-color: CanvasText;
				}
			}

			@media print {
				display: none;
			}
		}
	}
@layer norn.components {
		norn-rich-text {
			display: grid;
			grid-template-columns: minmax(0, 1fr);
			align-content: start;
			gap: var(--norn-space-m, 1.25rem);
			max-inline-size: var(--norn-text-measure, 40em);

			&[data-measure="none"] {
				max-inline-size: none;
			}
		}

		/* Prose styles stop at the components that style all their own markup. A callout, a notice, a card, or a table holds prose of its own (a list, a code span), so it stays in scope. */
		@scope (norn-rich-text) to (norn-code-block, norn-code-tabs, norn-fact-list) {
			h2,
			h3,
			h4,
			h5,
			h6 {
				margin: var(--norn-space-s, 0.75rem) 0 0;
				font-family: var(--norn-font-heading, var(--norn-font-body, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif));
				line-height: 1.15;
				text-wrap: balance;
			}

			/* norn-heading-anchor zeroes its heading's margin, so the space goes on its tag. */
			norn-heading-anchor:has(> :is(h2, h3, h4, h5, h6)) {
				margin-block-start: var(--norn-space-s, 0.75rem);
			}

			h2 {
				font-size: var(--norn-font-size-xl, 1.5rem);
			}

			h3 {
				font-size: var(--norn-font-size-l, 1.25rem);
			}

			h4,
			h5,
			h6 {
				font-size: var(--norn-font-size-m, 1rem);
			}

			p {
				margin: 0;
				text-wrap: pretty;
			}

			ul,
			ol {
				display: grid;
				gap: var(--norn-space-xs, 0.5rem);
				margin: 0;
				padding-inline-start: var(--norn-space-m, 1.25rem);
				list-style: revert;
			}

			blockquote {
				margin: 0;
				padding-inline-start: var(--norn-space-m, 1.25rem);
				border-inline-start: 3px solid var(--norn-ui-border-color, light-dark(#d3d8e2, #2d323e));
				color: var(--norn-text-muted, light-dark(#4b5160, #a4abba));
			}

			/* A sourced quote: a cite line inside the quote, or a figcaption under it. */
			blockquote:has(> cite) {
				display: grid;
				gap: var(--norn-space-xs, 0.5rem);
			}

			figure:has(> blockquote) {
				display: grid;
				gap: var(--norn-space-xs, 0.5rem);
				margin: 0;
			}

			blockquote > cite,
			figure:has(> blockquote) > figcaption {
				color: var(--norn-text-muted, light-dark(#4b5160, #a4abba));
				font-size: var(--norn-font-size-s, 0.875rem);
				font-style: normal;
			}

			table {
				border-collapse: collapse;
				border-block-end: 1px solid var(--norn-ui-border-color, light-dark(#d3d8e2, #2d323e));
			}

			th,
			td {
				padding: var(--norn-space-xs, 0.5rem) var(--norn-space-s, 0.75rem);
				border-block-end: 1px solid var(--norn-ui-border-color, light-dark(#d3d8e2, #2d323e));
				text-align: start;
			}

			hr {
				box-sizing: border-box;
				width: 100%;
				border: 0;
				border-block-start: 1px solid var(--norn-ui-border-color, light-dark(#d3d8e2, #2d323e));
			}

			:not(pre) > code {
				padding: 0.1em 0.35em;
				border-radius: var(--norn-ui-radius-s, 4px);
				background: var(--norn-surface-code, light-dark(hsl(40, 14%, 94%), #2c313b));
				font-family: var(--norn-font-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
				font-size: 0.875em;
			}
		}
	}
@layer norn.components {
		norn-sidebar-layout {
			display: block;
			container-type: inline-size;
			inline-size: min(100% - 2 * var(--norn-space-m, 1.25rem), var(--norn-layout-width, 64rem));
			margin-inline: auto;
			padding-block: var(--norn-space-l, 2rem);

			& > div {
				display: grid;
				grid-template-columns: var(--_nav, 14rem) minmax(0, 1fr);
				align-items: start;
				gap: var(--norn-space-l, 2rem);

				&[data-gap="s"] {
					gap: var(--norn-space-s, 0.75rem);
				}

				&[data-gap="m"] {
					gap: var(--norn-space-m, 1.25rem);
				}

				&[data-gap="xl"] {
					gap: var(--norn-space-xl, 4rem);
				}
			}

			/* The navigation stays in view; the norn-side-nav inside lets only its list scroll. The details is only a column here: its summary is hidden, and its content always shows. */
			& > div > details {
				position: sticky;
				inset-block-start: var(--norn-space-m, 1.25rem);
				display: flex;
				flex-direction: column;
				max-block-size: calc(100dvh - 2 * var(--norn-space-m, 1.25rem));

				&::details-content {
					content-visibility: visible;
					display: contents;
				}
			}

			& > div > details > summary {
				display: none;
			}

			& > div > article {
				display: grid;
				grid-template-columns: var(--_columns, minmax(0, 1fr));
				align-content: start;
				gap: var(--norn-space-m, 1.25rem);
				min-inline-size: 0;
			}

			& > div > article > :is(article, section) {
				display: grid;
				grid-template-columns: minmax(0, 1fr);
				align-content: start;
				gap: var(--norn-space-s, 0.75rem);
				min-inline-size: 0;
			}

			/* Narrow, the columns stack and the navigation is a control that opens it. */
			@container (max-width: 37.5rem) {
				& > div {
					grid-template-columns: minmax(0, 1fr);
				}

				& > div > details {
					position: static;
					display: block;
					max-block-size: none;

					&:not([open])::details-content {
						content-visibility: hidden;
					}

					&::details-content {
						display: block;
					}
				}

				& > div > details > summary {
					--_state: 0%;
					box-sizing: border-box;
					display: flex;
					align-items: center;
					justify-content: space-between;
					gap: var(--norn-space-s, 0.75rem);
					min-block-size: var(--norn-ui-control-height, 2.25rem);
					margin-block-end: var(--norn-space-xs, 0.5rem);
					padding: var(--norn-space-xs, 0.5rem) var(--norn-space-s, 0.75rem);
					border-radius: var(--norn-ui-radius-s, 4px);
					background-color: color-mix(in oklab, currentcolor var(--_state), var(--norn-surface-raised, light-dark(hsl(40, 14%, 96%), #242932)));
					font-weight: 600;
					list-style: none;
					cursor: pointer;

					&::-webkit-details-marker {
						display: none;
					}

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

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

					&:focus-visible {
						outline-offset: calc(-1 * var(--norn-ui-focus-offset, 2px));
					}

					/* A chevron drawn with two borders, pointing down when closed and up when open. */
					&::after {
						box-sizing: border-box;
						content: "";
						flex: none;
						inline-size: 0.5em;
						block-size: 0.5em;
						border-block-end: 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)));
						border-inline-end: 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)));
						rotate: 45deg;
					}
				}

				& > div > details[open] > summary::after {
					rotate: 225deg;
				}
			}

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

			@media (forced-colors: active) {
				& > div > details > summary::after {
					border-color: CanvasText;
				}
			}

			@media print {
				& > div {
					grid-template-columns: minmax(0, 1fr);
				}

				& > div > details > summary {
					display: none;
				}
			}
		}

		/* Without ::details-content a closed details can't show its content, so the control is always there. */
		@supports not selector(::details-content) {
			norn-sidebar-layout > div > details > summary {
				display: flex;
				min-block-size: var(--norn-ui-control-height, 2.25rem);
				align-items: center;
				font-weight: 600;
				cursor: pointer;
			}
		}
	}