/*
Theme Name: BDKJ Hessen
Author: Visualtech GmbH
Author URI: https://visualtech.de
Description: Website des BDKJ Hessen: Startseite mit Kopfbildern und Kontaktformular, dazu Impressum und Datenschutz. Version 2 (Oktober 2026) ohne Plugins, barrierefrei, Farben und Schriften auch im Editor.
Version: 2.0.0
Requires at least: 7.1
Requires PHP: 8.4
Text Domain: bdkjhessen
*/

/*
 * Farben und Schriften stehen in theme.json (gelten auch im Editor). Kontraste:
 *   Text #333 auf Weiß 12,6:1 · dunkle Schrift #1e1e1e auf BDKJ-Grün #77b800 6,5:1
 *   Links #4a7500 auf Weiß 5,5:1 · Überschriften #5f9400 auf Weiß 3,7:1 (nur große Schrift)
 *   Weiße Schrift auf #77b800 hätte nur 2,4:1 – deshalb seit 2.0 dunkle Schrift auf Grün.
 */

:root {
	--bdkj-rand: 50px;
	--bdkj-auf-gruen: #1e1e1e;
	--bdkj-gruen-rahmen: #3a5a00;
	--bdkj-fehler: #7a0000;
}

*,
*::before,
*::after {
	box-sizing: border-box;
}

body {
	margin: 0;
	-webkit-text-size-adjust: 100%;
}

img {
	display: block;
	max-width: 100%;
	height: auto;
}

:focus-visible {
	outline: 3px solid;
	outline-offset: 2px;
}

.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

.sprunglink {
	position: absolute;
	top: -100px;
	left: 1rem;
	z-index: 100;
	padding: .75rem 1rem;
	background: #fff;
	color: var(--wp--preset--color--text);
	font-weight: bold;
}

.sprunglink:focus {
	top: 1rem;
}

main:focus {
	outline: none;
}

/* --- Kopf der Startseite ----------------------------------------------------------- */

.kopf {
	position: relative;
}

.kopf-segel {
	position: absolute;
	top: 0;
	left: 0;
	z-index: 5;
	width: 30%;
	aspect-ratio: 394 / 270;
	background: url("assets/img/segel.png") no-repeat 0 0 / 100% auto;
}

.kopf-segel .logo {
	position: absolute;
	top: 0;
	left: 0;
	display: block;
	width: 40%;
	margin: 4%;
}

.kopf--ohne-bilder .kopf-segel {
	position: relative;
}

.kopfbilder {
	position: relative;
}

.kopfbilder-liste {
	position: relative;
	aspect-ratio: 2280 / 970;
	overflow: hidden;
	background: #eee;
}

.kopfbild {
	position: absolute;
	inset: 0;
	opacity: 0;
	transition: opacity 1.4s ease;
}

.kopfbild.ist-aktiv {
	opacity: 1;
}

.kopfbild img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.kopfbilder-steuerung {
	position: absolute;
	bottom: 8px;
	left: 0;
	z-index: 10;
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 4px;
	width: 100%;
}

.kopfbilder-steuerung[hidden] {
	display: none;
}

.kopfbilder-steuerung button {
	display: grid;
	place-items: center;
	width: 28px;
	height: 28px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	cursor: pointer;
}

.kopfbilder-steuerung button:focus-visible {
	outline-color: #fff;
	box-shadow: 0 0 0 5px #1e1e1e;
}

.kopfbilder-punkt::before {
	content: "";
	width: 14px;
	height: 14px;
	border: 2px solid #fff;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 0 0 1px rgba(0, 0, 0, .45);
	transition: background-color .3s ease;
}

.kopfbilder-punkt[aria-current="true"]::before {
	background: var(--wp--preset--color--blau);
}

.kopfbilder-pause {
	margin-right: 6px !important;
	background: rgba(0, 0, 0, .55) !important;
}

