/* ===========================================================================
   HEADER — site header / primary navigation

   Astra 4.x uses the Header Builder ("ast-hfb-header"), which nests several
   wrappers. The element that actually paints the header background is the ROW
   (.ast-primary-header-bar), NOT .site-header or .ast-main-header-wrap — those
   are transparent containers. Astra's Customizer CSS sets that row to white, so
   every background rule below has to target the rows themselves or the header
   renders as a white band with white-on-white text.

   These rules restyle Astra's own markup rather than replacing it, so the
   Customizer, the logo uploader and the mobile menu all keep working.
   =========================================================================== */

/* The rows that actually paint. Keep all four in sync. */
.vub-theme .ast-primary-header-bar,
.vub-theme .ast-above-header-bar,
.vub-theme .ast-below-header-bar,
.vub-theme .ast-main-header-wrap,
.vub-theme #ast-mobile-header .ast-primary-header-bar {
	background-color: var(--vub-black);
	border-bottom-color: var(--vub-border);
}

.vub-theme .ast-primary-header-bar {
	border-bottom: var(--vub-rule);
}

/* Astra paints the mobile off-canvas panel white too. */
.vub-theme .ast-mobile-popup-drawer .ast-mobile-popup-inner,
.vub-theme .ast-mobile-header-wrap .ast-primary-header-bar {
	background-color: var(--vub-black);
}

/* Transparent header over the hero, solidifying on scroll (main.js toggles the
   body class). Front page only. */
.vub-front .site-header {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: var(--vub-z-header);
}

.vub-front .ast-primary-header-bar,
.vub-front .ast-main-header-wrap {
	transition: background-color var(--vub-duration) var(--vub-ease),
	            border-color var(--vub-duration) var(--vub-ease);
}

.vub-front.vub-header-transparent .ast-primary-header-bar,
.vub-front.vub-header-transparent .ast-main-header-wrap {
	background-color: transparent;
	border-bottom-color: transparent;
}

.vub-front.vub-header-scrolled .ast-primary-header-bar,
.vub-front.vub-header-scrolled .ast-main-header-wrap {
	background-color: rgba(8, 9, 10, 0.92);
	-webkit-backdrop-filter: blur(10px);
	backdrop-filter: blur(10px);
}

.vub-front.vub-header-scrolled .ast-primary-header-bar {
	border-bottom-color: var(--vub-border);
}

/* Tighten Astra's default header height a little. */
.vub-theme .ast-primary-header-bar .site-primary-header-wrap {
	min-height: var(--vub-header-height);
}

/* --- Full-bleed rows ------------------------------------------------------
   Astra puts .ast-container on each header row wrap, which caps the row at the
   Customizer's content width and centres it. Drop the cap so the header spans
   the full viewport, and replace Astra's 20px container padding with a flat
   30px gutter on both sides. The mobile header bar carries the row classes
   itself instead of nesting an .ast-container, so the mobile rows are listed
   separately — and they mirror Astra's own #masthead selector, which is the
   only way to outrank the 20px padding it sets there. */
.vub-theme .site-header .ast-container,
.vub-theme #masthead .ast-mobile-header-wrap .ast-primary-header-bar,
.vub-theme #masthead .ast-mobile-header-wrap .ast-above-header-bar,
.vub-theme #masthead .ast-mobile-header-wrap .ast-below-header-bar {
	max-width: none;
	padding-left: 30px;
	padding-right: 30px;
}

/* --- Branding ----------------------------------------------------------- */
.vub-theme .site-title,
.vub-theme .site-title a {
	font-family: var(--vub-font-display);
	font-weight: var(--vub-weight-black);
	letter-spacing: var(--vub-tracking-tight);
	text-transform: uppercase;
	color: var(--vub-white);
	text-decoration: none;
}

.vub-theme .site-description { color: var(--vub-text-faint); }

.vub-theme .custom-logo-link img {
	max-height: 48px;
	width: auto;
}

/* The crest (vub_header_logo() in inc/setup.php): 115px on a desktop and
   82px on a phone (the user's size), with 8px and 6px of air above and below,
   so the bar is 132px and 95px tall. Everything measured from the header —
   the About page's arrival, the opening that leads to it — reads its height
   on the page, so nothing else needs to know. Astra's padding round the site
   title would make the bar taller, so it goes where the crest is. */
.vub-theme .site-branding:has(.vub-logo) { padding-block: 0; }

/* The bar's height, for what has to clear it (the homepage hero). */
:root { --vub-header-bar: 132px; }

@media (max-width: 921px) {
	:root { --vub-header-bar: 95px; }
}

.vub-theme .vub-logo {
	display: block;
	line-height: 0;
}

.vub-theme .vub-logo img {
	display: block;
	width: auto;
	height: 115px;
	max-width: none;
}

@media (max-width: 921px) {
	.vub-theme .vub-logo img { height: 82px; }

	.vub-theme #ast-mobile-header .ast-primary-header-bar .ast-builder-grid-row {
		min-height: 94px;
		align-items: center;
	}
}

