/*
 * Small amount of CSS that theme.json cannot express: layout of the header
 * and footer, the footer artwork, the sticky footer and the contact form.
 * Everything else (colors, fonts, sizes, spacing) lives in theme.json.
 */

/* Sticky footer: replaces the old jQuery stickyfooter.js. */
.wp-site-blocks {
	min-height: 100vh;
	display: flex;
	flex-direction: column;
}

.wp-site-blocks > main {
	flex: 1 0 auto;
}

/* Header ------------------------------------------------------------------ */

/* Sticky has to sit on the template-part wrapper, not on the group inside it. */
.wp-site-blocks > header.wp-block-template-part {
	position: sticky;
	top: var(--wp-admin--admin-bar--position-offset, 0px);
	z-index: 999;
}

.site-header .wp-block-navigation a:where(:not(.wp-element-button)) {
	color: inherit;
}

.site-header .wp-block-navigation-item__content:hover,
.site-header .wp-block-navigation-item__content[aria-current="page"] {
	opacity: 0.8;
}

/*
 * The menu has 10 top-level items and needs about 1200px. Core only switches
 * to the hamburger below 600px, so extend that up to 1199px. These two rules
 * undo core's @media (min-width: 600px) block for the header menu only.
 */
@media (min-width: 600px) and (max-width: 1199px) {
	.site-header .wp-block-navigation .wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) {
		display: none;
	}

	.site-header .wp-block-navigation .wp-block-navigation__responsive-container-open:not(.always-shown) {
		display: flex;
	}
}

/* With the hamburger: menu button on the left, logo on the right (as before). */
@media (max-width: 1199px) {
	.site-header__inner .wp-block-navigation {
		order: -1;
	}

	/* Core's flex layout resets child margins with (0,1,1); this is (0,2,0). */
	.site-header__inner > .site-header__logo {
		margin-left: auto;
	}
}

/*
 * Core always unfolds every submenu inside the hamburger overlay and hides
 * the chevron buttons, which makes the menu very long. Bring the chevrons
 * back and only show a submenu once its chevron has been clicked. Core's
 * view script already toggles aria-expanded on these buttons.
 *
 * The :focus-within check keeps submenus from unfolding on mouse hover
 * (core also opens on hover, which would make the list jump around).
 */
.site-header .wp-block-navigation__responsive-container.is-menu-open li.has-child {
	flex-direction: row;
	flex-wrap: wrap;
	align-items: center;
}

.site-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-submenu__toggle.wp-block-navigation__submenu-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 2.75rem;
	min-height: 2.75rem;
	margin: 0;
	padding: 0;
	color: inherit;
	background: transparent;
	border: 0;
}

.site-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-submenu__toggle svg {
	width: 0.875rem;
	height: 0.875rem;
}

.site-header .wp-block-navigation__responsive-container.is-menu-open .has-child > .wp-block-navigation__submenu-container {
	flex-basis: 100%;
}

.site-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-submenu__toggle:not([aria-expanded="true"]) ~ .wp-block-navigation__submenu-container,
.site-header .wp-block-navigation__responsive-container.is-menu-open .has-child:not(:focus-within) > .wp-block-navigation__submenu-container {
	display: none;
}

/* Footer ------------------------------------------------------------------ */

.site-footer {
	min-height: 20.5625rem;
	background: url("../images/bgFooterRasen.png") repeat-x bottom;
}

.site-footer__inner {
	min-height: 20.5rem;
	background: url("../images/bgFooter.png") no-repeat 510px 40px;
}

/* nav.* only: core also puts .wp-block-navigation on the inner <ul>. */
.site-footer nav.wp-block-navigation {
	max-width: 60%;
}

@media (max-width: 719px) {
	.site-footer__inner {
		background-image: none;
	}

	.site-footer nav.wp-block-navigation {
		max-width: none;
	}
}

/* Layout ------------------------------------------------------------------ */

/*
 * Header, main and footer touch each other; spacing comes from the sections.
 * Core adds the block gap here with :root :where(.wp-site-blocks) > * (0,1,0),
 * so this needs (0,2,0) to win regardless of stylesheet order.
 */
:root .wp-site-blocks > * {
	margin-block: 0;
}

/*
 * Columns with .reverse-mobile (on the columns block or a wrapper around it)
 * stack in reverse order. 781px matches the point where core stacks columns.
 */
@media (max-width: 781px) {
	.wp-block-columns.reverse-mobile,
	.reverse-mobile .wp-block-columns {
		flex-direction: column-reverse;
	}
}

/* Stufe names ---------------------------------------------------------------- */

/*
 * Stufe names in menus, headings and page titles (wrapped by
 * inc/stufen-farben.php). Not the same as the palette colors of the Stufen
 * tiles on purpose: these are the text colors.
 */
.stufe-name--biber {
	color: #936037;
}

.stufe-name--woelflinge {
	color: #ff6400;
}