/* Pause: zwei Balken; angehalten: Dreieck */
.kopfbilder-pause-symbol {
	width: 10px;
	height: 12px;
	border-inline: 3px solid #fff;
}

.ist-angehalten .kopfbilder-pause-symbol {
	width: 0;
	height: 0;
	margin-left: 3px;
	border-block: 7px solid transparent;
	border-inline: 11px solid #fff;
	border-inline-end: 0;
}

/* --- Kopf der Unterseiten ---------------------------------------------------------- */

.kopf-schmal {
	max-width: calc(900px + 2 * var(--bdkj-rand));
	margin: 0 auto;
	padding: 1.5rem var(--bdkj-rand) 0;
}

.kopf-segel--schmal {
	position: static;
	width: auto;
	aspect-ratio: auto;
	background: none;
}

.kopf-segel--schmal .logo {
	position: static;
	width: 160px;
	margin: 0;
}

/* --- Inhalt ------------------------------------------------------------------------ */

.inhalt {
	padding-bottom: var(--bdkj-rand);
}

.inhalt--start {
	padding-bottom: 0;
}

.begruessung {
	margin: 2rem auto;
	padding: 0 var(--bdkj-rand);
	text-align: center;
}

/* Inhalt aus dem Editor: alles auf 900 px, Gruppen „volle Breite“ über die ganze Seite */
.eintrag > *,
.zurueck {
	max-width: calc(900px + 2 * var(--bdkj-rand));
	margin-inline: auto;
	padding-inline: var(--bdkj-rand);
}

.eintrag > .alignfull {
	max-width: none;
	padding: var(--bdkj-rand);
}

.eintrag > .alignfull > * {
	max-width: 900px;
	margin-inline: auto;
}

.eintrag > .alignfull > :first-child {
	margin-top: 0;
}

.eintrag > .alignfull > :last-child {
	margin-bottom: 0;
}

body:not(.home) .eintrag h1 {
	margin: 0 auto 1.5rem;
	text-align: center;
}

body:not(.home) .eintrag h2,
body:not(.home) .eintrag h3 {
	color: var(--wp--preset--color--gruen-schrift);
	margin-bottom: .2rem;
}

body:not(.home) .eintrag h3 {
	font-weight: 700;
}

.zurueck {
	margin-top: 1rem;
	margin-bottom: 1.5rem;
	font-size: .875rem;
}

.eintrag h2 {
	margin-bottom: 1.5rem;
}

/* Grüne Fläche (Blockstil der Gruppe) */
.is-style-gruen {
	background: var(--wp--preset--color--gruen);
	color: var(--bdkj-auf-gruen);
}

.is-style-gruen :where(h1, h2, h3, h4, h5, h6),
.is-style-gruen a {
	color: inherit;
}

/* Logos (Blockstil der Galerie): ungeschnitten nebeneinander */
.wp-block-gallery.is-style-logos {
	gap: 60px;
	justify-content: space-between;
}

.wp-block-gallery.is-style-logos.has-nested-images figure.wp-block-image:not(#individual-image) {
	flex-grow: 0;
	width: calc((100% - 120px) / 3);
}

.wp-block-gallery.is-style-logos.has-nested-images figure.wp-block-image img {
	height: auto;
	object-fit: contain;
}

/* --- Kontaktformular (inc/kontakt.php) --------------------------------------------- */

.kontakt {
	position: relative;
	color: var(--bdkj-auf-gruen);
}

