/* Modul D - Druckansicht. Greift in zwei Faellen: am Bildschirm ueber
 * body.print-mode (Vorschau) und im echten Druck ueber @media print.
 * Keine Hex-Werte; Druckfarben kommen aus CSS-Farbnamen. */

#print-root { display: none; }

.print-page {
  break-after: page;
  page-break-after: always;
  break-inside: avoid;
  padding: 0 0 28px;
  margin: 0 0 28px;
}

.print-page:last-child { break-after: auto; page-break-after: auto; }

/* ---- Bildschirm-Vorschau ------------------------------------------------ */

body.print-mode { background: white; overflow-y: auto; }

body.print-mode #gateway,
body.print-mode #app,
body.print-mode .topbar,
body.print-mode .main-stage,
body.print-mode .vault-root { display: none !important; }

body.print-mode #print-root {
  display: block;
  position: relative;
  z-index: 100;
  max-width: 820px;
  margin: 0 auto;
  padding: 40px 32px 80px;
  background: white;
  color: black;
  font-family: var(--font-body), system-ui, sans-serif;
  font-size: 12px;
  line-height: 1.6;
}

.print-exit {
  position: sticky;
  top: 12px;
  float: right;
  border: 1px solid black;
  border-radius: 8px;
  background: white;
  color: black;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  padding: 8px 14px;
  cursor: pointer;
}

/* ---- Gemeinsame Typografie ---------------------------------------------- */

#print-root h1 {
  font-family: var(--font-headline), system-ui, sans-serif;
  font-size: 30px;
  line-height: 1.15;
  margin: 0 0 12px;
}

#print-root h2 {
  font-family: var(--font-headline), system-ui, sans-serif;
  font-size: 20px;
  line-height: 1.2;
  margin: 0 0 10px;
}

#print-root h5, #print-root h6 {
  font-family: var(--font-headline), system-ui, sans-serif;
  font-size: 13px;
  margin: 14px 0 6px;
}

#print-root p { margin: 0 0 8px; }
#print-root ul, #print-root ol { margin: 0 0 10px; padding-left: 20px; }
#print-root li { margin-bottom: 3px; }

.print-kicker {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: dimgray;
  margin: 0 0 6px;
}

.print-caption { font-size: 11px; color: dimgray; }

.print-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid lightgray;
  border-radius: 6px;
  padding: 10px;
  margin: 0 0 10px;
  background: whitesmoke;
  break-inside: avoid;
}

.print-image, #print-root .print-image svg, #print-root img {
  display: block;
  max-width: 100%;
  height: auto;
  break-inside: avoid;
  margin: 0 0 10px;
}

#print-root .vault-table-wrap { box-shadow: none; border: 1px solid lightgray; border-radius: 6px; overflow: visible; }
#print-root table { border-collapse: collapse; width: 100%; font-size: 11px; break-inside: auto; }
#print-root th, #print-root td { border-bottom: 1px solid lightgray; padding: 6px 8px; text-align: left; vertical-align: top; color: black; }
#print-root th { white-space: nowrap; }
#print-root tr { break-inside: avoid; }
#print-root code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }

#print-root .vault-status,
#print-root .vault-chip { background: none; color: black; padding: 0; }

.print-cover { text-align: left; padding-top: 80px; }

/* ---- Echter Druck -------------------------------------------------------- */

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

  html, body { background: white !important; }

  #gateway, #app, .topbar, .main-stage, .vault-root, .print-exit { display: none !important; }

  #print-root {
    display: block;
    max-width: none;
    margin: 0;
    padding: 0;
    background: white;
    color: black;
    font-family: var(--font-body), system-ui, sans-serif;
    font-size: 11px;
    line-height: 1.55;
  }

  #print-root a { color: black; text-decoration: none; }
  #print-root h1, #print-root h2 { break-after: avoid; page-break-after: avoid; }
}

@media (prefers-reduced-motion: reduce) {
  body.print-mode #print-root { animation: none; }
}

/* ============================================================
   Folien-HTML im Druck (.print-html)
   Dieselben Klassen wie auf der Buehne, aber in Schwarz/Weiss:
   keine Flaechenfarben, Struktur nur ueber Linien, Groesse und Fettung.
   ============================================================ */

