/* Print Stylesheet for Split Theme */
/* Optimised for teachers printing posts for classroom use */

/* Hide print header on screen */
.print-header {
    display: none;
}

@media print {
    /* Reset page setup */
    @page {
        margin: 2cm;
        size: A4;
    }

    /* Base typography for print - force pure white background */
    html, body {
        font-size: 12pt !important;
        line-height: 1.5 !important;
        color: #000 !important;
        background: #fff !important;
        background-color: #fff !important;
    }

    /* Force white background on all elements */
    *, *::before, *::after {
        background: transparent !important;
        background-color: transparent !important;
        background-image: none !important;
        box-shadow: none !important;
    }

    /* Ensure main containers have white background */
    body, main, article, section, div, .post-content, .canvas {
        background: #fff !important;
        background-color: #fff !important;
    }

    /* Show print header with feature image floated right */
    .print-header {
        display: block !important;
        margin-bottom: 24pt !important;
        padding-bottom: 12pt !important;
        border-bottom: 2pt solid #000 !important;
        overflow: hidden !important; /* Clear floats */
        background: #fff !important;
    }

    .print-feature-image {
        float: right !important;
        width: 25% !important;
        max-width: 150px !important;
        height: auto !important;
        margin: 0 0 12pt 12pt !important;
        border-radius: 4pt !important;
    }

    .print-header-text {
        overflow: hidden !important; /* Prevents text from going under image */
    }

    .print-title {
        font-size: 24pt !important;
        font-weight: bold !important;
        margin: 0 0 8pt 0 !important;
        color: #000 !important;
    }

    .print-excerpt {
        font-size: 14pt !important;
        font-style: italic !important;
        margin: 0 0 8pt 0 !important;
        color: #333 !important;
    }

    .print-meta {
        font-size: 11pt !important;
        margin: 0 0 4pt 0 !important;
        color: #666 !important;
    }

    .print-source {
        font-size: 9pt !important;
        margin: 0 !important;
        color: #999 !important;
    }

    /* Hide elements not needed for print */
    .share-mobile-only,
    .share-desktop-only,
    .share-btn-style,
    .share-dropdown-container,
    .share-buttons-row,
    .trex-breadcrumb,
    .language-switcher,
    #langmenu-container,
    .menu-drawer,
    #split-subscribe-card,
    .gh-post-upgrade-cta,
    nav,
    .switch-mode-btn,
    .lightbox,
    .pswp,
    .comments,
    .kg-signup-card,
    .kg-header-card-button,
    button,
    [data-portal],
    section:has(> h3),
    .related-posts,
    [class*="footer"],
    .lg\:sticky,
    .split-tag,
    .split-tag-featured,
    .split-tag-circle,
    .gh-announcement-bar,
    .announcement-bar,
    [class*="announcement"] {
        display: none !important;
        visibility: hidden !important;
        width: 0 !important;
        height: 0 !important;
        overflow: hidden !important;
    }

    /* Hide "You might also like" section specifically */
    section.p-6,
    section.sm\:p-10,
    section[class*="mt-12"]:has(h3) {
        display: none !important;
    }

    /* Hide the entire left panel (the sticky side with feature image, title, author) */
    .grid.grid-cols-1 > div:first-child,
    .grid > .relative.text-white,
    .lg\:grid-cols-2 > div:first-child {
        display: none !important;
        width: 0 !important;
        max-width: 0 !important;
        overflow: hidden !important;
    }

    /* Override the grid layout completely */
    .grid {
        display: block !important;
    }

    .grid.grid-cols-1,
    .lg\:grid-cols-2 {
        display: block !important;
        grid-template-columns: none !important;
    }

    /* Make the content panel full width */
    .grid > div:last-child,
    .pb-6,
    .sm\:pb-16 {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    /* Post content styling */
    .post-content {
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .canvas {
        display: block !important;
        max-width: 100% !important;
        padding: 0 !important;
        grid-template-columns: none !important;
    }

    .canvas > * {
        grid-column: unset !important;
    }

    /* Hide the "Know someone" and "Liked this" text */
    .font-medium.text-sm {
        display: none !important;
    }

    /* Typography for print */
    h1 {
        font-size: 24pt !important;
        margin-bottom: 12pt !important;
        page-break-after: avoid;
        color: #000 !important;
    }

    h2 {
        font-size: 18pt !important;
        margin-top: 18pt !important;
        margin-bottom: 8pt !important;
        page-break-after: avoid;
        color: #000 !important;
    }

    h3 {
        font-size: 14pt !important;
        margin-top: 14pt !important;
        margin-bottom: 6pt !important;
        page-break-after: avoid;
        color: #000 !important;
    }

    h4, h5, h6 {
        font-size: 12pt !important;
        margin-top: 12pt !important;
        margin-bottom: 4pt !important;
        page-break-after: avoid;
        color: #000 !important;
    }

    p {
        margin-bottom: 8pt !important;
        orphans: 3;
        widows: 3;
        color: #000 !important;
    }

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

    figure {
        page-break-inside: avoid;
        margin: 12pt 0 !important;
    }

    figcaption {
        font-size: 10pt !important;
        font-style: italic;
        text-align: center;
        color: #666 !important;
    }

    /* Links - don't show URLs for cleaner print */
    a[href]:after {
        content: none;
    }

    /* Blockquotes */
    blockquote {
        border-left: 3pt solid #ccc !important;
        padding-left: 12pt !important;
        margin: 12pt 0 !important;
        font-style: italic;
        page-break-inside: avoid;
        color: #333 !important;
    }

    /* Code blocks */
    pre, code {
        font-size: 10pt !important;
        background: #f5f5f5 !important;
        border: 1pt solid #ddd !important;
        page-break-inside: avoid;
        color: #000 !important;
    }

    pre {
        padding: 8pt !important;
        overflow: visible !important;
        white-space: pre-wrap !important;
        word-wrap: break-word !important;
    }

    /* Tables */
    table {
        border-collapse: collapse !important;
        width: 100% !important;
        page-break-inside: avoid;
    }

    th, td {
        border: 1pt solid #ccc !important;
        padding: 6pt !important;
        text-align: left;
        color: #000 !important;
    }

    th {
        background: #f0f0f0 !important;
        font-weight: bold;
    }

    /* Lists */
    ul, ol {
        margin: 8pt 0 !important;
        padding-left: 20pt !important;
    }

    li {
        margin-bottom: 4pt !important;
        color: #000 !important;
    }

    /* Horizontal rules */
    hr {
        border: none !important;
        border-top: 1pt solid #ccc !important;
        margin: 16pt 0 !important;
    }

    hr:after {
        content: none !important;
    }

    /* Ghost card elements */
    .kg-card {
        page-break-inside: avoid;
        margin: 12pt 0 !important;
    }

    .kg-image-card img {
        max-width: 100% !important;
    }

    .kg-gallery-card {
        page-break-inside: avoid;
    }

    .kg-bookmark-card {
        border: 1pt solid #ccc !important;
        padding: 8pt !important;
    }

    .kg-callout-card {
        border: 1pt solid #ccc !important;
        padding: 8pt !important;
        background: #f9f9f9 !important;
    }

    /* Ensure content doesn't get cut off */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* Force hide anything with these patterns */
    *[class*="share-"],
    *[class*="subscribe"],
    *[class*="related"],
    *[class*="language"],
    *[class*="breadcrumb"],
    *[class*="split-tag"] {
        display: none !important;
    }
}

