/* css/modules/print.css — Print a doc (docs/internal/DOC_PRINT_RESEARCH.md).
   One @media print block in a normally linked sheet, so it activates with
   everything else at print time. Every rule is gated on html.doc-print, the
   class js/features/doc-print.js stamps between beforeprint and afterprint
   ONLY while a doc is open — with no doc open this sheet is inert and a print
   is exactly what it was before. Paper colours are fixed here (ink on white)
   whatever the theme, so there is no light-mode twin. */

@media print {

    @page {
        margin: 20mm;
    }

    /* The app is a fixed 100vh shell of clipped boxes — a print of it is one
       sheet's worth of whatever was on screen. Hide it whole; let the view flow. */
    html.doc-print body > *:not(#docPrintView) {
        display: none !important;
    }
    html.doc-print,
    html.doc-print body {
        height: auto;
        overflow: visible;
        display: block;
        background: #fff;
        color: #1a1918;
        color-scheme: light;   /* the app's :root is color-scheme: dark — without this the sheet margins print black in dark mode */
    }
    html.doc-print #docPrintView {
        display: block;
        font-family: 'Newsreader', Georgia, 'Times New Roman', serif;
        font-size: 12pt;
        line-height: 1.6;
        color: #1a1918;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* One doc page per sheet run: a break BETWEEN pages, none before the first. */
    .doc-print-page + .doc-print-page {
        page-break-before: always;
        break-before: page;
    }

    /* "Page 2 of 3" — rendered only when the doc has more than one page. */
    .doc-print-meta {
        font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
        font-size: 9pt;
        color: #6b675f;
        margin: 0 0 6pt;
    }

    /* The page title, as the screen title (Newsreader, bold). */
    .doc-print-title {
        font-size: 24pt;
        font-weight: 700;
        line-height: 1.2;
        margin: 0 0 14pt;
        color: #1a1918;
        page-break-after: avoid;
        break-after: avoid;
    }

    /* The body — the screen rules (.doc-editor .ProseMirror …) in ink. */
    .doc-print-body > :first-child { margin-top: 0; }
    .doc-print-body p { margin: 0 0 0.75em; }
    .doc-print-body h1 { font-size: 20pt; font-weight: 700; margin: 1.2em 0 0.5em; }
    .doc-print-body h2 { font-size: 16pt; font-weight: 600; margin: 1.1em 0 0.45em; }
    .doc-print-body h3 { font-size: 13pt; font-weight: 600; margin: 1em 0 0.4em; color: #3d3a35; }
    .doc-print-body h1,
    .doc-print-body h2,
    .doc-print-body h3 {
        page-break-after: avoid;
        break-after: avoid;
    }
    .doc-print-body ul,
    .doc-print-body ol { margin: 0 0 0.75em; padding-left: 1.6em; }
    .doc-print-body li { margin: 0.15em 0; }
    .doc-print-body li p { margin: 0; }
    .doc-print-body blockquote {
        margin: 0.75em 0;
        padding-left: 1em;
        border-left: 2pt solid #bdb8ae;
        color: #3d3a35;
    }
    .doc-print-body a { color: inherit; text-decoration: underline; }
    .doc-print-body strong { font-weight: 700; }
    .doc-print-body mark { background: #f3e6a8; color: inherit; }
    .doc-print-body code {
        font-family: 'JetBrains Mono', Menlo, monospace;
        font-size: 0.9em;
        background: #f1efea;
        padding: 0 0.25em;
        border-radius: 2pt;
    }
    .doc-print-body pre {
        background: #f1efea;
        padding: 0.6em 0.8em;
        border-radius: 3pt;
        white-space: pre-wrap;
        margin: 0 0 0.75em;
    }
    .doc-print-body pre code { background: none; padding: 0; }
    .doc-print-body hr { border: 0; border-top: 1pt solid #bdb8ae; margin: 1em 0; }
    .doc-print-body img {
        max-width: 100%;
        height: auto;
        display: block;
        margin: 0.75em 0;
    }
    .doc-print-body table {
        border-collapse: collapse;
        width: 100%;
        margin: 0.75em 0;
        font-size: 10.5pt;
    }
    .doc-print-body th,
    .doc-print-body td {
        border: 0.75pt solid #8f8a80;
        padding: 4pt 7pt;
        vertical-align: top;
        text-align: left;
    }
    .doc-print-body th { font-weight: 600; background: #f1efea; }

    /* Task lists: the parser emits ul[data-type="taskList"] > li[data-checked]
       with no <input> — draw the box in ink. */
    .doc-print-body ul[data-type="taskList"] { list-style: none; padding-left: 0.2em; }
    .doc-print-body li[data-type="taskItem"] { display: flex; align-items: baseline; gap: 0.45em; }
    .doc-print-body li[data-type="taskItem"]::before { content: "☐"; flex-shrink: 0; }
    .doc-print-body li[data-type="taskItem"][data-checked="true"]::before { content: "☑"; }

    /* Never split these across sheets. */
    .doc-print-body img,
    .doc-print-body table,
    .doc-print-body blockquote,
    .doc-print-body pre,
    .doc-print-body li {
        page-break-inside: avoid;
        break-inside: avoid;
    }

}
