/* ============================================================
   Print stylesheet — paper output of flashcards / study sheet
   Triggered automatically by media="print"
   ============================================================ */

@page {
  size: A4;
  margin: 0;
}

@media print {
  /* Force colour fidelity across the entire document. Without this,
     classification banners, watermarks and category pills come out white. */
  *, *::before, *::after {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
  }

  /* Strip everything except the print sheets. */
  .no-print,
  .help-overlay,
  .overlay,
  .stamp-overlay,
  .filter-bar,
  .app-header,
  .classification-banner-top,
  .classification-banner-bottom { display: none !important; }

  html, body {
    background: white !important;
    color: black !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 210mm;
  }

  body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
    background-image: none !important;
  }

  .app-main {
    padding: 0 !important;
    margin: 0 !important;
    max-width: none !important;
  }

  .view { animation: none !important; }
  .view:not(.view-print) { display: none !important; }
  .view-print { display: block !important; }
  .view-print[hidden] { display: block !important; }

  .print-stage {
    padding: 0;
    margin: 0;
    max-width: none;
  }

  .print-sheets {
    gap: 0 !important;
    align-items: stretch !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* Each sheet IS a printed page. */
  .sheet {
    box-shadow: none !important;
    border-radius: 0 !important;
    margin: 0 !important;
    page-break-after: always;
    break-after: page;
    width: 210mm !important;
    height: 297mm !important;
    min-height: 297mm !important;
    background: white !important;
    color: black !important;
    overflow: hidden;
  }
  .sheet:last-child {
    page-break-after: auto;
    break-after: auto;
  }

  /* Cards must not split across pages. */
  .print-card,
  .study-row {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  /* Ensure dashed cut marks survive the toner. */
  .print-card { border-color: #b8b8b8 !important; }

  /* Banner colour fidelity */
  .sheet-banner {
    background: #a82a1f !important;
    color: white !important;
  }

  /* Watermark needs a touch more contrast on toner. */
  .pc-watermark {
    color: rgba(0,0,0,.06) !important;
  }

  /* Hide focus rings, hover effects, etc. that might bleed through. */
  *:focus { outline: none !important; }

  a { color: black !important; text-decoration: none !important; }
}
