/**
 * Collapsible submenus of the "Mobilmenü" navigation style (toggled by assets/js/mobile-menu.js,
 * animated by assets/js/aufklappen.js).
 *
 * The selectors are this specific to win over core's "always open" submenu rules.
 */
.wp-block-navigation.is-style-mobilmenue .has-child > .wp-block-navigation__submenu-container[hidden] {
	display: none;
}

/* Block instead of core's flex, so the toggle and its submenu stack. */
.wp-block-navigation.is-style-mobilmenue .wp-block-navigation__container > .has-child {
	display: block;
}

/*
 * Mobile top-level links (Aktuelles, Jobs, Kontakt) fill their whole row, so the row is the tap target;
 * padding and arrow live on the link (styles/blocks/navigation-mobilmenue.json). Core sets these
 * links to display: block. They stay right-aligned next to their arrow, unlike the left-aligned
 * Angebote/Hilfsverein toggles: a design choice (left-aligning them was tried and reverted 2026-11-19).
 */
.wp-block-navigation.is-style-mobilmenue .wp-block-navigation__container > .wp-block-navigation-link > .wp-block-navigation-item__content {
	display: flex;
}

.wp-block-navigation.is-style-mobilmenue .wp-block-navigation__container > .wp-block-navigation-link > .wp-block-navigation-item__content::after {
	display: block;
}

/*
 * Mobile submenu rows touch each other, so the whole row is tappable (core spaces them 3px apart;
 * the variation adds that space to the link padding instead).
 */
.wp-block-navigation.is-style-mobilmenue .wp-block-navigation-submenu .wp-block-navigation-item:not(:last-child) {
	margin-bottom: 0;
}

/*
 * Submenu entries (desktop dropdowns and mobile menu) follow the sidebar's Dienste-Liste, smaller:
 * Montserrat semibold in normal case, black, white row on hover and keyboard focus.
 */
.wp-block-navigation .wp-block-navigation__submenu-container .wp-block-navigation-item > .wp-block-navigation-item__content {
	color: var(--wp--preset--color--contrast);
	font-size: var(--wp--preset--font-size--small-plus);
	font-weight: 600;
	letter-spacing: 0;
	text-decoration: none;
	text-transform: none;
}

.wp-block-navigation.is-style-mobilmenue .wp-block-navigation__submenu-container .wp-block-navigation-item > .wp-block-navigation-item__content {
	font-size: var(--wp--preset--font-size--medium);
}

.wp-block-navigation .wp-block-navigation__submenu-container .wp-block-navigation-item > a.wp-block-navigation-item__content:is(:hover, :focus-visible) {
	background-color: var(--wp--preset--color--base);
}

@media (prefers-reduced-motion: no-preference) {
	.wp-block-navigation .wp-block-navigation__submenu-container .wp-block-navigation-item > a.wp-block-navigation-item__content {
		transition: background-color 0.1s;
	}
}

/*
 * Current page: plain text (functions.php turns its link into a span with aria-current="page"),
 * the whole row filled with the group colour, like the sidebar's Dienste-Liste. Entries without a
 * group get white.
 */
.wp-block-navigation .wp-block-navigation__submenu-container .current-menu-item > .wp-block-navigation-item__content {
	background-color: var(--gruppenfarbe, var(--wp--preset--color--base));
	color: var(--gruppentext, var(--wp--preset--color--contrast));
}

/* Overview link (menu item class "is-uebersicht") gets a back arrow, centred on the first line of the label. */
.wp-block-navigation .is-uebersicht > .wp-block-navigation-item__content::before {
	content: "";
	flex: none;
	align-self: flex-start;
	width: 1em;
	height: 1em;
	margin-block-start: calc((1lh - 1em) / 2 + 0.075em);
	margin-inline-end: 0.375em;
	background-color: currentColor;
	-webkit-mask: var(--icon-zurueck) center/contain no-repeat;
	mask: var(--icon-zurueck) center/contain no-repeat;
}

/*
 * Desktop dropdowns: lifted off the grey page by a soft shadow (cut off at the top edge); compact rows;
 * entries line up with the overview text after its arrow (1.375em). The right padding matches the indent.
 * The child combinator keeps the mobile overlay (nested inside the header navigation) out.
 */
.wp-block-navigation:not(.is-style-mobilmenue) > .wp-block-navigation__container .has-child > .wp-block-navigation__submenu-container {
	box-shadow: 0 1px 3px rgb(0 0 0 / 0.08), 0 3px 9px rgb(0 0 0 / 0.08);
	clip-path: inset(0 -1rem -1rem);
}

.wp-block-navigation:not(.is-style-mobilmenue) > .wp-block-navigation__container .has-child .wp-block-navigation__submenu-container .wp-block-navigation-item__content {
	padding: 0.625rem calc(1rem + 1.375em) 0.625rem 1rem;
}

