/* The QR card for a file request (js/request-qr.js): the sheet that shows it
   and the rules that print it. Loaded by index.html after request.css.
   Shared pieces (.sheet .overlay .btn) are components.css's and button.css's.

   The card, on screen and on paper (the same picture, 50 mm on paper):

     +--------------------------------+
     |      Wedding, 12 September     |   the delivery's title
     |    Add your photos and videos  |   the ask
     |  Scan with your phone's camera.|
     |         [ the code ]           |   at least 240 CSS px on screen
     |      Opens theirway.app        |   the link's own host
     |   No app or account needed.    |
     +--------------------------------+

   THE CARD IS PAPER in both themes: --card-paper and --card-ink are the same
   in light and dark (app.css, beside --on-photo). A code is dark on white
   always, and a card that printed light text on a dark theme's ink would
   print nothing. The code itself brings its own colours and quiet zone
   (js/request-qr.js), so it is the same file on screen, on paper and
   downloaded.

   PRINTING. The sheet is one of several things a page can show over the
   app; while THIS one is open (body:has(.qr-sheet)), printing shows the
   card alone, on an A6 page. Any other print of the app is left alone.
   The A6 page is a named page (`page: card`), so the size cannot leak to
   anything but the card: a bare @page{size:A6} would make every print of
   the app an A6 page. */

.qr-card{
  page:card;
  display:flex;flex-direction:column;align-items:center;gap:var(--space-2);
  margin:0 auto;max-width:320px;padding:var(--space-5);
  background:var(--card-paper);color:var(--card-ink);
  border:1px solid var(--line);border-radius:var(--radius-l);
  text-align:center;
  -webkit-print-color-adjust:exact;print-color-adjust:exact}
.qr-card > p{margin:0;overflow-wrap:anywhere;max-width:100%}
.qr-title{font:500 var(--text-xl)/24px var(--font-display);color:var(--card-mute)}
.qr-heading{font:500 var(--text-xl)/24px var(--font-sans)}
.qr-line,.qr-host,.qr-foot{font:400 var(--text-ui)/20px var(--font-sans)}
.qr-line,.qr-foot{color:var(--card-mute)}
.qr-host{font-weight:500}
.qr-code{margin:var(--space-2) 0}
/* The page's own `svg` rule is the icons' (16 px, a stroke); a code is
   drawn from its own attributes, and wide. */
.qr-code svg{display:block;width:min(100%,288px);height:auto;aspect-ratio:1}

/* A6 in millimetres, not `size:A6`: Chromium does not know the A6 keyword
   (it knows A3 to A5, B4, B5, letter, legal, ledger) and would print the
   card on a letter page. */
@page card{size:105mm 148mm;margin:8mm}

@media print{
  /* The card alone: everything but the sheet goes, and the sheet stops
     being a dialog over the page. */
  body:has(.qr-sheet) > :not(#ov){display:none!important}
  /* The page's colour would show round the card when a browser prints
     backgrounds, and in the dark theme it is not paper at all. */
  body:has(.qr-sheet){background:var(--card-paper)}
  body:has(.qr-sheet) .overlay{position:static;display:block;padding:0;background:none;animation:none}
  .qr-sheet{max-width:none;max-height:none;border:0;border-radius:0;box-shadow:none;background:none;animation:none;display:block}
  .qr-sheet > header,.qr-sheet > footer{display:none}
  .qr-sheet .body{padding:0;overflow:visible}

  /* The title is the producer's, so it may wrap to any number of lines,
     and the A6 page (89 x 132 mm inside its margins) has to hold the rest
     of the card beside it. The code (50 mm) and the ask are fixed; the
     title is the one part that gives, so it is the smallest type on the
     card. At 15pt with 4 mm gaps a 63-character title pushes the last line
     onto a second page. */
  .qr-card{max-width:none;padding:0;border:0;border-radius:0;gap:2mm;break-inside:avoid}
  .qr-title{font-size:12pt;line-height:1.25}
  .qr-heading{font-size:17pt;line-height:1.2}
  .qr-line,.qr-host,.qr-foot{font-size:12pt;line-height:1.3}
  .qr-code{margin:0}
  .qr-code svg{width:50mm;height:50mm}
}
