/* Phase 02X.2E.1: Structure image proportions + one-page print.
   Scoped to /structure. Does not modify the designer libraries, image map or galleries.
   Original source: 09-11-2569 structure main.jpg (4000x2250, ratio 16:9).
*/
.structure-area { width: 100%; }
.structure-area > .image { width: 100%; }
.structure-area > .image > img[usemap="#structure-map"] {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: none !important; /* Override designer .info-body .image img (550px cap) */
    height: auto !important;    /* Override any fixed HTML/image height */
    max-height: none;
    aspect-ratio: 16 / 9;
}

/* Phase 05X.14: match designer 14-11-2569. Show the WHOLE 4000x2250
   diagram at the available width on phones and tablets (no 1200px floor).
   The original imageMapResizer.js scales all ten cached polygon coords when
   the image loads or the viewport changes. Keep the image map untouched. */
@media screen and (max-width: 1200px) {
    #printBodyArea .structure-area,
    #printBodyArea .structure-area > .image {
        width: 100% !important;
        max-width: 100% !important;
    }
    #printBodyArea .structure-area > .image {
        overflow-x: visible !important;
        overflow-y: visible !important;
    }
    #printBodyArea .structure-area > .image > img[usemap="#structure-map"] {
        display: block !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        height: auto !important;
    }
}

/* Only /structure loads this CSS. The shared print stylesheet is unchanged.
   16:9 artwork fits on the first A4 landscape sheet at normal print scale. */
@media print {
    @page { size: A4 landscape; margin: 8mm; }

    #printFullArea {
        width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
        overflow: visible !important;
    }
    #printBodyArea {
        position: static !important;
        display: block !important;
        width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
        overflow: visible !important;
        margin: 0 !important;
        padding: 0 !important;
        opacity: 1 !important;
        transform: none !important;
        break-before: auto !important;
        page-break-before: auto !important;
        break-after: auto !important;
        page-break-after: auto !important;
    }
    #printBodyArea > .titlearea {
        display: block !important;
        position: static !important;
        height: auto !important;
        min-height: 0 !important;
        margin: 0 !important;
        padding: 0 0 3mm 0 !important;
        break-after: avoid !important;
        page-break-after: avoid !important;
    }
    #printBodyArea > .titlearea .font-title {
        margin: 0 !important;
        padding: 0 !important;
        font-size: 15pt !important;
        line-height: 1.25 !important;
    }
    #printBodyArea > .titlearea .font-title img {
        width: 9mm !important;
        height: auto !important;
    }
    #printBodyArea > .info-body {
        display: block !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        min-height: 0 !important;
        break-before: avoid !important;
        page-break-before: avoid !important;
    }
    #printBodyArea .structure-area,
    #printBodyArea .structure-area > .image {
        display: block !important;
        width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        overflow: visible !important;
        break-before: avoid !important;
        page-break-before: avoid !important;
    }
    #printBodyArea .structure-area > .image > img[usemap="#structure-map"] {
        display: block !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        height: auto !important;
        max-height: none !important;
        margin: 0 !important;
        padding: 0 !important;
        aspect-ratio: 16 / 9 !important;
        break-inside: avoid !important;
        page-break-inside: avoid !important;
    }
    #printBodyArea .structure-area map { display: none !important; }
}
