/* Print pack — client-side print-to-PDF (window.print() → "Save as PDF"). Loaded media="print".
 *
 * HARDENING (externally sourced):
 *  • CSS `bleed`/`marks` are unsupported by ALL browsers → NOT used. Instead each asset's
 *    background fills the whole @page (margin:0) and content stays ≥5mm from every edge
 *    (every consumer printer enforces a 3–6mm unprintable border → only dead bg is clipped).
 *  • `print-color-adjust: exact` (+ -webkit-) forces brand backgrounds to print (browsers strip
 *    them by default). The print view ALSO instructs: Background graphics ON, Margins None, 100%.
 *  • QR is inline SVG, pure #000 on #fff, shape-rendering crispEdges, sized in mm (DPI-independent),
 *    quiet zone 4 modules — scannable off paper at the spec distance.
 *  • Page breaks via break-after:page + legacy page-break-after:always (Safari). */

@media print {
  /* A4 default. (US Letter: the user picks "Letter" in the print dialog; the asset's mm sizing
     + content safe-margin tolerate the slightly different page box — CSS can't switch @page size
     by a body class, which is unsupported.) */
  @page {
    size: A4 portrait;
    margin: 0;
  }

  /* Hide the whole app; only the print container shows. */
  body > #app,
  body > #status,
  body > #alert {
    /* biome-ignore lint/complexity/noImportantStyles: print-only override — !important suppresses the live app during window.print(); documented hardening (print.css header) */
    display: none !important;
  }
  #print-root {
    /* biome-ignore lint/complexity/noImportantStyles: print-only override — !important forces the print container visible during window.print(); documented hardening (print.css header) */
    display: block !important;
  }

  html,
  body {
    margin: 0;
    padding: 0;
    background: #fff;
  }

  .print-asset {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    page-break-after: always;
    break-after: page;
    break-inside: avoid;
    position: relative;
    overflow: hidden;
    color: #fff;
    box-sizing: border-box;
  }
  .print-asset:last-child {
    page-break-after: auto;
    break-after: auto;
  }

  /* Poster — full A4, content in a 5mm-safe inner column. */
  .print-asset.poster {
    width: 210mm;
    height: 297mm;
    padding: 18mm 16mm;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
  }
  /* Table tent — A5 footprint centered on the sheet (fold-friendly single face). */
  .print-asset.tent {
    width: 148mm;
    height: 210mm;
    margin: 0 auto;
    padding: 14mm 12mm;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
  }
  /* Counter sticker — 80mm square centered. */
  .print-asset.sticker {
    width: 80mm;
    height: 80mm;
    margin: 8mm auto;
    padding: 6mm;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    border-radius: 6mm;
  }

  .print-logo {
    max-width: 36mm;
    max-height: 22mm;
    margin-bottom: 6mm;
    object-fit: contain;
  }
  .print-headline {
    font-weight: 800;
    line-height: 1.1;
    margin: 0 0 3mm;
  }
  .poster .print-headline {
    font-size: 30pt;
  }
  .tent .print-headline {
    font-size: 20pt;
  }
  .sticker .print-headline {
    font-size: 11pt;
  }
  .print-reward {
    font-size: 13pt;
    margin: 0 0 6mm;
  }
  .sticker .print-reward {
    font-size: 8pt;
    margin-bottom: 3mm;
  }

  /* The QR sits on a white tile so the 4-module quiet zone is genuinely quiet even on a
     brand-colored background. Sizes are the physical floor-safe targets. */
  .print-qr {
    background: #fff;
    padding: 4mm;
    border-radius: 3mm;
    display: inline-block;
  }
  .print-qr svg {
    display: block;
    shape-rendering: crispEdges;
  }
  .poster .print-qr svg {
    width: 80mm;
    height: 80mm;
  }
  .tent .print-qr svg {
    width: 45mm;
    height: 45mm;
  }
  .sticker .print-qr svg {
    width: 28mm;
    height: 28mm;
  }
  .print-instruct {
    font-size: 10pt;
    margin: 5mm 0 0;
  }
  .sticker .print-instruct {
    font-size: 7pt;
    margin-top: 2mm;
  }
  .print-code {
    font-family: var(--mono, monospace);
    font-size: 8pt;
    margin-top: 2mm;
    opacity: 0.85;
  }
}

/* Off-print: the print container is never shown on screen (it's an offscreen build target). */
#print-root {
  display: none;
}
