/* Mercury Trade printed, or saved as a PDF from the browser's print window (Help, 30 Nov 2026; claude/help-plan.md,
   section 4). Made for paper: black on white, with no band, sections bar, glass or glows; body text 11 to 12 pt;
   each part of the help on a new page, and no topic split across a page break where it fits; a footer with the
   date the help matches and page numbers. The page's parts are found by their data-m marks (mark in src/theme.js).

   The footer's date is the help's own (HELP_AS_OF in src/lib/help.js): test/help.test.js fails if they differ, so
   change both together. Nothing here shows on screen except the rule hiding print-only parts. */

@media screen {
  [data-m~="print-only"] { display: none !important; }
}

@media print {
  @page {
    size: A4;
    margin: 16mm 15mm 18mm;
    @bottom-left { content: "Mercury Trade help · matches the app as of 1 December 2026"; font: 9pt system-ui, sans-serif; color: #000; }
    @bottom-right { content: "Page " counter(page) " of " counter(pages); font: 9pt system-ui, sans-serif; color: #000; }
  }

  /* The page grows to its full length: on screen it scrolls inside its own box. */
  html, body, #root { height: auto !important; overflow: visible !important; background: #fff !important; }
  #root div { overflow: visible !important; }
  body { background: none !important; }

  /* Only the content: no band, sections bar, footer, buttons or links that only work on screen. */
  [data-m~="band"], [data-m~="sections"], [data-m~="footer"], [data-m~="noprint"] { display: none !important; }

  /* Help on a PC: the right-hand column (print buttons and contents) goes, and the reading column takes the page. */
  #root div:has(> div > [data-m~="help-side"]) { display: none !important; }

  /* Black on white, without glass or shadows. */
  #root, #root * {
    color: #000 !important;
    background: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
    -webkit-backdrop-filter: none !important;
            backdrop-filter: none !important;
    text-shadow: none !important;
  }
  #root [data-m~="glass"] { border: none !important; padding: 0 !important; margin: 0 !important; }
  #root [role="table"], #root [role="row"] { border-color: #000 !important; }
  #root [role="row"]:first-child { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }

  /* Body text 11 to 12 pt; headings a little bigger. The screen's px sizes are inline, so these say !important. */
  #root div { font-size: 11.5pt !important; line-height: 1.45 !important; }
  #root [role="heading"] { font-size: 15pt !important; line-height: 1.3 !important; }
  #root [data-m~="help-part"] > [role="heading"] { font-size: 20pt !important; }

  /* The column uses the page's width, starting at the top. */
  #root [role="main"] { max-width: none !important; margin: 0 !important; padding: 0 !important; }

  /* Each part on a new page; a topic kept on one page where it fits; a heading kept with what follows. */
  [data-m~="help-part"] { break-before: page; }
  [data-m~="help-topic"] { break-inside: avoid; margin-top: 10pt !important; }
  [role="heading"] { break-after: avoid; }
  [role="row"] { break-inside: avoid; }

  /* The guide for your staff: the owners' part left out, in the contents too. */
  html[data-help-print="staff"] [data-m~="help-owners"] { display: none !important; }
}
