/* Print view — strips the wiki chrome so a page comes out of the printer as a
   standalone document. Written for the association paperwork, which has to be
   printed, signed and filed with the court, but applies to every page. */

/* The screen-side Print button lives in content.css, on the theme tokens. */

/* --- Print --- */

@media print {

  /* Print always on the light palette, whatever the screen theme is. */
  :root,
  [data-theme='dark'] {
    --c-page: 255 255 255;
    --c-surface: 255 255 255;
    --c-raised: 244 244 245;
    --c-line: 212 212 216;
    --c-line-strong: 161 161 170;
    --c-fg: 0 0 0;
    --c-fg-muted: 0 0 0;
    --c-fg-subtle: 82 82 91;
    --c-accent: 0 0 0;
    --c-accent-hover: 0 0 0;
    color-scheme: light;
  }

  @page {
    size: A4;
    margin: 20mm 18mm;
  }

  /* Everything that is wiki, not document. */
  #top-bar,
  #sidebar,
  #sidebar-toggle,
  #breadcrumb-bar,
  #overlay,
  #navigation,
  #page-toc,
  #site-footer,
  #github-contrib,
  .page-actions,
  .searchbox,
  #searchbox {
    display: none !important;
  }

  /* Reclaim the space the sidebar and the content gutters were holding. */
  html,
  body {
    background: #fff !important;
    color: #000 !important;
    font-size: 11pt;
  }

  #body {
    margin-left: 0 !important;
  }

  .padding {
    padding: 0 !important;
  }

  #body-inner,
  #page-content {
    margin: 0 !important;
    max-width: none !important;
    padding: 0 !important;
    width: auto !important;
  }

  #page-with-toc {
    display: block !important;
  }

  /* A serif face reads better on paper and looks like what a court expects. */
  #page-content,
  #page-content p,
  #page-content li,
  #page-content td,
  #page-content th {
    font-family: "Times New Roman", Times, Georgia, serif;
    line-height: 1.45;
  }

  /* The page title is the document title; markdown h1s are section headings. */
  #page-content > h1:first-of-type {
    border: 0;
    font-size: 16pt;
    margin: 0 0 1.5rem;
    text-align: center;
    text-transform: none;
  }

  #page-content h1,
  #page-content h2,
  #page-content h3 {
    border: 0;
    color: #000;
    page-break-after: avoid;
  }

  #page-content h1 {
    font-size: 12pt;
    margin: 1.4rem 0 0.5rem;
  }

  #page-content h2 {
    font-size: 11.5pt;
    margin: 1.2rem 0 0.4rem;
  }

  #page-content h3 {
    font-size: 11pt;
    margin: 1rem 0 0.3rem;
  }

  /* Links are dead on paper — print them as ordinary text, no URL in tow. */
  #page-content a,
  #page-content a:visited {
    color: #000 !important;
    text-decoration: none !important;
  }

  #page-content a[href]::after {
    content: "" !important;
  }

  /* Signature blocks, attendance sheets and resolutions must not be split. */
  #page-content table {
    border-collapse: collapse;
    page-break-inside: avoid;
    width: 100%;
  }

  #page-content th,
  #page-content td {
    border: 1px solid #000;
    padding: 0.3rem 0.4rem;
    vertical-align: top;
  }

  #page-content thead {
    display: table-header-group;
  }

  #page-content tr {
    page-break-inside: avoid;
  }

  #page-content p,
  #page-content li {
    orphans: 2;
    widows: 2;
  }

  #page-content hr {
    border: 0;
    border-top: 1px solid #000;
    margin: 1.2rem 0;
  }

  /* Start a fresh sheet where the markdown asks for one. */
  .page-break {
    page-break-before: always;
  }
}
