/*
 * Automatic transition from page content to the global footer.
 *
 * The final content section draws its own background into the rounded
 * closing edge. This preserves solid colors, gradients and images without
 * a page-specific `--from-*` class. The empty divider in the Theme Builder
 * remains only as a stable marker and no longer contributes visual color.
 * Fixed/absolute Canvas overlays are not page-ending content sections.
 */
:root {
	--burnabit-footer-curve: clamp(2.5rem, 4vw, 3.5rem);
}

footer.et-l--footer .et_builder_inner_content > .burnabit-section-divider:first-child {
	display: none !important;
}

#main-content :is(.et-l--post, .et-l--body) > .et_builder_inner_content {
	z-index: 2;
}

/* A dedicated fixed Canvas must not trap its overlay below the global header.
 * Keep the footer stacking of ordinary content wrappers unchanged. */
#main-content :is(.et-l--post, .et-l--body) > .et_builder_inner_content:has(> .et_pb_section--fixed):not(:has(> .et_pb_section:not(.et_pb_section--fixed))) {
	z-index: auto;
}

#main-content :is(.et-l--post, .et-l--body) > .et_builder_inner_content > .et_pb_section:last-child:not(.et_pb_section--fixed):not(.et_pb_section--absolute) {
	position: relative;
	z-index: 2;
	box-sizing: border-box;
	margin-bottom: calc(-1 * var(--burnabit-footer-curve)) !important;
	border-bottom-left-radius: var(--burnabit-footer-curve);
	border-bottom-right-radius: var(--burnabit-footer-curve);
	/* Rundungen beschneiden, ohne den Scroll-Bezug von Sticky-Spalten zu ändern. */
	overflow: clip;
}

#main-content :is(.et-l--post, .et-l--body) > .et_builder_inner_content > .et_pb_section:last-child:not(.et_pb_section--fixed):not(.et_pb_section--absolute)::after {
	content: "";
	display: block;
	clear: both;
	height: var(--burnabit-footer-curve);
	pointer-events: none;
}

footer.et-l--footer .et_builder_inner_content > .burnabit-section-divider:first-child + .et_pb_section {
	position: relative;
	z-index: 1;
}

@media (max-width: 767px) {
	:root {
		--burnabit-footer-curve: 2.5rem;
	}
}

/*
 * Legal menu in the global Divi footer.
 *
 * Keep this footer menu expanded as text links on every breakpoint.
 * Alignment, typography and colors intentionally remain controlled by Divi.
 */
footer.et-l--footer .burnabit-footer-legal .et_pb_menu__menu {
	display: flex !important;
	width: 100%;
}

footer.et-l--footer .burnabit-footer-legal .et_mobile_nav_menu {
	display: none !important;
}

footer.et-l--footer .burnabit-footer-legal .et-menu-nav,
footer.et-l--footer .burnabit-footer-legal ul.et-menu {
	width: 100%;
}

footer.et-l--footer .burnabit-footer-legal ul.et-menu {
	flex-direction: column;
	flex-wrap: nowrap;
	margin-right: 0;
	margin-left: 0;
}

footer.et-l--footer .burnabit-footer-legal ul.et-menu > li {
	width: 100%;
	padding-right: 0;
	padding-left: 0;
}

footer.et-l--footer .burnabit-footer-legal ul.et-menu > li:first-child {
	margin-top: 0;
}

/*
 * Contact blurb links should follow the footer text color by default.
 *
 * Divi/global link colors otherwise turn phone and email links orange even
 * when the blurb text itself is configured as white. Hover/focus styling
 * stays in Divi.
 */
footer.et-l--footer .burnabit-footer-contact .et_pb_blurb_description a:not(:hover):not(:focus-visible),
footer.et-l--footer .et_pb_blurb_0_tb_footer .et_pb_blurb_description a:not(:hover):not(:focus-visible),
footer.et-l--footer .et_pb_blurb_1_tb_footer .et_pb_blurb_description a:not(:hover):not(:focus-visible) {
	color: inherit;
}

/* Kontaktlinks erhalten beim Tastaturfokus dieselbe Divi-Primärfarbe wie beim Hover. */
footer.et-l--footer a:is([href^="tel:"], [href^="mailto:"]):focus-visible {
	color: var(--gcid-primary-color, #ff700f) !important;
	outline: 2px solid currentColor;
	outline-offset: 4px;
}

/*
 * Keep the Theme Builder footer independent from the bablight body skin.
 *
 * The copyright/bottom bar has a dark background in Divi but may otherwise
 * inherit bablight's dark body text color on legal pages.
 */
body.bablight footer.et-l--footer .et_pb_section_2_tb_footer,
body.bablight footer.et-l--footer .et_pb_section_2_tb_footer .et_pb_text,
body.bablight footer.et-l--footer .et_pb_section_2_tb_footer .et_pb_text_inner {
	color: rgba(255, 255, 255, 0.35);
}

body.bablight footer.et-l--footer .et_pb_section_2_tb_footer a {
	color: inherit;
}

@media (min-width: 768px) and (max-width: 980px) {
	footer.et-l--footer .burnabit-footer-legal {
		text-align: left;
	}

	/* Contact column: stack each Divi blurb's icon above its text. */
	footer.et-l--footer .burnabit-footer-contact .et_pb_blurb_content {
		align-items: flex-start;
		flex-direction: column;
		gap: 0.5rem;
		text-align: left;
	}

	footer.et-l--footer .burnabit-footer-contact .et_pb_main_blurb_image {
		margin: 0;
	}

	footer.et-l--footer .burnabit-footer-contact .et_pb_blurb_container {
		width: 100%;
	}
}
