/*
 * Site header and footer (parts/header.html, parts/footer.html).
 *
 * Loaded with the Template Part block (functions.php), on every page and in the
 * editor. Colours and spacing that blocks can hold are in the parts' markup;
 * this file has the rest. 782px is WordPress's tablet breakpoint, the same one
 * block visibility uses to switch the two menus.
 */

/* Header: a 149px white bar with a 1px shadow, 30px side padding on desktop. */
.sutherland-header {
	position: relative;
	z-index: 10;
	min-height: 149px;
	padding-block: 15px;
	padding-inline: 30px;
	box-shadow: 0 1px 0 rgb(0 0 0 / 10%);
}

/*
 * The header and the footer run from one edge of the window to the other: no
 * rounded corners. theme.json rounds every Group that has a background; these
 * selectors are one class stronger than its rule.
 */
.wp-block-group.sutherland-header,
.wp-block-group.sutherland-footer {
	border-radius: 0;
}

/*
 * The logo narrows a little on small desktops. Below about 1080px the menu
 * no longer fits beside it and wraps to a second row.
 */
.sutherland-header .wp-block-site-logo img {
	width: clamp(200px, 22.4vw, 322px);
}

/*
 * The menu and search fill the row at full height, so the dropdowns start
 * at the header's bottom edge. The row isn't positioned: the search's panel
 * hangs from the header itself (search.css).
 */
.sutherland-header > .wp-block-group {
	align-self: stretch;
	margin-block: -15px;
}

/* The desktop menu (the mobile one is only a button until it opens). */
.sutherland-header > .wp-block-group > nav:not(:has(> button)),
.sutherland-header > .wp-block-group > nav > ul {
	align-self: stretch;
	align-items: stretch;
}

/* Divi's menu sits a little below the header's middle. */
.sutherland-header > .wp-block-group > nav > ul > li {
	padding-top: 15px;
}

.sutherland-header .wp-block-search__button-only {
	padding-top: 15px;
}

/* The DONATE tab hangs from the top right corner. */
.sutherland-header > .wp-block-buttons {
	position: absolute;
	top: 0;
	right: 30px;
	margin: 0;
}

.sutherland-header .wp-block-buttons .wp-block-button__link {
	padding: 9px 12px 5px;
	border: 0;
	border-radius: 0 0 var(--wp--preset--border-radius--small) var(--wp--preset--border-radius--small);
	font-size: 17px;
	font-weight: 600;
	line-height: 1.6;
	text-transform: uppercase;
}

@media (width <= 782px) {

	/* Tablet and mobile: an 80px bar with the page's side padding. */
	.sutherland-header {
		min-height: 80px;
		padding-inline: var(--wp--style--root--padding-left) var(--wp--style--root--padding-right);
	}

	/*
	 * DONATE is a button in the bar, before the menu button: the search is in
	 * the mobile menu there.
	 */
	.sutherland-header > .wp-block-buttons {
		position: static;
		order: 1;
		margin-inline-start: auto;
	}

	.sutherland-header > .wp-block-group {
		order: 2;
		flex-grow: 0;
	}

	.sutherland-header .wp-block-buttons .wp-block-button__link {
		padding: 7px 12px 5px;
		border-radius: var(--wp--preset--border-radius--small);
		font-size: 16px;
	}
}

/* Footer: "© {year} Sutherland Institute | Privacy" on black. */
.sutherland-footer a:where(:not(.wp-element-button)) {
	font-weight: 700;
	text-decoration: none;
}

.sutherland-footer a:where(:not(.wp-element-button)):hover {
	text-decoration: underline;
}

.sutherland-footer {
	--wp--custom--color--focus: var(--wp--preset--color--white);
}

/*
 * A page that ends with a full-width section: the footer meets it. Elsewhere
 * WordPress's gap between the page and the footer stays (white on white). The
 * section is the last block of the page's content, or of the template itself
 * (the Connect band under an article).
 */
.wp-site-blocks > main:has(> .alignfull:last-child:not(.wp-block-post-content), > .wp-block-post-content > .alignfull:last-child) + footer {
	margin-block-start: 0;
}

/*
 * Two full-width sections that follow each other meet too, where both have a
 * colour or a picture: WordPress's gap between them was a white strip. Next
 * to a white section the gap stays.
 */
:is(.wp-block-cover, .has-background).alignfull + :is(.wp-block-cover, .has-background).alignfull {
	margin-block-start: 0;
}

@media (width <= 782px) {

	.sutherland-footer .is-layout-flex {
		justify-content: center;
	}
}
