/* ── Print styles ──────────────────────────────────────────────────── */
/* Strips all screen UI; each .sheet-page becomes one physical page.   */
/* All dimensions use CSS mm units for accurate physical output.       */
/* Tip: set print dialog to 100% scale, margins: None, no headers.    */

@page {
  margin: 0;
}

@media print {
  /* ── Hide UI chrome ─────────────────────────────────────────────── */
  #sidebar,
  #loading-overlay,
  .page-label {
    display: none !important;
  }

  /* ── Reset document flow ────────────────────────────────────────── */
  html, body {
    margin: 0 !important;
    padding: 0 !important;
    height: auto !important;
    width: auto !important;
    overflow: visible !important;
    background: white !important;
  }

  #app {
    display: block !important;
    height: auto !important;
    width: auto !important;
    overflow: visible !important;
  }

  #preview-area {
    display: block !important;
    width: auto !important;
    height: auto !important;
    overflow: visible !important;
    padding: 0 !important;
    margin: 0 !important;
    background: white !important;
    flex: none !important;
    align-items: stretch !important;
  }

  #pages-container {
    display: block !important;
    width: auto !important;
    padding: 0 !important;
    margin: 0 !important;
    gap: 0 !important;
    align-items: stretch !important;
  }

  /* ── Kill preview scaling on wrappers ───────────────────────────── */
  /* JS sets inline transform + height; must override with !important */
  .page-wrapper {
    display: block !important;
    transform: none !important;
    transform-origin: unset !important;
    height: auto !important;
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* ── Each .sheet-page = one physical page ───────────────────────── */
  .sheet-page {
    box-shadow: none !important;
    overflow: visible !important;  /* crop marks may extend outside */
    page-break-after: always;
    break-after: page;
    margin: 0 !important;
    padding: 0 !important;
    position: relative;
  }

  /* Don't force blank trailing page */
  .page-wrapper:last-child .sheet-page {
    page-break-after: auto;
    break-after: auto;
  }

  /* ── Ensure colors & images print faithfully ────────────────────── */
  .card-cell img,
  .crop-marks-layer,
  .registration-marks-layer,
  .decklist-content,
  .ink-saver-card,
  .text-only-card {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}
