/* ── Save to PDF – public styles ─────────────────────────────────────── */

.wstpdf-wrap {
    margin: 1.5em 0;
    line-height: 1;
    clear: both;
}

.wstpdf-btn {
    display: inline-flex;
    align-items: center;
    padding: .55em 1.3em;
    font-size: .9rem;
    font-weight: 600;
    border: 2px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: opacity .15s ease, box-shadow .15s ease;
    text-decoration: none !important;
    white-space: nowrap;
    line-height: 1.4;
    font-family: inherit;
}
.wstpdf-btn:hover {
    opacity: .82;
    box-shadow: 0 2px 8px rgba(0,0,0,.18);
}
.wstpdf-btn:active  { opacity: .65; box-shadow: none; }
.wstpdf-btn:disabled,
.wstpdf-btn.is-loading {
    opacity: .6;
    cursor: wait;
    pointer-events: none;
}

/* ── Helper classes toggled by JS before printing ─────────────────────
   These work in BOTH normal view (briefly, while preparing) and print.
   `wstpdf-printing` is added to <body> for the duration.
───────────────────────────────────────────────────────────────────── */

/* Elements that were already hidden by responsive CSS — keep them
   hidden during print so Divi's mobile/desktop duplicates don't
   both appear in the PDF. */
body.wstpdf-printing .wstpdf-force-hide {
    display: none !important;
}

/* Slider / testimonial slides that Divi hides via JS — force visible */
body.wstpdf-printing .wstpdf-force-show {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}
/* Remove absolute positioning so slides stack instead of overlapping */
body.wstpdf-printing .wstpdf-static-pos {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    transform: none !important;
}

/* SVG placeholder images with no real counterpart */
.wstpdf-hide-print {
    display: none !important;
}

/* Background-image clones injected by JS */
.wstpdf-bg-clone {
    width: 100%;
    height: auto;
    display: block;
}

/* Print-only title / header / footer blocks */
.wstpdf-print-title-block { display: none; }
.wstpdf-print-header,
.wstpdf-print-footer,
.wstpdf-print-h1 { display: none; }


