/* ============================================
   MADANIA — PRINT STYLESHEET
   ============================================
   Loaded by WordPress with media="print" so it only
   applies when the user prints or generates a PDF.

   Goals (in priority order):
     1. Save ink — strip backgrounds, gradients, colored fills
     2. Ensure readability — force dark text on white
     3. Hide chrome — nav, footer, buttons, banners
     4. Preserve value — show URLs after links so printed copies
        remain useful as references
     5. Sensible page-breaks — avoid orphaned headings or split
        list items

   Print stylesheets are unusually long-lived: changes here
   should be tested by opening the browser's print preview,
   NOT by sending pages to a real printer each time. Most
   browsers expose print preview at Ctrl/Cmd+P.
   ============================================ */

@media print {

    /* ── Reset all backgrounds to save ink ──────────────────── */
    *,
    *::before,
    *::after {
        background: transparent !important;
        background-color: transparent !important;
        background-image: none !important;
        color: #000 !important;
        text-shadow: none !important;
        box-shadow: none !important;
        filter: none !important;
    }

    /* ── Body ──────────────────────────────────────────────── */
    body {
        font-family: Georgia, 'Times New Roman', Times, serif;
        font-size: 11pt;
        line-height: 1.5;
        color: #000;
        background: #fff;
    }

    /* ── Hide chrome / navigation / interactive elements ────── */
    .madania-navbar,
    .madania-hamburger,
    .madania-nav-container,
    .madania-nav-links,
    .sub-menu-toggle,
    .madania-donate-btn,
    .btn-donate-madania,
    .madania-footer,
    .madania-cookie-banner,
    .madania-related-posts,
    .madania-breadcrumbs,
    .skip-link,
    #wpadminbar,
    nav,
    aside,
    form,
    button,
    .elementor-button,
    .madania-prayer-times {
        display: none !important;
    }

    /* ── Headings ──────────────────────────────────────────── */
    h1, h2, h3, h4, h5, h6 {
        page-break-after: avoid;
        page-break-inside: avoid;
        font-weight: 700;
    }
    h1 { font-size: 22pt; margin: 0 0 12pt; }
    h2 { font-size: 18pt; margin: 18pt 0 10pt; }
    h3 { font-size: 14pt; margin: 14pt 0 8pt; }
    h4 { font-size: 12pt; margin: 12pt 0 6pt; }

    /* ── Paragraphs and lists ──────────────────────────────── */
    p, blockquote, ul, ol, dl, li, table {
        page-break-inside: avoid;
    }
    p { margin: 0 0 8pt; orphans: 3; widows: 3; }
    ul, ol { margin: 0 0 8pt 24pt; }
    li { margin: 0 0 4pt; }

    /* ── Links: show URL after the link text ───────────────── */
    a,
    a:visited {
        color: #000 !important;
        text-decoration: underline;
    }

    /* Print the URL in parentheses after external links.
       Skip same-page anchors, javascript URLs, and image links
       (which would print absurdly long blob/data URIs). */
    a[href^="http"]:not([href*="sameerm.com"])::after {
        content: " (" attr(href) ")";
        font-size: 9pt;
        font-weight: normal;
        word-break: break-all;
    }

    /* Same-domain links: show just the path, not the full URL */
    a[href^="/"]::after,
    a[href*="sameerm.com"]::after {
        content: " (" attr(href) ")";
        font-size: 9pt;
        font-weight: normal;
        word-break: break-all;
    }

    /* Suppress URL printing for image-wrapping links, anchors, etc. */
    a[href^="#"]::after,
    a[href^="javascript:"]::after,
    a[href^="mailto:"]::after,
    a[href^="tel:"]::after,
    a:has(img)::after {
        content: "";
    }

    /* ── Images ───────────────────────────────────────────── */
    img {
        max-width: 100% !important;
        page-break-inside: avoid;
    }

    /* ── Tables ───────────────────────────────────────────── */
    table {
        border-collapse: collapse;
        width: 100%;
    }
    th, td {
        border: 1px solid #666;
        padding: 4pt 6pt;
        text-align: left;
        vertical-align: top;
    }
    thead { display: table-header-group; } /* repeat headers per page */

    /* ── Page margins ─────────────────────────────────────── */
    @page {
        margin: 2cm;
    }
    @page :first {
        margin-top: 1.5cm; /* slightly less on the first page */
    }
}
