/**
 * PW Basis – ergänzende Styles.
 * Alles, was theme.json abbilden kann, steht dort. Hier nur, was darüber hinausgeht.
 */

/* ---------- Grundlagen ---------- */

/*
 * Ersatzschrift mit an Inter angepassten Maßen: Bis Inter geladen ist, nimmt der
 * Text denselben Platz ein, beim Wechsel springt nichts (Lighthouse: CLS).
 * Werte aus den Metriken von Inter 4.1 gegenüber Arial/Liberation Sans berechnet.
 */
@font-face {
	font-family: "Inter Fallback";
	src: local("Arial"), local("Liberation Sans"), local("Helvetica");
	size-adjust: 107.34%;
	ascent-override: 90.25%;
	descent-override: 22.47%;
	line-gap-override: 0%;
}

html {
	scroll-padding-top: 1rem;
}

body {
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
	font-feature-settings: "cv11", "ss01";
}

/* Sichtbarer Tastaturfokus auf hellen und dunklen Flächen (WCAG 2.4.7). */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
	outline: 3px solid var(--wp--preset--color--accent);
	outline-offset: 2px;
	box-shadow: 0 0 0 5px var(--wp--preset--color--contrast);
	border-radius: 2px;
}

.has-primary-dark-background-color :where(a, button):focus-visible,
.has-primary-background-color :where(a, button):focus-visible {
	box-shadow: none;
}

/* Text nicht über volle Bildschirmbreite laufen lassen. */
:where(.wp-block-post-content) > p,
:where(.wp-block-post-content) > ul,
:where(.wp-block-post-content) > ol {
	max-width: min(100%, 44rem);
}

::selection {
	background: var(--wp--preset--color--accent);
	color: var(--wp--preset--color--contrast);
}

/* ---------- Kopfbereich ---------- */

.pwit-topbar:not(:has(.wp-block-pwit-contact-info)) {
	display: none;
}

@media (max-width: 600px) {
	.pwit-topbar .is-field-address {
		display: none;
	}
}

.pwit-topbar a {
	text-decoration: none;
}

.pwit-topbar a:hover {
	text-decoration: underline;
}

.pwit-layout-klassisch .pwit-header {
	border-bottom: 4px solid var(--wp--preset--color--accent);
	background: var(--wp--preset--color--base);
}

.pwit-brand .wp-block-site-logo img {
	display: block;
}

.wp-block-navigation .wp-block-navigation-item__content {
	text-decoration: none;
	padding-block: 0.25rem;
	border-bottom: 2px solid transparent;
}

.wp-block-navigation .wp-block-navigation-item__content:hover,
.wp-block-navigation .current-menu-item > .wp-block-navigation-item__content {
	border-bottom-color: var(--wp--preset--color--accent);
}

.wp-block-navigation .current-menu-item > .wp-block-navigation-item__content {
	font-weight: 700;
}

.wp-block-navigation__responsive-container.is-menu-open {
	padding: var(--wp--preset--spacing--30);
}

.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content {
	font-size: var(--wp--preset--font-size--large);
}

/* ---------- Fußbereich ---------- */

/* Kein Weißraum zwischen letztem Abschnitt und Fußbereich – der Hauptbereich bringt eigenen Abstand mit. */
.wp-site-blocks > footer {
	margin-block-start: 0;
}

.pwit-footer .wp-block-navigation .wp-block-navigation-item__content:hover {
	border-bottom-color: var(--wp--preset--color--accent);
}

.pwit-footer-bottom {
	border-top: 1px solid color-mix(in srgb, var(--wp--preset--color--base) 25%, transparent);
}

.pwit-plain-list {
	list-style: none;
	padding-left: 0;
}

.pwit-plain-list li + li {
	margin-top: 0.5rem;
}

/* ---------- Bausteine des Themes ---------- */

/* Bilder mit festem Seitenverhältnis reservieren ihren Platz schon vor dem Laden (Lighthouse: CLS). */
.wp-block-image img[style*="aspect-ratio"] {
	width: 100%;
}

/* Versetzter Farbblock hinter Bildern – das wiedererkennbare Element der Variante „Klassisch“. */
.is-style-pwit-offset img,
.pwit-offset img {
	box-shadow: 0.875rem 0.875rem 0 0 var(--wp--preset--color--accent);
	border-radius: 4px;
}

.is-style-pwit-offset,
.pwit-offset {
	margin-right: 0.875rem;
	margin-bottom: 0.875rem;
}

/* Beitragskarten im Raster */
.pwit-card .wp-block-post-featured-image img {
	border-radius: 4px;
}

.pwit-card .wp-block-post-title {
	margin-top: 0;
}

.pwit-card .wp-block-post-date + .wp-block-post-title {
	margin-top: 0.125rem;
}

