/* ==========================================================================
   Site chrome: header and footer. Not a block, but loaded the same way.
   ========================================================================== */

/* Height the header occupies at the top of the page. Hero blocks pad for it:
   padding-top: calc(var(--header-h) + <their own space>). */
:root { --header-h: 184px; }

/* Header: transparent, floating over the first block.
   ========================================================================== */
.site-header { position: absolute; top: 0; left: 0; right: 0; z-index: 3; padding-top: 22px; }
.site-header .split { align-items: start; }
.site-header .logo { display: block; width: 156px; color: var(--green); }
.site-header .logo svg { display: block; width: 100%; height: auto; }

.head-right { display: flex; justify-content: space-between; align-items: start; gap: 16px; padding-top: 18px; }
.nav { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 16px; font-weight: 300; line-height: 1.6; }
.nav a { text-decoration: none; }
.nav a:hover { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }

/* Submenu (Diensten): an inline expansion inside the nav column, indented, no panel. It opens on
   hover and on keyboard focus anywhere inside the item; Diensten itself stays a link. */
.nav .sub-menu {
	list-style: none;
	margin: 0;
	padding: 0 0 0 16px;
	display: grid;
	gap: 4px;
	font-size: 15px;
	max-height: 0;
	overflow: hidden;
	opacity: 0;
	visibility: hidden;
	transition: max-height .25s ease, opacity .2s ease, visibility 0s linear .25s;
}
.nav li:hover > .sub-menu,
.nav li:focus-within > .sub-menu {
	max-height: 10em;
	padding-top: 2px;
	opacity: 1;
	visibility: visible;
	transition: max-height .25s ease, opacity .2s ease .05s, visibility 0s;
}
@media (prefers-reduced-motion: reduce) {
	.nav .sub-menu,
	.nav li:hover > .sub-menu,
	.nav li:focus-within > .sub-menu { transition: none; }
}
.btn-contact { padding: 12px 20px; font-size: 16px; font-weight: 300; margin-top: -2px; white-space: nowrap; flex: none; }
.menu-toggle { display: none; }

/* Between the mobile layout and 1200px the right column is narrower than nav + button; let it size to its content. */
@media (min-width: 901px) and (max-width: 1200px) {
	.site-header .split { grid-template-columns: minmax(0, 1fr) auto; }
}

