/* Truth Carriers Workbooks — Shared Print Stylesheet
   Linked via <link rel="stylesheet" href="../print.css" media="print">
   Applies only when the user prints (Ctrl+P) or saves as PDF.
*/

@page {
    size: letter;
    margin: 0.75in 0.6in 0.85in 0.6in;
    @bottom-center {
        content: "Truth Carriers Education — Page " counter(page);
        font-family: serif;
        font-size: 9pt;
        color: #555;
    }
}

@media print {
    /* Reset backgrounds + force ink-friendly contrast */
    html, body {
        background: #fff !important;
        color: #000 !important;
        font-family: Georgia, "Times New Roman", serif !important;
        font-size: 11pt;
        line-height: 1.45;
    }

    /* Drop dark-theme decorations (gradients, drop shadows, glows, etc.) */
    *, *::before, *::after {
        background: transparent !important;
        background-image: none !important;
        background-color: transparent !important;
        box-shadow: none !important;
        text-shadow: none !important;
        color: #000 !important;
        border-color: #888 !important;
    }

    /* Containers: drop fixed widths so content fills the print page */
    .container, .workbook, main, section, article, .lesson, .answer-key {
        max-width: 100% !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        border: none !important;
    }

    /* Headings: keep with the next block, allow page break before */
    h1 { font-size: 22pt; margin: 0 0 12pt 0; page-break-after: avoid; }
    h2 { font-size: 16pt; margin: 18pt 0 6pt 0; page-break-after: avoid; page-break-before: auto; }
    h3 { font-size: 13pt; margin: 12pt 0 4pt 0; page-break-after: avoid; }
    h4 { font-size: 11.5pt; margin: 8pt 0 3pt 0; page-break-after: avoid; font-weight: bold; }

    /* Lessons should not split awkwardly across pages */
    .lesson, .lesson-block, .key-point, .quote-box, .scripture, blockquote {
        page-break-inside: avoid;
    }

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

    /* Images: shrink to fit, never overflow the page width */
    img {
        max-width: 90% !important;
        max-height: 4.5in !important;
        height: auto !important;
        display: block !important;
        margin: 8pt auto !important;
        page-break-inside: avoid;
        page-break-after: avoid;
        /* Print engines render PNG with subtle anti-aliasing */
        image-rendering: auto;
    }

    /* Inline-image wrappers commonly used in this curriculum */
    .inline-image, .workbook-image-wrap {
        page-break-inside: avoid;
        margin: 8pt 0 !important;
        padding: 0 !important;
        border: none !important;
    }

    .image-caption, .inline-image p {
        font-size: 9.5pt;
        font-style: italic;
        color: #444 !important;
        text-align: center;
        margin: 2pt 0 8pt 0 !important;
    }

    /* Fill-in-blank inputs: render as printable underlines */
    input.fill-blank, input[type="text"], input[type="number"] {
        border: none !important;
        border-bottom: 1px solid #000 !important;
        background: transparent !important;
        width: 1.4in !important;
        min-width: 1.4in !important;
        height: 14pt !important;
        font-size: 11pt !important;
        color: #000 !important;
        padding: 0 4pt !important;
        outline: none !important;
        box-shadow: none !important;
    }

    /* Wider input cues (longer answers) */
    input.long, input[size]:not([size="1"]):not([size="2"]):not([size="3"]) {
        width: 3.2in !important;
        min-width: 3.2in !important;
    }

    /* Check-boxes / radio buttons keep visible but simple */
    input[type="checkbox"], input[type="radio"] {
        appearance: auto !important;
        width: 12pt !important;
        height: 12pt !important;
        vertical-align: middle;
    }

    textarea {
        border: 1px solid #888 !important;
        background: transparent !important;
        width: 100% !important;
        min-height: 0.9in !important;
        font-size: 11pt !important;
        color: #000 !important;
    }

    /* Quote / key-point / scripture boxes — keep visible but ink-light */
    .key-point, .quote-box, .scripture, .memory-verse, blockquote {
        border-left: 3px solid #000 !important;
        padding: 4pt 8pt !important;
        margin: 8pt 0 !important;
        font-style: italic;
    }

    /* Multi-choice + true-false blocks shouldn't split */
    .multiple-choice, .true-false, .true-false-6r, .matching, .word-bank {
        page-break-inside: avoid;
        margin: 8pt 0 !important;
    }

    /* Tables: bordered, full width */
    table {
        width: 100% !important;
        border-collapse: collapse !important;
        page-break-inside: avoid;
        margin: 8pt 0 !important;
    }
    th, td {
        border: 1px solid #000 !important;
        padding: 3pt 6pt !important;
        text-align: left;
        vertical-align: top;
    }
    thead { display: table-header-group; }
    tfoot { display: table-footer-group; }

    /* Lists */
    ul, ol { margin: 6pt 0 6pt 24pt; padding: 0; }
    li { margin: 2pt 0; page-break-inside: avoid; }

    /* Hide things that don't belong on paper */
    nav, .nav, .navigation,
    .no-print, .screen-only,
    button, .button,
    audio, video,
    iframe,
    .floating, .sticky,
    .cookie-banner, .modal {
        display: none !important;
    }

    /* Hide decorative emoji-only headers? Keep — they're part of the design.
       But make their backgrounds plain. */

    /* Show URLs after links so printed copy is auditable */
    a[href^="http"]::after {
        content: " (" attr(href) ")";
        font-size: 8pt;
        color: #555 !important;
        word-break: break-all;
    }
    /* Don't print URLs for in-page anchors or image-relative refs */
    a[href^="#"]::after,
    a[href^="../"]::after,
    a[href^="./"]::after,
    a[href$=".png"]::after,
    a[href$=".jpg"]::after {
        content: "";
    }

    /* Page-break helpers (add class to elements where you want forced breaks) */
    .page-break, .lesson + .lesson { page-break-before: always; }
    .answer-key { page-break-before: always; }

    /* Avoid stranded answer-key labels */
    .answer-key h2, .answer-key h3 { page-break-after: avoid; }
}
