/*
 * Header logo on phones and tablets (below 1200px, where the menu becomes the slide-in drawer).
 * The logo comes from siteSettings in Contentful and can be any shape. Its width is set in the
 * markup, so a taller logo (the stacked one, about 3:2) came out 79px high in a 60px bar and
 * spilled below it. Sizing by height instead makes any logo, wide or stacked, sit inside the bar.
 * The max-width keeps a very wide logo clear of the menu and contact buttons either side.
 * Keyed to the width rather than the .rd-navbar-fixed class, which only arrives once the navbar
 * script has run - so there's no flash of the oversized logo while the page loads.
 */
@media (max-width: 1199.98px) {
	.rd-navbar .navbar-logo img {
		width: auto;
		height: 48px;
		max-width: 50vw;
		object-fit: contain;
	}

	/* The template pins the logo 16px from the top, which suited the old 28px-high logo. Centre the
	   48px one in the 60px bar instead. */
	/* "body" because the template's navbar CSS loads after this file with the same specificity. */
	body .rd-navbar-fixed .navbar-logo { top: 6px; }
}

/*
 * Desktop (1200px and up). The template fixes the header's height for the old short logo
 * (157px, or 193px on wide screens). The stacked logo makes the logo row 40px taller, so the
 * menu row overflowed that box and sat on top of the page heading. Let the header be as tall
 * as its content instead.
 * The logo also gets its real height up front (the same size it already shows at), so the
 * header's height is right even before the image has downloaded - the navbar script measures
 * it then. The max-width stops a very wide logo getting huge at this height.
 */
@media (min-width: 1200px) {
	body .rd-navbar-fullwidth.rd-navbar-extended { height: auto; }

	/* The navbar script also writes a height onto the <header> around it, to hold the space when
	   the menu sticks to the top on scroll. Its first measurement is taken before the page has
	   finished laying out, so it comes out short with this logo (it corrects itself after a
	   scroll). While the menu is in its normal place, let the header be its natural height; once
	   it sticks, the script's own (by then re-measured) height holds the space as before. */
	html:not(.rd-navbar-stuck) header:has(> .rd-navbar-fullwidth) { height: auto !important; }

	.rd-navbar .navbar-logo img {
		width: auto;
		height: 79px;
		max-width: 320px;
		object-fit: contain;
	}
}
