/*
 * Wohnbau Flipbook – Übersicht der Ausgaben und Blätterbuch.
 * Farben über die Kadence-Palette (mit Ersatzwerten); die Werkzeugleiste ist bewusst dunkel
 * („short black“ wie im alten Blätterbuch), Knöpfe mindestens 44 × 44 px.
 */

.wbfb-raster,
.wbfb-inline,
.wbfb-leser,
.wbfb-overlay {
	--wbfb-blau: var(--global-palette1, #0089d0);
	--wbfb-blau-dunkel: var(--wb-blau-dark, #0070ab);
	--wbfb-ueberschrift: var(--global-palette4, #0089d0);
	--wbfb-grau: var(--global-palette5, #565656);
	--wbfb-hellblau: var(--global-palette3, #7fc4e7);
	--wbfb-mint: var(--global-palette7, #d5f2ef);
	--wbfb-weiss: var(--global-palette9, #fff);
	--wbfb-leiste-oben: #3c3c3c;
	--wbfb-leiste-unten: #222;
	--wbfb-symbol: #f0f0f0;
}

/* ------------------------------------------------------------------ */
/* Übersicht [wohnbau_magazin] – Aufbau wie das alte Archiv             */
/* ------------------------------------------------------------------ */

.wbfb-raster {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(max(210px, calc((100% - (var(--wbfb-spalten, 4) - 1) * 30px) / var(--wbfb-spalten, 4))), 1fr));
	gap: 40px 30px;
	max-width: 1200px;
	margin: 0 auto;
}

.wbfb-karte {
	display: flex;
	flex-direction: column;
	text-align: center;
	min-width: 0;
}

.wbfb-karte .wbfb-cover {
	display: block;
	margin-bottom: 16px;
	border-radius: 4px;
	text-decoration: none;
}

.wbfb-karte .wbfb-cover img,
.wbfb-kein-bild {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 210 / 297; /* DIN A4 – alle Titel gleich hoch */
	object-fit: cover; /* abweichende Bildformate füllen den Rahmen, statt kleiner zu wirken */
	object-position: top center;
	box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
	transition: transform 0.2s ease;
}

.wbfb-kein-bild {
	background: var(--wbfb-mint);
	box-shadow: none;
}

.wbfb-karte .wbfb-cover:hover img,
.wbfb-karte .wbfb-cover:focus-visible img {
	transform: scale(1.03);
}

.wbfb-karte .wbfb-cover:focus-visible {
	outline: 3px solid var(--wbfb-blau-dunkel);
	outline-offset: 4px;
}

.wbfb-karte .wbfb-ausgabe {
	margin: 0 0 14px;
	font-size: 17px;
	line-height: 1.5;
	color: var(--wbfb-grau);
}

.wbfb-ausgabe-titel {
	font-size: 19px;
	font-weight: 700;
	color: var(--wbfb-ueberschrift);
}

.wbfb-knoepfe {
	margin-top: auto; /* Knöpfe immer bündig unten */
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
}

.wbfb-raster .wbfb-knopf,
.wbfb-leser .wbfb-knopf,
.wbfb-inline .wbfb-knopf {
	box-sizing: border-box;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	max-width: 240px;
	min-height: 48px;
	margin: 0;
	padding: 10px 16px;
	border: 2px solid var(--wbfb-blau);
	border-radius: 999px;
	box-shadow: none;
	font-family: inherit;
	font-size: 19px;
	font-weight: 700;
	line-height: 1.25;
	text-align: center;
	text-decoration: none;
	text-transform: none;
	letter-spacing: normal;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.wbfb-raster .wbfb-knopf-pdf,
.wbfb-leser .wbfb-knopf-pdf,
.wbfb-inline .wbfb-knopf-pdf {
	background: var(--wbfb-blau);
	color: #fff;
}

.wbfb-raster .wbfb-knopf-blaettern {
	background: #fff;
	color: var(--wbfb-blau-dunkel);
}

.wbfb-raster .wbfb-knopf:hover,
.wbfb-raster .wbfb-knopf:focus-visible,
.wbfb-leser .wbfb-knopf:hover,
.wbfb-leser .wbfb-knopf:focus-visible,
.wbfb-inline .wbfb-knopf:hover,
.wbfb-inline .wbfb-knopf:focus-visible {
	background: var(--wbfb-grau);
	border-color: var(--wbfb-grau);
	color: #fff;
	text-decoration: none;
}

.wbfb-raster .wbfb-knopf:focus-visible,
.wbfb-inline .wbfb-knopf:focus-visible,
.wbfb-leser .wbfb-knopf:focus-visible {
	outline: 3px solid var(--wbfb-blau-dunkel);
	outline-offset: 3px;
}

.wbfb-raster .wbfb-knopf[hidden] {
	display: none;
}

@media (max-width: 500px) {
	.wbfb-raster {
		grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
		gap: 32px 16px;
	}

	.wbfb-raster .wbfb-knopf {
		padding: 8px 10px;
	}

	.wbfb-raster .wbfb-knopf-blaettern {
		font-size: 17px;
	}
}

.wbfb-hinweis {
	padding: 12px 16px;
	border-left: 4px solid var(--wbfb-blau);
	background: var(--wbfb-mint);
}

/* ------------------------------------------------------------------ */
/* Blätterbuch auf der Seite [wohnbau_flipbook]                         */
/* ------------------------------------------------------------------ */

.wbfb-inline {
	position: relative;
	margin: 0 auto 1.5em;
}

.wbfb-inline.ist-aktiv {
	height: min(var(--wbfb-hoehe, 950px), 88vh);
	min-height: 440px;
}

.wbfb-inline .wbfb-ersatz {
	text-align: center;
}

/* ------------------------------------------------------------------ */
/* Der Leser                                                           */
/* ------------------------------------------------------------------ */

.wbfb-leser {
	position: relative;
	display: flex;
	flex-direction: column;
	box-sizing: border-box;
	width: 100%;
	height: 100%;
	min-height: 0;
	font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
	font-size: 17px;
	line-height: 1.4;
	color: var(--wbfb-symbol);
	outline: none;
}

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

.wbfb-leser:focus-visible {
	outline: 3px solid var(--wbfb-hellblau);
	outline-offset: -3px;
}

.wbfb-flaeche {
	position: relative;
	flex: 1 1 auto;
	min-height: 0;
}

.wbfb-buehne {
	position: absolute;
	inset: 0;
	display: flex;
	overflow: hidden;
	touch-action: pan-y; /* senkrecht scrollt die Seite, waagerecht wird geblättert */
	-webkit-user-select: none;
	user-select: none;
	-webkit-tap-highlight-color: transparent;
	cursor: pointer;
}

.wbfb-leser .wbfb-pfeil {
	touch-action: pan-y; /* Wischen darf auch auf den Pfeilen beginnen */
}

.ist-overlay .wbfb-buehne,
.ist-vollbild .wbfb-buehne,
.wbfb-leser.ist-overlay .wbfb-pfeil,
.wbfb-leser.ist-vollbild .wbfb-pfeil {
	touch-action: none;
}

.ist-gezoomt .wbfb-buehne {
	overflow: auto;
	touch-action: pan-x pan-y;
	cursor: grab;
}

.ist-gezoomt .wbfb-buehne.ist-verschieben {
	cursor: grabbing;
}

.wbfb-buch {
	position: relative;
	flex: none;
	margin: auto; /* mittig, beim Zoomen trotzdem ganz scrollbar */
}

.wbfb-innen {
	position: absolute;
	inset: 0;
	transform-style: preserve-3d;
}

.wbfb-fang {
	position: absolute;
	inset: 0;
	z-index: 2;
}

.wbfb-seite {
	position: absolute;
	top: 0;
	width: 50%;
	height: 100%;
	background: #fff;
}

.wbfb-links {
	left: 0;
}

.wbfb-rechts {
	left: 50%;
}

.ist-einzeln .wbfb-links {
	display: none;
}

.ist-einzeln .wbfb-rechts {
	left: 0;
	width: 100%;
}

.wbfb-papier {
	position: absolute;
	inset: 0;
	overflow: hidden;
	background: #fff no-repeat center / 100% 100%;
}

/* Buchrücken: leichte Schattierung zur Mitte hin. */
.wbfb-papier::after {
	content: "";
	position: absolute;
	inset: 0;
	pointer-events: none;
}

.ist-doppel .wbfb-links .wbfb-papier::after {
	background: linear-gradient(to left, rgba(0, 0, 0, 0.22), rgba(0, 0, 0, 0.07) 3%, rgba(0, 0, 0, 0) 11%);
}

.ist-doppel .wbfb-rechts .wbfb-papier::after {
	background: linear-gradient(to right, rgba(0, 0, 0, 0.22), rgba(0, 0, 0, 0.07) 3%, rgba(0, 0, 0, 0) 11%);
}

.ist-einzeln .wbfb-rechts .wbfb-papier::after {
	background: linear-gradient(to right, rgba(0, 0, 0, 0.14), rgba(0, 0, 0, 0) 5%);
}

.wbfb-schatten {
	position: absolute;
	inset: 0;
	z-index: 1;
	pointer-events: none;
}

/* Seite wird noch gezeichnet. */
.wbfb-papier.laedt::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 40px;
	height: 40px;
	margin: -20px 0 0 -20px;
	border: 4px solid #ddd;
	border-top-color: #888;
	border-radius: 50%;
	animation: wbfb-drehen 0.9s linear infinite;
}

/* Das bewegte Blatt: verschachtelte Streifen (siehe flipbook.js). */
.wbfb-blatt {
	position: absolute;
	top: 0;
	left: 50%;
	width: 50%;
	height: 100%;
	transform: translateZ(1px);
	transform-style: preserve-3d;
	pointer-events: none;
}

.wbfb-blatt[hidden] {
	display: none;
}

.ist-einzeln .wbfb-blatt {
	left: 0;
	width: 100%;
}

.wbfb-streifen {
	position: absolute;
	top: 0;
	height: 100%;
	transform-origin: 0 50%;
	transform-style: preserve-3d;
}

.wbfb-fl {
	position: absolute;
	top: 0;
	left: 0;
	width: calc(100% + 1px); /* überlappt den Nachbarn: keine Haarlinien (Hintergrund in %, bleibt passgenau) */
	height: 100%;
	-webkit-backface-visibility: hidden;
	backface-visibility: hidden;
	background-color: #fff;
	background-repeat: no-repeat;
	opacity: var(--wbfb-deckkraft, 1);
}

.wbfb-fl-vorn {
	background-image: linear-gradient(to right, rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0) 9%), var(--wbfb-vorn, none);
}

.wbfb-fl-hinten {
	transform: rotateY(180deg);
	background-image: linear-gradient(to left, rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0) 9%), var(--wbfb-hinten, none);
}

.ist-leer-hinten .wbfb-fl-hinten {
	background-image: linear-gradient(to left, #e6e6e6, #fafafa 35%, #f2f2f2);
}

.wbfb-licht {
	position: absolute;
	inset: 0;
}

/* Große Pfeile links und rechts (wie im alten Blätterbuch). */
.wbfb-leser .wbfb-pfeil {
	position: absolute;
	top: 50%;
	z-index: 3;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 56px;
	height: 56px;
	margin: -28px 0 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.94);
	box-shadow: 0 1px 6px rgba(0, 0, 0, 0.28);
	color: #333;
	cursor: pointer;
}

.wbfb-leser .wbfb-pfeil svg {
	width: 30px;
	height: 30px;
}

.wbfb-pfeil-zurueck {
	left: 12px;
}

.wbfb-pfeil-weiter {
	right: 12px;
}

.wbfb-leser .wbfb-pfeil:hover {
	background: #fff;
	color: #000;
}

.wbfb-leser .wbfb-pfeil:focus-visible {
	outline: 3px solid var(--wbfb-blau-dunkel);
	outline-offset: 2px;
}

.ist-overlay .wbfb-pfeil,
.ist-vollbild .wbfb-pfeil {
	background: rgba(50, 50, 50, 0.9);
	color: var(--wbfb-symbol);
}

.wbfb-leser.ist-overlay .wbfb-pfeil:hover,
.wbfb-leser.ist-vollbild .wbfb-pfeil:hover {
	background: #555;
	color: #fff;
}

.ist-overlay .wbfb-pfeil:focus-visible,
.ist-vollbild .wbfb-pfeil:focus-visible {
	outline-color: var(--wbfb-hellblau);
}

.wbfb-leser .wbfb-pfeil[aria-disabled="true"] {
	visibility: hidden;
}

/* Handy: Pfeile würden Text am Seitenrand verdecken – Blättern per Leiste, Tippen oder Wischen. */
.wbfb-leser.ist-schmal .wbfb-pfeil {
	display: none;
}

.ist-schmal .wbfb-pfeil svg {
	width: 24px;
	height: 24px;
}

.ist-schmal .wbfb-pfeil-zurueck {
	left: 4px;
}

.ist-schmal .wbfb-pfeil-weiter {
	right: 4px;
}

/* Werkzeugleiste */
.wbfb-leiste {
	flex: none;
	align-self: center;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 4px 10px;
	max-width: calc(100% - 16px);
	margin: 10px auto 12px;
	padding: 4px 8px;
	border-radius: 6px;
	background-color: var(--wbfb-leiste-oben);
	background-image: linear-gradient(to bottom, var(--wbfb-leiste-oben), var(--wbfb-leiste-unten));
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.wbfb-gruppe {
	display: flex;
	align-items: center;
	gap: 2px;
}

.wbfb-gruppe + .wbfb-gruppe {
	padding-left: 10px;
	border-left: 1px solid #4d4d4d;
}

.wbfb-leser .wbfb-kn {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 46px;
	height: 46px;
	min-height: 0;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 4px;
	background: transparent;
	box-shadow: none;
	color: var(--wbfb-symbol);
	font: inherit;
	line-height: 1;
	text-decoration: none;
	cursor: pointer;
}

.wbfb-leser .wbfb-kn[hidden] {
	display: none;
}

.wbfb-leser .wbfb-kn:hover {
	background: #4d4d4d;
	color: #fff;
}

.wbfb-leser .wbfb-kn:focus-visible,
.wbfb-overlay .wbfb-zu:focus-visible {
	outline: 3px solid var(--wbfb-hellblau);
	outline-offset: 1px;
}

.wbfb-leser .wbfb-kn[aria-disabled="true"] {
	opacity: 0.4;
	background: transparent;
	cursor: default;
}

.wbfb-seitenwahl {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 0 6px;
	color: var(--wbfb-symbol);
	white-space: nowrap;
}

.wbfb-leser .wbfb-feld {
	width: 3.4em;
	height: 40px;
	min-height: 0;
	margin: 0;
	padding: 0 4px;
	border: 1px solid #6a6a6a;
	border-radius: 4px;
	background: rgba(255, 255, 255, 0.1);
	box-shadow: none;
	color: #fff;
	font: inherit;
	font-size: 17px;
	text-align: center;
}

.wbfb-leser .wbfb-feld:focus {
	border-color: var(--wbfb-hellblau);
	background: rgba(0, 0, 0, 0.35);
	outline: 3px solid var(--wbfb-hellblau);
	outline-offset: 1px;
	color: #fff;
}

.wbfb-gesamt {
	min-width: 2.6em;
	font-size: 17px;
	text-align: left;
}

/* Kurzhilfe über den Knöpfen (Maus und Tastatur). */
@media (hover: hover) {
	.wbfb-leser .wbfb-kn[data-tipp]:hover::after,
	.wbfb-overlay .wbfb-zu[data-tipp]:hover::after {
		content: attr(data-tipp);
		position: absolute;
		bottom: calc(100% + 10px);
		left: 50%;
		z-index: 6;
		padding: 6px 10px;
		border-radius: 4px;
		background: #111;
		color: #fff;
		font-size: 15px;
		line-height: 1.3;
		white-space: nowrap;
		transform: translateX(-50%);
		pointer-events: none;
	}

	.wbfb-overlay .wbfb-zu[data-tipp]:hover::after {
		top: calc(100% + 6px);
		bottom: auto;
		left: auto;
		right: 0;
		transform: none;
	}
}

.wbfb-leser .wbfb-kn[data-tipp]:focus-visible::after {
	content: attr(data-tipp);
	position: absolute;
	bottom: calc(100% + 10px);
	left: 50%;
	z-index: 6;
	padding: 6px 10px;
	border-radius: 4px;
	background: #111;
	color: #fff;
	font-size: 15px;
	line-height: 1.3;
	white-space: nowrap;
	transform: translateX(-50%);
	pointer-events: none;
}

/* Schmale Ansicht (Handy): Blättern oben, Werkzeuge darunter. */
.ist-schmal .wbfb-leiste {
	gap: 2px 6px;
	margin: 6px auto 8px;
	padding: 4px;
}

.ist-schmal .wbfb-gruppe-nav {
	order: -1;
	flex-basis: 100%;
	justify-content: center;
}

.ist-schmal .wbfb-gruppe + .wbfb-gruppe {
	padding-left: 0;
	border-left: 0;
}

.ist-schmal .wbfb-gruppe-mehr {
	padding-left: 6px;
	border-left: 1px solid #4d4d4d;
}

/* Laden und Fehler */
.wbfb-laden {
	position: absolute;
	top: 50%;
	left: 50%;
	z-index: 4;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
	min-width: 220px;
	padding: 16px 20px;
	border-radius: 8px;
	background: #1a1a1a;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
	color: #f2f2f2;
	font-size: 17px;
	transform: translate(-50%, -50%);
}

.wbfb-laden[hidden],
.wbfb-fehler[hidden] {
	display: none;
}

.wbfb-kreis {
	width: 36px;
	height: 36px;
	border: 4px solid #555;
	border-top-color: var(--wbfb-hellblau);
	border-radius: 50%;
	animation: wbfb-drehen 0.9s linear infinite;
}

.wbfb-balken {
	display: block;
	width: 180px;
	height: 6px;
	overflow: hidden;
	border-radius: 3px;
	background: #444;
}

.wbfb-balken span {
	display: block;
	width: 0;
	height: 100%;
	background: var(--wbfb-hellblau);
	transition: width 0.2s linear;
}

.wbfb-fehler {
	position: absolute;
	top: 50%;
	left: 50%;
	z-index: 5;
	width: min(92%, 440px);
	padding: 24px;
	border-radius: 12px;
	background: #fff;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
	color: var(--wbfb-grau);
	text-align: center;
	transform: translate(-50%, -50%);
}

.wbfb-fehler p {
	margin: 0 0 16px;
	font-size: 18px;
	line-height: 1.5;
}

.ist-fehler .wbfb-pfeil,
.ist-fehler .wbfb-gruppe-zoom,
.ist-fehler .wbfb-gruppe-nav {
	visibility: hidden;
}

@keyframes wbfb-drehen {
	to {
		transform: rotate(360deg);
	}
}

/* ------------------------------------------------------------------ */
/* Overlay und Vollbild                                                */
/* ------------------------------------------------------------------ */

html.wbfb-gesperrt,
html.wbfb-gesperrt body {
	overflow: hidden;
}

.wbfb-overlay {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	background: rgba(18, 18, 18, 0.92);
	outline: none;
}

.wbfb-overlay-rahmen {
	position: relative;
	display: flex;
	flex: 1 1 auto;
	min-width: 0;
	min-height: 0;
	margin: 58px 8px 0;
}

.wbfb-overlay .wbfb-zu {
	position: absolute;
	top: 5px;
	right: 8px;
	z-index: 7;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	box-shadow: none;
	color: #fff;
	cursor: pointer;
}

.wbfb-overlay .wbfb-zu svg {
	width: 30px;
	height: 30px;
}

.wbfb-overlay .wbfb-zu:hover {
	background: #444;
	color: #fff;
}

.wbfb-overlay:fullscreen {
	background: #161616;
}

.wbfb-leser:fullscreen {
	background: #1d1d1d;
}

.wbfb-leser.ist-pseudo-vollbild {
	position: fixed;
	inset: 0;
	z-index: 100000;
	height: auto;
	background: #1d1d1d;
}

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

@media (prefers-reduced-motion: reduce) {
	.wbfb-karte .wbfb-cover img,
	.wbfb-balken span {
		transition: none;
	}

	.wbfb-karte .wbfb-cover:hover img,
	.wbfb-karte .wbfb-cover:focus-visible img {
		transform: none;
	}

	.wbfb-kreis,
	.wbfb-papier.laedt::before {
		animation-duration: 3s;
	}
}

/* Nur für Screenreader */
.wbfb-sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}
