/* =============================================================
   Wilmars Gaerten — Theme-Styles
   Nachbau von wilmarsgaerten.com. Ergänzt theme.json um alles,
   was dort nicht abbildbar ist (fixe Ebenen, Scroll-Zustände).
   ============================================================= */

:root {
	--wg-ease: cubic-bezier(.25, 1, .5, 1);
	--wg-duration: .8s;
}

html {
	scroll-behavior: smooth;
}

body {
	margin: 0;
}

.wp-site-blocks {
	padding: 0;
}

.wp-site-blocks > * {
	margin-block-start: 0;
}

/* Ruhiger Seitenaufbau: Bis Schriften, Logo, Icons und Platzhalterbild
   geladen sind, bleibt die Startseite dunkel; dann blendet alles gemeinsam
   ein (Klasse wg-loading aus functions.php, entfernt von site.js). */
.wp-site-blocks {
	transition: opacity .9s var(--wg-ease);
}

html.wg-loading .wp-site-blocks {
	opacity: 0;
}

img {
	user-select: none;
	-webkit-user-drag: none;
}

.wg-top-row figure,
.wg-bottom-row figure,
.wg-hero-logo,
.wg-background figure {
	margin: 0;
}

/* ---------- Hintergrundvideo + Scroll-Overlay ---------- */
/* Platzhalterbild sofort als Hintergrund; das Video wird nach dem Seitenaufbau
   nachgeladen (site.js) und blendet ein, sobald es laeuft. --wg-poster setzt
   functions.php aus dem Poster-Bild des Video-Blocks. */
.wg-bg-video {
	position: fixed;
	inset: 0;
	z-index: -1;
	margin: 0;
	background: #222 var(--wg-poster, url("../images/video-poster.jpg")) center / cover no-repeat;
}

.wg-bg-video video {
	width: 100%;
	height: 100%;
	object-fit: cover;
	pointer-events: none;
	opacity: 0;
	transition: opacity 1.2s var(--wg-ease);
}

.wg-bg-video.is-playing video {
	opacity: 1;
}

/* Fallback: Standbild, falls das Video nicht laedt oder nicht startet */
.wg-bg-video.is-fallback video {
	display: none;
}

.wg-scroll-overlay {
	position: fixed;
	inset: 0;
	z-index: 0;
	pointer-events: none;
	background: linear-gradient(to bottom, #fffffff2, #fffffffc 20%);
	opacity: 0;
	transition: opacity var(--wg-duration) var(--wg-ease);
}

html.has-scrolled .wg-scroll-overlay {
	opacity: 1;
}

/* ---------- Kopfzeile: Textbloecke ----------
   Jeder direkte Block in .wg-top-row ist ein Punkt – Punkte lassen sich im
   Site-Editor frei hinzufuegen, duplizieren und loeschen. 4 pro Zeile,
   weitere Punkte rutschen in die naechste Zeile. */
.wg-top-row {
	position: relative;
	z-index: 1;
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	align-items: start;
	gap: 8px;
	padding: 24px;
	color: #faf5f0;
	transition: color var(--wg-duration) var(--wg-ease);
}

.wg-top-row p {
	margin: 0;
}

.wg-top-row > * {
	--title-size: clamp(1.2rem, min(7.5vh, 10cqw), 4rem);
	position: relative;
	container-type: inline-size;
	min-width: 0;
	padding: 20px;
	margin: 0 !important;
}

.wg-top-row > * > * + * {
	margin-block-start: 0;
}

.wg-title {
	font-family: var(--wp--preset--font-family--display);
	font-size: var(--title-size);
	line-height: 1;
	text-transform: uppercase;
	letter-spacing: .01em;
	transition: transform var(--wg-duration) var(--wg-ease);
	transform-origin: left top;
}

.wg-title a {
	color: inherit;
	text-decoration: none;
}

/* ganze Wortmarke klickbar */
.wg-title a::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
}

.wg-top-row > *:has(.wg-title a):hover .wg-title {
	transform: scale(1.06);
}

.wg-info {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	column-gap: 1.2em;
	margin-top: .3em;
}

.wg-address,
.wg-tagline {
	font-style: italic;
	font-size: max(.8rem, min(2.6vh, 5.6cqw));
	line-height: 1.05;
}

.wg-tagline {
	font-size: max(.95rem, min(3.6vh, 7.5cqw));
}

.wg-hours {
	font-family: var(--wp--preset--font-family--display);
	font-size: max(.7rem, min(2.3vh, 5cqw));
	line-height: 1.15;
	letter-spacing: .02em;
	text-transform: uppercase;
}

html.has-scrolled .wg-top-row {
	color: #383a3c;
}

/* „More information soon“-Sticker ueber Gemüsetüte / Farm School */
.wg-sticker {
	--pad: 20px;
	--rot: -4deg;
	position: absolute;
	z-index: 2;
	left: calc(var(--pad) + 8cqw);
	top: calc(var(--pad) + var(--title-size) * 1.3);
	width: max-content;
	max-width: calc(100% - var(--pad));
	padding: .2em .6em;
	border-radius: .35em;
	background: #faf5f0;
	color: #111;
	font-family: var(--wp--preset--font-family--display);
	font-size: max(.7rem, min(2.8vh, 6.4cqw));
	line-height: 1.1;
	text-transform: uppercase;
	white-space: nowrap;
	transform: translateY(-50%) rotate(var(--rot));
	pointer-events: none;
	transition: background-color var(--wg-duration) var(--wg-ease), color var(--wg-duration) var(--wg-ease);
}

.wg-sticker--right {
	--rot: 3deg;
}