@media (max-width: 900px) {
	:root { --header-h: 76px; }

	.site-header .split { grid-template-columns: 1fr auto; row-gap: 0; align-items: center; }
	.site-header .logo { width: 128px; }
	.head-right { padding-top: 0; gap: 10px; align-items: center; }
	.menu-toggle {
		display: inline-flex;
		align-items: center;
		background: none;
		border: 1px solid var(--green);
		border-radius: 999px;
		padding: 11px 16px;
		font: 300 15px/1 var(--sans);
		color: var(--green);
		cursor: pointer;
	}
	.btn-contact { padding: 11px 16px; font-size: 15px; margin-top: 0; }

	/* Fullscreen menu. The overlay sits inside the header at z-index -1, so it covers the page and the
	   stuck bar's own background while the header row (logo, toggle, contact button) stays on top, in
	   place. Only the list scrolls, starting below that row (--menu-top is measured by site.js). */
	.site-nav {
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		z-index: -1;
		display: flex;
		flex-direction: column;
		height: 100vh;
		height: 100dvh;
		padding-top: var(--menu-top, var(--header-h));
		background: var(--beige);
		visibility: hidden;
		opacity: 0;
		clip-path: inset(0 0 100% 0);
		/* Closing: a quick fade. The curtain resets and visibility drops only once the fade is done, so the
		   overlay stays rendered until then and its links are unreachable afterwards. */
		transition: opacity .25s ease, clip-path 0s linear .25s, visibility 0s linear .25s;
	}
	.site-nav.open {
		visibility: visible;
		opacity: 1;
		clip-path: inset(0 0 0 0);
		/* Opening: the overlay drops down from under the header row like a curtain. */
		transition: clip-path .42s cubic-bezier(.22, .61, .36, 1), opacity 0s, visibility 0s;
	}
	/* The stuck bar may still be sliding back in; a transform would make it the overlay's containing block.
	   No transition either: site.js measures the row right after opening, so it must already be in place. */
	html.menu-open .site-header.is-stuck { transform: none; transition: none; }

	.site-nav .nav {
		flex: 1 1 auto;
		min-height: 0;
		overflow-y: auto;
		overscroll-behavior: contain;
		align-content: start;
		gap: 10px;
		padding: clamp(24px, 6vh, 56px) var(--g) calc(40px + env(safe-area-inset-bottom, 0px));
		font-family: var(--serif);
		font-size: clamp(32px, 11vw, 48px);
		line-height: 1.15;
		letter-spacing: -0.02em;
	}
	/* The services are always visible, indented under Diensten, at the same 3:4 scale as before. */
	.nav .sub-menu,
	.nav li:hover > .sub-menu,
	.nav li:focus-within > .sub-menu {
		font-size: .75em;
		gap: 4px;
		max-height: none;
		padding: .3em 0 .15em .75em;
		opacity: 1;
		visibility: visible;
		overflow: visible;
		transition: none;
	}

	/* Links rise in one after another while the curtain drops (--i is each link's index, set by site.js).
	   On close they just fade with the overlay. Inline links cannot be transformed, hence inline-block. */
	.site-nav .nav > li > a { display: inline-block; }
	.site-nav .nav a {
		opacity: 0;
		transform: translateY(14px);
		transition: opacity .15s ease, transform 0s linear .25s;
	}
	.site-nav.open .nav a {
		opacity: 1;
		transform: none;
		transition:
			opacity .3s ease-out calc(120ms + var(--i, 0) * 50ms),
			transform .45s cubic-bezier(.22, .61, .36, 1) calc(120ms + var(--i, 0) * 50ms);
	}
}
/* Reduced motion: system.css already drops the transitions; also drop the offsets so nothing moves. */
@media (max-width: 900px) and (prefers-reduced-motion: reduce) {
	.site-nav,
	.site-nav.open { clip-path: none; }
	.site-nav .nav a { transform: none; }
}

/* Sticky header. At the very top nothing changes (absolute over the hero). Once site.js sees you have
   scrolled past it, .is-stuck turns it into a fixed bar on the page cream with a hairline; it slides
   away while you scroll down (.is-hidden) and back on scroll up. Reduced motion: system.css drops transitions.
   ========================================================================== */
html { scroll-padding-top: 92px; }
.site-header.is-stuck {
	position: fixed;
	padding-block: 0;
	background: var(--cream);
	border-bottom: 1px solid var(--line);
}
.site-header.is-stuck.is-hidden { transform: translateY(-101%); }
.site-header.is-stuck.is-ready { transition: transform .35s cubic-bezier(.22, .61, .36, 1); }
.site-header.is-settling { animation: head-settle .3s ease both; }
@keyframes head-settle { from { opacity: 0; } to { opacity: 1; } }
.admin-bar .site-header.is-stuck { top: 32px; }
@media (max-width: 782px) { .admin-bar .site-header.is-stuck { top: 46px; } }
@media (max-width: 600px) { .admin-bar .site-header.is-stuck { top: 0; } }

/* On desktop the vertical nav would make a tall bar, so the stuck header is one compact row and
   Diensten opens as a small dropdown under its link. */
@media (min-width: 901px) {
	.site-header.is-stuck .split { grid-template-columns: auto 1fr; align-items: center; }
	.site-header.is-stuck .logo { width: 128px; }
	.site-header.is-stuck .head-right { padding-top: 0; justify-content: flex-end; align-items: center; gap: 32px; }
	.site-header.is-stuck .nav { display: flex; align-items: center; gap: 28px; }
	.site-header.is-stuck .nav > li { position: relative; }
	.site-header.is-stuck .nav > li > a { display: block; padding-block: 25px; }
	.site-header.is-stuck .btn-contact { margin-top: 0; }
	.site-header.is-stuck .nav .sub-menu {
		position: absolute;
		top: 100%;
		left: -16px;
		min-width: 240px;
		padding: 10px 16px 12px;
		gap: 6px;
		max-height: none;
		overflow: visible;
		background: var(--cream);
		border: 1px solid var(--line);
		border-radius: var(--radius-s);
		box-shadow: 0 10px 30px rgba(7, 59, 48, .1);
		transition: opacity .2s ease, visibility 0s linear .2s;
	}
	.site-header.is-stuck .nav li:hover > .sub-menu,
	.site-header.is-stuck .nav li:focus-within > .sub-menu {
		max-height: none;
		padding: 10px 16px 12px;
		transition: opacity .2s ease, visibility 0s;
	}
	.site-header.is-stuck .nav .sub-menu a { display: block; white-space: nowrap; }
}

