/**
 * Print Stylesheet — Sprint 5 Task 5.2.4
 *
 * Hides navigation, footer, interactive elements.
 * Makes map + legend printable.
 *
 * @package Pollgraphics_Access
 * @version 2.28.65
 */

@media print {
    /* ── Hide non-essential elements ── */
    #header,
    .site-header,
    .pg-user-menu,
    .pg-mega-menu,
    .pg-scroll-top,
    .pg-skip-link,
    .pg-back-link,
    .mapmenulibrary,
    #controls,
    .pg-pwa-install-banner,
    .pg-footer-wrapper,
    .site-footer,
    .footer-menu,
    .go-to-top,
    .pg-breadcrumbs,
    .mobile-bottom-sheet,
    .pg-search-section,
    button,
    .wp-block-separator {
        display: none !important;
    }

    /* ── Page setup ── */
    @page {
        margin: 1.5cm;
        size: A4 portrait;
    }

    body {
        font-family: 'Source Sans 3', Arial, Helvetica, sans-serif !important;
        font-size: 11pt !important;
        color: #000 !important;
        background: #fff !important;
        line-height: 1.5 !important;
    }

    /* ── Layout: full width ── */
    .site-main,
    .entry-content,
    .map-grid-wrapper {
        max-width: 100% !important;
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    /* ── Map grid: single column for print ── */
    .map-grid-wrapper {
        display: block !important;
    }

    /* ── Title + Legend: visible ── */
    #title-legend-container {
        display: block !important;
        margin-bottom: 12pt !important;
        border: none !important;
        box-shadow: none !important;
        background: #fff !important;
    }

    #title-container,
    #legend-container {
        overflow: visible !important;
    }

    #title-container object,
    #legend-container object {
        max-width: 100% !important;
        height: auto !important;
    }

    /* ── Map container ── */
    #map-container,
    #svg-container {
        border: 1px solid #ccc !important;
        box-shadow: none !important;
        background: #fff !important;
        page-break-inside: avoid !important;
        max-width: 100% !important;
    }

    #svg-container object {
        max-width: 100% !important;
        height: auto !important;
    }

    /* ── Charts: show, but page-break-before ── */
    #polls-container {
        page-break-before: always !important;
        border: none !important;
        box-shadow: none !important;
        background: #fff !important;
    }

    #timeline-canvas {
        max-width: 100% !important;
        height: auto !important;
    }

    /* ── Area info: visible for constituency pages ── */
    #area-info-container {
        border: 1px solid #ccc !important;
        box-shadow: none !important;
        background: #fff !important;
        margin-bottom: 12pt !important;
        page-break-inside: avoid !important;
    }

    /* ── Cards: simple borders for print ── */
    .pg-card,
    .pg-explainer-card,
    .pg-source-card {
        border: 1px solid #ccc !important;
        box-shadow: none !important;
        background: #fff !important;
        color: #000 !important;
        page-break-inside: avoid !important;
    }

    /* ── Area cards grid ── */
    .pg-area-grid {
        display: grid !important;
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 6pt !important;
    }

    .pg-area-card {
        border: 1px solid #ccc !important;
        background: #f9f9f9 !important;
        color: #000 !important;
        text-decoration: none !important;
        page-break-inside: avoid !important;
    }

    /* ── Links: show URLs ── */
    .pg-explainer-card a::after,
    .pg-source-card a::after {
        content: " (" attr(href) ")" !important;
        font-size: 9pt !important;
        color: #666 !important;
    }

    /* ── Headings ── */
    h1, h2, h3 {
        font-family: 'Source Serif 4', Georgia, 'Times New Roman', serif !important;
        color: #000 !important;
        page-break-after: avoid !important;
    }

    /* ── Loading states: hide ── */
    .pg-loading,
    .pg-skeleton-active {
        opacity: 1 !important;
        filter: none !important;
    }

    .pg-skeleton-active::before,
    .pg-loading::after {
        display: none !important;
    }

    /* ── Print footer ── */
    body::after {
        content: "poll.graphics — POLLION GmbH — https://poll.graphics" !important;
        display: block !important;
        text-align: center !important;
        font-size: 9pt !important;
        color: #999 !important;
        margin-top: 24pt !important;
        padding-top: 12pt !important;
        border-top: 1px solid #ccc !important;
    }
}
