/*
 * Header (O1). Logo left, navigation centred on the page, haloed CTA right.
 * The overlay variant (front page) sits on top of the first section.
 *
 * Responsive defaults (neutral, pending Steven's mobile design):
 * - The Navigation block is set to overlay "Always", so core shows the
 *   hamburger at every width. From 1100 px we put the links back inline
 *   (core's own 600 px rules, re-applied at our breakpoint).
 * - Below 1100 px: one row, logo left, CTA then hamburger right.
 * - Below 520 px (interim, R-HDR-3): the bar CTA is hidden (logo, CTA and
 *   hamburger need about 425 px of content width). The menu has its
 *   own "Find a hackathon" button (class meckup-nav-cta), shown only in the
 *   open overlay.
 * Overlay colours are the block's overlay colour attributes (base / contrast).
 */

/* ---------------------------------------------------------------------------
 * 1100 px and up: links inline, navigation centred on the page.
 * ------------------------------------------------------------------------- */

@media (min-width: 1100px) {
	/* Centre the navigation on the page, not between the logo and the button.
	   The side columns never shrink below their content, so the CTA stays on one line. */
	.meckup-header .meckup-header__bar {
		display: grid;
		grid-template-columns: minmax(max-content, 1fr) auto minmax(max-content, 1fr);
		align-items: center;
	}

	.meckup-header .meckup-header__bar > :last-child {
		justify-self: end;
	}

	/* Core's 600 px "show inline" rules, which "Always" turns off. */
	.meckup-header .wp-block-navigation__responsive-container.hidden-by-default:not(.is-menu-open) {
		display: block;
		position: relative;
		z-index: auto;
		width: 100%;
		background-color: inherit;
	}

	.meckup-header .wp-block-navigation__responsive-container.hidden-by-default:not(.is-menu-open) .wp-block-navigation__responsive-container-close,
	.meckup-header .wp-block-navigation__responsive-container-open.always-shown {
		display: none;
	}
}

/* Narrow desktop: tighter link gap so the links stay on one line. */
@media (min-width: 1100px) and (max-width: 1279px) {
	/* The link list and its wrappers inherit this gap (core: gap: inherit). */
	.meckup-header .wp-block-navigation {
		gap: var(--wp--preset--spacing--50);
	}
}

.meckup-header .meckup-header__bar .wp-block-button__link {
	white-space: nowrap;
}

/* ---------------------------------------------------------------------------
 * Below 1100 px: one row, logo | CTA, hamburger.
 * ------------------------------------------------------------------------- */

@media (max-width: 1099px) {
	.meckup-header .meckup-header__bar > .wp-block-buttons {
		order: 1;
		margin-inline-start: auto;
	}

	.meckup-header .meckup-header__bar > .wp-block-navigation {
		order: 2;
	}
}

/* Phones: slimmer header, CTA moves into the menu (interim, R-HDR-3). */
@media (max-width: 599px) {
	/* The part's padding is var(--meckup-header-padding-block, 2.5rem). */
	.meckup-header {
		--meckup-header-padding-block: var(--wp--preset--spacing--40);
	}
}

@media (max-width: 519px) {
	.meckup-header .meckup-header__bar > .wp-block-buttons {
		display: none;
	}
}

/* The menu's own CTA only shows in the open overlay. */
.meckup-header .wp-block-navigation__responsive-container:not(.is-menu-open) .meckup-nav-cta {
	display: none;
}

/* ---------------------------------------------------------------------------
 * Hamburger and overlay (R-HDR-5). Not designed yet: neutral defaults.
 * ------------------------------------------------------------------------- */

/* 44 px touch targets; the icons stay aligned with the content edge. */
.meckup-header .wp-block-navigation__responsive-container-open,
.meckup-header .wp-block-navigation__responsive-container-close {
	padding: calc((44px - 24px) / 2);
}

.meckup-header .wp-block-navigation__responsive-container-open {
	margin-inline-end: calc((24px - 44px) / 2);
}

/* Same side padding and top offset as the header, so the close button sits
   where the hamburger was. */
.meckup-header .wp-block-navigation__responsive-container.is-menu-open {
	padding-block-start: var(--meckup-header-padding-block, 2.5rem);
	padding-inline: var(--wp--style--root--padding-left) var(--wp--style--root--padding-right);
}

/* Where the bar shows the CTA, the row is the haloed button (68 px), so the
   hamburger sits 12 px below the header padding. */
@media (min-width: 520px) {
	.meckup-header .wp-block-navigation__responsive-container.is-menu-open {
		padding-block-start: calc(var(--meckup-header-padding-block, 2.5rem) + var(--wp--preset--spacing--30));
	}
}

.meckup-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-close {
	right: calc((24px - 44px) / 2);
}

.meckup-header .wp-block-navigation__responsive-container.is-menu-open .meckup-nav-cta {
	margin-block-start: var(--wp--preset--spacing--40);
}

/* ---------------------------------------------------------------------------
 * Overlay variant (front page).
 * ------------------------------------------------------------------------- */

/* Template part with className "meckup-header-overlay" (templates/front-page.html). */
.meckup-header-overlay {
	position: absolute;
	inset-inline: 0;
	top: 0;
	z-index: 10;
}

.meckup-header-overlay .meckup-header {
	background: transparent;
}