.wp-block-navigation:not(.is-style-mobilmenue) > .wp-block-navigation__container .wp-block-navigation__submenu-container > .wp-block-navigation-item:not(.is-uebersicht) > .wp-block-navigation-item__content {
	padding-left: calc(1rem + 1.375em);
}

/*
 * Desktop top level: every entry gets the same padding, so the menu doesn't shift between pages.
 * Core pads plain links 0.5em 1em (the header navigation has a background colour), but not the
 * submenu toggles or the current page's span, which made the current entry 28px narrower and the
 * gaps uneven. Now only the navigation's blockGap spaces the entries; the vertical padding keeps
 * the taller tap target for all of them. Only the header's desktop menu (class "kopf-menue" in the
 * header pattern): the footer menus and the mobile menu's legal links have their own spacing.
 */
.wp-block-navigation.kopf-menue > .wp-block-navigation__container > .wp-block-navigation-item > .wp-block-navigation-item__content {
	padding-block: 0.5em;
	padding-left: 0;
}

/* Submenu toggles keep their right padding, which holds the chevron (see below). */
.wp-block-navigation.kopf-menue > .wp-block-navigation__container > .wp-block-navigation-item > .wp-block-navigation-item__content:not(.wp-block-navigation-submenu__toggle) {
	padding-right: 0;
}

/*
 * Submenu chevrons: core's own icon, in a 1em box (core: 0.6em) for a bigger click target next to the
 * label; the icon itself is drawn at 0.7em in the middle, so its 1.5 line stays light.
 */
.wp-block-navigation .wp-block-navigation-item .wp-block-navigation__submenu-icon {
	width: 1em;
	height: 1em;
}

.wp-block-navigation .wp-block-navigation-item .wp-block-navigation__submenu-icon svg {
	width: 0.7em;
	height: 0.7em;
	margin: 0.15em;
}

.wp-block-navigation .wp-block-navigation-item.open-on-click .wp-block-navigation-submenu__toggle {
	padding-right: 1.1em;
}

.wp-block-navigation .wp-block-navigation-item.open-on-click .wp-block-navigation-submenu__toggle + .wp-block-navigation__submenu-icon {
	margin-left: -1em;
}

/*
 * Menu entries that open in a new tab (e.g. Eduard Willis Stiftung) get ↗ after the label, announced to
 * screen readers like the "Link mit Pfeil" style. On the label, so the icon wraps with the last word.
 */
.wp-block-navigation .wp-block-navigation-item__content[target="_blank"] .wp-block-navigation-item__label::after {
	content: "" / " (öffnet in neuem Tab)";
	display: inline-block;
	width: 0.875em;
	height: 0.875em;
	margin-inline-start: 0.25em;
	vertical-align: -0.075em;
	background-color: currentColor;
	-webkit-mask: var(--icon-extern) center/contain no-repeat;
	mask: var(--icon-extern) center/contain no-repeat;
}

/*
 * Mobile menu overlay (pattern mobile-menu). Core resets every link inside a navigation block
 * (the overlay is nested in the header navigation), so the contact links get their underline back.
 */
.wp-block-navigation .mobilmenue-kontakt a {
	font-weight: 500;
	text-decoration: underline;
}

/*
 * Search in the overlay's top row (core Search block, button only; core's script opens and closes it).
 * Core would grow the field sideways, which doesn't fit beside the logo, so the row wraps instead:
 * the form and its wrapper drop out of the layout (display: contents), the button joins the row
 * next to the close button, and the opened field takes a full row of its own below the logo and
 * pushes the contact details down. The menu stays visible; the results are the search page.
 */
.wp-block-navigation .mobilmenue-kopf {
	flex-wrap: wrap;
	justify-content: flex-start;
	column-gap: var(--wp--preset--spacing--20);
	row-gap: var(--wp--preset--spacing--30);
}

/* The logo takes the free space, so the search button and the X sit together at the right with a small gap. */
.wp-block-navigation .mobilmenue-kopf > .wp-block-image {
	margin-inline-end: auto;
}

.wp-block-navigation .mobilmenue-werkzeuge {
	display: contents;
}

.wp-block-navigation .mobilmenue-werkzeuge .wp-block-search,
.wp-block-navigation .mobilmenue-werkzeuge .wp-block-search__inside-wrapper {
	display: contents;
}

.wp-block-navigation .mobilmenue-werkzeuge .wp-block-search__button {
	width: 44px;
	height: 44px;
	margin: 0;
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: none;
	color: var(--wp--preset--color--accent-1);
}

/* Core draws the magnifier small inside its box; 36px gives it the visual size of the X (the global rule's negative margin is dropped). */
.wp-block-navigation .mobilmenue-werkzeuge .wp-block-search__button svg {
	width: 36px;
	height: 36px;
	margin: 0;
}