.kontakt-hp {
	position: absolute;
	left: -10000px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.kontakt-feld {
	margin: 0 0 1rem;
}

.kontakt label {
	display: block;
	margin-bottom: 7px;
}

.kontakt input,
.kontakt textarea {
	display: block;
	width: 100%;
	padding: .9rem 1rem;
	border: 2px solid var(--bdkj-gruen-rahmen);
	border-radius: 5px;
	background: #fff;
	color: var(--bdkj-auf-gruen);
	font: inherit;
}

.kontakt textarea {
	min-height: 15rem;
	resize: vertical;
}

.kontakt [aria-invalid="true"] {
	border-color: var(--bdkj-fehler);
	border-width: 3px;
}

.kontakt-fehler {
	display: block;
	margin-top: .3rem;
	font-weight: bold;
}

.kontakt-fehler:empty {
	display: none;
}

.kontakt-meldung {
	margin-bottom: 1rem;
	background: #fff;
	border-radius: 5px;
	font-weight: bold;
}

.kontakt-meldung:not(:empty) {
	padding: .9rem 1rem;
	border-left: 6px solid var(--bdkj-gruen-rahmen);
}

.kontakt-meldung.ist-fehler {
	border-left-color: var(--bdkj-fehler);
}

.kontakt-senden {
	display: flex;
	justify-content: flex-end;
	margin: 0;
}

.kontakt button[type="submit"] {
	min-width: 25%;
	min-height: 3rem;
	padding: .75rem 2rem;
	border: 2px solid var(--bdkj-gruen-rahmen);
	border-radius: 5px;
	background: #fff;
	color: var(--bdkj-auf-gruen);
	font: inherit;
	font-weight: bold;
	cursor: pointer;
	transition: background-color .3s ease, color .3s ease;
}

.kontakt button[type="submit"]:hover,
.kontakt button[type="submit"]:focus-visible {
	background: var(--bdkj-auf-gruen);
	color: #fff;
}

.kontakt button[disabled] {
	opacity: .7;
	cursor: wait;
}

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

.fuss {
	padding: 1.5rem var(--bdkj-rand);
	background: var(--wp--preset--color--fuss);
	color: #fff;
	font-size: .875rem;
}

.fuss-inhalt {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	align-items: center;
	gap: .5rem 2rem;
	max-width: 900px;
	min-height: 2rem;
	margin: 0 auto;
}

.fuss p {
	margin: 0;
}

.fuss-menue ul {
	display: flex;
	gap: 1rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.fuss-menue a {
	position: relative;
	display: inline-block;
	padding: .25rem 0;
	color: #fff;
	text-decoration: none;
}

.fuss-menue a::after {
	content: "";
	position: absolute;
	left: 0;
	bottom: -2px;
	width: 0;
	height: 3px;
	background: #fff;
	transition: width .3s ease;
}

.fuss-menue a:hover::after,
.fuss-menue a:focus-visible::after {
	width: 100%;
}

/* --- Kleinere Bildschirme ---------------------------------------------------------- */

@media (max-width: 800px) {
	.kopf-segel {
		width: 40%;
	}

	/* Rechts unten steht auf den Bildern der Schriftzug */
	.kopfbilder-steuerung {
		justify-content: flex-start;
		left: 8px;
		bottom: 4px;
	}
}

@media (max-width: 600px) {
	.wp-block-gallery.is-style-logos {
		gap: 30px;
	}

	.wp-block-gallery.is-style-logos.has-nested-images figure.wp-block-image:not(#individual-image) {
		width: calc((100% - 60px) / 3);
	}
}

@media (max-width: 550px) {
	.fuss-inhalt {
		flex-direction: column;
		text-align: center;
	}
}

@media (max-width: 500px) {
	:root {
		--bdkj-rand: 25px;
	}

	.kopf-segel {
		width: 50%;
	}

	.kopf-segel--schmal .logo {
		width: 120px;
	}

	.eintrag > .alignfull {
		padding-block: 35px;
	}
}

@media (max-width: 450px) {
	html {
		font-size: 14px;
	}

	.wp-block-gallery.is-style-logos {
		flex-direction: column;
		align-items: center;
		gap: 35px;
	}

	.wp-block-gallery.is-style-logos.has-nested-images figure.wp-block-image:not(#individual-image) {
		width: 100%;
		max-width: 220px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.kopfbild,
	.kopfbilder-punkt::before,
	.fuss-menue a::after,
	.kontakt button[type="submit"] {
		transition: none;
	}
}
