/* ==========================================================================
   MGC — desktop main menu (2026-09-01)
   Loaded after mgc-home.css. Uses only tokens already declared at :root by
   mgc.css. No new tokens are introduced.

   Everything below the first block is scoped to the desktop rail
   (min-width: 1025px). Below that width the links live in the dark overlay
   sheet, which mgc-home.css already styles; none of these rules reach it.
   ========================================================================== */

/* ---- One measure for both masthead tiers ------------------------------ */
/* .mgc-brand is authored inside a wp:html block, so WordPress's own
   `box-sizing: border-box` reset — which it emits per block type, not
   universally — never reached it. The anchor therefore read its
   `max-width: 1320px` as a CONTENT width and grew to 1376px, while
   .mgc-header__controls (a real group block, border-box) stayed at 1320px.
   The two tiers of the masthead were consequently out of register on every
   viewport above 1280px: the logo sat 28px left of the first menu item and
   the wordmark ran 28px past the "Стани член" button. Measured before the
   fix — logo left / menu left: 1440px → 60 / 88, 1400px → 40 / 68,
   1360px → 28 / 48, 1280px → 28 / 28. */
.mgc-brand { box-sizing: border-box; }

/* ---- Desktop rail ----------------------------------------------------- */
@media (min-width: 1025px) {
	/* The element selector is load-bearing: WordPress stamps the block's
	   `mgc-nav` class onto BOTH the <nav> and the inner
	   <ul class="wp-block-navigation__container">, so a plain `.mgc-nav`
	   here applies the pull-back twice and lands the menu a full pad left of
	   the logo instead of on it. */
	.mgc-header nav.mgc-nav {
		/* The link padding doubles as the hit area and as the body of the
		   hover and current-page states, so it is spent rather than the gap:
		   2 × padding + gap reproduces the 26px text rhythm the rail was
		   authored with, while the target itself stays contiguous. The clamp
		   tightens that rhythm to ~19px as the rail narrows, which is what
		   keeps the English menu on one line at 1025px (it wrapped before). */
		--nav-pad: clamp(8px, 0.85vw, 13px);

		/* Pull the strip back by one pad so the first LABEL, not the first
		   padding box, lands on the container edge — the menu then starts on
		   the same vertical as the logo above it. Same correction the
		   hamburger already makes for its own side bearing. */
		margin-left: calc(-1 * var(--nav-pad));
	}
	.mgc-header .mgc-nav .wp-block-navigation__container {
		gap: 2px;
		/* A wrapped main menu silently doubles the rail's height and leaves a
		   ragged second line under the first. The breakpoints below are set so
		   that every one of the four languages fits on one line wherever the
		   inline menu is shown, and nowrap makes any future overflow visible
		   instead of quietly restyling the masthead. */
		flex-wrap: nowrap;
	}
	.mgc-header .mgc-nav .wp-block-navigation-item__content {
		position: relative;
		display: flex;
		align-items: center;
		/* Fills the rail, so the target is 58px tall instead of the 22px text
		   box it was — the old target failed WCAG 2.2 "Target Size (Minimum)"
		   on height at every width. */
		min-height: var(--mast-rail);
		padding-inline: var(--nav-pad);
		white-space: nowrap;
		color: var(--text-body);
		/* Matches the letter-spacing of .mgc-btn, the rail's other Montserrat
		   element, so the menu and the "Стани член" button are set alike. */
		letter-spacing: 0.01em;
		transition: color var(--duration-fast) var(--ease-standard);
	}

	/* Menu size. Set on the link and not on the <nav>, because WordPress
	   stamps `wp-block-navigation` onto the inner <ul> as well as the <nav>:
	   mgc.css's `.mgc-header .wp-block-navigation { font-size: --text-sm }`
	   therefore re-applies 14px halfway down the tree and any size declared on
	   the <nav> never reaches the labels. At 14px the Montserrat labels read a
	   step below the "Стани член" button beside them; 15px seats the menu on
	   the same optical line without reaching the 16px body size. The rail is
	   nowrap, so this is the widest the labels may get before the 1025px
	   breakpoint has to move — measured at 1025px, Macedonian, English and
	   Croatian each still hold one line beside the switcher and the button,
	   and German holds one at its own 1240px.

	   The `:not(.is-menu-open)` guard is load-bearing: between 1025px and
	   1239px German still uses the dark overlay sheet (see the breakpoint
	   block at the foot of this file), and those links sit inside this same
	   media range, so an unguarded size here would shrink the sheet's
	   1.6–2.75rem labels to 15px. */
	.mgc-header .mgc-nav .wp-block-navigation__responsive-container:not(.is-menu-open) .wp-block-navigation-item__content {
		font-size: 0.9375rem;
	}

	/* The indicator is the masthead's own brand rule. .mgc-tricolor already
	   runs a 3px red line under the full width of the rail; this bar is twice
	   that height and hangs one rule-width below the rail's edge, so the line
	   the visitor already sees simply swells to double under the item they are
	   on or pointing at. Nothing new is introduced to the masthead. */
	.mgc-header .mgc-nav .wp-block-navigation-item__content::after {
		content: "";
		position: absolute;
		inset-inline: 0;
		bottom: calc(-1 * var(--rule-brand));
		height: calc(var(--rule-brand) * 2);
		background: var(--red-500);
		transform: scaleX(0);
		transition: transform var(--duration-base) var(--ease-standard);
	}

	.mgc-header .mgc-nav .wp-block-navigation-item__content:hover {
		color: var(--color-primary);
	}
	.mgc-header .mgc-nav .wp-block-navigation-item__content:hover::after,
	.mgc-header .mgc-nav .wp-block-navigation-item__content:focus-visible::after {
		transform: scaleX(1);
	}
	/* mgc.css gives the language switcher a focus ring but left the menu with
	   the browser default; this matches the switcher. Inset, so the ring is
	   drawn inside the rail rather than across the tier boundary. */
	.mgc-header .mgc-nav .wp-block-navigation-item__content:focus-visible {
		outline: 2px solid var(--focus-ring);
		outline-offset: -3px;
		color: var(--color-primary);
	}

	/* Current page. The label darkens rather than thickening: a weight change
	   would re-measure the item and shove every link after it sideways as the
	   visitor moves through the site. The swelled rule carries the signal and
	   the wash seats the item on it. */
	.mgc-header .mgc-nav .current-menu-item > .wp-block-navigation-item__content,
	.mgc-header .mgc-nav .current-menu-ancestor > .wp-block-navigation-item__content {
		color: var(--text-heading);
		background-image: linear-gradient(to top, var(--red-50), transparent 80%);
	}
	.mgc-header .mgc-nav .current-menu-item > .wp-block-navigation-item__content::after,
	.mgc-header .mgc-nav .current-menu-ancestor > .wp-block-navigation-item__content::after {
		transform: scaleX(1);
	}
}

