/*
Theme Name: Lokalverein
Theme URI: https://lokalverein-wenden.de
Author: Landwirtschaftlicher Lokalverein für die Gemeinde Wenden e.V.
Description: Schlankes Block-Theme für den Lokalverein Wenden. Ohne externe Schriften oder Abhängigkeiten, pflegbar komplett über den Website-Editor.
Requires at least: 6.6
Tested up to: 6.9
Requires PHP: 8.0
Version: 1.1.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: lokalverein
*/

/* Alles Gestalterische steht in theme.json – hier nur, was dort nicht geht. */

html {
	scroll-behavior: smooth;
}

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

.lv-header {
	position: sticky;
	top: 0;
	z-index: 50;
	backdrop-filter: saturate(1.4) blur(10px);
	-webkit-backdrop-filter: saturate(1.4) blur(10px);
	background-color: color-mix(in srgb, var(--wp--preset--color--base) 88%, transparent);
	border-bottom: 1px solid var(--wp--preset--color--line);
}

.admin-bar .lv-header {
	top: var(--wp-admin--admin-bar--height, 32px);
}

@media (max-width: 600px) {
	.admin-bar .lv-header {
		top: 0;
	}
}

.lv-header .wp-block-site-logo img {
	width: auto;
	max-height: 64px;
}

.lv-header .wp-block-navigation .wp-block-navigation-item__content {
	padding: 0.4em 0.1em;
	border-bottom: 2px solid transparent;
	transition: border-color 0.15s ease;
}

.lv-header .wp-block-navigation .wp-block-navigation-item__content:hover,
.lv-header .wp-block-navigation .wp-block-navigation-item__content[aria-current="page"] {
	border-bottom-color: var(--wp--preset--color--accent);
}

/* „Mitglied werden“ im Menü automatisch als Button hervorheben */
.lv-header .wp-block-navigation-item > a[href*="mitglied-werden"] {
	padding: 0.45em 1.1em;
	border: 0;
	border-radius: 999px;
	background: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--surface);
	white-space: nowrap;
}

.lv-header .wp-block-navigation-item > a[href*="mitglied-werden"]:hover {
	background: var(--wp--preset--color--primary-dark);
}

.lv-header .wp-block-navigation__responsive-container.is-menu-open a[href*="mitglied-werden"] {
	display: inline-block;
	margin-top: 0.5em;
}

.lv-header .wp-block-navigation__submenu-container {
	border-radius: 10px;
	border: 1px solid var(--wp--preset--color--line) !important;
	box-shadow: var(--wp--preset--shadow--soft);
	padding: 0.4em 0 !important;
}

.lv-header .wp-block-navigation__submenu-container .wp-block-navigation-item__content {
	padding: 0.45em 1.1em;
	border-bottom: 0;
}

/* ---------- Startseite: Hero ---------- */

.lv-hero {
	position: relative;
	overflow: hidden;
	isolation: isolate;
}