/* Hinweis-/Infokasten */
.is-style-pwit-hinweis {
	border-left: 4px solid var(--wp--preset--color--accent);
	background: var(--wp--preset--color--surface);
	padding: var(--wp--preset--spacing--30);
}

/* Button „Kontur“ */
.wp-block-button.is-style-outline > .wp-block-button__link {
	background: transparent;
	color: var(--wp--preset--color--primary);
	border-color: currentColor;
}

.wp-block-button.is-style-outline > .wp-block-button__link:hover {
	background: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--base);
	border-color: var(--wp--preset--color--primary);
}

/* Buttons auf dunklen Flächen */
:is(.has-primary-background-color, .has-primary-dark-background-color) .wp-block-button:not(.is-style-outline) > .wp-block-button__link {
	background: var(--wp--preset--color--accent);
	border-color: var(--wp--preset--color--accent);
	color: var(--wp--preset--color--contrast);
}

:is(.has-primary-background-color, .has-primary-dark-background-color) .wp-block-button:not(.is-style-outline) > .wp-block-button__link:hover {
	background: var(--wp--preset--color--base);
	border-color: var(--wp--preset--color--base);
}

:is(.has-primary-background-color, .has-primary-dark-background-color) .wp-block-button.is-style-outline > .wp-block-button__link {
	color: var(--wp--preset--color--base);
}

:is(.has-primary-background-color, .has-primary-dark-background-color) .wp-block-button.is-style-outline > .wp-block-button__link:hover {
	background: var(--wp--preset--color--base);
	color: var(--wp--preset--color--primary-dark);
	border-color: var(--wp--preset--color--base);
}

/* ---------- Formulare (Basis, u. a. für FluentForms) ---------- */

:where(input[type="text"], input[type="email"], input[type="tel"], input[type="url"], input[type="search"], input[type="number"], input[type="date"], textarea, select) {
	font: inherit;
	color: var(--wp--preset--color--contrast);
	background: var(--wp--preset--color--base);
	border: 1px solid var(--wp--preset--color--muted);
	border-radius: 4px;
	padding: 0.625rem 0.75rem;
}

.wp-block-search__button {
	margin-left: 0.5rem;
}

/*
 * FluentForms an die Website anpassen.
 * FluentForms bringt eigene Farben mit (Blau, teils als Inline-Style am Button),
 * daher hier gezielt mit höherer Spezifität bzw. !important.
 */
/* FluentForms-eigene Variablen auf die Theme-Farben setzen (greift auch für Elemente ohne eigene Regel unten). */
.fluentform {
	--fluentform-primary: var(--wp--preset--color--primary);
	--fluentform-secondary: var(--wp--preset--color--contrast);
	--fluentform-danger: #b42318;
	--fluentform-border-color: var(--wp--preset--color--muted);
	--fluentform-border-radius: 4px;
}

.fluentform .ff-el-group {
	margin-bottom: 1.25rem;
}

.fluentform .ff-el-input--label label {
	font-weight: 600;
	color: var(--wp--preset--color--contrast);
}

.fluentform .ff-el-is-required.asterisk-right label::after,
.fluentform .ff-el-is-required.asterisk-left label::before {
	color: var(--wp--preset--color--contrast);
}

.fluentform .ff-el-form-control {
	font: inherit;
	font-size: var(--wp--preset--font-size--medium);
	color: var(--wp--preset--color--contrast);
	background: var(--wp--preset--color--base);
	border: 1px solid var(--wp--preset--color--muted);
	border-radius: 4px;
	padding: 0.625rem 0.75rem;
	line-height: 1.5;
	box-shadow: none;
}

.fluentform .ff-el-form-control:focus {
	border-color: var(--wp--preset--color--primary);
	box-shadow: 0 0 0 1px var(--wp--preset--color--primary);
}

.fluentform .ff-el-form-control::placeholder {
	color: var(--wp--preset--color--muted);
	opacity: 1;
}

.fluentform .ff-el-form-check label.ff-el-form-check-label {
	display: inline-flex;
	gap: 0.625rem;
	align-items: flex-start;
	line-height: 1.5;
}

/* Einwilligung: FluentForms setzt sie als Tabellenzeile – Abstand zwischen Kästchen und Text. */
.fluentform .ff-el-tc label.ff_tc_label > div {
	padding-left: 0.625rem;
}

.fluentform .ff-el-tc label.ff_tc_label > span {
	padding-top: 0.15rem !important;
}

.fluentform .ff-el-form-check-input {
	accent-color: var(--wp--preset--color--primary);
	width: 1.125rem;
	height: 1.125rem;
	margin-top: 0.2em;
	flex: none;
}

.fluentform .ff-btn-submit,
.fluentform .ff-btn-submit.ff_btn_style {
	font: inherit;
	font-weight: 600;
	background-color: var(--wp--preset--color--primary) !important;
	border: 2px solid var(--wp--preset--color--primary) !important;
	color: var(--wp--preset--color--base) !important;
	border-radius: 4px;
	padding: 0.75rem 1.375rem;
	line-height: 1.3;
	opacity: 1;
}

