/* Print Styles for PDF Generation */
@media print {

    /* Hide interactive and unnecessary elements */
    nav,
    .navbar,
    .btn-fullscreen-video,
    .btn-approfondisci,
    .btn-outline-ema,
    #download-pdf,
    footer,
    .flow-arrows {
        display: none !important;
    }

    /* Reset background and text colors for readability */
    body {
        background-color: white !important;
        color: black !important;
    }

    /* Force background colors and images for sections */
    section,
    header {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .bg-anthracite {
        background-color: #1A1A1A !important;
        color: white !important;
    }

    .bg-anthracite .hero-title,
    .bg-anthracite p,
    .bg-anthracite .text-light,
    .bg-anthracite .text-white-50 {
        color: white !important;
    }

    /* Page Break Management */
    section,
    header {
        page-break-inside: avoid;
        break-inside: avoid;
        margin-bottom: 20px;
    }

    .hero-section {
        min-height: auto !important;
        padding: 50px 0 !important;
    }

    /* Ensure detail content is visible */
    .detail-content {
        max-height: none !important;
        display: block !important;
        opacity: 1 !important;
    }

    /* Fix image and video display */
    video {
        display: none !important;
    }

    .video-poster {
        display: block !important;
        opacity: 1 !important;
        max-width: 500px;
        margin: 0 auto;
        position: relative !important;
    }

    img {
        max-width: 100% !important;
        height: auto !important;
    }
}

/* --- High-Efficiency PDF Capture Engine (Virtual Print) --- */
body.pdf-mode {
    overflow: visible !important;
}

body.pdf-mode [data-aos] {
    opacity: 1 !important;
    transform: none !important;
    visibility: visible !important;
    transition: none !important;
    animation: none !important;
}

body.pdf-mode .navbar,
body.pdf-mode nav,
body.pdf-mode footer,
body.pdf-mode #download-pdf,
body.pdf-mode .btn-approfondisci,
body.pdf-mode .btn-fullscreen-video,
body.pdf-mode .flow-arrows,
body.pdf-mode video,
body.pdf-mode audio,
body.pdf-mode iframe,
body.pdf-mode .video-background,
body.pdf-mode .partnership-logo-link i {
    display: none !important;
}

body.pdf-mode .detail-content {
    max-height: none !important;
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    overflow: visible !important;
}

/* Force light colors in dark sections for PDF */
/* --- FINAL PDF ABSOLUTE STABILITY SYSTEM --- */
body.is-generating-pdf {
    overflow: visible !important;
    width: 1400px !important;
    background-color: #ffffff !important;
    /* Force a base background */
}

body.is-generating-pdf section,
body.is-generating-pdf header {
    scroll-snap-align: none !important;
    min-height: auto !important;
    padding-top: 80px !important;
    padding-bottom: 80px !important;
    page-break-after: always;
    break-after: page;
    background-image: none !important;
    border: none !important;
}

/* Force light themes */
body.is-generating-pdf .bg-white,
body.is-generating-pdf section:not(.bg-anthracite) {
    background-color: #ffffff !important;
    background-image: none !important;
}

body.is-generating-pdf .bg-white *,
body.is-generating-pdf section:not(.bg-anthracite) * {
    color: #1A1A1A !important;
    opacity: 1 !important;
    fill: #1A1A1A !important;
}

/* Force dark themes */
body.is-generating-pdf .bg-anthracite,
body.is-generating-pdf footer,
body.is-generating-pdf header#home,
body.is-generating-pdf #competenze {
    background-color: #1A1A1A !important;
    background-image: none !important;
}

body.is-generating-pdf .bg-anthracite *,
body.is-generating-pdf #competenze * {
    color: #ffffff !important;
    opacity: 1 !important;
    fill: #ffffff !important;
}

/* Exceptions: Preserving brand orange */
body.is-generating-pdf .text-orange,
body.is-generating-pdf .text-orange * {
    color: #FF6B00 !important;
}

/* Fix for hero-title black box Rendering Bug */
body.is-generating-pdf .hero-title {
    background: none !important;
    -webkit-background-clip: initial !important;
    background-clip: initial !important;
    -webkit-text-fill-color: initial !important;
    color: #1A1A1A !important;
    filter: none !important;
    text-shadow: none !important;
}

body.is-generating-pdf .bg-anthracite .hero-title {
    color: #ffffff !important;
}

/* Clean UI Cleanup */
body.is-generating-pdf .navbar,
body.is-generating-pdf .btn-fullscreen-video,
body.is-generating-pdf .btn-approfondisci,
body.is-generating-pdf .flow-arrows,
body.is-generating-pdf #download-pdf,
body.is-generating-pdf video,
body.is-generating-pdf .video-background,
body.is-generating-pdf .btn-fullscreen,
body.is-generating-pdf .cert-scroller,
body.is-generating-pdf .pencil-element,
body.is-generating-pdf footer {
    display: none !important;
}

/* AOS and Animation Kill */
body.is-generating-pdf [data-aos],
body.is-generating-pdf .animating * {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
    animation: none !important;
    visibility: visible !important;
}

/* Detail visibility */
body.is-generating-pdf .detail-content {
    max-height: none !important;
    opacity: 1 !important;
    display: block !important;
    visibility: visible !important;
    overflow: visible !important;
    padding-top: 20px;
}

/* Preserve background styling */
@media print {
    body {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}