.wp-block-navigation .mobilmenue-werkzeuge .wp-block-search__input {
	order: 1;
	flex: 1 0 100%;
	box-sizing: border-box;
	min-width: 0;
	width: 100%;
	padding: 0.6em 0.9em;
	border: 1.5px solid var(--wp--preset--color--accent-1);
	border-radius: 0;
	background: var(--wp--preset--color--base);
	color: var(--wp--preset--color--contrast);
	font: inherit;
}

.wp-block-navigation .mobilmenue-werkzeuge .wp-block-search__searchfield-hidden .wp-block-search__input {
	display: none;
}

/* Legal links: rows of at least 40px that touch, so each row is the tap target. */
.wp-block-navigation .mobilmenue-rechtliches .wp-block-navigation-item__content {
	display: block;
	min-height: 40px;
	box-sizing: border-box;
	padding-block: calc((40px - 1lh) / 2);
	line-height: 1.6;
}

/*
 * Drawing beside the legal links (same grid cell, flush with the screen edge). The group grows to fill what
 * is left of the screen, so the links stay at the top and the drawing sinks to the bottom. Its size
 * depends only on the screen width. The links sit on top with a grey halo, so they stay readable
 * where they overlap the drawing on narrow phones.
 */
.wp-block-navigation .mobilmenue-fuss {
	display: grid;
	flex-grow: 1;
}

.wp-block-navigation .mobilmenue-fuss > * {
	grid-area: 1 / 1;
	margin: 0;
}

.wp-block-navigation .mobilmenue-fuss > .mobilmenue-rechtliches {
	position: relative;
	z-index: 1;
	align-self: start;
	padding-bottom: var(--wp--preset--spacing--30);
}

.wp-block-navigation .mobilmenue-rechtliches .wp-block-navigation-item__content {
	--halo: var(--wp--preset--color--accent-3);
	text-shadow: 0 0 2px var(--halo), 0 0 2px var(--halo), 0 0 4px var(--halo), 1px 1px 0 var(--halo), -1px -1px 0 var(--halo), 1px -1px 0 var(--halo), -1px 1px 0 var(--halo);
}

/*
 * Width in vw, not %: Chrome sized the grid row with the % width unresolved, so the row came out
 * ~14px shorter than the drawing, which then hung below the menu's grey into the transparent overlay
 * and showed the page behind it at the end of the scroll (board card, 2026-11-19). Same size as
 * before: half of the group (screen width minus its left padding).
 */
.wp-block-navigation .mobilmenue-zeichnung {
	justify-self: end;
	align-self: end;
	width: min(calc((100vw - var(--wp--preset--spacing--50)) / 2), 190px);
}

/*
 * The overlay is a solid sheet over the whole screen: core leaves it transparent (the theme's overlay
 * pattern paints the grey), so any gap would let the page through. Its scrolling stays inside it
 * (no scroll chaining or pull-to-refresh into the page); core already locks the page itself
 * (overflow: hidden on <html> while it is open), the rule below adds the same for body (iOS).
 */
.wp-block-navigation__responsive-container.is-menu-open {
	background-color: var(--wp--preset--color--accent-3);
	overscroll-behavior: contain;
}

html.has-modal-open,
html.has-modal-open body {
	overflow: hidden;
	overscroll-behavior: none;
}

.wp-block-navigation .mobilmenue-zeichnung img {
	display: block;
	width: 100%;
	height: auto;
}

/*
 * Menu button (phones/tablets): two navy lines, 28px long and 3px thick (theme icon
 * "weinsberger-hilfsverein/menue", functions.php), with no fill, so it stays quiet next to the logo. The button keeps a 44px tap
 * area around the lines; it reaches 8px past the page edge so the lines end on the edge, in line
 * with the text below. Core sets the icon to 24px and resets margins at the same specificity,
 * hence these selectors here rather than in theme.json (zero specificity there).
 */
.wp-block-navigation .wp-block-navigation__responsive-container-open {
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	margin-inline-end: -8px;
	padding: 0;
	background: none;
	color: var(--wp--preset--color--accent-1);
}

.wp-block-navigation .wp-block-navigation__responsive-container-open svg {
	width: 28px;
	height: 12px;
}

/*
 * Close button in the mobile menu (core "navigation-overlay-close" block): matches the menu
 * button, an X of two navy 3px lines (each about 28px long, like the menu lines) with no fill,
 * in a 44px tap area that reaches 8px past the page edge, so the X ends where the menu lines did.
 * The X is the theme icon "weinsberger-hilfsverein/schliessen" (functions.php) in place of core's
 * thin one. Scoped to the overlay because core's block CSS loads after this file.
 */
.wp-block-navigation__responsive-container .wp-block-navigation-overlay-close {
	width: 44px;
	height: 44px;
	margin-inline-end: -8px;
	padding: 0;
	background: none;
	color: var(--wp--preset--color--accent-1);
}

.wp-block-navigation__responsive-container .wp-block-navigation-overlay-close svg {
	width: 22px;
	height: 22px;
}
