/*
Theme Name: Burgwinkel Digital
Theme URI: https://www.burgwinkeldigital.de
Author: Lars Burgwinkel
Description: Schlankes Block-Theme fuer Burgwinkel Digital. Beratung und Umsetzung aus einer Hand.
Version: 0.1.0
Requires at least: 6.5
Tested up to: 6.8
Requires PHP: 8.1
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: burgwinkel-digital
Tags: block-theme, one-column, custom-colors, custom-menu, accessibility-ready
*/

/* Fast alles Gestalterische steht in theme.json.
   Hier stehen nur Dinge, die theme.json nicht abbilden kann. */

/* Sichtbarer Fokusring fuer Tastaturnutzung - wichtig fuer Barrierearmut. */
:where(a, button, input, textarea, select, summary, .wp-block-button__link):focus-visible {
	outline: 3px solid var(--wp--preset--color--terrakotta-dunkel);
	outline-offset: 2px;
	border-radius: 2px;
}

/* Sprunglink zum Inhalt, nur bei Tastaturfokus sichtbar. */
.skip-link:not(:focus) {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

/* Aktuelle Seite in der Navigation: gefuellte Terrakotta-Flaeche.
   Kontrast Elfenbein auf #B05024 betraegt 4,9:1 und erfuellt damit WCAG AA. */
.wp-block-navigation .wp-block-navigation-item > a[aria-current="page"],
.wp-block-navigation .wp-block-navigation-item.current-menu-item > a {
	background-color: var(--wp--preset--color--terrakotta-dunkel);
	color: var(--wp--preset--color--elfenbein);
	border-radius: 5px;
	padding-block: 0.35em;
	padding-inline: 0.8em;
	text-decoration: none;
}

/* Der Ausgleich verhindert, dass die gefuellte Flaeche die Zeile auseinanderdrueckt. */
.wp-block-navigation:not(.is-responsive) .wp-block-navigation__container {
	align-items: center;
}

/* ---------------------------------------------------------------------------
   Prozessablauf: links die Schritte, rechts die Erklaerung.
   Die Quellblocke bleiben im Markup stehen und werden nur ausgeblendet,
   sobald das Skript die auswaehlbare Fassung daneben aufgebaut hat.
   --------------------------------------------------------------------------- */

.bd-prozess__quelle.is-ersetzt {
	display: none;
}

.bd-prozess__interaktiv {
	display: grid;
	grid-template-columns: 1fr;
	gap: var(--wp--preset--spacing--40);
	margin-top: var(--wp--preset--spacing--50);
}

@media (min-width: 782px) {
	.bd-prozess__interaktiv {
		grid-template-columns: minmax(15rem, 36%) 1fr;
		gap: var(--wp--preset--spacing--50);
		align-items: start;
	}
}

.bd-prozess__liste {
	display: flex;
	flex-direction: column;
}

.bd-prozess__knopf {
	position: relative;
	display: flex;
	align-items: center;
	gap: 0.9rem;
	width: 100%;
	margin: 0;
	padding: 0.85rem 1rem;
	border: 0;
	border-radius: 6px;
	background: none;
	font: inherit;
	color: var(--wp--preset--color--gruen);
	text-align: left;
	cursor: pointer;
	transition: background-color 0.15s ease;
}

/* Verbindungslinie von einer Ziffer zur naechsten. */
.bd-prozess__knopf::after {
	content: "";
	position: absolute;
	left: 2.125rem;
	top: 50%;
	width: 2px;
	height: 100%;
	background: var(--wp--preset--color--sand);
}

.bd-prozess__knopf:last-child::after {
	display: none;
}

.bd-prozess__ziffer {
	position: relative;
	z-index: 1;
	flex: 0 0 auto;
	display: grid;
	place-items: center;
	width: 2.25rem;
	height: 2.25rem;
	border-radius: 50%;
	background: var(--wp--preset--color--sand);
	color: var(--wp--preset--color--gruen);
	font-family: var(--wp--preset--font-family--montserrat);
	font-weight: 700;
	font-size: 0.95rem;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.bd-prozess__knopf:hover {
	background: color-mix(in srgb, var(--wp--preset--color--sand) 40%, transparent);
}

.bd-prozess__knopf.is-aktiv {
	background: var(--wp--preset--color--sand);
}

.bd-prozess__knopf.is-aktiv .bd-prozess__knopftitel {
	font-weight: 600;
}

.bd-prozess__knopf.is-aktiv .bd-prozess__ziffer,
.bd-prozess__knopf.is-erledigt .bd-prozess__ziffer {
	background: var(--wp--preset--color--terrakotta-dunkel);
	color: var(--wp--preset--color--elfenbein);
}

.bd-prozess__tafel {
	border: 1px solid var(--wp--preset--color--sand);
	border-radius: 8px;
	padding: var(--wp--preset--spacing--40);
	background: var(--wp--preset--color--elfenbein);
}

.bd-prozess__tafel > :first-child {
	margin-top: 0;
}

.bd-prozess__tafel > :last-child {
	margin-bottom: 0;
}

.bd-prozess__tafeltitel {
	margin-bottom: 0.75rem;
}

/* ---------------------------------------------------------------------------
   Kontaktformular
   --------------------------------------------------------------------------- */

.bd-formular__raster {
	display: grid;
	grid-template-columns: 1fr;
	gap: var(--wp--preset--spacing--30);
}

@media (min-width: 600px) {
	.bd-formular__raster {
		grid-template-columns: 1fr 1fr;
	}

	.bd-formular__feld--voll {
		grid-column: 1 / -1;
	}
}

.bd-formular__feld {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
}

.bd-formular label {
	font-weight: 600;
	font-size: 0.9375rem;
}

.bd-formular__stern {
	color: var(--wp--preset--color--terrakotta-dunkel);
}

.bd-formular__hilfe {
	font-size: 0.875rem;
	opacity: 0.75;
}

.bd-formular input[type="text"],
.bd-formular input[type="email"],
.bd-formular input[type="tel"],
.bd-formular textarea {
	/* Ohne border-box wuerden Polsterung und Rahmen auf die Breite
	   aufgeschlagen, das Feld liefe aus seiner Spalte heraus. */
	box-sizing: border-box;
	width: 100%;
	padding: 0.7rem 0.85rem;
	border: 1px solid var(--wp--preset--color--sand);
	border-radius: 6px;
	background: var(--wp--preset--color--elfenbein);
	color: var(--wp--preset--color--gruen);
	font-family: inherit;
	font-size: 1rem;
	line-height: 1.5;
}

.bd-formular textarea {
	resize: vertical;
	min-height: 8rem;
}

.bd-formular .has-fehler input,
.bd-formular .has-fehler textarea {
	border-color: var(--wp--preset--color--terrakotta-dunkel);
	border-width: 2px;
}

.bd-formular__fehler {
	color: var(--wp--preset--color--terrakotta-dunkel);
	font-size: 0.875rem;
	font-weight: 600;
}

.bd-formular__pflichthinweis {
	margin-block: 0 var(--wp--preset--spacing--30);
	font-size: 0.875rem;
	opacity: 0.75;
}

.bd-formular__hinweis {
	margin-bottom: var(--wp--preset--spacing--30);
	padding: var(--wp--preset--spacing--30);
	border: 2px solid var(--wp--preset--color--terrakotta-dunkel);
	border-radius: 6px;
}

.bd-formular__hinweis p {
	margin: 0;
}

.bd-formular__einwilligung {
	display: grid;
	grid-template-columns: auto 1fr;
	gap: 0.6rem;
	align-items: start;
	margin-top: var(--wp--preset--spacing--40);
}

.bd-formular__einwilligung input {
	width: 1.15rem;
	height: 1.15rem;
	margin-top: 0.2rem;
	accent-color: var(--wp--preset--color--terrakotta-dunkel);
}

.bd-formular__einwilligung label {
	font-weight: 400;
	font-size: 0.9375rem;
	line-height: 1.5;
}

.bd-formular__einwilligung .bd-formular__fehler {
	grid-column: 2;
}

/* Der Honigtopf muss fuer Menschen unsichtbar bleiben, fuer automatisierte
   Skripte aber wie ein normales Feld aussehen. */
.bd-formular__honigtopf {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

.bd-formular__knopf {
	margin-top: var(--wp--preset--spacing--40);
	cursor: pointer;
	border: 0;
}

.bd-formular__erfolg {
	padding: var(--wp--preset--spacing--40);
	border: 1px solid var(--wp--preset--color--sand);
	border-left: 4px solid var(--wp--preset--color--terrakotta-dunkel);
	border-radius: 8px;
	background: var(--wp--preset--color--elfenbein);
}

.bd-formular__erfolg > :first-child { margin-top: 0; }
.bd-formular__erfolg > :last-child { margin-bottom: 0; }

/* Nur fuer Screenreader sichtbar. */
.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

/* ---------------------------------------------------------------------------
   Aufklappbare Kacheln fuer die Zielgruppen auf der Leistungsseite.
   Ohne JavaScript bleibt jeder Abschnitt offen und lesbar; erst das Skript
   ergaenzt die Klasse is-interaktiv und baut die Knoepfe.
   --------------------------------------------------------------------------- */

.bd-akkordeon__bereich {
	border: 1px solid var(--wp--preset--color--sand);
	border-radius: 8px;
	background: var(--wp--preset--color--elfenbein);
	padding: var(--wp--preset--spacing--40);
	margin-block: var(--wp--preset--spacing--30);
	/* Beim Sprung ueber einen Anker etwas Luft nach oben lassen. */
	scroll-margin-top: var(--wp--preset--spacing--40);
}

.bd-akkordeon__bereich.is-interaktiv {
	padding: 0;
	overflow: hidden;
}

.bd-akkordeon__ueberschrift {
	margin: 0;
}

.bd-akkordeon__knopf {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	width: 100%;
	margin: 0;
	padding: var(--wp--preset--spacing--40);
	border: 0;
	background: none;
	font: inherit;
	color: inherit;
	text-align: left;
	cursor: pointer;
	transition: background-color 0.15s ease;
}

.bd-akkordeon__knopf:hover {
	background: color-mix(in srgb, var(--wp--preset--color--sand) 35%, transparent);
}

.bd-akkordeon__bereich.is-offen > .bd-akkordeon__ueberschrift .bd-akkordeon__knopf {
	background: color-mix(in srgb, var(--wp--preset--color--sand) 45%, transparent);
}

/* Pfeil aus zwei Rahmenkanten, dreht sich beim Aufklappen. */
.bd-akkordeon__pfeil {
	flex: 0 0 auto;
	width: 0.65rem;
	height: 0.65rem;
	margin-inline-end: 0.35rem;
	border-right: 3px solid var(--wp--preset--color--terrakotta-dunkel);
	border-bottom: 3px solid var(--wp--preset--color--terrakotta-dunkel);
	transform: rotate(45deg);
	transition: transform 0.2s ease;
}

.bd-akkordeon__knopf[aria-expanded="true"] .bd-akkordeon__pfeil {
	transform: rotate(-135deg);
}

.bd-akkordeon__tafel {
	padding: 0 var(--wp--preset--spacing--40) var(--wp--preset--spacing--40);
}

.bd-akkordeon__tafel:not([hidden]) {
	animation: bdAufklappen 0.22s ease-out;
}

@keyframes bdAufklappen {
	from { opacity: 0; transform: translateY(-6px); }
	to   { opacity: 1; transform: none; }
}

.bd-akkordeon__tafel > :first-child {
	margin-top: 0;
}

.bd-akkordeon__tafel > :last-child {
	margin-bottom: 0;
}

/* Kompakte Fassung des Prozessablaufs: Schritte nebeneinander, Erklaerung
   darunter. Gedacht als Orientierungsstreifen oben auf einer Seite.
   Unterhalb von 782 px greift wieder die untereinander stehende Fassung. */
@media (min-width: 782px) {
	.bd-prozess--kompakt .bd-prozess__interaktiv {
		grid-template-columns: 1fr;
		gap: var(--wp--preset--spacing--40);
	}

	.bd-prozess--kompakt .bd-prozess__liste {
		flex-direction: row;
	}

	.bd-prozess--kompakt .bd-prozess__knopf {
		flex: 1 1 0;
		flex-direction: column;
		align-items: center;
		gap: 0.6rem;
		text-align: center;
	}

	/* Verbindungslinie waagerecht, auf Hoehe der Ziffernmitte. */
	.bd-prozess--kompakt .bd-prozess__knopf::after {
		left: 50%;
		top: calc(0.85rem + 1.125rem - 1px);
		width: 100%;
		height: 2px;
	}
}

/* Karten gleicher Hoehe: Die Spalte streckt sich ohnehin auf volle Hoehe,
   die Karte darin muss diese Hoehe nur uebernehmen. */
.bd-karten > .wp-block-column {
	display: flex;
}

.bd-karten > .wp-block-column > .wp-block-group {
	flex: 1;
}

/* Die Wandel-Illustration im Einstieg. Die Figur muss die Breite selbst
   vorgeben, sonst schrumpft sie auf die Standardgroesse der SVG-Datei. */
.bd-wandel.wp-block-image {
	display: block;
	width: 100%;
	max-width: 46rem;
	margin-inline: auto;
}

.bd-wandel.wp-block-image img {
	width: 100%;
	height: auto;
}

/* Die Drei-Stufen-Grafik auf der Leistungsseite. Es gibt zwei Fassungen:
   nebeneinander fuer breite Bildschirme, untereinander fuer schmale.
   Nebeneinander waeren die drei Felder auf dem Handy nur rund 70 px breit
   und damit unlesbar. */
.bd-stufen.wp-block-image {
	display: block;
	width: 100%;
	margin-inline: auto;
}

.bd-stufen.wp-block-image img {
	width: 100%;
	height: auto;
}

/* Die Doppelklasse ist noetig, weil .bd-stufen.wp-block-image oben
   bereits display:block setzt. */
.bd-stufen--breit.wp-block-image {
	display: none;
}

@media (min-width: 782px) {
	.bd-stufen--breit.wp-block-image {
		display: block;
	}

	.bd-stufen--hoch.wp-block-image {
		display: none;
	}
}

/* Auf schmalen Bildschirmen frisst der grosse Innenabstand zu viel Breite.
   Das !important ist noetig, weil der Blockeditor den Abstand als
   Inline-Stil schreibt und der sonst gewinnt. */
@media (max-width: 781px) {
	.bd-stufenkasten {
		padding-left: var(--wp--preset--spacing--30) !important;
		padding-right: var(--wp--preset--spacing--30) !important;
	}
}

/* Die Elfenbein-Flaeche im Footer traegt das farbige Logo. Sie umschliesst
   das Bild eng, damit sie nicht als leerer Kasten wirkt. */
.bd-logo-flaeche figure {
	margin: 0;
}

/* Lange deutsche Komposita wie "Verbraucherstreitbeilegung" sprengen auf
   schmalen Displays sonst die Spalte. Die Silbentrennung greift ueber das
   lang-Attribut, das WordPress am html-Element setzt. */
h1, h2, h3, h4, h5, h6 {
	overflow-wrap: break-word;
	hyphens: auto;
}

p, li, dd, dt, figcaption {
	overflow-wrap: break-word;
}

/* Bilder nie ueber die Spaltenbreite hinaus. */
img,
figure {
	max-width: 100%;
	height: auto;
}

/* Nutzer mit reduzierter Bewegung nicht animieren. */
@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
}
