/*
Theme Name: Gärtnerei Ritter
Theme URI: https://www.gaertnerei-ritter.de
Author: Markus Ritter
Author URI: https://www.gaertnerei-ritter.de
Description: Block Theme für die Gärtnerei Ritter in Bendestorf. Regionales Gemüse, klares modernes Design – Inter lokal eingebunden, saisonale Stilvarianten, gebaut für den Site Editor.
Requires at least: 6.9
Tested up to: 7.0
Requires PHP: 8.1
Version: 1.2.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: gaertnerei-ritter
Tags: block-patterns, block-styles, full-site-editing, custom-colors, editor-style, one-column, wide-blocks
*/

:where(html) {
	scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
	:where(html) { scroll-behavior: auto; }
	*, *::before, *::after {
		animation-duration: 0.01ms !important;
		transition-duration: 0.01ms !important;
	}
}

/* ---------- Typografische Feinheiten ---------- */

body {
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
}

/* Maximale Zeilenlänge nur für Fließtext-Absätze */
.wp-block-post-content p,
main .entry-content p {
	max-width: 65ch;
}

/* ---------- Lesbarkeits-Fixes ---------- */

/* Outline-Buttons: dunkler Text + grüner Rahmen */
.wp-block-button.is-style-outline > .wp-block-button__link {
	color: var(--wp--preset--color--secondary);
	border: 2px solid var(--wp--preset--color--primary);
	background: transparent;
}
.wp-block-button.is-style-outline > .wp-block-button__link:hover,
.wp-block-button.is-style-outline > .wp-block-button__link:focus {
	color: var(--wp--preset--color--background);
	background: var(--wp--preset--color--primary);
	border-color: var(--wp--preset--color--primary);
}

/* Accent-Variante (Bernstein) – nur für besondere CTAs */
.wp-block-button.is-style-accent > .wp-block-button__link {
	background: var(--wp--preset--color--accent);
	color: var(--wp--preset--color--background);
}
.wp-block-button.is-style-accent > .wp-block-button__link:hover,
.wp-block-button.is-style-accent > .wp-block-button__link:focus {
	background: var(--wp--preset--color--secondary);
	color: var(--wp--preset--color--background);
}

/* Links auf dunklen / grünen Flächen */
.has-contrast-background-color a:not(.wp-element-button),
.has-secondary-background-color a:not(.wp-element-button),
.has-primary-background-color a:not(.wp-element-button) {
	color: var(--wp--preset--color--surface);
	text-decoration-color: color-mix(in srgb, var(--wp--preset--color--surface) 60%, transparent);
}
.has-contrast-background-color a:not(.wp-element-button):hover,
.has-secondary-background-color a:not(.wp-element-button):hover,
.has-primary-background-color a:not(.wp-element-button):hover {
	color: var(--wp--preset--color--background);
}

/* Headings + Listen + Paragraphen auf dunklen Flächen automatisch hell.
   Schützt gegen Vererbungs-Lücken (z. B. theme.json elements.heading.color
   überschreibt sonst die geerbte helle Containerfarbe). */
.has-contrast-background-color :where(h1, h2, h3, h4, h5, h6):not(.has-text-color),
.has-secondary-background-color :where(h1, h2, h3, h4, h5, h6):not(.has-text-color),
.has-primary-background-color :where(h1, h2, h3, h4, h5, h6):not(.has-text-color) {
	color: var(--wp--preset--color--background);
}

/* Cover-Sicherheitsnetz: wenn ein Cover-Overlay keine Farbklasse hat
   (z. B. wegen verwaister Slugs oder Lazy-Load-Fehlern), mindestens
   ein 35% Anthrazit-Boden, damit weißer Text immer lesbar bleibt. */
.wp-block-cover > .wp-block-cover__background.has-background-dim:not([class*="background-color"]) {
	background-color: var(--wp--preset--color--secondary);
	opacity: 0.35;
}

/* Sichtbarer Tastatur-Fokus (BFSG / WCAG) */
:where(a, button, input, summary, [tabindex]):focus-visible {
	outline: 3px solid var(--wp--preset--color--accent);
	outline-offset: 2px;
	border-radius: 2px;
}
.has-contrast-background-color :focus-visible,
.has-secondary-background-color :focus-visible,
.has-primary-background-color :focus-visible {
	outline-color: var(--wp--preset--color--surface);
}