/* ══════════════════════════════════════════════════════════════════════
   PRINT STYLESHEET
   Applied only when the browser print dialog is open (window.print()).
   This is where the real PDF formatting happens.
══════════════════════════════════════════════════════════════════════ */
@media print {

    /* Force background colours/images to print regardless of the
       browser's "background graphics" checkbox where supported. */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
    }

    html, body {
        width: 100% !important;
        height: auto !important;
        overflow: visible !important;
        background: #fff !important;
        color: #1a1a1a !important;
    }

    /* ── Hide site chrome ────────────────────────────────────────────── */
    header, footer, nav,
    #main-header, #top-header, #et-top-navigation,
    .et-l--header, .et-l--footer,
    .site-header, .site-footer, .main-navigation,
    .sidebar, .widget-area, #secondary,
    .comments-area, #comments, .comment-respond,
    .sharedaddy, .addtoany_share_save_container,
    .et-pb-arrow-up, .et_pb_scroll_top,
    .et_pb_fullwidth_header,
    .et_pb_section_video_bg, video,
    [class*="cookie"], [id*="cookie"],
    [class*="popup"],  [id*="popup"],
    [class*="modal"],  [id*="modal"],
    .wstpdf-wrap, .wstpdf-btn, .no-pdf,
    #wpadminbar, .admin-bar,
    iframe {
        display: none !important;
    }

    /* ── Print-only title block ───────────────────────────────────────── */
    .wstpdf-print-title-block {
        display: block !important;
        page-break-after: avoid;
    }
    .wstpdf-print-header {
        display: block !important;
        font-size: 9pt;
        color: #555;
        border-bottom: 1px solid #ddd;
        padding-bottom: 6px;
        margin-bottom: 14px;
    }
    .wstpdf-print-h1 {
        display: block !important;
        font-size: 22pt;
        font-weight: 700;
        color: #222;
        margin: 0 0 16px;
        line-height: 1.25;
    }
    .wstpdf-print-footer {
        display: block !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        font-size: 8pt;
        color: #777;
        border-top: 1px solid #ddd;
        padding-top: 4px;
        text-align: center;
    }

    /* ── Layout resets so content fills the printable area ─────────────── */
    #page-container, #main-content, #et-main-area,
    .et_pb_section, .et_pb_row, .et_pb_column,
    .container, .et_builder_inner_content,
    article, main, .entry-content {
        width: 100% !important;
        max-width: 100% !important;
        float: none !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        box-sizing: border-box !important;
    }

    /* Remove fullscreen / viewport-height sections that create blank
       pages — let them size to their actual content. */
    .et_pb_section,
    .et_pb_fullwidth_section,
    [style*="min-height"],
    [style*="height: 100vh"],
    [style*="height:100vh"] {
        min-height: 0 !important;
        height: auto !important;
    }

    /* Divi rows/columns: stack into normal block flow for print
       so multi-column layouts don't get clipped */
    .et_pb_row,
    .et_pb_row_inner,
    .et_pb_column_inner,
    .et_pb_column_inner_1,
    .et_pb_column_inner_2,
    .et_pb_column_inner_3,
    .et_pb_column_inner_4 {
        display: block !important;
    }
    .et_pb_column,
    .et_pb_column_1,
    .et_pb_column_2,
    .et_pb_column_3,
    .et_pb_column_4 {
        width: 100% !important;
        max-width: 100% !important;
        float: none !important;
        display: block !important;
    }

    /* Divi's scroll-triggered "appear" animations leave modules at
       opacity:0 / translated off-canvas until JS adds .et-animated.
       Force everything visible regardless of animation state. */
    .et_pb_module,
    .et-waypoint,
    [class*="et-animated"],
    [data-animation],
    [class*="_animation_"] {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
        animation: none !important;
        visibility: visible !important;
    }

    /* Clipped overflow on Divi wrappers can hide content during reflow */
    #page-container, #main-content, #et-main-area,
    .et_pb_section, .et_pb_row, .et_pb_column,
    .et_pb_module, .et_pb_text, .et_pb_image,
    .container, .et_builder_inner_content,
    article, main, .entry-content {
        overflow: visible !important;
    }

    /* Reduce excessive section padding that wastes paper */
    .et_pb_section {
        padding: 10px 0 !important;
    }

    /* ── Images & media ──────────────────────────────────────────────── */
    img {
        max-width: 100% !important;
        height: auto !important;
        page-break-inside: avoid;
        display: inline-block;
    }

    /* ── Typography & page-break hygiene ────────────────────────────── */
    h1, h2, h3, h4, h5, h6 {
        page-break-after: avoid;
        color: #222 !important;
        orphans: 3;
        widows: 3;
    }
    p, blockquote, table, figure, li {
        page-break-inside: avoid;
        color: #333 !important;
        orphans: 3;
        widows: 3;
    }

    /* Hyperlinks stay visually intact and active (Chrome embeds real
       clickable link annotations for every <a href> when printing to
       PDF — no extra work needed). Keep normal link styling so they
       still look like links in the saved PDF. */
    a, a:link, a:visited {
        color: #1a4f8b !important;
        text-decoration: underline;
        cursor: pointer;
    }

    /* Optional: show the full URL after each link (opt-in via the
       "Show link URLs" setting). Off by default for a clean,
       screenshot-like result with active hyperlinks. */
    body.wstpdf-show-urls a[href]::after {
        content: " (" attr(href) ")";
        font-size: 8pt;
        color: #666;
        text-decoration: none;
    }
    body.wstpdf-show-urls a[href^="#"]::after,
    body.wstpdf-show-urls a[href^="javascript:"]::after,
    body.wstpdf-show-urls a[href=""]::after {
        content: "";
    }

    /* Divi sliders: after expansion, stack slides vertically with spacing */
    .et_pb_slide, .et_pb_testimonial {
        page-break-inside: avoid;
        margin-bottom: 14px;
        border-bottom: 1px solid #eee;
        padding-bottom: 14px;
    }

    /* Buttons rendered as plain text (avoid odd button chrome in print) */
    .et_pb_button, .et_pb_promo_button {
        border: 1px solid #999 !important;
        background: transparent !important;
        color: #222 !important;
        padding: 4px 10px !important;
    }
}
