/* content/print.css — the article as a printed page, and so as the PDF the
   Download PDF button makes (print.js opens the browser's print dialog;
   "Save as PDF" is the export). Linked with media="print" after every other
   sheet, a post's own included, so these rules win without !important.
   print.js drops body.dark-mode for the print, so the light palette and the
   light twins of dark-art diagrams are what reach paper. */

@page {
    margin: 18mm 17mm 20mm;
    @bottom-right {
        content: counter(page) " / " counter(pages);
        font: 8.5pt "IBM Plex Sans", sans-serif;
        color: #6b6570;
    }
}

* {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

html { font-size: 10pt; }

body {
    background: #ffffff;
    font-size: 11pt;
    line-height: 1.55;
    overflow: visible;
}

/* Site chrome has no place on paper; the article's own H1 is the title. */
.main-header,
.sidebar,
.sidebar-backdrop,
.menu-fab,
.post-export,
#theme-toggle,
.acord-code-tools,
.read-more-container {
    display: none;
}

.main-content {
    max-width: none;
    margin: 0;
    padding: 0;
}

.main-content > h1:first-child,
.main-content > h1:first-of-type {
    margin-top: 0;
}

h1, h2, h3, h4, h5, h6 {
    break-after: avoid-page;
    break-inside: avoid;
}

p, li, dd {
    orphans: 3;
    widows: 3;
}

pre, table, figure, img, svg, video, keypoint, blockquote, .md-figure, .toc, .acord-code {
    break-inside: avoid;
}

/* Long tables and code may still need to split; never let them run off. */
table { max-width: 100%; }
pre, pre code {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    overflow: visible;
}

img, svg, video {
    max-width: 100%;
    height: auto;
}

/* Full-bleed blocks (|+| widecontent, 100vw tricks in post sheets) fit the
   page instead. */
widecontent, .widecontent {
    width: auto;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
}

/* Nothing on paper can be clicked to reveal. */
.spoiler,
.spoiler:not(.revealed) * {
    color: inherit;
    background: var(--code-bg);
}
.spoiler:not(.revealed) img,
.spoiler:not(.revealed) video {
    filter: none;
}

/* The contents list prints in place as an index of the article. */
.toc-rail {
    position: static;
    width: auto;
}
.toc { background: transparent; }

a { text-decoration: underline; text-decoration-thickness: 0.5px; }