/* The reduced-motion guard in mgc.css is written against `*`, and the universal
   selector does not match pseudo-elements — the indicator kept sliding open
   with the preference set (measured: transition-duration still 0.2s, transform
   caught mid-scale). It is stated again here for the element that needs it. */
@media (min-width: 1025px) and (prefers-reduced-motion: reduce) {
	.mgc-header .mgc-nav .wp-block-navigation-item__content::after {
		transition: none;
	}
}

/* ---- Where the inline menu is affordable ------------------------------ */
/* The German labels run ~30% longer than the Macedonian ones
   ("Veranstaltungen", "Mitgliedschaft"), which is 190px more menu than the
   1025px rail can seat beside the language switcher and the join button. It
   wrapped to two lines at 1025px and 1150px. Rather than shrink the type for
   all four languages to suit one, German keeps the overlay sheet — already
   designed, and reachable by the same hamburger — until the rail is wide
   enough to hold the links honestly. Measured: German clears the switcher with
   room to read as a separate group from 1240px up. */
@media (min-width: 1025px) and (max-width: 1239px) {
	html:lang(de) .mgc-header .wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) {
		display: none;
	}
	html:lang(de) .mgc-header .wp-block-navigation__responsive-container-open:not(.always-shown) {
		display: flex;
	}
	html:lang(de) .mgc-header nav.mgc-nav {
		order: 0;
		margin-right: 0;
		margin-left: 0;
	}
}
