/* Shared paper-safe print contract for legal, conversion, and Learn documents. */

@page {
    margin: 16mm;
}

html,
body {
    background: #fff !important;
    color: #111 !important;
    color-scheme: light !important;
    overflow: visible !important;
}

body.menu-is-open {
    overflow: visible !important;
}

.site-global-grid,
.site-header,
.scroll-progress,
.mobile-menu-toggle,
.tradiency-cookie-banner,
.tradiency-cookie-modal,
.footer-nav,
.menu-item-cookie-settings,
.td-vs-button,
.td-pricing-checkout__actions,
.td-faq-final__actions,
.td-about-hero__actions,
.td-about-final__actions,
.td-learn-related-learning,
.td-learn-article-next {
    display: none !important;
}

.site-footer {
    margin-top: 1.5rem !important;
    padding: 0.75rem 0 0 !important;
    border-top: 1px solid #bbb !important;
    background: #fff !important;
    color: #333 !important;
}

.footer-copy,
.footer-disclaimer {
    color: #444 !important;
    font-size: 9pt !important;
}

.site-footer a {
    color: #111 !important;
    text-decoration: underline !important;
    text-decoration-color: currentColor !important;
}

:is(.td-conversion-page, .site-main--legal, .td-learn--article) {
    background: #fff !important;
    color: #111 !important;
    overflow: visible !important;
}

:is(.td-conversion-page, .site-main--legal, .td-learn--article) *,
:is(.td-conversion-page, .site-main--legal, .td-learn--article) *::before,
:is(.td-conversion-page, .site-main--legal, .td-learn--article) *::after {
    box-shadow: none !important;
    text-shadow: none !important;
}

:is(.td-conversion-page, .site-main--legal, .td-learn--article)
    :where(section, article, aside, header, footer, div, details, figure, dl, ol, ul, li) {
    background-color: transparent !important;
    background-image: none !important;
}

:is(.td-conversion-page, .site-main--legal, .td-learn--article)
    :where(h1, h2, h3, h4, h5, h6, p, li, dt, dd, span, strong, em, small, summary, figcaption) {
    color: #111 !important;
}

:is(.td-conversion-page, .site-main--legal, .td-learn--article) a {
    color: #111 !important;
    text-decoration: underline !important;
}

:is(.td-conversion-page, .site-main--legal, .td-learn--article)
    :where(p, li, blockquote, dd) {
    orphans: 3;
    widows: 3;
}

/* Let long content paginate naturally. Route CSS previously avoided breaks on whole sections. */
.td-conversion-page :where(section, article, details),
.site-main--legal :where(section, article),
.td-learn--article :where(section, article, aside) {
    break-inside: auto !important;
}

/* Keep only genuinely compact records together where practical. */
:is(.td-conversion-page, .site-main--legal, .td-learn--article)
    :where(
        figure,
        blockquote,
        .td-pricing-facts > div,
        .td-pricing-status,
        .td-about-proof__status,
        .td-learn-learning-note,
        .td-learn-gate-context
    ) {
    break-inside: avoid !important;
}

:is(.td-conversion-page, .site-main--legal, .td-learn--article)
    :where(h1, h2, h3, h4, summary) {
    break-after: avoid;
    page-break-after: avoid;
}

/* Native disclosures are opened by main.js before print. Remove web-only markers. */
.td-disclosure__marker {
    display: none !important;
}

.td-disclosure,
.td-disclosure__answer {
    overflow: visible !important;
}

/* Printable tables must fit portrait A4/Letter without horizontal scrolling. */
.td-learn--article table,
.site-main--legal table,
.td-conversion-page table {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    table-layout: auto !important;
    border-collapse: collapse !important;
    font-size: 9pt !important;
}

.td-learn--article :where(th, td),
.site-main--legal :where(th, td),
.td-conversion-page :where(th, td) {
    padding: 0.25rem 0.35rem !important;
    overflow-wrap: anywhere !important;
}

.td-learn--article :where(.wp-block-table, .legal-table-wrap),
.site-main--legal :where(.wp-block-table, .legal-table-wrap),
.td-conversion-page :where(.wp-block-table, .legal-table-wrap) {
    overflow: visible !important;
    max-width: 100% !important;
}

/* Screen scrolling and dark code surfaces are unavailable/unsafe in paper output. */
.td-learn--article :where(pre, code),
.site-main--legal :where(pre, code),
.td-conversion-page :where(pre, code) {
    max-width: 100% !important;
    color: #111 !important;
    white-space: pre-wrap !important;
    overflow: visible !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
}

.td-learn--article code,
.site-main--legal code,
.td-conversion-page code {
    background: #f1f1f1 !important;
}

.td-learn--article pre,
.site-main--legal pre,
.td-conversion-page pre {
    border: 1px solid #bbb !important;
    background: #f5f5f5 !important;
}

.td-learn--article pre code,
.site-main--legal pre code,
.td-conversion-page pre code {
    background: transparent !important;
    color: inherit !important;
}

:is(.td-conversion-page, .site-main--legal, .td-learn--article) img,
:is(.td-conversion-page, .site-main--legal, .td-learn--article) svg {
    max-width: 100% !important;
    height: auto !important;
}

/* Web pagination controls are meaningless in a complete printed legal document. */
.site-main--legal .legal-page-nav {
    display: none !important;
}

/* Preserve useful destinations when link annotations are lost in paper/flattened PDFs. */
.entry-content a[href^="http"]:not([href*="#"])::after,
.legal-content a[href^="http"]:not([href*="#"])::after,
.td-conversion-page a[href^="http"]:not(.td-vs-button):not([href*="#"])::after,
.td-learn-article-body a[href^="http"]:not([href*="#"])::after,
.td-learn-article-risk-note a[href^="http"]:not([href*="#"])::after,
.footer-disclaimer a[href^="http"]:not([href*="#"])::after {
    content: " (" attr(href) ")";
    color: #333 !important;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 8pt;
    font-weight: 400;
    overflow-wrap: anywhere;
}

.tradiency-print-source {
    display: block !important;
    margin: 0.75rem 0 1rem !important;
    color: #444 !important;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace !important;
    font-size: 8pt !important;
    overflow-wrap: anywhere !important;
}