.stufe-name--juffis {
	color: #2f53a7;
}

.stufe-name--pfadis {
	color: #00823c;
}

.stufe-name--rover {
	color: #cc1f2f;
}

/* The Stufen tiles have the Stufe color as background: keep their text white. */
.stufe-box .stufe-name {
	color: inherit;
}

/*
 * Outline buttons: core's outline style sets its own smaller padding and a 2px border,
 * which can win over theme.json depending on load order. Match the normal button size.
 */
.wp-block-button.is-style-outline > .wp-block-button__link {
	padding: 0.9375rem 1.875rem;
	border-width: 1px;
}

/* Front page ---------------------------------------------------------------- */

/* Hero: fill the screen below the 5rem header (min. 490px, as before). */
.is-home-hero {
	min-height: max(30.625rem, calc(100vh - 5rem));
	min-height: max(30.625rem, calc(100svh - 5rem));
}

.hero-subtitle {
	font-weight: 400;
}

/* Hero buttons the same width, whatever their label. */
.hero-buttons .wp-block-button__link {
	min-width: 11rem;
}

/* Phones: hero buttons stacked, full width. */
@media (max-width: 639px) {
	.hero-buttons > .wp-block-button {
		flex-basis: 100%;
	}

	.hero-buttons .wp-block-button__link {
		width: 100%;
	}
}

/* Stufen tiles: 6 across, 3 on tablets, 1 on phones. */
.stufe-box {
	min-height: 0;
	aspect-ratio: 480 / 326;
}

.stufe-box a {
	color: inherit;
	text-decoration: none;
}

.stufe-box a:hover,
.stufe-box a:focus {
	text-decoration: underline;
}