#print-root .print-html { font-size: 11px; line-height: 1.5; color: black; }
#print-root .print-html p { margin: 0 0 6px; font-size: 11px; line-height: 1.5; color: black; }
#print-root .print-html strong { font-weight: 700; color: black; }
#print-root .print-html em { font-style: normal; color: dimgray; }

#print-root .print-html h2 { font-size: 15px; margin: 0 0 6px; }
#print-root .print-html h3 { font-size: 13px; margin: 0 0 5px; }
#print-root .print-html h4 { font-size: 12px; margin: 0 0 5px; }

#print-root .print-html code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  padding: 0;
  background: none;
  color: black;
}

#print-root .print-html .sub { font-size: 13px; line-height: 1.4; margin: 0 0 10px; color: dimgray; }
#print-root .print-html .lead { font-size: 12px; margin: 0 0 8px; }
#print-root .print-html .note,
#print-root .print-html .fnote,
#print-root .print-html .title-ref { font-size: 10px; line-height: 1.4; color: dimgray; }
#print-root .print-html .note.warnline { color: black; font-weight: 700; }
#print-root .print-html .close { font-size: 12px; }

/* Raster: im Druck flach untereinander, damit nichts abgeschnitten wird. */
#print-root .print-html .grid2,
#print-root .print-html .two-col,
#print-root .print-html .grid3,
#print-root .print-html .grid4,
#print-root .print-html .title-meta,
#print-root .print-html .phasen,
#print-root .print-html .cohort,
#print-root .print-html .bilanz {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 14px;
}
#print-root .print-html .cardstack { display: block; }
#print-root .print-html .grid2 > *,
#print-root .print-html .grid3 > *,
#print-root .print-html .grid4 > *,
#print-root .print-html .cardstack > * { break-inside: avoid; page-break-inside: avoid; }

#print-root .print-html .card,
#print-root .print-html .case,
#print-root .print-html .minicase,
#print-root .print-html .flowbox,
#print-root .print-html .formula,
#print-root .print-html .kpibox,
#print-root .print-html .soll,
#print-root .print-html .decision,
#print-root .print-html pre.term {
  background: none;
  border: 1px solid gainsboro;
  border-radius: 4px;
  padding: 8px 10px;
  margin: 0 0 8px;
  box-shadow: none;
}
#print-root .print-html .card ul { list-style: disc; padding-left: 16px; margin: 0; }
#print-root .print-html .card li::before { content: none; }
#print-root .print-html li { font-size: 11px; line-height: 1.45; margin-bottom: 3px; }
#print-root .print-html ul.ticks,
#print-root .print-html ol.blocks,
#print-root .print-html ul.crit { list-style: none; padding-left: 14px; }
#print-root .print-html ul.ticks li::before { content: "\2013"; margin-left: -14px; margin-right: 6px; }
#print-root .print-html ol.blocks strong { position: static; }

#print-root .print-html .chip,
#print-root .print-html .verdict,
#print-root .print-html .rnd {
  display: inline-block;
  padding: 1px 5px;
  border: 1px solid gainsboro;
  border-radius: 3px;
  background: none;
  box-shadow: none;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: black;
}

#print-root .print-html .num,
#print-root .print-html .bignum,
#print-root .print-html .bilanz strong,
#print-root .print-html .kpirow strong,
#print-root .print-html .delta {
  font-family: var(--font-headline), system-ui, sans-serif;
  font-weight: 700;
  line-height: 1;
  color: black;
}
#print-root .print-html .num { font-size: 18px; margin-bottom: 4px; }
#print-root .print-html .bignum { font-size: 26px; margin-bottom: 4px; }
#print-root .print-html .bilanz strong { font-size: 20px; display: block; }
#print-root .print-html .kpirow strong { font-size: 18px; }
#print-root .print-html .kpirow.big strong { font-size: 22px; }
#print-root .print-html .delta { font-size: 13px; }

#print-root .print-html .kpirow {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px solid gainsboro;
}
#print-root .print-html .kpirow:last-of-type { border-bottom: none; }
#print-root .print-html .kpirow span { flex: none; width: 120px; font-size: 10px; color: dimgray; }
#print-root .print-html .kpirow em { font-style: normal; font-size: 10px; color: dimgray; }

#print-root .print-html .title-meta div { border-left: 2px solid black; padding-left: 8px; }
#print-root .print-html .title-meta span,
#print-root .print-html .caseline span,
#print-root .print-html .cohort span,
#print-root .print-html .bilanz span,
#print-root .print-html .vnhead {
  display: block;
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: dimgray;
}
#print-root .print-html .title-meta strong { display: block; font-size: 11px; }

