/* PRINT STYLES */
@media print {

    /* Page base */
    body {
        margin: 20px;
        padding: 0;
        font-family: Arial, sans-serif;
        font-size: 12pt;
        color: #000;
    }

    /* Hide anything marked as no-print */
    .no-print {
        display: none !important;
    }

    /* Container for the whole report */
    .print-container {
        width: 100%;
    }

    /* Headings */
    h1, h2, h3 {
        margin: 0 0 8px 0;
        font-weight: bold;
        page-break-after: avoid;
    }

    /* Subject image */
    img {
        max-width: 180px;
        border-radius: 6px;
        margin-bottom: 20px;
        display: block;
        object-fit: contain;
    }

    /* Disorder analysis blocks */
    .analysis-block {
        margin-bottom: 20px;
        page-break-inside: avoid;
        break-inside: avoid;
    }

    hr {
        margin: 20px 0;
        border: none;
        border-top: 1px solid #ccc;
    }

    /* Force a new page when needed */
    .page-break {
        page-break-before: always;
        break-before: page;
    }

    /* Ensure colours print correctly */
    * {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    /* PRINT GALLERY LAYOUT */
.gallery-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important; /* 2 across */
    gap: 20px;
    width: 100%;
    page-break-inside: avoid;
}

.gallery-card {
    border: 1px solid #ccc;
    padding: 12px;
    border-radius: 6px;
    break-inside: avoid;
    page-break-inside: avoid;
    overflow-wrap: break-word;      /* Wrap long words */
    word-break: break-word;         /* Wrap long URLs or unbroken text */
    white-space: normal !important; /* Force wrapping */
}

.analysis-card p,
.gallery-card p {
    white-space: normal !important;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* Ensure images never overflow */
.gallery-main-img,
.gallery-concern-img {
    width: 100%;
    object-fit: contain;
    display: block;
}
}