/* ==========================================================================
   AMI Toolkit — fidelity print mode (opt-in)
   --------------------------------------------------------------------------
   Makes "Save as PDF" reproduce the page as it appears on screen, instead of
   the ink-friendly print layout that css/ami.css applies by default.

   To use it, a page needs two things:

     <html lang="en" data-print="fidelity">
     ...
     <link rel="stylesheet" href="../css/ami.css">
     <link rel="stylesheet" href="../css/print-fidelity.css">   <- after ami.css

   The attribute switches off the economical print rules in ami.css; this file
   supplies the page geometry. Both are required — one without the other does
   nothing useful.

   WHEN TO USE IT
   Review artefacts, where the colour IS the content: the design system page,
   or a module being sent to PQMD for sign-off.

   WHEN NOT TO
   Module pages in ordinary use. Hard rule 6 says they must print cleanly so
   people can work from them in a room with partners, and a full-colour PDF
   with dark panels is expensive to print. That stays the default.
   ========================================================================== */

@media print {

  /* ---- Page geometry -------------------------------------------------------
     A PDF only matches the screen if the layout is measured at the same width.
     Print media queries resolve against the printable area, so the page box is
     sized to make that area exactly 76rem — the shell's max-width:

        1296px page - (2 x 40px margin) = 1216px = 76rem

     Every screen breakpoint (46 / 52 / 62rem) therefore matches, and the PDF
     gets the wide-desktop layout rather than a reflowed narrow one. Height
     keeps roughly ISO proportions. This is a large page by design; PDF readers
     display it fine, and sending it to a physical printer scales it to fit.

     This @page overrides the A4 one in ami.css because this file loads later. */
  @page {
    size: 1296px 1832px;
    margin: 40px;
  }

  /* ---- The one deliberate difference from the screen ------------------------
     The rail is navigation chrome. On screen it is sticky and always in view;
     printed, it would render once and leave an empty gutter down every later
     page. So it is hidden, and the content column is held at exactly the width
     it has on screen — 76rem shell, minus padding, minus the rail, minus the
     gap — so every block is the same width in the PDF as in the browser:

        1216 - (2 x 20 padding) - 208 rail - 48 gap = 920px

     To keep the rail instead, delete this block: the shell grid then prints
     as-is, gutter included. */
  .rail { display: none !important; }
  .shell { display: block; }
  .module { max-width: 920px; margin-inline: auto; }

  /* Everything else is inherited from the screen styles: the dark band and
     metric-card header keep their panels, the logo accents stay, type stays at
     screen size, links keep their colour. ami.css already forces
     print-color-adjust: exact, so none of it depends on the reader ticking
     "Background graphics". */

  /* The masthead is a page header, not a section of its own. */
  .masthead { break-after: avoid; }
}
