/*
 * .SYNOPSIS
 * print.css - what the document looks like on paper, or in a PDF the
 * browser exports.
 *
 * .USAGE
 *   Loaded in this order by MarkstrataWebPart.ts, because later rules
 *   override earlier ones:
 *
 *     base, typography, code, syntax, callouts, tables-lists, extras,
 *     chrome, the three themes, modifiers, print
 *
 * .NOTES
 * Since:     0.0.6
 * Ships in:  the web part bundle
 * Requires:  nothing else in this project
 * Loaded:    last
 */

@media print {
  .strata-root {
    background: #ffffff !important;
    color: #000000 !important;
  }

  .strata-toolbar,
  .strata-code-actions,
  .strata-panel,
  .strata-editor-pane,
  .strata-anchor {
    display: none !important;
  }

  .strata-layout {
    display: block;
  }

  /* Nothing scrolls on paper. The editor's panes are a fixed height with the
     overflow inside them on screen, which on a printer would put the first
     screenful on the page and drop the rest of the document. */
  .strata-editor,
  .strata-preview-pane,
  .strata-preview-box {
    height: auto;
    max-height: none;
    min-height: 0;
    overflow: visible;
  }

  .strata-toc-sidebar {
    position: static;
    width: 100%;
    max-height: none;
    page-break-after: always;
  }

  .strata-content {
    max-width: none;
  }

  /* Code and callouts keep their fill in print - a bordered, tinted block is
     what makes them legible on paper too - but never split across pages.

     Every selector in here is scoped to the web part's own root, tables and
     headings included. SharePoint loads this stylesheet into the page itself,
     not into anything belonging to the web part, so a bare `table` is every
     table on the page - and printing a page that merely has this web part
     somewhere on it would have taken SharePoint's own tables and headings with
     it. */
  .strata-root .strata-code,
  .strata-root .strata-callout,
  .strata-root .strata-mermaid,
  .strata-root table {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .strata-code pre {
    white-space: pre-wrap;
    overflow: visible;
  }

  .strata-code-line {
    width: auto;
  }

  .strata-root h1,
  .strata-root h2,
  .strata-root h3,
  .strata-root h4 {
    break-after: avoid;
    page-break-after: avoid;
  }

  details.strata-callout:not([open]) .strata-callout-content {
    display: block;
  }

  /* The worst of the three: unscoped, this printed the address after every
     external link on the page, including SharePoint's own navigation and every
     other web part on it. */
  .strata-root a[href^='http']::after {
    content: ' (' attr(href) ')';
    font-size: 0.85em;
    color: #444444;
  }
}
