/* Helios Course Hub — Print Stylesheet */

@page {
    margin: 1.5cm 2cm;
}

@media print {
    /* Hide navigation chrome */
    aside,
    header,
    footer,
    .mobile-nav-overlay,
    .mobile-nav-panel,
    #htmx-prev-next,
    #htmx-loading,
    #htmx-breadcrumbs {
        display: none !important;
    }

    /* Reset colors for print — covers both light and dark themes */
    body {
        background: white !important;
    }
    * {
        color: black !important;
        border-color: #ccc !important;
        box-shadow: none !important;
    }

    /* Collapse sidebar offset so content fills the page */
    :root {
        --helios-sidebar-width: 0px;
    }

    /* Full-width content layout */
    #toc-layout {
        display: block !important;
        max-width: 100% !important;
    }

    /* Show absolute URLs inline after links — skips relative paths and anchor links */
    #htmx-article a[href^="http"]::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: #000;
    }

    /* Avoid page breaks inside cards, callouts, and common content blocks */
    .doc-card,
    .callout,
    img,
    figure,
    pre,
    blockquote,
    table {
        break-inside: avoid;
    }

    /* Avoid breaking inside lists and individual list items */
    ul, ol, li {
        break-inside: avoid;
    }

    /* Keep headings attached to the content that follows them */
    h1, h2, h3, h4, h5, h6 {
        break-after: avoid;
    }

    /* Repeat table header row on each printed page */
    thead {
        display: table-header-group;
    }

    /* Prevent single orphaned/widowed lines at page breaks */
    p, li {
        orphans: 3;
        widows: 3;
    }

    /* Prevent code blocks from overflowing page width */
    pre, code {
        white-space: pre-wrap;
        word-wrap: break-word;
    }

    /* Utility class: hide elements from print output */
    .no-print {
        display: none !important;
    }
}