/* Keyboard focus on the crest: a ring round its circle, not its square. */
.vub-theme .vub-logo:focus-visible {
	outline: none;
}

.vub-theme .vub-logo:focus-visible img {
	border-radius: 50%;
	outline: 2px solid var(--vub-red);
	outline-offset: 2px;
}

/* --- Primary navigation -------------------------------------------------- */
/* base.css spaces every list and list item on the page; in the header bar that
   pushed the menu 16px above the middle, off the line of the crest — and it
   was those margins that made the desktop bar 112px tall. Without them the
   bar takes its height from here: the crest and 8px of air above and below
   it. */
.vub-theme #ast-desktop-header .main-header-menu,
.vub-theme #ast-desktop-header .main-header-menu > .menu-item { margin: 0; }

.vub-theme #ast-desktop-header .ast-primary-header-bar .site-primary-header-wrap { min-height: 131px; }

.vub-theme .main-header-menu > .menu-item > .menu-link {
	font-size: var(--vub-text-sm);
	font-weight: var(--vub-weight-semibold);
	letter-spacing: var(--vub-tracking-wide);
	text-transform: uppercase;
	color: var(--vub-text);
	transition: var(--vub-transition-color);
}

/* Eight items, the sections' labels long (vub_nav_links() in inc/setup.php),
   have to fit beside the crest down to the phone header at 921px. As the
   screen narrows the gaps between them close in; under 1200px the type steps
   down a size and the gaps open again and close; under 1100px a label of two
   words or more stacks its first word over the rest (.vub-nav-line), centred.
   The menu never wraps into a second row or runs past the bar. Should a
   label still not fit, it breaks between words, never inside one. */
@media (min-width: 922px) {
	.vub-theme #ast-desktop-header .main-header-menu { flex-wrap: nowrap; }

	.vub-theme #ast-desktop-header .main-header-menu > .menu-item > .menu-link {
		display: flex;
		align-items: center;
		min-height: 80px;
		padding-inline: clamp(6px, calc((100vw - 1130px) / 16), 14px);
		line-height: 1.25;
		text-align: center;
		text-wrap: balance;
		overflow-wrap: normal;
		word-break: normal;
	}
}

@media (min-width: 922px) and (max-width: 1199px) {
	.vub-theme #ast-desktop-header .main-header-menu > .menu-item > .menu-link {
		padding-inline: clamp(6px, calc((100vw - 980px) / 16), 14px);
		font-size: var(--vub-text-xs);
		letter-spacing: 0.04em;
	}
}

@media (min-width: 922px) and (max-width: 1099px) {
	/* Down to 6px a side: German's single-word labels (Trainingsplan,
	   Mitgliedschaft) cannot stack like two-word ones, and with the language
	   switcher after them they need the room. */
	.vub-theme #ast-desktop-header .main-header-menu > .menu-item > .menu-link {
		padding-inline: clamp(6px, calc((100vw - 830px) / 16), 14px);
	}

	.vub-theme #ast-desktop-header .vub-nav-line {
		display: block;
		white-space: nowrap;
	}
}

/* Red under the pointer, while pressed, under keyboard focus, and on the
   page you are on. */
.vub-theme .main-header-menu > .menu-item > .menu-link:hover,
.vub-theme .main-header-menu > .menu-item > .menu-link:active,
.vub-theme .main-header-menu > .menu-item > .menu-link:focus-visible,
.vub-theme .main-header-menu > .menu-item.current-menu-item > .menu-link {
	color: var(--vub-red);
}

/* And a red rule under the active item. */
.vub-theme .main-header-menu > .menu-item {
	position: relative;
}

.vub-theme .main-header-menu > .menu-item.current-menu-item::after {
	content: "";
	position: absolute;
	left: var(--vub-space-sm);
	right: var(--vub-space-sm);
	bottom: 0;
	height: 2px;
	background-color: var(--vub-red);
}

/* --- Dropdowns ----------------------------------------------------------- */
.vub-theme .main-header-menu .sub-menu {
	background-color: var(--vub-surface-2);
	border: var(--vub-rule);
	border-radius: var(--vub-radius-md);
	box-shadow: var(--vub-shadow-md);
	padding-block: var(--vub-space-3xs);
}

.vub-theme .main-header-menu .sub-menu .menu-link {
	color: var(--vub-text-muted);
	font-size: var(--vub-text-sm);
}

.vub-theme .main-header-menu .sub-menu .menu-link:hover {
	color: var(--vub-white);
	background-color: var(--vub-surface-3);
}

/* --- Header call-to-action ----------------------------------------------- */
.vub-theme .main-header-menu .menu-item.vub-nav-cta > .menu-link {
	background-color: var(--vub-red);
	color: var(--vub-white);
	border-radius: var(--vub-radius-button);
	padding-inline: var(--vub-space-md);
	margin-inline-start: var(--vub-space-sm);
}

