@layer norn.components {
		norn-card {
			display: grid;
			grid-template-columns: minmax(0, 1fr);
			block-size: 100%;

			/* The article takes the rows the tag has. A norn-card-grid gives the tag three subgrid rows, one each for the heading, the body, and a footer, so they line up across a row. */
			& > article {
				--_state: 0%;
				--_accent: initial;
				box-sizing: border-box;
				position: relative;
				display: grid;
				grid-row: 1 / -1;
				grid-template-columns: minmax(0, 1fr);
				grid-template-rows: inherit;
				align-content: start;
				row-gap: 0;
				block-size: 100%;
				padding: var(--norn-space-m, 1.25rem);
				/* Without an accent the declaration is invalid, so there is no line and no space for one. */
				border-block-start: 2px solid var(--_accent);
				border-radius: var(--norn-ui-border-radius, 6px);
				background-color: color-mix(in oklab, currentcolor var(--_state), var(--norn-surface-raised, light-dark(hsl(40, 14%, 96%), #242932)));

				/* A fourth child has no row to take, so a card with more than a heading, a body, and a footer lays out on its own. */
				&:has(> :nth-child(4 of :not([data-media]:empty))) {
					grid-template-rows: none;
				}

				&[data-accent="accent"] {
					--_accent: var(--norn-ui-accent, #2346d4);
				}

				&[data-accent="info"] {
					--_accent: var(--norn-status-info, light-dark(#1b4fc4, #8fb0ff));
				}

				&[data-accent="success"] {
					--_accent: var(--norn-status-success, light-dark(#0b6b3a, #7ed6a1));
				}

				&[data-accent="warning"] {
					--_accent: var(--norn-status-warning, light-dark(#9a4a00, #ffb36b));
				}

				&[data-accent="danger"] {
					--_accent: var(--norn-status-danger, light-dark(#b42318, #ff8a80));
				}

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

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

				/* The ring goes around the card, not around the link text. */
				&:has(a: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: var(--norn-ui-focus-offset, 2px);
				}
			}

			& > article > * {
				margin: 0;
			}

			& > article > :not(:last-child, :has(+ [data-media]:last-child)) {
				margin-block-end: var(--norn-space-s, 0.75rem);
			}

			& > article > :is(h2, h3, h4, h5, h6),
			& > article > norn-heading-anchor > :is(h2, h3, h4, h5, h6) {
				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);
				line-height: 1.15;
				text-wrap: balance;
			}

			& > article > :is(h2, h3, h4, h5, h6) a,
			& > article > norn-heading-anchor > :is(h2, h3, h4, h5, h6) a {
				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)));
				text-decoration: none;
				overflow-wrap: anywhere;

				/* The link reaches over the whole card. */
				&::after {
					content: "";
					position: absolute;
					inset: 0;
				}

				&:hover {
					text-decoration: underline;
				}

				&:focus-visible {
					outline: none;
				}
			}

			/* The image sits at the top, edge to edge. Its wrapper comes last in the source, so the heading stays the card's first content. */
			& > article > [data-media] {
				order: -1;
				margin-block-start: calc(-1 * var(--norn-space-m, 1.25rem));
				margin-inline: calc(-1 * var(--norn-space-m, 1.25rem));
				margin-block-end: var(--norn-space-s, 0.75rem);
				overflow: hidden;
				border-start-start-radius: inherit;
				border-start-end-radius: inherit;
			}

			& > article > [data-media]:empty {
				display: none;
			}

			& > article > [data-media] > :is(img, picture, svg, video) {
				display: block;
				inline-size: 100%;
				block-size: auto;
				aspect-ratio: 16 / 9;
				object-fit: cover;
			}

			& > article > p {
				color: var(--norn-text-muted, light-dark(#4b5160, #a4abba));
				text-wrap: pretty;
			}

			& > article[data-title-face="mono"] > :is(h2, h3, h4, h5, h6),
			& > article[data-title-face="mono"] > norn-heading-anchor > :is(h2, h3, h4, h5, h6) {
				font-family: var(--norn-font-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
				font-size: var(--norn-font-size-m, 1rem);
				font-weight: 700;
			}

			@media (prefers-reduced-motion: no-preference) {
				& > article {
					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) {
				& > article {
					border: 1px solid CanvasText;
				}
			}

			@media print {
				break-inside: avoid;
			}
		}
	}