html.has-scrolled .wg-sticker {
	background: #383a3c;
	color: #ccc;
}

/* Stile → „Sticker ausgeblendet“ */
.wg-sticker.is-style-sticker-off {
	display: none;
}

@media (max-width: 1080px) {
	.wg-top-row {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.wg-top-row > * {
		padding: 0;
	}

	.wg-sticker {
		--pad: 0px;
	}
}

/* ---------- Hero: Sticky-Logo + Inhalt ---------- */
.wg-hero-wrapper {
	position: relative;
	z-index: 1;
	max-width: 896px;
	min-height: 100vh;
	margin: 0 auto;
	padding: 0 1rem 4rem;
	box-sizing: border-box;
}

.wg-hero-logo {
	position: sticky;
	top: 0;
	z-index: 2;
	display: flex;
	justify-content: center;
	margin-top: var(--hero-offset, 20vh);
	pointer-events: none;
}

/* WordPress setzt beim ersten Element im Flow-Layout margin-top: 0 –
   hier muss der berechnete Abstand gewinnen, damit das Logo beim Laden
   in der Bildschirmmitte steht. */
.wg-hero-wrapper > .wg-hero-logo.wp-block-image {
	margin-top: var(--hero-offset, 20vh);
}

.wg-hero-logo a {
	display: block;
	line-height: 0;
	pointer-events: auto;
}

.wg-hero-logo img {
	display: block;
	width: auto;
	height: min(150px, 18vh);
	max-width: none;
	aspect-ratio: 1 / 1;
	object-fit: contain;
	box-sizing: content-box;
	padding: 2rem;
	border-radius: 50%;
}

.wg-page-content {
	position: relative;
	z-index: 1;
	box-sizing: border-box;
	padding: 2rem;
	opacity: 0;
	transition: opacity var(--wg-duration) var(--wg-ease);
}

html.has-scrolled .wg-page-content {
	opacity: 1;
}

.wg-page-content p {
	margin: 1em 0;
}

.wg-page-content .wp-block-group + .wp-block-group {
	margin-top: 3rem;
}

/* Walnuss am letzten Absatz */
.wg-walnut {
	float: right;
	display: inline-block;
	margin-top: .3em;
	line-height: 0;
}

.wg-walnut img {
	width: auto;
	height: .7em;
	transition: transform var(--wg-duration) var(--wg-ease);
}

.wg-walnut:hover img,
.wg-walnut:focus-visible img {
	transform: scale(1.1) rotate(-8deg);
}

/* Farm School */
.wg-farm-school {
	display: flex;
	flex-direction: column;
	gap: 2rem;
	scroll-margin-top: 2rem;
}

.wg-farm-school > * {
	margin: 0 !important;
}

.wg-farm-school__heading {
	font-style: italic;
}

/* Impressum am Ende der Startseite: aufklappbar + PDF-Link (wie Originalseite) */
.wg-page-content .wg-imprint {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	gap: 2rem;
	margin-top: 4rem;
	padding-top: 1rem;
	border-top: 1px solid #ccc;
	font-size: 1rem;
}

.wg-imprint > * {
	margin: 0 !important;
}

.wg-imprint__details {
	flex: 1 1 20rem;
	interpolate-size: allow-keywords;
}

.wg-imprint__details::details-content {
	block-size: 0;
	opacity: 0;
	overflow: clip;
	transition: block-size .4s var(--wg-ease), opacity .4s var(--wg-ease), content-visibility .4s allow-discrete;
}

.wg-imprint__details[open]::details-content {
	block-size: auto;
	opacity: 1;
}

.wg-imprint__details summary,
.wg-imprint__pdf,
.wg-imprint__heading {
	font-family: var(--wp--preset--font-family--display);
	font-size: .875rem;
	font-style: normal;
	letter-spacing: .06em;
	text-transform: uppercase;
	color: #222;
}

.wg-imprint__details summary {
	display: flex;
	align-items: center;
	gap: .6em;
	margin-bottom: 1rem;
	list-style: none;
	cursor: pointer;
}

.wg-imprint__details summary::-webkit-details-marker {
	display: none;
}

.wg-imprint__details summary::before {
	content: "";
	border-style: solid;
	border-width: .4em 0 .4em .7em;
	border-color: transparent transparent transparent currentcolor;
	transition: transform .4s var(--wg-ease);
}

.wg-imprint__details[open] summary::before {
	transform: rotate(90deg);
}

.wg-imprint__heading {
	margin: 1rem 0 .25rem !important;
	line-height: 1.2;
}

.wg-imprint__details p {
	margin: 0 0 1rem;
}

.wg-imprint__pdf a {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 3px;
}

/* ---------- Fußzeile: Icon-Leiste ---------- */
.wg-bottom-row {
	position: fixed;
	bottom: 2rem;
	left: 0;
	right: 0;
	z-index: 1;
	display: flex;
	gap: 8px;
	opacity: 1;
	transition: opacity var(--wg-duration) var(--wg-ease);
}

html.has-scrolled .wg-bottom-row {
	opacity: 0;
	pointer-events: none;
}

.wg-bottom-item {
	flex: 1;
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 20px;
	padding: 8px;
	margin: 0 !important;
}

.wg-icon img {
	display: block;
	width: auto;
	height: 3vh;
	max-width: 100%;
}

.wg-icon--mail img {
	height: 2.5vh;
}

@media (max-width: 1080px) {
	.wg-bottom-row {
		flex-direction: column;
	}
}

/* ---------- Unterseiten (Impressum etc.) ---------- */
.wg-subpage .wg-hero-logo {
	position: static;
	margin-top: 0;
}
