/* Company letterhead behind the A4 documents (Components/Shared/LetterheadImage.razor).
   The image is a full A4 page; the sheet's padding keeps the text clear of its logo and footer.
   The two paddings below are measured for the letterhead's printed logo and address.

   .lh-sheet: letterhead on screen and in print.
   .lh-print: letterhead in print only (the patient result pages, which are phone pages on screen).
   "body ..." outranks each document's own .xxx-sheet print rules. */

@media screen and (min-width: 801px) {
    body .lh-sheet {
        width: 210mm;
        max-width: 100%;
        min-height: 297mm;
        padding: 46mm 14mm 26mm;
        box-sizing: border-box;
        position: relative;
        background-color: #fff;
    }

    /* A screen has no page breaks, so a long sheet can't repeat the full image: the text would run
       over its footer and logo. Only the letterhead's top and bottom show, each inside the padding
       kept for it, so nothing sits behind the text. The watermark appears in print only. */
    body .lh-sheet::before,
    body .lh-sheet::after {
        content: "";
        position: absolute;
        left: 0;
        right: 0;
        background-image: var(--lh-image);
        background-size: 100% auto;
        background-repeat: no-repeat;
        pointer-events: none;
    }

    body .lh-sheet::before { top: 0; height: 46mm; background-position: top center; }
    body .lh-sheet::after { bottom: 0; height: 26mm; background-position: bottom center; }

    .lh-sheet .lh-hide { display: none !important; }
}

.lh-page-image { display: none; }

@media print {
    /* One image, repeated by the browser on every printed page. */
    .lh-page-image {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: 210mm;
        height: 297mm;
        z-index: 0;
    }

    /* Clone: every page of a long document gets the same top and bottom space. */
    body .lh-sheet,
    body .lh-print {
        display: block !important;
        position: relative;
        z-index: 1;
        width: auto !important;
        max-width: none !important;
        min-height: 0 !important;
        margin: 0 !important;
        padding: 46mm 14mm 26mm !important;
        background: none !important;
        border: none !important;
        box-shadow: none !important;
        -webkit-box-decoration-break: clone;
        box-decoration-break: clone;
    }

    .lh-sheet .lh-hide,
    .lh-print .lh-hide { display: none !important; }

    /* White result cards would cut the letterhead's watermark into strips. */
    .lh-print .prp-sheet,
    .lh-print .pr-card,
    .lh-print .pr-header { background: transparent !important; }

    /* The purchase order centres its stamp with flex, which is off here. */
    .lh-sheet .po-stamp { margin-inline: auto; }
}
