/**
 * Prompt #10: print stylesheet — linked with media="print" in
 * templates/layout/header.php, so it only loads/applies when a page is
 * actually printed or exported to PDF, never affecting on-screen weight.
 * Aimed squarely at the content types worth printing (blog articles,
 * pSEO guides, the FAQ page) rather than the app shell around them.
 */

@page {
    margin: 2cm;
}

@media print {
    * {
        animation: none !important;
        transition: none !important;
        box-shadow: none !important;
    }

    html, body {
        background: #ffffff !important;
        color: #000000 !important;
    }

    /* Chrome that only makes sense on a screen. */
    .site-header,
    .site-footer,
    .toast-region,
    .header-search-panel,
    .search-suggest,
    .install-banner,
    .skip-link,
    .reading-progress,
    .theme-toggle,
    [data-modal] {
        display: none !important;
    }

    /* Interactive-only chrome that has no printed equivalent. */
    .btn,
    .pagination,
    .search-box,
    .upload-area,
    .tool-form,
    .newsletter,
    .comments-placeholder,
    .cta,
    .share-buttons,
    .table-of-contents,
    .favorite-toggle,
    form button[type="submit"] {
        display: none !important;
    }

    a, a:visited {
        color: #000000 !important;
        text-decoration: underline;
    }

    /* Print the destination URL after a link, but only inside real
       article/prose content — doing this site-wide would print a noisy
       URL after every nav item, footer link and button. */
    .prose a[href^="http"]:after,
    .prose a[href^="/"]:after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: #444444;
    }

    .container,
    .article-layout,
    main {
        max-width: 100% !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        display: block !important;
    }

    h1, h2, h3, h4 {
        color: #000000 !important;
        page-break-after: avoid;
    }

    img, figure, table {
        page-break-inside: avoid;
        max-width: 100% !important;
    }

    p, li {
        orphans: 3;
        widows: 3;
    }

    /* FAQ/guide answers are collapsed by default on screen
       (components/accordion.php uses the `hidden` attribute) — a printed
       page has no click interaction, so every answer must be visible. */
    .accordion__panel[hidden] {
        display: block !important;
    }

    .accordion__trigger .accordion__chevron {
        display: none;
    }

    .accordion__trigger {
        cursor: default;
    }

    /* One small, honest attribution line instead of trying to fake a
       running header/footer with generated content on every page type. */
    main#main-content::after {
        content: "Printed from mypdf.tech";
        display: block;
        margin-top: 2em;
        padding-top: 1em;
        border-top: 1px solid #cccccc;
        font-size: 0.75em;
        color: #666666;
    }
}
