/* Print Stylesheet for Optimized Printing Experience */

@media print {
    /* Reset and base styles */
    * {
        -webkit-print-color-adjust: exact !important;
        color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    
    body {
        font-family: 'Times New Roman', serif !important;
        font-size: 12pt !important;
        line-height: 1.4 !important;
        color: #000 !important;
        background: #fff !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    /* Hide unnecessary elements */
    header,
    nav,
    .mobile-menu,
    #menu-btn,
    .scroll-to-top,
    .table-of-contents,
    .toc-toggle,
    #stars-bg,
    .stars,
    .loading-overlay,
    .tooltip,
    button:not(.print-button),
    .social-links,
    .back-to-blog,
    .related-posts,
    footer {
        display: none !important;
    }
    
    /* Page layout */
    @page {
        margin: 2cm;
        size: A4;
    }
    
    /* Main content */
    main {
        margin: 0 !important;
        padding: 0 !important;
        background: none !important;
    }
    
    .container {
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    /* Article styling */
    article {
        background: none !important;
        border: none !important;
        box-shadow: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    article header {
        display: block !important;
        margin-bottom: 2em !important;
        border-bottom: 2px solid #000 !important;
        padding-bottom: 1em !important;
    }
    
    /* Typography */
    h1 {
        font-size: 24pt !important;
        font-weight: bold !important;
        color: #000 !important;
        margin: 0 0 0.5em 0 !important;
        page-break-after: avoid !important;
        background: none !important;
        -webkit-background-clip: unset !important;
        background-clip: unset !important;
        -webkit-text-fill-color: unset !important;
    }
    
    h2 {
        font-size: 18pt !important;
        font-weight: bold !important;
        color: #000 !important;
        margin: 1.5em 0 0.5em 0 !important;
        page-break-after: avoid !important;
        border-bottom: 1px solid #ccc !important;
        padding-bottom: 0.2em !important;
    }
    
    h3 {
        font-size: 14pt !important;
        font-weight: bold !important;
        color: #000 !important;
        margin: 1em 0 0.5em 0 !important;
        page-break-after: avoid !important;
    }
    
    h4, h5, h6 {
        font-size: 12pt !important;
        font-weight: bold !important;
        color: #000 !important;
        margin: 1em 0 0.5em 0 !important;
        page-break-after: avoid !important;
    }
    
    p {
        font-size: 12pt !important;
        line-height: 1.4 !important;
        color: #000 !important;
        margin: 0 0 1em 0 !important;
        text-align: justify !important;
        orphans: 3;
        widows: 3;
    }
    
    /* Lists */
    ul, ol {
        margin: 1em 0 !important;
        padding-left: 2em !important;
    }
    
    li {
        font-size: 12pt !important;
        line-height: 1.4 !important;
        color: #000 !important;
        margin: 0.5em 0 !important;
    }
    
    /* Code blocks */
    pre, code {
        font-family: 'Courier New', monospace !important;
        font-size: 10pt !important;
        background: #f5f5f5 !important;
        border: 1px solid #ccc !important;
        padding: 0.5em !important;
        page-break-inside: avoid !important;
    }
    
    pre {
        white-space: pre-wrap !important;
        word-wrap: break-word !important;
        margin: 1em 0 !important;
    }
    
    code {
        padding: 0.2em 0.4em !important;
    }
    
    /* Links */
    a {
        color: #000 !important;
        text-decoration: underline !important;
    }
    
    a[href]:after {
        content: " (" attr(href) ")" !important;
        font-size: 10pt !important;
        color: #666 !important;
    }
    
    /* Don't show URLs for internal links */
    a[href^="#"]:after,
    a[href^="/"]:after {
        content: "" !important;
    }
    
    /* Badges and tags */
    .badge,
    .skill-tag {
        display: inline !important;
        background: none !important;
        color: #000 !important;
        border: 1px solid #000 !important;
        padding: 0.1em 0.3em !important;
        font-size: 10pt !important;
        margin: 0 0.2em !important;
    }
    
    /* Images */
    img {
        max-width: 100% !important;
        height: auto !important;
        page-break-inside: avoid !important;
        margin: 1em 0 !important;
        border: 1px solid #ccc !important;
    }
    
    /* Tables */
    table {
        width: 100% !important;
        border-collapse: collapse !important;
        margin: 1em 0 !important;
        page-break-inside: avoid !important;
    }
    
    th, td {
        border: 1px solid #000 !important;
        padding: 0.5em !important;
        text-align: left !important;
        font-size: 11pt !important;
    }
    
    th {
        background: #f0f0f0 !important;
        font-weight: bold !important;
    }
    
    /* Blockquotes */
    blockquote {
        border-left: 3px solid #000 !important;
        margin: 1em 0 !important;
        padding: 0 0 0 1em !important;
        font-style: italic !important;
        page-break-inside: avoid !important;
    }
    
    /* Page breaks */
    .page-break {
        page-break-before: always !important;
    }
    
    .no-page-break {
        page-break-inside: avoid !important;
    }
    
    /* Article metadata */
    .article-meta {
        font-size: 10pt !important;
        color: #666 !important;
        margin-bottom: 2em !important;
        border-bottom: 1px solid #ccc !important;
        padding-bottom: 1em !important;
    }
    
    .article-meta .badge {
        background: #f0f0f0 !important;
        color: #000 !important;
    }
    
    /* Print-specific elements */
    .print-only {
        display: block !important;
    }
    
    .no-print {
        display: none !important;
    }
    
    /* Header for printed pages */
    .print-header {
        display: block !important;
        text-align: center !important;
        font-size: 10pt !important;
        color: #666 !important;
        margin-bottom: 2em !important;
        border-bottom: 1px solid #ccc !important;
        padding-bottom: 0.5em !important;
    }
    
    /* Footer for printed pages */
    .print-footer {
        display: block !important;
        text-align: center !important;
        font-size: 10pt !important;
        color: #666 !important;
        margin-top: 2em !important;
        border-top: 1px solid #ccc !important;
        padding-top: 0.5em !important;
    }
    
    /* Ensure proper spacing */
    section {
        margin: 0 !important;
        padding: 0 !important;
        background: none !important;
    }
    
    /* Remove gradients and animations */
    * {
        background-image: none !important;
        animation: none !important;
        transition: none !important;
        transform: none !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }
}