/*
 * JLB PDF-Export – Druckansicht im PDF-Stil (nur beim Drucken aktiv).
 * Der Artikelinhalt wird an .jlb-druck-kopf erkannt (steht als erstes Kind im Inhalt).
 */
@media print {

	html,
	body {
		background: #fff !important;
		margin: 0 !important;
		padding: 0 !important;
	}

	/* 1. Nur den Artikel drucken: alles ausblenden, was ihn weder enthält noch in ihm liegt. */
	body *:not(:has(.jlb-druck-kopf)):not(:has(> .jlb-druck-kopf) *) {
		display: none !important;
	}

	/* 2. Alle Hüllen um den Artikel neutralisieren (Spalten, Abstände, Schatten des Themes). */
	body *:has(.jlb-druck-kopf) {
		display: block !important;
		position: static !important;
		float: none !important;
		width: auto !important;
		max-width: none !important;
		min-width: 0 !important;
		height: auto !important;
		min-height: 0 !important;
		margin: 0 !important;
		padding: 0 !important;
		border: 0 !important;
		box-shadow: none !important;
		background: none !important;
		transform: none !important;
		overflow: visible !important;
		columns: auto !important;
	}

	/* 3. Typografie wie im PDF. */
	:has(> .jlb-druck-kopf) {
		font-size: 10pt !important;
		line-height: 1.55 !important;
		color: #1a1a1a !important;
	}

	:has(> .jlb-druck-kopf) :is(p, li, dd, dt, blockquote) {
		font-size: 10pt !important;
		line-height: 1.55 !important;
		color: #1a1a1a !important;
		orphans: 3;
		widows: 3;
	}

	:has(> .jlb-druck-kopf) p {
		margin: 0 0 2.6mm 0 !important;
	}

	:has(> .jlb-druck-kopf) :is(h2, h3, h4, h5, h6) {
		color: #000 !important;
		line-height: 1.12 !important;
		break-after: avoid;
		page-break-after: avoid;
		break-inside: avoid;
	}

	:has(> .jlb-druck-kopf) h2 { font-size: 17pt !important; margin: 6mm 0 1.8mm !important; }
	:has(> .jlb-druck-kopf) h3 { font-size: 14pt !important; margin: 5mm 0 1.5mm !important; }
	:has(> .jlb-druck-kopf) :is(h4, h5, h6) { font-size: 12pt !important; margin: 4mm 0 1.2mm !important; }

	:has(> .jlb-druck-kopf) a {
		color: #000 !important;
		text-decoration: underline !important;
	}

	:has(> .jlb-druck-kopf) a::after {
		content: none !important;
	}

	:has(> .jlb-druck-kopf) :is(ul, ol) {
		margin: 0 0 3mm 0 !important;
		padding-left: 6mm !important;
	}

	:has(> .jlb-druck-kopf) blockquote {
		margin: 4mm 0 !important;
		padding: 0.5mm 0 0.5mm 5mm !important;
		border: 0 !important;
		border-left: 0.8mm solid #000 !important;
		background: none !important;
		font-style: italic;
	}

	:has(> .jlb-druck-kopf) :is(img, svg, figure, table, pre, blockquote, .wp-block-image, .wp-block-gallery) {
		break-inside: avoid;
		page-break-inside: avoid;
	}

	:has(> .jlb-druck-kopf) img {
		max-width: 100% !important;
		max-height: 120mm !important;
		width: auto !important;
		height: auto !important;
		object-fit: contain;
	}

	:has(> .jlb-druck-kopf) figure {
		margin: 4mm 0 !important;
	}

	:has(> .jlb-druck-kopf) figcaption {
		font-size: 7.5pt !important;
		color: #555 !important;
		text-align: center;
	}

	:has(> .jlb-druck-kopf) table {
		width: 100% !important;
		border-collapse: collapse !important;
		font-size: 8.5pt !important;
	}

	:has(> .jlb-druck-kopf) :is(th, td) {
		border: 0.25mm solid #9a9a9a !important;
		padding: 1.6mm 2mm !important;
		background: none !important;
		color: #1a1a1a !important;
		vertical-align: top;
	}

	:has(> .jlb-druck-kopf) th {
		background: #eee !important;
		-webkit-print-color-adjust: exact;
		print-color-adjust: exact;
	}

	/* 4. Was auch im PDF fehlt: Button, Einbettungen, Formulare, Werbung, Teilen-Leisten. */
	:has(> .jlb-druck-kopf) :is(.jlb-pdf, .no-pdf, .jlb-pdf-ausblenden, iframe, video, audio, embed, object, form, button, input, select, textarea, noscript, ins, .adsbygoogle, .td-a-rec, .wp-block-embed, .wp-block-buttons, .wp-block-button, .wp-block-file, .wp-block-search, .sharedaddy, .jp-relatedposts, .td-post-sharing, .tdb_single_post_share) {
		display: none !important;
	}

	/* Inhaltsverzeichnisse: bekannte Plugins und Blöcke … */
	:has(> .jlb-druck-kopf) :is(#toc, #toc_container, #ez-toc-container, #rank-math-toc, #ftwp-container, #table-of-contents, .toc, .lwptoc, .ez-toc-container, .ez-toc-widget-container, .wp-block-rank-math-toc-block, .yoast-table-of-contents, .wp-block-yoast-seo-table-of-contents, .simpletoc, .wp-block-simpletoc-toc, .wp-block-kadence-tableofcontents, .kb-table-of-content-nav, .ht_toc, .wp-block-ht-block-toc, .ftwp-container-outer, .gb-table-of-contents, .wp-block-uagb-table-of-contents, .uagb-toc__wrap, [class*="table-of-contents"], [class*="table_of_contents"], [class*="tableofcontents"]) {
		display: none !important;
	}

	/* … und jede Box im Artikel, die nur aus Sprungmarken (#…) besteht – egal von welchem Plugin. */
	:has(> .jlb-druck-kopf) > :is(div, nav, aside, details, section):not(.jlb-druck-kopf, .jlb-druck-ende, .jlb-pdf):has(li + li a[href^="#"]):not(:has(a:not([href^="#"]), h1, h2, h3, h4, h5, h6, img, table, figure, blockquote, .wp-block-footnotes)) {
		display: none !important;
	}

	/* Alles, was andere Plugins hinter den Artikel hängen (Buchtipps, Empfehlungen …), fällt weg – wie im PDF. */
	.jlb-pdf--ende ~ :not(.jlb-druck-ende),
	.jlb-druck-ende ~ * {
		display: none !important;
	}

	/* 5. Druckkopf. */
	.jlb-druck-kopf {
		display: block !important;
		margin: 0 0 6mm 0 !important;
		padding: 0 0 3mm 0 !important;
		border-bottom: 0.25mm solid #9a9a9a !important;
		overflow: hidden;
		color: #000 !important;
	}

	.jlb-druck-qr {
		float: right;
		width: 22mm;
		margin: 0 0 2mm 6mm;
		text-align: right;
	}

	.jlb-druck-qr svg {
		display: block;
		width: 20mm;
		height: 20mm;
		margin-left: auto;
	}

	.jlb-druck-qr span {
		display: block;
		margin-top: 0.8mm;
		font: 6pt Verdana, "DejaVu Sans", sans-serif;
		color: #555;
	}

	.jlb-druck-label {
		margin: 0 0 2.4mm 0;
		font: 700 6.8pt Verdana, "DejaVu Sans", sans-serif;
		letter-spacing: 0.14em;
		text-transform: uppercase;
		color: #333;
	}

	.jlb-druck-titel {
		margin: 0 0 2.4mm 0;
		font-family: "JLB Zain Druck", Verdana, sans-serif;
		font-weight: 700;
		font-size: 28pt;
		line-height: 1.05;
		color: #000;
		overflow-wrap: break-word;
		hyphens: manual;
	}

	.jlb-druck-meta {
		font: 7.8pt Verdana, "DejaVu Sans", sans-serif;
		color: #555;
	}

	/* 6. Druckende: Steady-Teaser und Notizfeld. */
	.jlb-druck-ende {
		display: block !important;
		margin-top: 8mm !important;
	}

	.jlb-druck-box {
		margin: 0 0 8mm 0;
		padding: 3.5mm 4mm;
		border: 0.35mm solid #333;
		break-inside: avoid;
		page-break-inside: avoid;
	}

	.jlb-druck-box-titel,
	.jlb-druck-notizen-titel {
		margin: 0 0 1.5mm 0;
		font-family: "JLB Zain Druck", Verdana, sans-serif;
		font-weight: 700;
		font-size: 14pt;
		line-height: 1.1;
		color: #000;
	}

	.jlb-druck-box-text,
	.jlb-druck-box-link {
		font-size: 8.6pt;
		line-height: 1.5;
	}

	.jlb-druck-box-link {
		margin-top: 1.5mm;
		font-weight: 700;
		text-decoration: underline;
	}

	.jlb-druck-notizen {
		break-inside: avoid;
		page-break-inside: avoid;
	}

	.jlb-druck-linie {
		height: 8.5mm;
		border-bottom: 0.2mm solid #9a9a9a;
	}
}
