/*
 * print_report.css
 * ----------------
 * Print (PDF) styling for the "T reports" tool (pages/tools/t_reports.py).
 *
 * Auto-loaded by Dash from /assets. Everything is scoped under
 * `body.t-reports-printing` — a class the Export-PDF clientside callback adds
 * to <body> only for the duration of a T-reports print (added before
 * window.print(), removed on `afterprint`). Scoping this way means:
 *   - other pages' printing is completely unaffected;
 *   - the app never looks different on screen (rules live inside @media print).
 *
 * What it does when printing a T report:
 *   - hides the app chrome (header, navbar, global filter bar) and the config
 *     rail, leaving only the report preview;
 *   - expands the preview to full page width and removes the on-screen
 *     scroll/height caps;
 *   - keeps each `.t-report-section` whole across page breaks;
 *   - sets a comfortable page margin.
 *
 * NO COLOUR INVERSION ANY MORE. This file used to flip the app's forced-dark
 * theme to dark-on-light for paper, and to paint a dark plate behind the
 * `plotly_dark` charts so their light-on-dark rendering stayed legible. The
 * Verdemar inversion (design_system.md §2.5) made the app light and the charts
 * light, so both hacks became not merely redundant but wrong — the chart plate
 * would have printed a dark rectangle behind a light figure. What remains is
 * purely structural: hide chrome, expand width, control page breaks.
 */

@media print {
    /* Print backgrounds/colours as authored (Chromium honours this). */
    body.t-reports-printing {
        background: var(--vm-surface) !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* ── Hide app chrome + the config rail ── */
    body.t-reports-printing .mantine-AppShell-header,
    body.t-reports-printing header.mantine-AppShell-header,
    body.t-reports-printing .mantine-AppShell-navbar,
    body.t-reports-printing nav.mantine-AppShell-navbar,
    body.t-reports-printing #global-filter-bar-wrap,
    body.t-reports-printing [data-testid="t-reports-config-rail"] {
        display: none !important;
    }

    /* ── Expand the main content + preview to full width ── */
    body.t-reports-printing .mantine-AppShell-main {
        padding: 0 !important;
        margin: 0 !important;
    }
    body.t-reports-printing [data-testid="t-reports-preview"] {
        max-height: none !important;
        overflow: visible !important;
    }
    /* The preview column is a flex child sized for the on-screen split; let it
       take the full page when the rail is gone. */
    body.t-reports-printing [data-testid="t-reports-preview"],
    body.t-reports-printing [data-testid="t-reports-preview"] > * {
        flex: 1 1 100% !important;
        min-width: 0 !important;
        width: 100% !important;
    }

    /* Cards print as they appear: white surface, hairline border, no shadow.
       §4.5 already forbids resting shadows, but print engines sometimes
       synthesise one, so it is suppressed explicitly. */
    body.t-reports-printing .mantine-Paper-root {
        box-shadow: none !important;
    }

    /* ── Page breaks: never split a section across pages. ── */
    body.t-reports-printing .t-report-section {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    @page {
        margin: 14mm;
    }
}
