@media print {
  @page {
    size: A4;
    margin: 16mm 15mm 18mm;
  }

  html body .md-header,
  html body .md-tabs,
  html body .md-sidebar,
  html body .md-footer,
  html body footer.foot,
  html body .md-top,
  html body .md-dialog,
  html body .md-overlay,
  html body .md-skip,
  html body .md-search,
  html body nav.md-path,
  html body .md-content__button,
  html body .bt-pagenav,
  html body #cookie-banner,
  html body .cookie-banner,
  html body .md-source-file,
  html body .md-feedback,
  html body .md-tooltip,
  html body .md-tooltip2,
  html body .bt-print {
    display: none !important;
  }

  html body,
  html body .md-container,
  html body .md-main,
  html body .md-main__inner,
  html body .md-content,
  html body .md-content__inner,
  html body .md-grid {
    display: block !important;
    width: auto !important;
    max-width: none !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
    color: #000 !important;
  }

  html body .md-content__inner::before {
    display: none !important;
  }

  html body .md-typeset {
    font-size: 12pt !important;
    line-height: 1.4 !important;
    color: #000 !important;
  }

  html body .md-typeset h1,
  html body .md-typeset h2,
  html body .md-typeset h3,
  html body .md-typeset h4 {
    color: #000 !important;
    overflow-wrap: normal !important;
    hyphens: manual !important;
    break-after: avoid;
    page-break-after: avoid;
  }

  html body .md-typeset h1 {
    font-size: 22pt !important;
    margin: 0 0 0.6em !important;
  }

  html body .md-typeset h2 {
    font-size: 16pt !important;
    margin: 1.4em 0 0.5em !important;
  }

  html body .md-typeset h3 {
    font-size: 13.5pt !important;
  }

  html body .md-typeset .lede {
    font-size: 13pt !important;
    color: #333 !important;
  }

  html body .md-typeset figure,
  html body .md-typeset img,
  html body .md-typeset svg,
  html body .md-typeset table,
  html body .md-typeset pre,
  html body .md-typeset li,
  html body .md-typeset .admonition {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  html body .md-typeset details > summary {
    break-after: avoid;
    page-break-after: avoid;
  }

  /* Схемы и рисунки — во всю ширину листа, не шире. */
  html body .md-typeset p,
  html body .md-typeset ul,
  html body .md-typeset ol,
  html body .md-typeset li,
  html body .md-typeset h1,
  html body .md-typeset h2,
  html body .md-typeset h3 {
    max-width: none !important;
  }

  html body .md-typeset figure,
  html body .md-typeset figure.mermaid-static {
    display: block !important;
    width: auto !important;
    max-width: 100% !important;
    margin: 0.8em 0 !important;
    padding: 0 !important;
  }

  html body .md-typeset figure.mermaid-static svg,
  html body .md-typeset img {
    display: block !important;
    margin: 0 !important;
  }

  html body .md-typeset figure.mermaid-static svg,
  html body .md-typeset img {
    max-width: 100% !important;
    height: auto !important;
  }

  /* Сворачиваемые ответы («Частые вопросы») печатаются раскрытыми. */
  html body .md-typeset details.question,
  html body .md-typeset :not(details.question) + details.question {
    border: 0 !important;
    max-width: none !important;
    margin: 0.9em 0 0 !important;
  }

  html body .md-typeset details.question > summary {
    padding: 0 !important;
    font-size: 12pt !important;
    color: #000 !important;
  }

  html body .md-typeset details.question > summary::after,
  html body .md-typeset details.question[open] > summary::after {
    display: none !important;
    content: none !important;
  }

  html body .md-typeset details {
    display: block !important;
    border: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0.6em 0 !important;
    background: transparent !important;
  }

  html body .md-typeset details > summary {
    display: block !important;
    font-weight: 600 !important;
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
    cursor: default;
  }

  html body .md-typeset details > summary::before,
  html body .md-typeset details > summary::after {
    display: none !important;
  }

  html body .md-typeset details > :not(summary) {
    display: block !important;
    padding: 0 !important;
    margin: 0.3em 0 0 !important;
  }

  /* Список заголовков в PDF: вставляет hooks/pdf_export.py после подзаголовка, на сайте его нет. */
  html body .md-typeset .pdf-toc {
    margin: 1.2em 0 1.8em !important;
    padding: 0 !important;
    border: 0 !important;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  html body .md-typeset .pdf-toc ul {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  html body .md-typeset .pdf-toc ul ul {
    margin: 0.1em 0 0.2em 1.2em !important;
  }

  html body .md-typeset .pdf-toc li {
    margin: 0.3em 0 !important;
    padding: 0 !important;
    font-size: 12.5pt !important;
    font-weight: 600 !important;
    line-height: 1.3 !important;
  }

  html body .md-typeset .pdf-toc ul ul li {
    font-size: 11.5pt !important;
    font-weight: 500 !important;
    margin: 0.15em 0 !important;
  }

  html body .md-typeset .pdf-toc li::before {
    content: none !important;
  }

  html body .md-typeset .pdf-toc a {
    color: #000 !important;
    text-decoration: none !important;
  }

  /* Ссылки: чёрные, с адресом только у внешних. */
  html body .md-typeset a {
    color: #000 !important;
    text-decoration: underline !important;
  }

  html body .md-typeset a[href^="http"]:not([href*="bibtech.ru"])::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
    color: #444;
  }

  html body .md-typeset table:not([class]) {
    display: table !important;
    width: 100% !important;
    font-size: 11pt !important;
  }

  html body .md-typeset table:not([class]) th,
  html body .md-typeset table:not([class]) td {
    border: 1px solid #bbb !important;
    padding: 4px 8px !important;
  }
}
