/* components/site-header: a band with an image or colour; the site name (and a subtitle) in the middle, the
   tools (share menu, language picker) in the top right corner, the main menu at the bottom. */
@layer components {
	.dv-site-header {
		position: relative;
		display: flex;
		flex-direction: column;
		aspect-ratio: var(--header-ratio);
		background: var(--header-background) var(--header-image) var(--header-position) / var(--header-size) no-repeat;
	}

	.dv-site-header-name {
		order: 1;
		margin: var(--site-name-margin);
		font-size: var(--site-name-size);
		font-weight: bold;
		font-style: italic;
		text-align: center;
		color: var(--site-name-color);
		text-shadow: var(--site-name-shadow);
	}

	/* The subtitle: a smaller line under the name, in the name's colour and shadow (Tim, 2026-10-16). */
	.dv-site-header-subtitle {
		order: 1;
		margin: var(--site-subtitle-margin);
		font-size: var(--site-subtitle-size);
		font-style: italic;
		text-align: center;
		color: var(--site-name-color);
		text-shadow: var(--site-name-shadow);
	}

	.dv-site-header-tools {
		position: absolute;
		inset-block-start: var(--space-2);
		inset-inline-end: var(--space-2);
		z-index: 20;
		display: flex;
		align-items: flex-start;
		gap: var(--space-2);
	}

	.dv-site-header-navigation {
		order: 2;
		margin-block: auto var(--space-2);
		transition: opacity var(--motion-duration) ease-out;
	}

	/* While a tool open as a row (the share menu, the language picker; components/disclosure, view 'row') the
	   main menu fades behind it and takes no pointer (Tim, 2026-10-15: "Navbar vervagen als dit open staat"):
	   a click on it closes the row, Tab out of the row closes it too, and the menu is whole again.
	   site-header.js makes it inert meanwhile, so it is truly inactive. */
	.dv-site-header:has(.dv-disclosure--row .dv-disclosure-button[aria-expanded="true"]) .dv-site-header-navigation,
	.dv-site-header:has(.dv-disclosure--row details[open]) .dv-site-header-navigation {
		opacity: var(--site-header-fade);
		pointer-events: none;
	}

	/* A main menu of more than one row, and on a narrow screen every header, stands under the banner image, never over
	   it (Tim, 2026-11-07: "ook dan moet voorkomen worden dat het op deze manier de banner overlapt"; 2026-11-10: the
	   chips hid the title in the image of handssee.eu). site-header.js sets the modifier when the menu's items stand
	   on more than one row (the rows follow the width, components/navbar) or the token --header-stacked is 1
	   (css/tokens.css sets it on a narrow screen). The band keeps its ratio as a pseudo-element spanning the rows of
	   the name and subtitle; the tools have the row above it (in the corner of a wide band they are out of flow and the
	   row has no height) and the menu the row under it. */
	.dv-site-header--stacked {
		display: grid;
		grid-template-rows: auto auto 1fr auto;
		aspect-ratio: auto;
		background: none;
	}

	.dv-site-header--stacked::before {
		content: "";
		grid-area: 2 / 1 / 4 / 2;
		aspect-ratio: var(--header-ratio);
		background: var(--header-background) var(--header-image) var(--header-position) / var(--header-size) no-repeat;
	}

	.dv-site-header--stacked > * {
		grid-column: 1;
	}

	.dv-site-header--stacked .dv-site-header-tools {
		grid-row: 1;
	}

	.dv-site-header--stacked .dv-site-header-name {
		grid-row: 2;
	}

	.dv-site-header--stacked .dv-site-header-subtitle {
		grid-row: 3;
		align-self: start;
	}

	.dv-site-header--stacked .dv-site-header-navigation {
		grid-row: 4;
		margin-block: var(--space-2) 0;
	}

	/* A narrow screen has no corner beside the site name: the tools go above the banner, at the end (the token
	   --header-stacked is 1 there, so the header is stacked). They may wrap: an open row is a line of its own under the chips
	   (components/disclosure). */
	@media (width < 768px) {
		.dv-site-header-tools {
			position: relative;
			inset: auto;
			order: 0;
			align-self: end;
			flex-wrap: wrap;
			justify-content: flex-end;
			margin: var(--space-2) var(--space-2) 0;
		}
	}
}