.vub-theme .main-header-menu .menu-item.vub-nav-cta > .menu-link:hover {
	background-color: var(--vub-red-hover);
}

/* --- Mobile toggle -------------------------------------------------------- */
.vub-theme .ast-mobile-menu-trigger-minimal,
.vub-theme .menu-toggle {
	background-color: transparent;
	color: var(--vub-white);
	border: var(--vub-rule);
	border-radius: var(--vub-radius-button);
}

.vub-theme .ast-mobile-popup-drawer .ast-mobile-popup-inner {
	background-color: var(--vub-black);
}

.vub-theme .ast-mobile-popup-drawer .menu-link {
	color: var(--vub-text);
	border-bottom: var(--vub-rule);
	text-transform: uppercase;
	letter-spacing: var(--vub-tracking-wide);
	font-size: var(--vub-text-sm);
	font-weight: var(--vub-weight-semibold);
}

/* --- Language switcher ----------------------------------------------------
   vub_language_switcher() in inc/languages.php: the current language's code
   with a chevron, opening a small list of the page in each language — code
   and the language's own name, the current one marked. It closes the desktop
   bar, after the menu and a thin rule, and sits beside the menu button on a
   phone. The list hangs from the button's right edge, so it never runs past
   the screen. Closed on a click outside or Escape (main.js). */
.vub-theme .vub-lang {
	display: flex;
	align-items: center;
	flex: none;
}

.vub-theme .vub-lang__switch { position: relative; }

.vub-theme .vub-lang__toggle {
	display: flex;
	align-items: center;
	gap: 7px;
	padding: 8px 6px;
	font-size: var(--vub-text-xs);
	font-weight: var(--vub-weight-semibold);
	letter-spacing: var(--vub-tracking-wide);
	line-height: 1;
	color: var(--vub-white);
	list-style: none;
	cursor: pointer;
	user-select: none;
	transition: var(--vub-transition-color);
}

.vub-theme .vub-lang__toggle::-webkit-details-marker { display: none; }

.vub-theme .vub-lang__toggle:hover,
.vub-theme .vub-lang__toggle:focus-visible,
.vub-theme .vub-lang__switch[open] > .vub-lang__toggle {
	color: var(--vub-red);
}

/* The code, with the menu's red rule under it. */
.vub-theme .vub-lang__current {
	position: relative;
	padding-block: 2px;
}

.vub-theme .vub-lang__current::after {
	content: "";
	position: absolute;
	left: 0;
	right: var(--vub-tracking-wide);
	bottom: -4px;
	height: 2px;
	background-color: var(--vub-red);
}

/* The chevron: two sides of a square, turned. */
.vub-theme .vub-lang__toggle::after {
	content: "";
	width: 5px;
	height: 5px;
	margin-top: -3px;
	border-right: 1.5px solid currentColor;
	border-bottom: 1.5px solid currentColor;
	transform: rotate(45deg);
	transition: transform var(--vub-duration-fast) var(--vub-ease);
}

.vub-theme .vub-lang__switch[open] > .vub-lang__toggle::after {
	margin-top: 3px;
	transform: rotate(225deg);
}

.vub-theme .vub-lang__menu {
	position: absolute;
	top: calc(100% + 10px);
	right: 0;
	z-index: 1;
	min-width: 10rem;
	margin: 0;
	padding: var(--vub-space-3xs) 0;
	list-style: none;
	background-color: var(--vub-surface-2);
	border: var(--vub-rule);
	border-radius: var(--vub-radius-md);
	box-shadow: var(--vub-shadow-md);
}

.vub-theme .vub-lang__item { margin: 0; }

.vub-theme .vub-lang__link {
	display: flex;
	align-items: baseline;
	gap: var(--vub-space-xs);
	padding: 10px var(--vub-space-sm);
	color: var(--vub-text-muted);
	font-size: var(--vub-text-sm);
	line-height: 1.2;
	text-decoration: none;
	transition: var(--vub-transition-color);
}

.vub-theme .vub-lang__code {
	min-width: 2em;
	font-size: var(--vub-text-xs);
	font-weight: var(--vub-weight-semibold);
	letter-spacing: var(--vub-tracking-wide);
}

.vub-theme .vub-lang__link:hover,
.vub-theme .vub-lang__link:focus-visible {
	color: var(--vub-white);
	background-color: var(--vub-surface-3);
}

/* The language you are reading: white, its code red. */
.vub-theme .vub-lang__link[aria-current] { color: var(--vub-white); }

.vub-theme .vub-lang__link[aria-current] .vub-lang__code { color: var(--vub-red); }

.vub-theme .vub-lang--desktop {
	margin-inline-start: clamp(4px, calc((100vw - 1130px) / 16), 14px);
	padding-inline-start: clamp(4px, calc((100vw - 1130px) / 16), 14px);
	border-inline-start: 1px solid var(--vub-border-strong);
}

.vub-theme .vub-lang--mobile {
	margin-inline-end: var(--vub-space-2xs);
}
