/* print.css — benutzerfreundliches Drucken für OMCD e.V. Seiten
   - Entfernt Dekorationen (Hintergründe, Navigation, Footer)
   - Macht Inhalt breit und gut lesbar
   - Fügt sichtbare URLs in Klammern nach Links ein
   - Verhindert das Abschneiden von Bildern / Tabellen
*/

/* Page / basics */
@media print {
  @page {
    margin: 12mm; /* Standard-Seitenrand für Druck */
    size: auto;
  }

  /* Grundlegende Stile für Druck */
  html, body {
    background: #fff !important;
    -webkit-print-color-adjust: exact;
    font-family: "Georgia", "Times", serif;
    font-size: 12pt;
    line-height: 1.4;
  }

  /* Entferne Hintergrundbild und sonstige Dekorationen */
  body.custom-background,
  body.custom-background * {
    background: none !important;
    background-image: none !important;
  }

  /* Zusätzlich spezifische Elemente verstecken */
  [class*="grecaptcha-badge"],
  [class*="menu-skip-links"],
  [class*="site-header"],
  [class*="comments-area-inner"],
  [id*="cmplz-cookiebanner-container"],
  [id*="comments"],
  #cmplz-manage-consent,
  .cmplz-manage-consent,
  #secondary,
  .widget-area.sidebar {
    background: none !important;
    display: none !important;
    visibility: none !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* Hauptinhalt soll die ganze Breite nutzen */
  #main, main {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    background: none !important;
  }

  /* Titel und Überschriften */
  .entry-title, h1.entry-title, h1 {
    display: block;
    font-size: 18pt;
    font-weight: 700;
    margin: 0 0 0.4em 0;
    break-after: avoid-page;
  }
  h2, h3, h4 {
    font-size: 14pt;
    /* color: #000; */
    break-after: avoid-page;
  }

  /* Lesefreundlicher Text */
  .entry-content, .entry-content p, .entry-content li {
    font-size: 12pt;
    line-height: 1.45;
    /* color: #000; */
    widows: 2;
    orphans: 2;
  }

  /* Bilder: skaliere, vermeide Seitenumbruch in Bildmitte */
  img, figure img {
    max-width: 100% !important;
    height: auto !important;
    display: block;
    page-break-inside: avoid;
    break-inside: avoid;
  }
  
  /* Verstecke Links um Bilder in Post-Thumbnails */
  figure.post-thumbnail a {
    display: none !important;
  }

  /* Karten / iframes (Google Maps) ausblenden */
  iframe, .cmplz-iframe, .map, .wp-block-embed, .embed-responsive {
    display: none !important;
  }

  /* Tabellen für Druck formatiert */
  table {
    width: 100% !important;
    border-collapse: collapse !important;
    page-break-inside: avoid;
  }
  th, td {
    border: 1px solid #222 !important;
    padding: 0.25em !important;
  }

  /* Links: zeige die URL hinter dem Linktext */
  /*
    a[href]:after {
    content: " (" attr(href) ")";
    font-size: 0.9em;
    color: #000;
    text-decoration: none;
    word-break: break-all;
  }
  */

  /* Ausnahme: Mailto und Telefon formatiert kurz */
  /*
  a[href^="mailto:"]:after {
    content: " (" attr(href) ")";
  }
  a[href^="tel:"]:after {
    content: " (" attr(href) ")";
  }
  */

  h1, h2, h3, h4 {
    page-break-after: avoid;
  }

  /* Verhindere kleine Zeilen am Seitenanfang/Ende */
  h1, h2, h3, p, figure {
    page-break-inside: avoid;
  }

  /* Vermeide Drucken von leeren/visuellen Elementen */
  .no-print, .hide-on-print, [aria-hidden="true"] {
    display: none !important;
  }

  /* Code / pre: umbrechen */
  pre, code {
    white-space: pre-wrap !important;
    word-wrap: break-word !important;
    font-family: monospace;
    font-size: 9pt;
  }

  /* Optionaler Seitenumbruch-Klasse (im Editor anwendbar) */
  .page-break { display: block; page-break-before: always; }

  /* Footer am Ende nicht wiederholen */
  footer, .site-footer {
    display: none !important;
  }
}