/* ---------- Basis-Bildstile ---------- */

.wp-block-image img,
.wp-block-post-featured-image img {
	border-radius: 14px;
	height: auto;
}

/* ---------- Header: sticky mit Milchglas ---------- */

.ritter-header {
	position: sticky;
	top: 0;
	z-index: 50;
	background: color-mix(in srgb, var(--wp--preset--color--background) 85%, transparent);
	-webkit-backdrop-filter: blur(12px);
	backdrop-filter: blur(12px);
	border-bottom: 1px solid color-mix(in srgb, var(--wp--preset--color--secondary) 8%, transparent);
	transition: box-shadow 0.25s ease;
}
.ritter-header.is-scrolled {
	box-shadow: 0 4px 20px rgba(15, 36, 24, 0.06);
}
@supports not (backdrop-filter: blur(12px)) {
	.ritter-header { background: var(--wp--preset--color--background); }
}

/* ---------- Signature: Live-Badge ---------- */

.ritter-live-badge {
	display: inline-flex;
	align-items: center;
	gap: 0.5em;
	background: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--background);
	font-size: 0.8125rem;
	font-weight: 600;
	letter-spacing: 0.04em;
	padding: 0.4em 1em;
	border-radius: 999px;
}
.ritter-live-badge::before {
	content: "";
	width: 0.55em;
	height: 0.55em;
	border-radius: 50%;
	background: var(--wp--preset--color--accent);
	animation: ritter-pulse 2s ease-in-out infinite;
}
@keyframes ritter-pulse {
	0%, 100% { opacity: 1; }
	50% { opacity: 0.35; }
}

/* ---------- Karten ---------- */

.ritter-card {
	transition: transform 0.25s ease, box-shadow 0.25s ease;
	border: 1px solid color-mix(in srgb, var(--wp--preset--color--secondary) 7%, transparent);
}
.ritter-card:hover {
	transform: translateY(-4px);
	box-shadow: 0 14px 32px rgba(15, 36, 24, 0.10);
}

/* ---------- Scroll-Reveal ---------- */

.ritter-reveal {
	opacity: 0;
	transform: translateY(18px);
	transition: opacity 0.55s ease, transform 0.55s ease;
}
.ritter-reveal.is-visible {
	opacity: 1;
	transform: none;
}
@media (prefers-reduced-motion: reduce) {
	.ritter-reveal { opacity: 1; transform: none; }
}

/* ---------- Inline-Hervorhebung in Headlines ---------- */

h1 em, h2 em {
	font-style: normal;
	color: var(--wp--preset--color--primary);
	font-weight: inherit;
}

/* ---------- Mobil (bis 781px, WP-Spalten-Breakpoint) ---------- */

@media (max-width: 781px) {
	main .wp-block-group.alignfull {
		padding-top: var(--wp--preset--spacing--50);
		padding-bottom: var(--wp--preset--spacing--50);
	}

	/* Buttons volle Breite, Daumen-freundlich */
	.wp-block-buttons .wp-block-button,
	.wp-block-buttons .wp-block-button__link {
		width: 100%;
		text-align: center;
	}
	.wp-block-button__link {
		padding-top: 0.95rem;
		padding-bottom: 0.95rem;
		min-height: 48px;
	}

	.ritter-card { margin-bottom: var(--wp--preset--spacing--30); }
	.ritter-header { padding-top: 0.5rem; padding-bottom: 0.5rem; }
}

/* ---------- Sehr kleine Geräte (≤480px) ---------- */

@media (max-width: 480px) {
	h1, .wp-block-heading.has-xx-large-font-size {
		font-size: clamp(2rem, 9vw, 2.5rem) !important;
		letter-spacing: -0.02em;
	}
	h2, .wp-block-heading.has-x-large-font-size {
		font-size: clamp(1.6rem, 7vw, 2rem) !important;
	}
	h3, .wp-block-heading.has-large-font-size {
		font-size: 1.2rem !important;
	}
	body {
		padding-left: 0;
		padding-right: 0;
	}
}