.fluentform .ff-btn-submit:hover {
	background-color: var(--wp--preset--color--primary-dark) !important;
	border-color: var(--wp--preset--color--primary-dark) !important;
}

.fluentform .ff-el-is-error .ff-el-form-control {
	border-color: #b42318;
	box-shadow: 0 0 0 1px #b42318;
}

.fluentform .error.text-danger,
.fluentform .ff-el-is-error .text-danger {
	color: #b42318;
	font-size: var(--wp--preset--font-size--small);
	margin-top: 0.375rem;
}

.ff-message-success {
	border: 0 !important;
	border-left: 4px solid var(--wp--preset--color--primary) !important;
	background: var(--wp--preset--color--surface) !important;
	box-shadow: none !important;
	color: var(--wp--preset--color--contrast);
	padding: var(--wp--preset--spacing--30) !important;
	border-radius: 0 4px 4px 0;
}

/* ---------- Bewegung reduzieren ---------- */

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

/* ---------- Layout „Modern“ ---------- */

/* Runde Schaltflächen, weichere Ecken. */
.pwit-layout-modern .wp-element-button,
.pwit-layout-modern .wp-block-button__link,
.pwit-layout-modern .fluentform .ff-btn-submit {
	border-radius: 999px;
}

.pwit-layout-modern .pwit-header {
	background: var(--wp--preset--color--base);
	box-shadow: 0 1px 0 var(--wp--preset--color--border);
}

/* Kopfbereich liegt transparent über dem Titelbild der Startseite. */
.pwit-has-hero .wp-site-blocks {
	position: relative;
}

.pwit-has-hero .wp-site-blocks > header {
	position: absolute;
	inset: 0 0 auto;
	z-index: 20;
}

.pwit-has-hero .pwit-header {
	background: transparent;
	box-shadow: none;
}

.pwit-has-hero .pwit-header .wp-block-site-title a,
.pwit-has-hero .pwit-header .wp-block-navigation__responsive-container:not(.is-menu-open) .wp-block-navigation-item__content,
.pwit-has-hero .pwit-header .wp-block-navigation__responsive-container-open {
	color: var(--wp--preset--color--base);
}

.pwit-has-hero .pwit-header .wp-block-site-title a:focus-visible,
.pwit-has-hero .pwit-header .wp-block-navigation-item__content:focus-visible {
	box-shadow: none;
}

/* Titelbild: Text unten links, an der Inhaltsbreite ausgerichtet. */
.pwit-einstieg-modern {
	align-items: flex-end;
}

/* Abstand oben, damit Überschrift und Kopfbereich sich nicht überlagern. */
.pwit-has-hero .pwit-einstieg-modern:first-child {
	padding-top: calc(var(--wp--preset--spacing--60) + 5rem) !important;
}

/* Schaltflächen auf dem Titelbild: Akzent bzw. weiße Kontur. */
.wp-block-cover .wp-block-button:not(.is-style-outline) > .wp-block-button__link {
	background: var(--wp--preset--color--accent);
	border-color: var(--wp--preset--color--accent);
	color: var(--wp--preset--color--contrast);
}

.wp-block-cover .wp-block-button.is-style-outline > .wp-block-button__link {
	color: var(--wp--preset--color--base);
}

.wp-block-cover .wp-block-button > .wp-block-button__link:hover {
	background: var(--wp--preset--color--base);
	border-color: var(--wp--preset--color--base);
	color: var(--wp--preset--color--contrast);
}

.pwit-layout-modern .pwit-footer .wp-block-navigation-item__content {
	color: var(--wp--preset--color--contrast);
}

.pwit-layout-modern .pwit-footer-bottom {
	border-top-color: var(--wp--preset--color--border);
}

/* ---------- Layout „Kompakt“ ---------- */

.pwit-layout-kompakt .pwit-header {
	background: var(--wp--preset--color--base);
	text-align: center;
}

.pwit-layout-kompakt .pwit-nav-band {
	border-top: 1px solid var(--wp--preset--color--border);
	border-bottom: 3px solid var(--wp--preset--color--primary);
	margin-top: var(--wp--preset--spacing--30);
}

.pwit-layout-kompakt .pwit-brand .wp-block-site-logo img {
	margin-inline: auto;
}

.pwit-layout-kompakt .pwit-footer .wp-block-site-title {
	text-align: center;
}

.pwit-layout-kompakt .pwit-footer-contact .wp-block-pwit-contact-info {
	justify-content: center;
}

/* Rechtliche Links in einer Zeile (Modern, Kompakt) */
.pwit-legal-links ul {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem 1.25rem;
	list-style: none;
	margin: 0;
	padding: 0;
}
