/*
 * Print-CSS für Pterweide-Heft
 * ============================
 * Für Phase 1: Browser-Print-to-PDF.
 * Wird in echte App eingebunden, sobald die existiert.
 *
 * Nutzung im Browser:
 *   1. App öffnen
 *   2. Cmd+P (Mac) / Ctrl+P (Win)
 *   3. "Als PDF speichern"
 *   4. Optionen: Hintergrundgrafiken einschalten, Header/Footer aus
 */

@page {
  size: A4;
  margin: 16mm 14mm;
}

@media print {

  /* Browser-Default ausblenden */
  body {
    background: white !important;
    color: #1a2630 !important;
    font-family: 'Newsreader', Georgia, serif !important;
    font-size: 10pt !important;
    line-height: 1.5 !important;
  }

  /* App-Chrome ausblenden — Toolbar, Mikro, Welten-Switcher etc. */
  .toolbar,
  .heft-actions,
  .status-bar,
  nav,
  .device,           /* falls Mockup-Geräte-Frames sichtbar */
  .desktop-bar,
  .ipad-screen::before,
  .phone::before,
  [data-no-print] {
    display: none !important;
  }

  /* Jedes Kapitel = neue A4-Seite */
  .heft-spread,
  .editorial[data-chapter],
  .kapitel {
    page-break-before: always;
    page-break-inside: avoid;
    height: auto !important;
    background: white !important;
  }
  .heft-spread:first-child,
  .editorial[data-chapter]:first-child,
  .kapitel:first-child {
    page-break-before: auto;  /* erstes Kapitel ohne Umbruch */
  }

  /* Bilder: Vollbreite, mittig */
  .editorial-img,
  img.kapitel-bild {
    width: 100% !important;
    max-height: 14cm !important;
    object-fit: cover !important;
    margin: 0 0 8mm 0 !important;
    page-break-inside: avoid;
    background-size: cover !important;
    background-position: center !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* Headlines */
  .chapter-h, h1, h2 {
    font-family: 'Cormorant Garamond', 'Newsreader', Georgia, serif !important;
    font-weight: 400 !important;
    font-size: 28pt !important;
    line-height: 1.05 !important;
    color: #1a2630 !important;
    margin: 0 0 6mm 0 !important;
    page-break-after: avoid;
  }
  .chapter-h em {
    font-style: italic !important;
    color: #3a4856 !important;
  }

  /* Kapitel-Label */
  .chapter-label {
    font-family: 'Manrope', sans-serif !important;
    font-size: 8pt !important;
    letter-spacing: 0.22em !important;
    text-transform: uppercase !important;
    color: #997f4a !important;
    margin: 0 0 4mm 0 !important;
  }

  /* Body-Text */
  .chapter-body, p {
    font-size: 10.5pt !important;
    line-height: 1.6 !important;
    color: #3a4856 !important;
    margin: 0 0 4mm 0 !important;
    orphans: 3;
    widows: 3;
  }
  .chapter-body strong, p strong {
    color: #1a2630 !important;
    font-weight: 500 !important;
  }

  /* Cover-Seite (erste Seite des Hefts) */
  .heft-cover {
    height: 100vh;
    display: flex !important;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    page-break-after: always;
    background: white !important;
  }
  .heft-cover .heft-titel {
    font-family: 'Cormorant Garamond', serif !important;
    font-size: 42pt !important;
    font-weight: 400 !important;
    line-height: 1.0 !important;
    margin: 0 0 8mm 0 !important;
  }
  .heft-cover .heft-subtitel {
    font-family: 'Newsreader', serif !important;
    font-style: italic !important;
    font-size: 14pt !important;
    color: #6a7682 !important;
  }

  /* Inhaltsverzeichnis */
  .heft-toc {
    page-break-after: always;
  }
  .heft-toc ol {
    list-style: none;
    padding: 0;
  }
  .heft-toc li {
    font-family: 'Newsreader', serif !important;
    font-size: 12pt !important;
    padding: 3mm 0 !important;
    border-bottom: 0.5pt dotted #d8cdb0 !important;
  }
  .heft-toc .toc-num {
    font-style: italic;
    color: #997f4a;
    margin-right: 3mm;
  }

  /* Seitenzahlen */
  @page {
    @bottom-center {
      content: counter(page) " / " counter(pages);
      font-family: 'Newsreader', serif;
      font-style: italic;
      font-size: 9pt;
      color: #6a7682;
    }
  }

  /* Links in Print: URL anzeigen */
  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 8pt;
    color: #6a7682;
  }
  a[href^="#"]::after,
  a[href^="javascript:"]::after,
  .no-print-url::after {
    content: "";
  }
}
