/* Aus dem Designsystem (Komponente ReportPrint) übernommen. Wird nur von app/Views/report.php geladen —
   NICHT nach lg/p/ legen: die @page-Regeln gälten sonst für jeden Ausdruck (Zertifikat!). */
/* ========== ReportPrint · Druck- und PDF-Fassung des Sprachreports (A4 hoch) ==========
   Greift nur auf Report-Seiten (Seite enthält .gd-charts). Nur CSS auf dem bestehenden HTML.
   Kopf/Fuß über @page-Ränder (benannte Seite „report“), Umbrüche über break-*. */
@media print {
  /* ---------- Seite */
  @page {
    size: A4 portrait;
    margin: 17mm 15mm 16mm;
    @top-left { content: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2213%22 height=%2213%22 viewBox=%2296 120 468 468%22%3E%3Cpath fill=%22%230f8b8d%22 fill-rule=%22evenodd%22 d=%22M444.43,551.98L447.00,555.00L451.69,557.37L456.10,559.51L460.87,561.73L465.35,563.72L469.86,565.63L474.07,567.34L478.63,569.10L482.89,570.67L487.16,572.15L491.45,573.57L495.75,574.90L500.06,576.16L504.38,577.33L508.37,578.34L512.70,579.35L516.71,580.20L521.04,581.05L525.05,581.74L529.05,582.36L533.04,582.89L537.04,583.35L541.02,583.72L546.49,584.11L548.67,584.18L550.61,584.10L552.14,583.85L552.81,583.66L553.40,583.42L553.90,583.14L554.28,582.84L554.65,582.40L554.91,581.90L555.05,581.33L555.08,580.74L555.00,580.09L554.81,579.32L554.49,578.49L554.06,577.57L553.09,575.92L551.80,574.05L551.00,573.00L549.21,570.86L547.46,568.64L545.74,566.35L544.06,563.99L541.14,559.57L538.51,555.20L537.02,552.54L535.58,549.81L534.19,547.02L532.85,544.17L531.56,541.26L530.32,538.29L529.14,535.26L528.01,532.17L526.13,526.47L525.27,523.55L524.45,520.59L523.69,517.59L522.97,514.55L522.32,511.46L521.71,508.34L521.16,505.17L520.67,501.97L519.91,495.82L519.59,492.51L519.33,489.17L519.02,482.76A229.30,229.30 0 1 0 444.43,551.98ZM366.02,529.96A402.33,402.33 0 0 0 407.58,366.66A559.13,559.13 0 0 1 256.68,366.84A402.33,402.33 0 0 0 298.37,530.23A182.43,182.43 0 0 1 298.86,171.35A402.33,402.33 0 0 0 256.38,349.95A542.45,542.45 0 0 0 407.87,349.77A402.33,402.33 0 0 0 365.53,171.61A182.43,182.43 0 0 1 366.02,529.96ZM165.79,346.75A165.74,165.74 0 0 0 268.59,504.18A419.01,419.01 0 0 1 239.90,364.31A559.13,559.13 0 0 1 165.79,346.75ZM395.92,503.54A165.74,165.74 0 0 0 497.18,346.75A559.13,559.13 0 0 1 424.37,364.09A419.01,419.01 0 0 1 395.92,503.54ZM495.87,329.67A165.74,165.74 0 0 0 395.50,197.95A419.01,419.01 0 0 1 424.54,347.14A542.45,542.45 0 0 0 495.87,329.67ZM239.71,347.36A419.01,419.01 0 0 1 269.01,197.32A165.74,165.74 0 0 0 167.10,329.67A542.45,542.45 0 0 0 239.71,347.36Z%22%3E%3C/path%3E%3C/svg%3E") "\2002Sprachreport · Letzte 30 Tage"; font: 700 7.5pt/1 "Geologica", Arial, sans-serif; color: #12272a; vertical-align: bottom; padding-bottom: 3mm; border-bottom: .5pt solid #c0cbcd; }
    @top-right { content: "langula.app/de/sprachreport"; font: 400 7.5pt/1 "Source Sans 3", Arial, sans-serif; color: #5c6566; vertical-align: bottom; padding-bottom: 3mm; border-bottom: .5pt solid #c0cbcd; }
    @bottom-left { content: "langula.app/de/sprachreport · Quelle: Langula Sprachreport"; font: 400 7.5pt/1.2 "Source Sans 3", Arial, sans-serif; color: #5c6566; vertical-align: top; padding-top: 3mm; border-top: .5pt solid #c0cbcd; }
    @bottom-right { content: "Seite " counter(page) " von " counter(pages); font: 600 7.5pt/1.2 "Source Sans 3", Arial, sans-serif; color: #12272a; vertical-align: top; padding-top: 3mm; border-top: .5pt solid #c0cbcd; }
  }
  @page :first { margin-top: 13mm; @top-left { content: ""; border: 0; padding: 0; } @top-right { content: ""; border: 0; padding: 0; } }

  html:has(.gd-charts) { font-size: 9.5pt; background: #fff !important; }
  body:has(.gd-charts) { background: #fff !important; color: #12272a; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body:has(.gd-charts) :is(.lg-page, .lg-main) { display: block; min-height: 0 !important; height: auto !important; padding: 0 !important; }
  body:has(.gd-charts) * { -webkit-print-color-adjust: exact; print-color-adjust: exact; box-shadow: none !important; text-shadow: none !important; }
  body:has(.gd-charts) a { color: inherit; text-decoration: none; }
  body:has(.gd-charts) .lg-container { max-width: none !important; padding-inline: 0 !important; margin: 0 !important; }
  body:has(.gd-charts) .lg-sec { padding: 0 !important; margin: 0 0 6mm; background: none !important; border: 0; }

  /* ---------- Was im PDF entfällt */
  body:has(.gd-charts) :is(.lg-header__nav, .lg-header__end, .lg-header__iosbar, [data-app-bar], nav[aria-label="Brotkrumen"], .lg-crumbs, .lg-hero__actions, .lg-embed, .lg-ad, .lg-anchor, .ad-anchor, .ad-slot, .lg-house, .lg-layer, .lg-toast, .lg-footer, #ausgaben, .gd-actions, [data-guest-cta], [data-consent], .lg-consent, .fc-consent-root, .lg-resume-btn, button, textarea) { display: none !important; }
  body:has(.gd-charts) .lg-sec:has(.lg-qa), body:has(.gd-charts) .lg-sec:has(.lg-tile) { display: none !important; }

  /* ---------- Titelbereich (nur Seite 1) */
  body:has(.gd-charts) .lg-header { display: block !important; position: static !important; height: auto; background: none !important; border: 0; padding: 0; }
  body:has(.gd-charts) .lg-header__in { display: flex; justify-content: space-between; align-items: center; height: auto; padding: 0 0 3mm !important; border-bottom: 1.5pt solid #12272a; }
  body:has(.gd-charts) .lg-header__logo { display: inline-flex; align-items: center; gap: 2mm; font: 800 15pt/1 var(--font-display); letter-spacing: -.02em; color: #12272a; }
  body:has(.gd-charts) .lg-header__logo img { width: 7mm; height: 7mm; }
  body:has(.gd-charts) .lg-header__in::after { content: "Datenbericht · langula.app/de/sprachreport"; font: 600 8pt/1 var(--font-text); letter-spacing: .02em; color: #5c6566; }
  body:has(.gd-charts) .lg-hero { background: none !important; color: #12272a !important; padding: 7mm 0 0 !important; margin: 0 0 6mm; border: 0; min-height: 0; }
  body:has(.gd-charts) .lg-hero__grid { display: block !important; }
  body:has(.gd-charts) .lg-eyebrow { display: block; margin: 0 0 2mm; font: 700 8pt/1.2 var(--font-text); letter-spacing: .1em; text-transform: uppercase; color: #006768; }
  body:has(.gd-charts) .lg-hero h1 { margin: 0; max-width: 165mm; font: 800 23pt/1.08 var(--font-display); letter-spacing: -.025em; color: #12272a; }
  body:has(.gd-charts) .lg-hero__lead { margin: 3mm 0 0; max-width: 160mm; font-size: 10.5pt; line-height: 1.45; color: #3a4b4d !important; opacity: 1 !important; }
  body:has(.gd-charts) .lg-hero__text > .lg-chart__src { margin: 2mm 0 0; font: 600 8pt/1.3 var(--font-text); color: #5c6566; }
  body:has(.gd-charts) .lg-hero__side { margin-top: 5mm; }
  body:has(.gd-charts) .lg-kpis { display: grid !important; grid-template-columns: 1fr 1fr 1.35fr; gap: 6mm; border: 0; border-radius: 0; background: none !important; overflow: visible; }
  body:has(.gd-charts) .lg-kpi { padding: 2.5mm 0 0; border: 0; border-top: 2pt solid #00797b; margin: 0; }
  body:has(.gd-charts) .lg-kpi b { display: block; font: 800 22pt/1 var(--font-display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: #12272a; white-space: nowrap; }
  body:has(.gd-charts) .lg-kpi .gd-kpi-sm { font-size: 13pt; line-height: 1.25; padding-top: 1.6mm; }
  body:has(.gd-charts) .lg-kpi span { display: block; margin-top: 1.2mm; font-size: 8.5pt; color: #5c6566; }

  /* „Das Wichtigste in Kürze“ – Kasten */
  body:has(.gd-charts) .lg-hero + .lg-sec .gd-cprose { padding: 4mm 5mm 4.5mm; border: .75pt solid #12272a; border-inline-start: 3pt solid #00797b; border-radius: 1.5mm; background: #ecfafa; break-inside: avoid; max-width: none; }
  body:has(.gd-charts) .gd-cprose h2 { margin: 0 0 2.5mm; font: 800 12pt/1.2 var(--font-display); letter-spacing: -.01em; color: #12272a; break-after: avoid; }
  body:has(.gd-charts) .lg-hero + .lg-sec .gd-cprose ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 1.6mm; }
  body:has(.gd-charts) .lg-hero + .lg-sec .gd-cprose li { position: relative; padding-inline-start: 5mm; font-size: 9.5pt; line-height: 1.4; }
  body:has(.gd-charts) .lg-hero + .lg-sec .gd-cprose li::before { content: ""; position: absolute; inset-inline-start: 0; top: 1.5mm; width: 2.2mm; height: 2.2mm; background: #00797b; }

  /* ---------- Diagramme: zwei Spalten, lange über die volle Breite */
  body:has(.gd-charts) .gd-charts { display: grid !important; grid-template-columns: 1fr 1fr; gap: 8mm 9mm; align-items: start; }
  body:has(.gd-charts) :is(#grafik-sprachen, #grafik-sprachpaare, #grafik-uhrzeit) { grid-column: 1 / -1; }
  body:has(.gd-charts) .lg-chart { margin: 0; padding: 0; border: 0; border-radius: 0; background: none !important; break-inside: avoid; page-break-inside: avoid; }
  body:has(.gd-charts) .lg-chart__head { display: block; margin: 0 0 3mm; padding-top: 2mm; border-top: 1pt solid #12272a; break-after: avoid; }
  body:has(.gd-charts) .lg-chart__title { margin: 0; font: 800 11pt/1.2 var(--font-display); letter-spacing: -.01em; color: #12272a; }
  body:has(.gd-charts) .lg-chart__sub { margin: 1mm 0 0; font-size: 8pt; line-height: 1.35; color: #5c6566; }
  body:has(.gd-charts) .lg-chart > .lg-chart__src { margin: 2.5mm 0 0; font: 400 7pt/1.2 var(--font-text); color: #5c6566; }

  /* Balken */
  body:has(.gd-charts) .lg-hbars { gap: 1.3mm; }
  body:has(.gd-charts) .lg-hbars li { grid-template-columns: 27mm 1fr 15mm; gap: 2.5mm; min-height: 4.4mm; font-size: 8.5pt; line-height: 1.15; }
  body:has(.gd-charts) #grafik-sprachen .lg-hbars li { grid-template-columns: 30mm 1fr 15mm; }
  body:has(.gd-charts) #grafik-sprachpaare .lg-hbars li { grid-template-columns: 44mm 1fr 15mm; }
  body:has(.gd-charts) .lg-hbars li > span:first-child { overflow-wrap: anywhere; }
  /* Lange Listen (ab 17 Zeilen, z. B. alle 26 Sprachen): zweispaltig, damit das Diagramm auf Seite 1 bleibt */
  body:has(.gd-charts) .lg-chart .lg-hbars:has(> li:nth-child(17)) { display: block; columns: 2; column-gap: 9mm; }
  body:has(.gd-charts) .lg-chart .lg-hbars:has(> li:nth-child(17)) li { margin-bottom: 1.3mm; grid-template-columns: 26mm 1fr 13mm; break-inside: avoid; }
  body:has(.gd-charts) .lg-hbars__bar { grid-column: auto; height: 3.4mm; background: #ecf1f2 !important; border-inline-start: .75pt solid #12272a; }
  body:has(.gd-charts) .lg-hbars__bar span { background: #00797b !important; border-radius: 0 .8mm .8mm 0; }
  body:has(.gd-charts) .lg-hbars__bar span[style*="--v:100%"] { background: #ffb38a !important; box-shadow: inset 0 0 0 .6pt #954c28 !important; }
  body:has(.gd-charts) .lg-hbars b { font-size: 8.5pt; font-weight: 700; white-space: nowrap; text-align: end; font-variant-numeric: tabular-nums; }
  body:has(.gd-charts) .lg-hbars li:first-child > span:first-child { font-weight: 700; }
  /* Negative Werte (Template setzt class="is-neg"): schraffiert + Minuszeichen im Text – auch ohne Farbe erkennbar */
  body:has(.gd-charts) .lg-hbars li.is-neg .lg-hbars__bar span { background: repeating-linear-gradient(135deg, #12272a 0 .45mm, #ffffff .45mm 1.2mm) !important; box-shadow: inset 0 0 0 .6pt #12272a !important; }
  body:has(.gd-charts) .lg-hbars li.is-neg b { font-weight: 600; }

  /* Säulen (Uhrzeit) */
  body:has(.gd-charts) .lg-cols { gap: 2mm; }
  body:has(.gd-charts) .lg-cols__y { height: 34mm; font-size: 7pt; color: #5c6566; translate: 0 1mm; }
  body:has(.gd-charts) .lg-cols__plot { height: 34mm; gap: .9mm; border-bottom: .75pt solid #12272a; background: linear-gradient(#dadfe0 .5pt, transparent .5pt) 0 0 / 100% 25% !important; }
  body:has(.gd-charts) .lg-cols__c span { background: #00797b !important; border-radius: .6mm .6mm 0 0; }
  body:has(.gd-charts) .lg-cols__c span[style*="--v:100%"] { background: #ffb38a !important; box-shadow: inset 0 0 0 .6pt #954c28 !important; }
  body:has(.gd-charts) .lg-cols__x { gap: .9mm; font-size: 7pt; color: #5c6566; margin-top: 1mm; }

  /* „Noch nicht genug Daten“ */
  body:has(.gd-charts) .lg-chart > .lg-muted { margin: 0; padding: 5mm; min-height: 24mm; box-sizing: border-box; border: .75pt dashed #788284; border-radius: 1.5mm; font-size: 8.5pt; line-height: 1.4; color: #3a4b4d; }
  body:has(.gd-charts) .lg-chart > .lg-muted::before { content: "Noch nicht genug Daten"; display: block; margin-bottom: 1.5mm; font: 700 9.5pt/1.2 var(--font-display); color: #12272a; }

  /* ---------- Methodik + Für Redaktionen: bleiben zusammen am Ende */
  body:has(.gd-charts) .lg-sec:has(+ #presse) { break-inside: avoid; margin: 0 0 5mm; }
  body:has(.gd-charts) .lg-sec:has(+ #presse) .gd-cprose { columns: 2; column-gap: 9mm; max-width: none; border-top: 1pt solid #12272a; padding-top: 2mm; }
  body:has(.gd-charts) .lg-sec:has(+ #presse) .gd-cprose h2 { column-span: all; margin-bottom: 2mm; }
  body:has(.gd-charts) .lg-sec:has(+ #presse) .gd-cprose p { margin: 0 0 2mm; font-size: 8.5pt; line-height: 1.45; color: #3a4b4d; orphans: 3; widows: 3; break-inside: avoid-column; }
  body:has(.gd-charts) #presse { break-inside: avoid; }
  body:has(.gd-charts) #presse .lg-cta { display: block; padding: 4mm 5mm; border: .75pt solid #12272a; border-radius: 1.5mm; background: #fff !important; color: #12272a; }
  body:has(.gd-charts) #presse h2 { margin: 0 0 1.5mm; font: 800 11pt/1.2 var(--font-display); }
  body:has(.gd-charts) #presse p { margin: 0; font-size: 9pt; line-height: 1.45; }
  body:has(.gd-charts) #presse p::after { content: "Link: https://langula.app/de/sprachreport/"; display: block; margin-top: 1.5mm; font-weight: 700; }
  body:has(.gd-charts) #presse .gd-mail { font-weight: 700; color: #006768; }

  /* ---------- Allgemeine Umbruchregeln */
  body:has(.gd-charts) :is(h1, h2, h3, .lg-chart__head) { break-after: avoid; page-break-after: avoid; }
  body:has(.gd-charts) :is(.lg-kpis, .lg-hbars li, .lg-cols, figure) { break-inside: avoid; }
  body:has(.gd-charts) p { orphans: 3; widows: 3; }
}
