/**
 * Print Stylesheet
 * Optimized for black-on-white printing with good contrast
 */

@media print {
    /* ===========================
       RESET & BASE STYLES
       =========================== */

    * {
        background: white !important;
        color: black !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }

    html, body {
        font-family: Georgia, 'Times New Roman', serif;
        font-size: 12pt;
        line-height: 1.4;
        margin: 0;
        padding: 0;
    }

    /* ===========================
       HIDE NON-PRINT ELEMENTS
       =========================== */

    .navbar-container,
    .navbar,
    .navLink,
    .construction-bar,
    .filter-btn,
    .tag-filter-btn,
    .filters-container,
    .social-links-container,
    .back-link,
    #travel-map-container,
    .map-zoom-controls,
    .map-tooltip,
    .map-legend,
    video,
    .sidenote-toggle,
    button:not(.sidenote-number) {
        display: none !important;
    }

    /* ===========================
       TYPOGRAPHY
       =========================== */

    h1 {
        font-size: 24pt;
        font-weight: bold;
        margin-bottom: 12pt;
        page-break-after: avoid;
    }

    h2 {
        font-size: 18pt;
        font-weight: bold;
        margin-top: 18pt;
        margin-bottom: 10pt;
        page-break-after: avoid;
    }

    h3 {
        font-size: 14pt;
        font-weight: bold;
        margin-top: 14pt;
        margin-bottom: 8pt;
        page-break-after: avoid;
    }

    p {
        margin-bottom: 10pt;
        orphans: 3;
        widows: 3;
    }

    /* ===========================
       LAYOUT
       =========================== */

    .content-wrapper,
    .note-detail,
    .project-detail,
    .sidenote-layout {
        max-width: 100% !important;
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .main-content {
        margin: 0 !important;
        max-width: 100% !important;
    }

    /* Page margins */
    @page {
        margin: 1in;
    }

    /* ===========================
       LINKS
       =========================== */

    a {
        color: #00008B !important;
        text-decoration: none;
    }

    /* Show URLs for external links */
    a[href^="http"]:after {
        content: " (" attr(href) ")";
        font-size: 10pt;
        color: #666 !important;
    }

    /* Don't show URLs for internal links or images */
    a[href^="#"]:after,
    a[href^="/"]:after,
    a.note-link:after,
    a.project-link:after {
        content: "";
    }

    /* ===========================
       CODE BLOCKS
       =========================== */

    code,
    pre {
        font-family: 'Courier New', Courier, monospace;
        background: #f5f5f5 !important;
        color: black !important;
        border: 1px solid #333 !important;
        page-break-inside: avoid;
    }

    pre {
        padding: 10pt !important;
        margin: 10pt 0 !important;
        white-space: pre-wrap;
        word-wrap: break-word;
    }

    code {
        padding: 2pt 4pt !important;
        font-size: 10pt;
    }

    /* Remove syntax highlighting colors */
    pre[class*="language-"] *,
    code[class*="language-"] * {
        color: black !important;
        background: transparent !important;
    }

    /* ===========================
       IMAGES
       =========================== */

    img {
        max-width: 100% !important;
        height: auto !important;
        page-break-inside: avoid;
        display: block;
        margin: 10pt auto;
    }

    .image-container {
        page-break-inside: avoid;
        margin: 10pt 0;
        width: 100% !important;
        max-width: 100% !important;
    }

    .image-caption {
        color: #333 !important;
        font-size: 10pt;
        font-style: italic;
        text-align: center;
        margin-top: 5pt;
    }

    /* ===========================
       SIDENOTES → FOOTNOTES
       =========================== */

    .sidenote-wrapper {
        display: inline;
    }

    .sidenote-number {
        vertical-align: super;
        font-size: 8pt;
        color: black !important;
    }

    .sidenote {
        display: none; /* Hide inline sidenotes */
    }

    /* Print footnotes at end of page */
    .footnotes-section {
        display: block !important;
        margin-top: 30pt;
        border-top: 2pt solid black;
        padding-top: 15pt;
    }

    .footnote-item {
        margin-bottom: 8pt;
        font-size: 10pt;
        color: black !important;
    }

    /* ===========================
       LISTS
       =========================== */

    ul, ol {
        margin: 10pt 0;
        padding-left: 25pt;
    }

    li {
        margin-bottom: 5pt;
    }

    /* ===========================
       BLOCKQUOTES
       =========================== */

    blockquote {
        border-left: 3pt solid #333 !important;
        padding-left: 15pt !important;
        margin: 15pt 0 !important;
        font-style: italic;
        color: #222 !important;
    }

    /* ===========================
       TABLES
       =========================== */

    table {
        border-collapse: collapse;
        width: 100%;
        margin: 15pt 0;
        page-break-inside: avoid;
    }

    th, td {
        border: 1pt solid #333 !important;
        padding: 5pt !important;
        text-align: left;
        color: black !important;
    }

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

    /* ===========================
       PROJECT & NOTE CARDS
       =========================== */

    .project-item,
    .note-item {
        page-break-inside: avoid;
        margin-bottom: 15pt;
        border: 1pt solid #333 !important;
        padding: 10pt !important;
        display: block !important;
        height: auto !important;
        min-height: 0 !important;
    }

    .project-item-content,
    .note-item-content {
        width: 100% !important;
    }

    .project-item-image {
        width: 100% !important;
        margin-top: 10pt;
    }

    .project-tags,
    .note-tags {
        margin-top: 8pt;
    }

    .project-tag,
    .note-tag {
        display: inline;
        color: black !important;
        background: transparent !important;
        border: none !important;
        font-size: 10pt;
    }

    .project-tag:after,
    .note-tag:after {
        content: ", ";
    }

    .project-tag:last-child:after,
    .note-tag:last-child:after {
        content: "";
    }

    /* Type badges */
    .project-type-tag,
    .type-tag {
        display: inline-block;
        color: black !important;
        background: #e0e0e0 !important;
        padding: 2pt 5pt !important;
        font-size: 9pt;
        font-weight: bold;
        border: 1pt solid #333 !important;
        margin-top: 5pt;
    }

    /* ===========================
       TIMELINE
       =========================== */

    .timeline-container {
        display: block !important;
        position: static !important;
    }

    .timeline-line {
        display: none !important;
    }

    .timeline-item {
        position: static !important;
        width: 100% !important;
        margin: 0 0 15pt 0 !important;
        padding: 0 !important;
        page-break-inside: avoid;
    }

    .timeline-content {
        border: 1pt solid #333 !important;
        padding: 10pt !important;
        background: white !important;
    }

    .timeline-dot {
        display: none !important;
    }

    /* ===========================
       PROFILE/BIO SECTION
       =========================== */

    .profile_picture_div {
        text-align: center;
        margin-bottom: 15pt;
    }

    .profile_picture {
        width: 150pt !important;
        height: 150pt !important;
        border: 2pt solid #333 !important;
        border-radius: 50%;
    }

    .profile_info {
        text-align: center;
        margin-bottom: 20pt;
    }

    /* ===========================
       METADATA & DATES
       =========================== */

    .note-date,
    .project-date,
    .note-meta,
    .project-meta {
        font-size: 10pt;
        color: #666 !important;
        margin: 5pt 0;
    }

    /* ===========================
       COUNTERS
       =========================== */

    .list-counter {
        display: none !important;
    }

    /* ===========================
       PAGE BREAKS
       =========================== */

    /* Avoid breaks inside these elements */
    .project-item,
    .note-item,
    .image-container,
    blockquote,
    pre,
    table,
    .timeline-item {
        page-break-inside: avoid;
    }

    /* Avoid breaks after headings */
    h1, h2, h3, h4, h5, h6 {
        page-break-after: avoid;
    }

    /* Allow breaks before section headers */
    .section-header {
        page-break-before: auto;
    }

    /* ===========================
       HORIZONTAL RULES
       =========================== */

    hr {
        border: none;
        border-top: 2pt solid #333 !important;
        margin: 15pt 0;
    }

    /* ===========================
       UTILITY CLASSES
       =========================== */

    .no-print {
        display: none !important;
    }

    .print-only {
        display: block !important;
    }

    /* ===========================
       CONTENT ENHANCEMENTS
       =========================== */

    /* Add "Page X of Y" to header */
    @page {
        @top-right {
            content: "Page " counter(page);
        }
    }

    /* Ensure content is readable */
    .note-content,
    .project-content,
    article {
        color: black !important;
        background: white !important;
    }

    /* Remove all transforms and transitions */
    * {
        transform: none !important;
        transition: none !important;
        animation: none !important;
    }
}