/* Tabellen erben die Grundregeln von #print-root table. */
#print-root .print-html table.tbl { width: 100%; border-collapse: collapse; font-size: 10px; margin: 0 0 8px; }
#print-root .print-html table.tbl th,
#print-root .print-html table.tbl td { border-bottom: 1px solid gainsboro; padding: 4px 6px; text-align: left; vertical-align: top; color: black; }
#print-root .print-html table.tbl th { font-size: 9.5px; letter-spacing: 0.08em; text-transform: uppercase; color: dimgray; }
#print-root .print-html table.tbl td.c, #print-root .print-html table.tbl th.c { text-align: center; }
#print-root .print-html table.tbl tr.no td,
#print-root .print-html table.tbl tr.yes td,
#print-root .print-html table.tbl tr.row-hl td { background: none; }
#print-root .print-html table.tbl tr.row-hl td { font-weight: 700; }
#print-root .print-html table.tbl tr.sum td { border-top: 1px solid darkgray; font-weight: 700; }
#print-root .print-html table.tbl td.ok,
#print-root .print-html table.tbl td.part,
#print-root .print-html table.tbl td.open,
#print-root .print-html table.tbl td.up { font-weight: 700; color: black; }

#print-root .print-html .quote,
#print-root .print-html .quote-s,
#print-root .print-html .quote-b {
  background: none;
  border: none;
  border-left: 2px solid black;
  border-radius: 0;
  box-shadow: none;
  padding: 4px 0 4px 10px;
  margin: 0 0 8px;
  break-inside: avoid;
  page-break-inside: avoid;
}
#print-root .print-html .quote p { font-size: 11px; color: black; margin-bottom: 5px; }
#print-root .print-html .quote strong { display: block; font-size: 10px; color: black; }
#print-root .print-html .quote span,
#print-root .print-html .quote-s span { display: block; font-size: 9.5px; color: dimgray; margin-top: 2px; }

/* Bilder skaliert: nie breiter als der Satzspiegel, nie hoeher als eine
   halbe Druckseite - sonst schiebt ein Screenshot die Folie auf zwei Seiten. */
#print-root .print-html img,
#print-root .print-html .figwrap img,
#print-root .print-html figure.shot img,
#print-root .print-html .imgbox img,
#print-root .print-image {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 120mm;
  object-fit: contain;
  border: 1px solid gainsboro;
  border-radius: 4px;
  margin: 0 0 8px;
  break-inside: avoid;
  page-break-inside: avoid;
}
#print-root .print-html figure.shot { margin: 0 0 8px; }
#print-root .print-html figure.shot figcaption,
#print-root .print-html .fignote { font-size: 9.5px; line-height: 1.4; color: dimgray; margin-top: 4px; }
#print-root .print-html .figwrap { display: block; }

#print-root .print-html .flowbox .url {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  padding: 4px 6px;
  border: 1px solid gainsboro;
  border-radius: 3px;
  background: none;
  color: black;
  word-break: break-all;
}
#print-root .print-html .arrow { text-align: center; font-size: 10px; padding: 4px 0; color: dimgray; }
#print-root .print-html .flowbox .arrow::before { content: "\25BC"; display: block; font-size: 9.5px; }
#print-root .print-html .caseline { padding: 6px 0; border-bottom: 1px solid gainsboro; font-size: 11px; }
#print-root .print-html .caseline:last-child { border-bottom: none; }
#print-root .print-html .cohort div { border: 1px solid gainsboro; border-radius: 3px; padding: 6px; }
#print-root .print-html .cohort strong { display: block; font-size: 12px; }
#print-root .print-html .phasen span { border: 1px solid gainsboro; border-radius: 3px; padding: 4px; text-align: center; }
#print-root .print-html .frow code { font-size: 12px; font-weight: 700; }
#print-root .print-html pre.term {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Platzhalterflaeche aus der Buehne: im Druck nur ein beschrifteter Rahmen. */
#print-root .fig-placeholder {
  display: block;
  min-height: 0;
  padding: 10px;
  border: 1px dashed darkgray;
  border-radius: 4px;
  background: none;
  box-shadow: none;
  font-size: 10px;
  color: dimgray;
}
