/* ─────────────────────────────────────────────────────────────────────────
   biodanza-cockpit — css/print.css

   Geschichtserzaehlung: Drucken und "Als PDF speichern" (X1: Session/
   Vivencia, AU3: Ausschreibung). core/print.js rendert das Dokument in
   #print-root (direktes Kind von <body>) und ruft window.print(). Diese
   Datei sorgt dafuer, dass NUR #print-root auf dem Papier landet — ohne
   TopBar, Tabs, Toasts — auf A4 mit ruhigen Raendern, immer hell (auch
   wenn die App gerade im Dunkel- oder Ruhig-Modus ist) und mit echten
   Farben (print-color-adjust: exact, sonst fallen Petrol-Linien weg).

   Fuer Module: Grundklassen unten (.print-doc, .print-header, .print-meta,
   .print-section, .print-table, .print-avoid-break, .print-page-break).
   Eigene Druck-Regeln gehoeren in den eigenen Abschnitt von modules.css,
   eingeschlossen in @media print { #print-root .mein-export { ... } }.

   ── DECISION — @page A4 mit 18/16 mm Rand ──
     vs. Browser-Standard (Letter in manchen Engines, Kopf-/Fusszeilen).
     Grund: Anton druckt in Oesterreich/Spanien auf A4; feste Raender
     machen das PDF auf jedem Geraet gleich.

   ── DECISION — Text in pt, Abstaende in mm ──
     Grund: Papier hat physische Masse; 11 pt Fliesstext ist die
     Lese-Groesse eines Briefs, unabhaengig von der Bildschirm-Skalierung.
   ───────────────────────────────────────────────────────────────────────── */

@media print {

  /* ── Seite ── */
  @page {
    size: A4;
    margin: 18mm 16mm 20mm;
  }

  /* ── Immer hell drucken ──
        Semantische Tokens auf Papier-Werte zwingen — gleiche Spezifitaet
        wie in tokens.css, diese Datei kommt spaeter, gewinnt also. */
  :root,
  :root[data-theme="dark"],
  :root[data-quiet="true"] {
    color-scheme: light;
    --color-bg: #FFFFFF;
    --color-surface: #FFFFFF;
    --color-surface-muted: #EEF2F5;
    --color-text: #222222;
    --color-text-secondary: #555555;
    --color-primary: #1F6F8B;
    --color-on-primary: #FFFFFF;
    --color-primary-text: #1F6F8B;
    --color-border: #BBBBBB;
    --color-divider: #CCCCCC;
    --color-favorite: #F1C40F;
    --color-favorite-stroke: #A07F08;
    --color-success-text: #1E7E46;
    --color-danger-text: #C0392B;
    --shadow-card: none;
  }

  * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  html,
  body {
    background: #FFFFFF !important;
    color: #222222;
  }

  body {
    display: block;
    min-height: 0;
    font-size: 11pt;
    line-height: 1.45;
  }

  /* ── Nur #print-root ──
        Alles andere auf <body>-Ebene verschwindet (TopBar, Screen, Tabs,
        Overlays). Darum muss #print-root ein direktes Kind von body sein. */
  body > *:not(#print-root) {
    display: none !important;
  }

  #print-root {
    display: block !important;
  }

  /* ── Typografie auf Papier ── */
  #print-root h1 {
    margin: 0 0 3mm;
    font-size: 20pt;
    line-height: 1.2;
    color: #1F6F8B;
  }

  #print-root h2 {
    margin: 7mm 0 2mm;
    font-size: 14pt;
    line-height: 1.25;
    break-after: avoid;
  }

  #print-root h3 {
    margin: 5mm 0 1.5mm;
    font-size: 12pt;
    break-after: avoid;
  }

  #print-root p,
  #print-root li {
    orphans: 3;
    widows: 3;
  }

  #print-root p + p {
    margin-top: 2mm;
  }

  #print-root ul,
  #print-root ol {
    padding-left: 6mm;
    list-style: disc;
  }

  #print-root ol {
    list-style: decimal;
  }

  #print-root img {
    max-width: 100%;
    break-inside: avoid;
  }

  #print-root a {
    color: inherit;
    text-decoration: none;
  }

  /* Bedienelemente haben auf Papier nichts verloren */
  #print-root button,
  #print-root .icon-btn,
  #print-root .no-print {
    display: none !important;
  }

  /* ── Grundklassen fuer Export-Dokumente ── */
  .print-doc {
    max-width: 100%;
  }

  .print-header {
    padding-bottom: 3mm;
    margin-bottom: 5mm;
    border-bottom: 1.2pt solid #1F6F8B;
  }

  .print-meta {
    font-size: 10pt;
    color: #555555;
  }

  .print-section {
    margin-top: 6mm;
  }

  .print-avoid-break {
    break-inside: avoid;
  }

  .print-page-break {
    break-before: page;
  }

  .print-muted {
    color: #555555;
  }

  .print-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 10pt;
  }

  .print-table th,
  .print-table td {
    padding: 1.8mm 1.5mm;
    border-bottom: 0.5pt solid #CCCCCC;
    text-align: left;
    vertical-align: top;
  }

  .print-table th {
    border-bottom: 1pt solid #222222;
    font-weight: 600;
  }

  .print-table thead {
    display: table-header-group;
  }

  .print-table tr {
    break-inside: avoid;
  }

  .print-table .is-number {
    text-align: right;
    font-variant-numeric: tabular-nums;
  }

  .print-footer {
    margin-top: 8mm;
    font-size: 9pt;
    color: #555555;
  }
}