@media (max-width: 1023px) {
	.wp-block-group.stufen-grid.is-layout-grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (max-width: 639px) {
	.wp-block-group.stufen-grid.is-layout-grid {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* Calendar: list on phones, month view from 640px (replaces wp_is_mobile()). */
.calendar-desktop {
	display: none;
}

@media (min-width: 640px) {
	.calendar-mobile {
		display: none;
	}

	.calendar-desktop {
		display: block;
	}
}

/*
 * Partner logos: exactly 3 per row, 2 on phones, rows centered. The gallery
 * block's own "columns" setting is ignored by core when imageCrop is off, so
 * the cell width is forced here. Logos keep their natural size up to the cell
 * width, as in the classic theme.
 */
.wp-block-gallery.partner-logos {
	justify-content: center;
	align-items: center;
	gap: 1.5rem;
}

.wp-block-gallery.partner-logos > .wp-block-image {
	flex: 0 0 calc((100% - 2 * 1.5rem) / 3);
	max-width: calc((100% - 2 * 1.5rem) / 3);
	margin: 0;
}

/*
 * Center each logo vertically in its row. Core pins images in uncropped
 * galleries to the top with margin-bottom: auto on a selector containing
 * :not(#individual-image), so repeat that selector here to outrank it.
 */
.wp-block-gallery.partner-logos.has-nested-images:not(.is-cropped) figure.wp-block-image:not(#individual-image) {
	margin-block: auto;
}

@media (max-width: 599px) {
	.wp-block-gallery.partner-logos > .wp-block-image {
		flex: 0 0 calc((100% - 1.5rem) / 2);
		max-width: calc((100% - 1.5rem) / 2);
	}
}

.wp-block-gallery.partner-logos > .wp-block-image > a {
	display: flex;
	align-items: center;
	justify-content: center;
}

.wp-block-gallery.partner-logos img {
	width: auto;
	height: auto;
	max-width: 100%;
}

/* Posts and pages with a hero: the featured image is the background; without one, the old default. */
.is-featured-hero {
	background: url("../images/home-header.jpg") center / cover no-repeat;
}

/* Single posts: the content starts over the white end of the faded banner. */
.is-faded-hero {
	margin-bottom: -8.75rem;
}

.is-faded-hero + * {
	position: relative;
	z-index: 1;
}

/* Contact form (Contact Form 7) --------------------------------------------- */

/*
 * Taken over from the classic theme. Foundation used to style every field;
 * without it the fields need their own border and box sizing. The old
 * .wpcf7-mail-sent-ok / .wpcf7-validation-errors classes no longer exist in
 * CF7 5.x, so the messages are styled via the form's state classes instead.
 */
.wpcf7-form {
	max-width: 800px;
	margin: 0 auto;
	padding: 20px;
}

.wpcf7-form label {
	display: block;
	margin-bottom: 5px;
	font-weight: 700;
	color: #333;
}

.wpcf7-form input:where(:not([type="checkbox"], [type="radio"], [type="submit"], [type="file"])),
.wpcf7-form textarea,
.wpcf7-form select {
	display: block;
	box-sizing: border-box;
	width: 100%;
	margin-top: 5px;
	padding: 10px;
	font: inherit;
	font-weight: 400;
	color: var(--wp--preset--color--contrast);
	background-color: var(--wp--preset--color--base);
	border: 1px solid var(--wp--preset--color--gray-medium);
	border-radius: 5px;
	box-shadow: inset 0 1px 2px rgba(10, 10, 10, 0.1);
	transition: all 0.3s ease-in-out;
}

.wpcf7-form input:focus,
.wpcf7-form textarea:focus,
.wpcf7-form select:focus {
	border-color: #0056b3;
	outline: none;
	box-shadow: 0 0 5px rgba(0, 91, 187, 0.5);
}

.wpcf7-form input::placeholder,
.wpcf7-form textarea::placeholder {
	color: var(--wp--preset--color--gray-dark);
}

.wpcf7-form .wpcf7-submit {
	width: 100%;
	padding: 12px 20px;
	font-family: inherit;
	font-size: 18px;
	color: var(--wp--preset--color--base);
	background: var(--wp--preset--color--primary);
	border: none;
	border-radius: 5px;
	cursor: pointer;
	transition: all 0.3s ease-in-out;
}

.wpcf7-form .wpcf7-submit:hover,
.wpcf7-form .wpcf7-submit:focus-visible {
	background: var(--wp--preset--color--accent);
}

.wpcf7-form .wpcf7-submit:focus-visible {
	outline: 2px solid var(--wp--preset--color--primary);
	outline-offset: 2px;
}

.wpcf7-form .wpcf7-not-valid-tip {
	margin-top: 5px;
	font-size: 14px;
	color: var(--wp--preset--color--accent);
}

.wpcf7-form .wpcf7-not-valid {
	border-color: var(--wp--preset--color--accent);
}

/* Messages under the form: success green, anything else red. */
.wpcf7 form .wpcf7-response-output {
	margin: 10px 0 0;
	padding: 10px;
	border: 0;
	border-left: 4px solid;
	border-radius: 5px;
}

.wpcf7 form.sent .wpcf7-response-output {
	color: #155724;
	background: #d4edda;
	border-color: #28a745;
}

.wpcf7 form.invalid .wpcf7-response-output,
.wpcf7 form.unaccepted .wpcf7-response-output,
.wpcf7 form.payment-required .wpcf7-response-output,
.wpcf7 form.failed .wpcf7-response-output,
.wpcf7 form.aborted .wpcf7-response-output,
.wpcf7 form.spam .wpcf7-response-output {
	color: #721c24;
	background: #f8d7da;
	border-color: #dc3545;
}

/*
 * Search field: one rounded box (corners as the buttons) with a small magnifier icon instead of a full button.
 * Every part gets an explicit height, so browser defaults and core styles cannot change it.
 */
.wp-block-search__button-inside .wp-block-search__inside-wrapper {
	box-sizing: border-box;
	align-items: stretch;
	height: 2.75rem;
	padding: 0;
	overflow: hidden;
	background: var(--wp--preset--color--base);
	border: 1px solid var(--wp--preset--color--primary);
	border-radius: 0.25rem;
}

.wp-block-search__button-inside .wp-block-search__inside-wrapper:focus-within {
	outline: 2px solid var(--wp--preset--color--sky-dark);
	outline-offset: 2px;
}

.wp-block-search__button-inside .wp-block-search__input {
	box-sizing: border-box;
	height: 100%;
	min-height: 0;
	margin: 0;
	padding: 0 0 0 1rem;
	font: inherit;
	line-height: normal;
	color: var(--wp--preset--color--contrast);
	background: transparent;
	border: 0;
	border-radius: 0;
	outline: 0;
	box-shadow: none;
	appearance: none;
}

/* Safari/Chrome draw their own clear button and inner padding on search inputs. */
.wp-block-search__button-inside .wp-block-search__input::-webkit-search-decoration,
.wp-block-search__button-inside .wp-block-search__input::-webkit-search-cancel-button {
	appearance: none;
}

.wp-block-search__input::placeholder {
	color: var(--wp--preset--color--gray-dark);
	opacity: 1;
}

.wp-block-search__button-inside .wp-block-search__button.has-icon {
	box-sizing: border-box;
	display: flex;
	flex: 0 0 2.75rem;
	align-items: center;
	justify-content: center;
	height: 100%;
	margin: 0;
	padding: 0;
	line-height: 0;
	color: var(--wp--preset--color--primary);
	background: transparent;
	border: 0;
	border-radius: 0;
}

.wp-block-search__button-inside .wp-block-search__button.has-icon:hover,
.wp-block-search__button-inside .wp-block-search__button.has-icon:focus-visible {
	color: var(--wp--preset--color--accent);
	background: transparent;
}

.wp-block-search__button-inside .wp-block-search__button.has-icon svg {
	width: 1.5rem;
	height: 1.5rem;
	min-width: 0;
	min-height: 0;
}
