/* Fix: Cookie-Banner (DSGVO-Plugin) rechnet Padding auf 100% Breite drauf
   und erzeugt horizontales Scrollen auf Mobilgeräten */
#fhw_cookiehinweis {
	box-sizing: border-box;
	max-width: 100%;
}

/* Instagram-artiges Beitragsraster (Query-Loop mit className "top-home-grid").
   alignfull + gleiches padding-inline wie Header und .top-termine → gemeinsame Flucht */

.top-home-grid {
	padding-inline: clamp(1.25rem, 4vw, 4rem);
}

.top-home-grid ul.wp-block-post-template {
	display: block;
	columns: 3;
	column-gap: clamp(0.45rem, 1vw, 0.95rem);
}

.top-home-grid .wp-block-post-template > li {
	position: relative;
	overflow: hidden;
	margin: 0 0 clamp(0.45rem, 1vw, 0.95rem);
	break-inside: avoid;
	background: var(--wp--preset--color--background, #243b8c);
}

/* Kacheln ohne Beitragsbild: leerer Bilderrahmen mit Bild-Symbol
   (gleiche Optik wie „Weitere Beiträge" auf der Beitragsseite) */
.top-home-grid .wp-block-post-template > li:not(:has(figure)) {
	aspect-ratio: 1 / 1;
	background: transparent;
	border: 2px solid var(--top-hairline);
	box-sizing: border-box;
}

/* Ohne Bild verlinkt nur der Titel — Titelblock deshalb über die ganze Kachel
   spannen (Balken-Optik wandert auf den Link) und den Link darüber strecken */
.top-home-grid .wp-block-post-template > li:not(:has(figure)) .wp-block-post-title {
	inset: 0;
	padding: 0;
	background: transparent;
	display: flex;
	align-items: flex-end;
}

.top-home-grid .wp-block-post-template > li:not(:has(figure)) .wp-block-post-title a {
	display: block;
	width: 100%;
	padding: 0.6rem 0.8rem;
	background: var(--wp--preset--color--custom-venezianisches-rot, #002fa7);
}

.top-home-grid .wp-block-post-template > li:not(:has(figure)) .wp-block-post-title a::after {
	content: "";
	position: absolute;
	inset: 0;
}

.top-home-grid .wp-block-post-template > li:not(:has(figure))::before {
	content: "";
	position: absolute;
	inset: 0;
	background: var(--top-hairline);
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M8.5 13.5l2.5 3 3.5-4.5 4.5 6H5z'/%3E%3Ccircle cx='8' cy='8.5' r='1.5'/%3E%3C/svg%3E") center / 28% no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M8.5 13.5l2.5 3 3.5-4.5 4.5 6H5z'/%3E%3Ccircle cx='8' cy='8.5' r='1.5'/%3E%3C/svg%3E") center / 28% no-repeat;
	pointer-events: none;
}

.top-home-grid .wp-block-post-template > li > figure {
	margin: 0;
}

.top-home-grid .wp-block-post-featured-image img {
	display: block;
	width: 100%;
	height: auto;
}

@media (max-width: 600px) {
	.top-home-grid ul.wp-block-post-template {
		columns: 1;
	}
}

/* Titel als roter Balken, nur bei Hover/Tastaturfokus sichtbar */
.top-home-grid .wp-block-post-title {
	position: absolute;
	inset: auto 0 0 0;
	margin: 0;
	padding: 0.6rem 0.8rem;
	background: var(--wp--preset--color--custom-venezianisches-rot, #002fa7);
	font-size: 0.85rem;
	line-height: 1.35;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.12s ease;
}

.top-home-grid .wp-block-post-title a {
	color: var(--wp--preset--color--custom-farbe-2, #ece2d0);
	text-decoration: none;
}

.top-home-grid .wp-block-post-template > li:hover .wp-block-post-title,
.top-home-grid .wp-block-post-template > li:focus-within .wp-block-post-title {
	opacity: 1;
	visibility: visible;
}

/* Kacheln ohne Beitragsbild: Titel dauerhaft zeigen, sonst bleibt nur ein blauer Kasten */
.top-home-grid .wp-block-post-template > li:not(:has(figure)) .wp-block-post-title {
	opacity: 1;
	visibility: visible;
}

/* Paginierung im Seiten-Stil */
.top-home-grid .wp-block-query-pagination {
	margin-top: 2.5rem;
	font-weight: 700;
	text-transform: uppercase;
	font-size: 0.85rem;
	letter-spacing: 0.04em;
}

.top-home-grid .wp-block-query-pagination a,
.top-home-grid .wp-block-query-pagination .page-numbers {
	text-decoration: none;
	padding: 0.35rem 0.75rem;
}

.top-home-grid .wp-block-query-pagination a:hover {
	text-decoration: underline;
	text-underline-offset: 3px;
	text-decoration-thickness: 2px;
}

.top-home-grid .wp-block-query-pagination .page-numbers.current {
	background: var(--wp--preset--color--custom-venezianisches-rot, #002fa7);
	color: var(--wp--preset--color--custom-farbe-2, #ece2d0);
}