/* Open mobile menu: the page behind is locked; the fullscreen overlay needs no backdrop. */
@media (max-width: 900px) {
	html.menu-open { overflow: hidden; }
	.site-header.is-stuck .split { min-height: 68px; }
}

@media (max-width: 420px) {
	.site-header .logo { width: 104px; }
	.head-right { gap: 8px; }
	.menu-toggle { padding: 11px 14px; }
	.btn-contact { padding: 11px 14px; }
}

/* Footer: green rounded container with page margin on both sides and below.
   ========================================================================== */
.site-footer {
	--foot-line: rgba(245, 239, 234, .16);
	background: var(--green);
	color: var(--beige);
	margin: 0 var(--g) var(--g);
	border-radius: var(--radius-l);
	padding: var(--sp-block) clamp(0px, 2vw, 24px) 32px;
	font-size: var(--fs-small);
}
.site-footer .logo { display: block; color: var(--beige); }
.site-footer .logo svg { display: block; width: 100%; height: auto; }
.site-footer :focus-visible { outline-color: var(--beige); }

.foot-grid { display: grid; grid-template-columns: minmax(0, var(--col-a)) minmax(0, var(--col-b)); column-gap: var(--gap); row-gap: 40px; }
.foot-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; }
.foot-title { margin: 0 0 14px; font-size: var(--fs-micro); font-weight: 400; color: var(--ink-on-green); }
.foot-grid ul, .foot-base ul { list-style: none; padding: 0; margin: 0; }
.foot-grid ul { display: grid; gap: 6px; }
.foot-grid li { overflow-wrap: anywhere; }
.foot-grid a { text-decoration: none; }
.foot-grid a:hover { text-decoration: underline; }

.foot-brand { display: grid; gap: 22px; align-content: start; }
.foot-brand .logo { width: 140px; }
.tagline { font-family: var(--serif); font-size: clamp(28px, 2.6vw, 38px); line-height: 1.15; max-width: 11em; }

.foot-base {
	margin-top: var(--sp-block);
	padding-top: 20px;
	border-top: 1px solid var(--foot-line);
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 12px 24px;
	color: var(--ink-on-green);
	font-size: var(--fs-micro);
}
/* Legal links are separated by a gap only: a separator character would start a wrapped line. */
.foot-base ul { display: flex; flex-wrap: wrap; gap: 4px 22px; }
.foot-base a { text-decoration: none; }
.foot-company { display: flex; flex-wrap: wrap; gap: 4px 22px; }
.foot-address { font-style: normal; display: grid; gap: 2px; margin-bottom: 12px; }
.foot-grid .foot-social { display: flex; flex-wrap: wrap; gap: 4px; margin: 10px 0 0 -9px; }
.foot-social a { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 999px; }
.foot-social a:hover { text-decoration: none; color: var(--beige); background: rgba(245, 239, 234, .1); }
.foot-social .icon { width: 22px; height: 22px; }
.foot-base a:hover { text-decoration: underline; color: var(--beige); }

@media (max-width: 900px) {
	.foot-grid { grid-template-columns: 1fr; }
	.foot-cols { grid-template-columns: 1fr; }
}

/* Mobile panel: sub-items are comfortable tap targets (desktop dropdown untouched). */
@media (max-width: 900px) {
	#site-nav .sub-menu a { display: flex; align-items: center; min-height: 44px; }
}
