/* =====================================================
   PRINT COMPATIBILITY
   Supports A4, A3, Letter, Portrait and Landscape
===================================================== */

@media print {

    /* Allow the user/browser to select paper size and orientation */
    @page {
        size: auto;
        margin: 10mm;
    }

    /* Preserve colours and backgrounds */
    *,
    *::before,
    *::after {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        box-sizing: border-box !important;
    }

    html,
    body {
        width: auto !important;
        height: auto !important;
        min-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
        background: #fff !important;
    }

    /* Main content should flow across multiple pages */
    main,
    section,
    article,
    .container,
    .topbar,
    .site-header,
    .main-nav,
    .whatsnew-bar,
    .site-footer,
    .footer-container,
    .row {
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        overflow: visible !important;
    }

    /* Maintain centered boxed layout */
    .container {
        width: 100% !important;
        max-width: 1140px !important;
        margin-left: auto !important;
        margin-right: auto !important;
        padding-left: 8px !important;
        padding-right: 8px !important;
    }

    /* Remove fixed and sticky positioning */
    .site-header,
    .main-nav,
    .topbar,
    .whatsnew-bar,
    .site-footer {
        position: static !important;
        inset: auto !important;
    }

    /* Topbar */
    .topbar .container {
        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: flex-end !important;
        align-items: center !important;
        gap: 6px 12px !important;
    }

    .topbar,
    .topbar * {
        visibility: visible !important;
        opacity: 1 !important;
    }

    /* Hide unnecessary interactive elements */
    .skip-link,
    a.skip-link,
    .scroll-top-btn,
    #scroll-top-btn,
    .ihbt-language-overlay,
    #ihbtLanguagePopup,
    .ihbt-logo-overlay,
    #ihbtLogoPopup,
    .ihbt-ticker-control,
    .print-hide,
    body > [class*="accessibility"],
    body > [id*="accessibility"],
    body > [class*="ux4g-widget"],
    body > [id*="ux4g-widget"] {
        display: none !important;
    }

    /* Disable animations */
    [data-aos],
    .fade,
    .animate,
    [class*="reveal"] {
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
        transition: none !important;
        animation: none !important;
    }

    /* Images and media */
    img,
    svg,
    video,
    iframe {
        max-width: 100% !important;
    }

    img,
    video {
        height: auto !important;
    }

    /* Avoid unnecessary page breaks inside elements */
    img,
    figure,
    table,
    tr,
    .module-card,
    .card {
        break-inside: avoid !important;
        page-break-inside: avoid !important;
    }

    /* Keep headings with their following content */
    h1,
    h2,
    h3,
    h4 {
        break-after: avoid !important;
        page-break-after: avoid !important;
    }

    /* Allow long tables to flow across pages */
    table {
        width: 100% !important;
        max-width: 100% !important;
        border-collapse: collapse !important;
    }

    th,
    td {
        overflow-wrap: anywhere !important;
    }

    /* Prevent horizontal overflow */
    .row {
        max-width: 100% !important;
    }

    /* Remove unwanted shadows */
    .card,
    .module-card,
    .site-header,
    .site-footer {
        box-shadow: none !important;
    }

    /* Links should remain readable */
    a {
        text-decoration: underline;
        overflow-wrap: anywhere;
    }

    /* Make sure content is visible */
    .d-none,
    .hidden {
        /* Keep intentionally hidden website elements hidden */
    }

    body,
    p,
    li,
    td,
    th {
        overflow-wrap: break-word;
    }
}
/* ==========================================
   HOMEPAGE PRINT FIX
========================================== */

/* Homepage hero/banner */
body.csirihbt-site .hero-section,
body.csirihbt-site .dj-slideshow,
body.csirihbt-site .djslider,
body.csirihbt-site .hero-banner {
    position: relative !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
}

/* Homepage sections */
body.csirihbt-site .home-section,
body.csirihbt-site .whatsnew-section,
body.csirihbt-site .stats-section,
body.csirihbt-site .container {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
}

/* Homepage cards */
body.csirihbt-site .module-card,
body.csirihbt-site .card {
    break-inside: avoid !important;
    page-break-inside: avoid !important;
}

/* Avoid oversized homepage images */
body.csirihbt-site img {
    max-width: 100% !important;
    object-fit: contain !important;
}

/* Remove slider controls */
body.csirihbt-site .slick-arrow,
body.csirihbt-site .slick-dots,
body.csirihbt-site .owl-nav,
body.csirihbt-site .owl-dots {
    display: none !important;
}
/* ==========================================
   TOPBAR PRINT FIX
========================================== */

@media print {

    .topbar {
        width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
        padding: 5px 0 !important;
        position: static !important;
        overflow: visible !important;
    }

    .topbar .container {
        width: 100% !important;
        max-width: 100% !important;
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 5px 12px !important;
        padding: 0 5px !important;
    }

    .topbar a,
    .topbar span,
    .topbar li {
        display: inline-block !important;
        float: none !important;
        font-size: 9pt !important;
        line-height: 1.5 !important;
        white-space: normal !important;
    }

    /* Header logos */
    .site-header img {
        max-height: 65px !important;
        width: auto !important;
        object-fit: contain !important;
    }

    .site-header .container {
        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: space-between !important;
        align-items: center !important;
    }

    /* Navigation */
    .main-nav {
        position: static !important;
        width: 100% !important;
        height: auto !important;
    }

    .main-nav ul {
        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
    }

    .main-nav li {
        display: inline-block !important;
        float: none !important;
    }

    /* Hide mobile menu toggle */
    .navbar-toggler,
    .mobile-menu-toggle {
        display: none !important;
    }
}