/* Dezentes Ackerfurchen-Muster, rein per CSS */
.lv-hero::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	opacity: 0.09;
	background-image: repeating-linear-gradient(
		-24deg,
		#fff 0 2px,
		transparent 2px 26px
	);
	mask-image: linear-gradient(90deg, transparent 20%, #000 100%);
	-webkit-mask-image: linear-gradient(90deg, transparent 20%, #000 100%);
}

/* Auf Folgeseiten der Beitragsliste kein Hero */
.paged .lv-hero,
.paged .lv-quicklinks {
	display: none;
}

.lv-date-badge {
	display: inline-flex;
	flex-direction: column;
	gap: 0.15em;
	padding: 1em 1.4em;
	border-radius: 14px;
	background: rgb(255 255 255 / 0.1);
	border: 1px solid rgb(255 255 255 / 0.25);
}

.lv-date-badge__label {
	font-size: var(--wp--preset--font-size--small);
	text-transform: uppercase;
	letter-spacing: 0.08em;
	opacity: 0.85;
}

.lv-date-badge__date {
	font-family: var(--wp--preset--font-family--heading);
	font-size: var(--wp--preset--font-size--x-large);
	line-height: 1.15;
}

.lv-date-badge__hint {
	font-size: var(--wp--preset--font-size--small);
	opacity: 0.85;
}

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

.lv-card {
	height: 100%;
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.lv-card:hover {
	transform: translateY(-2px);
	box-shadow: var(--wp--preset--shadow--soft);
}

/* Ganze Karte klickbar über den Titel-Link */
.lv-card {
	position: relative;
}

.lv-card :is(.wp-block-post-title, .wp-block-heading) a::after {
	content: "";
	position: absolute;
	inset: 0;
}

.lv-card .wp-block-post-terms a,
.lv-card .wp-block-read-more {
	position: relative;
	z-index: 1;
}

.lv-card .wp-block-post-featured-image img {
	aspect-ratio: 16 / 9;
	object-fit: cover;
}

.wp-block-post-template.is-layout-grid > li {
	height: 100%;
}

/* ---------- Inhalte (auch ältere Classic-Editor-Inhalte) ---------- */

.wp-block-post-content {
	display: flow-root; /* fängt alte float-Layouts ein */
	overflow-wrap: break-word;
}

/* Lange, nackte URLs als Linktext dürfen überall umbrechen */
.wp-block-post-content a {
	overflow-wrap: anywhere;
}

/* Klassische Bildunterschriften ([caption]) haben feste Pixelbreiten */
.wp-block-post-content .wp-caption {
	width: auto !important;
	max-width: 100%;
}

.wp-block-post-content .wp-caption-text {
	margin-top: 0.4em;
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--contrast-soft);
}

.wp-block-post-content iframe,
.wp-block-post-content video,
.wp-block-post-content embed {
	max-width: 100%;
}

.wp-block-post-content iframe[src*="youtube"],
.wp-block-post-content iframe[src*="vimeo"] {
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 9;
	border-radius: 12px;
}

/* Hochgeladene Videos ([video]-Shortcode) so breit wie YouTube-Einbettungen */
.wp-block-post-content .wp-video {
	width: 100% !important;
}

.wp-block-post-content .wp-video video,
.wp-block-post-content .wp-video .mejs-container {
	width: 100% !important;
	height: auto !important;
	aspect-ratio: 16 / 9;
	border-radius: 12px;
	overflow: hidden;
}

.wp-block-post-content img {
	max-width: 100%;
	height: auto;
	border-radius: 8px;
}

/* Alte Tabellen haben oft feste Pixelbreiten (z. B. Impressum) – immer an die Spalte anpassen */
.wp-block-post-content table,
.wp-block-post-content :is(th, td) {
	width: auto !important;
}

.wp-block-post-content table {
	width: 100% !important;
	max-width: 100%;
	overflow-wrap: anywhere;
	border-collapse: collapse;
	font-size: var(--wp--preset--font-size--small);
}

.wp-block-post-content th,
.wp-block-post-content td {
	padding: 0.6em 0.75em;
	border-bottom: 1px solid var(--wp--preset--color--line);
	text-align: left;
}

/* Alte Inline-Spaltenlayouts (z. B. Vorstand) auf dem Handy untereinander */
@media (max-width: 640px) {
	.wp-block-post-content div[style*="float: left"],
	.wp-block-post-content div[style*="float:left"] {
		float: none !important;
		width: 100% !important;
	}
}

/* ---------- Formulare (Formidable u. a.) ---------- */

.wp-block-post-content input[type="text"],
.wp-block-post-content input[type="email"],
.wp-block-post-content input[type="tel"],
.wp-block-post-content input[type="number"],
.wp-block-post-content input[type="date"],
.wp-block-post-content select,
.wp-block-post-content textarea {
	font: inherit;
	border-radius: 8px;
}

.wp-block-post-content :is(input, select, textarea):focus-visible {
	outline: 2px solid var(--wp--preset--color--primary);
	outline-offset: 1px;
}

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

.lv-footer ul {
	list-style: none;
}

.lv-footer a {
	text-decoration: none;
}

.lv-footer a:hover {
	text-decoration: underline;
}

.lv-footer .wp-block-social-links .wp-social-link {
	background: rgb(255 255 255 / 0.12) !important;
	color: #fff !important;
}

.lv-footer .wp-block-social-links .wp-social-link:hover {
	background: var(--wp--preset--color--accent) !important;
	color: var(--wp--preset--color--contrast) !important;
}

/* ---------- Barrierefreiheit ---------- */

:where(a, button, .wp-element-button):focus-visible {
	outline: 2px solid var(--wp--preset--color--accent);
	outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}

	.lv-card {
		transition: none;
	}
}

/* ---------- Seitennummerierung ---------- */

.wp-block-query-pagination-numbers {
	display: flex;
	gap: 0.25rem;
}

.wp-block-query-pagination-numbers .page-numbers {
	min-width: 2.2em;
	padding: 0.35em 0.6em;
	border-radius: 999px;
	text-align: center;
	text-decoration: none;
}

.wp-block-query-pagination-numbers .page-numbers.current {
	background: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--surface);
}

/* Logo im Fußbereich: auf heller Karte, da das Logo einen weißen Hintergrund hat */
.lv-footer-logo img {
	padding: 0.6rem;
	border-radius: 12px;
	background: #fff;
	box-sizing: content-box;
}

/* Handy: Logo kleiner, Untertitel ausblenden, damit das Menü-Symbol in der Zeile bleibt */
@media (max-width: 600px) {
	.lv-header .wp-block-site-logo img {
		max-height: 44px;
	}

	.lv-header .wp-block-site-tagline {
		display: none;
	}

	.lv-header .wp-block-site-title {
		font-size: 1.05rem;
	}

	.lv-header > .alignwide {
		flex-wrap: nowrap !important;
		gap: 0.75rem !important;
	}
}
