@layer norn.components {
		norn-header {
			display: block;
			container-type: inline-size;

			& > header {
				position: relative;
				display: flex;
				flex-wrap: wrap;
				align-items: center;
				justify-content: space-between;
				gap: var(--norn-space-xs, 0.5rem) var(--norn-space-m, 1.25rem);
				padding: var(--norn-space-s, 0.75rem) var(--norn-space-m, 1.25rem);
				background: var(--norn-surface-raised, light-dark(hsl(40, 14%, 96%), #242932));
			}

			& > header > a[rel="home"] {
				display: inline-flex;
				align-items: center;
				gap: var(--norn-space-xs, 0.5rem);
				color: var(--norn-text-base, light-dark(#16181d, #eceef3));
				font-family: var(--norn-font-heading, var(--norn-font-body, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif));
				font-size: var(--norn-font-size-l, 1.25rem);
				font-weight: 700;
				text-decoration: none;
			}

			& > header > [rel="home"] img {
				display: block;
				inline-size: auto;
				max-inline-size: 100%;
				block-size: var(--_logo, 2rem);
			}

			/* Wide, the details is only a wrapper: its summary is hidden, and the navigation sits in the row. */
			& > header > details {
				display: contents;

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

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

			& > header > details > nav {
				display: flex;
				flex-wrap: wrap;
				gap: var(--norn-space-2xs, 0.25rem) var(--norn-space-xs, 0.5rem);
				font-size: var(--norn-font-size-m, 1rem);
			}

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

			& > header > details > nav > a {
				--_state: 0%;
				box-sizing: border-box;
				display: inline-flex;
				align-items: center;
				gap: var(--norn-space-2xs, 0.25rem);
				min-block-size: var(--norn-ui-control-height, 2.25rem);
				padding-inline: var(--norn-space-xs, 0.5rem);
				border-block-end: 2px solid transparent;
				border-radius: var(--norn-ui-radius-s, 4px);
				background-color: color-mix(in oklab, currentcolor var(--_state), transparent);
				color: var(--norn-text-muted, light-dark(#4b5160, #a4abba));
				text-decoration: none;

				&:hover {
					--_state: var(--norn-ui-state-hover, 8%);
					color: var(--norn-text-base, light-dark(#16181d, #eceef3));
				}

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

				&[aria-current] {
					border-block-end-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)));
					color: var(--norn-text-base, light-dark(#16181d, #eceef3));
				}
			}

			/* Narrow, the links fold into a control at the end of the brand's row. Open, they take the full width below it. */
			@container (max-width: 40rem) {
				& > header {
					row-gap: 0;
				}

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

				& > header > details::details-content {
					display: block;
					flex: 1 0 100%;
				}

				& > header > details > nav {
					flex-direction: column;
					padding-block-start: var(--norn-space-xs, 0.5rem);
					flex-wrap: nowrap;
					gap: 0;
				}

				& > header > details > nav > a {
					padding-inline: var(--norn-space-s, 0.75rem);
				}

				& > header > details > summary {
					--_state: 0%;
					box-sizing: border-box;
					display: flex;
					align-items: center;
					gap: var(--norn-space-s, 0.75rem);
					min-block-size: var(--norn-ui-control-height, 2.25rem);
					margin-inline-start: auto;
					padding-inline: var(--norn-space-s, 0.75rem);
					border-radius: var(--norn-ui-radius-s, 4px);
					background-color: color-mix(in oklab, currentcolor var(--_state), transparent);
					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;
					}
				}

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

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

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

			/* A clear border would be drawn in the text color, so the links that aren't current take the page's. */
			@media (forced-colors: active) {
				& > header > details > nav > a {
					border-block-end-color: Canvas;
				}

				& > header > details > nav > a[aria-current] {
					border-block-end-color: Highlight;
				}

				& > header > details > summary::after {
					border-color: CanvasText;
				}
			}

			@media print {
				& > header > details {
					display: none;
				}
			}

			/* Last, so a header with no links drops the whole control. */
			& > header > details:not(:has(a)) {
				display: none;
			}
		}

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