/* ==========================================================
   MSJ Mortgage | Co-branded property flyer
   ========================================================== */

/* 01. Builder and responsive form */
.msj-flyer-dialog {
    width: min(900px, calc(100% - 32px));
    max-width: none;
}

.msj-flyer-form h3 {
    margin: 14px 0 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #dedcd8;
    font-size: 18px;
}

.msj-flyer-form label {
    display: block;
    min-width: 0;
}

.msj-flyer-form label input {
    display: block;
    width: 100%;
    margin-top: 6px;
}

.msj-flyer-help {
    color: #626367;
    font-size: 13px;
    line-height: 1.5;
    margin: 0;
}

.msj-flyer-toolbar {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

/* 02. Printable flyer artwork */
.msj-flyer-sheet {
    box-sizing: border-box;
    width: 100%;
    max-width: 760px;
    margin: 16px auto 0;
    padding: 0;
    background: #fff;
    color: #202123;
    border: 1px solid #dedcd8;
    font: 400 13px/1.35 Lato, "Segoe UI", Arial, sans-serif;
    overflow-wrap: anywhere;
}

.msj-flyer-sheet *,
.msj-flyer-sheet *::before,
.msj-flyer-sheet *::after {
    box-sizing: border-box;
}

.msj-flyer-sheet [hidden] {
    display: none !important;
}

.msj-flyer-main-photo,
.msj-flyer-gallery > div {
    position: relative;
    background: #eee;
    overflow: hidden;
    display: grid;
    place-items: center;
    color: #777;
}

.msj-flyer-main-photo {
    aspect-ratio: 2.2 / 1;
}

.msj-flyer-main-photo img,
.msj-flyer-gallery img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.msj-flyer-main-photo img:not([hidden]) + span,
.msj-flyer-gallery img:not([hidden]) + span {
    visibility: hidden;
}

.msj-flyer-heading {
    padding: 10px 18px;
    color: #800000;
}

.msj-flyer-heading h2 {
    color: #800000;
    font-size: clamp(24px, 4vw, 38px);
    line-height: 1.1;
    margin: 4px 0 0;
    text-transform: uppercase;
}

.msj-flyer-gallery {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
}

.msj-flyer-gallery > div {
    aspect-ratio: 1.85 / 1;
    text-align: center;
    font-size: 10px;
}

/* 03. Property and financing information */
.msj-flyer-information,
.msj-flyer-professionals {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
    padding: 14px 18px;
}

.msj-flyer-sheet h3,
.msj-flyer-sheet h4 {
    color: #800000;
    margin: 0 0 5px;
    font-size: 15px;
    line-height: 1.25;
}

.msj-flyer-sheet h4 {
    font-size: 13px;
    margin-top: 9px;
}

.msj-flyer-sheet p {
    margin: 2px 0;
    font-size: inherit;
    line-height: inherit;
}

.msj-flyer-sheet .msj-flyer-source {
    font-size: 11px;
    color: #515151;
}

.msj-flyer-sheet dl {
    margin: 0;
}

.msj-flyer-sheet dl > div {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    border-bottom: 1px solid #e5e1de;
    padding: 3px 0;
}

.msj-flyer-sheet dd {
    margin: 0;
    text-align: right;
    font-weight: 700;
}

.msj-flyer-total {
    color: #800000;
    font-weight: 700;
}

.msj-flyer-price {
    background: #800000;
    color: #fff;
    padding: 12px;
    display: grid;
    gap: 3px;
}

.msj-flyer-price strong {
    font-size: clamp(18px, 3vw, 29px);
    line-height: 1.15;
}

.msj-flyer-facts {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    text-align: center;
    padding: 12px 0;
}

.msj-flyer-facts strong,
.msj-flyer-facts span {
    display: block;
}

.msj-flyer-facts strong {
    color: #800000;
    font-size: 16px;
}

/* 04. Co-branded professional details and disclosures */
.msj-flyer-professionals {
    border-top: 1px solid #dedcd8;
}

.msj-flyer-profile {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.msj-flyer-profile img {
    width: 62px;
    height: 78px;
    object-fit: cover;
    flex: none;
}

.msj-flyer-profile > div {
    min-width: 0;
    font-size: 11px;
}

.msj-flyer-brand {
    display: block;
    max-width: 135px;
    width: 100%;
    height: 38px;
    object-fit: contain;
    object-position: left center;
    margin-top: 7px;
}

.msj-flyer-disclaimer {
    border-top: 2px solid #800000;
    padding: 8px 18px 12px;
    font-size: 9px;
    color: #454545;
}

.msj-flyer-housing {
    float: left;
    width: 44px;
    height: auto;
    margin: 2px 10px 4px 0;
    padding: 3px;
    background: #202123;
}

.msj-flyer-disclaimer {
    display: flow-root;
}

.msj-flyer-disclaimer strong {
    color: #800000;
}

#msj-flyer-print {
    display: none;
}

@media (max-width: 560px) {
    .msj-flyer-dialog {
        width: calc(100% - 16px);
    }

    .msj-flyer-information,
    .msj-flyer-professionals {
        grid-template-columns: 1fr;
        gap: 14px;
        padding-inline: 12px;
    }

    .msj-flyer-heading,
    .msj-flyer-disclaimer {
        padding-inline: 12px;
    }
}

/* 05. A4 browser printing; the website is excluded from the output. */
@media print {
    @page {
        size: A4 portrait;
        margin: 7mm;
    }

    html:has(#msj-flyer-print),
    body:has(#msj-flyer-print) {
        background: white !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
        height: auto !important;
    }

    body:has(#msj-flyer-print) > :not(#msj-flyer-print) {
        display: none !important;
    }

    #msj-flyer-print {
        display: block !important;
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }

    #msj-flyer-print .msj-flyer-sheet {
        width: 100%;
        max-width: none;
        margin: 0;
        border: 0;
        font-size: 10pt;
    }

    #msj-flyer-print .msj-flyer-main-photo {
        height: 78mm;
        aspect-ratio: auto;
    }

    #msj-flyer-print .msj-flyer-gallery > div {
        height: 31mm;
        aspect-ratio: auto;
    }

    #msj-flyer-print .msj-flyer-information,
    #msj-flyer-print .msj-flyer-professionals {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 5mm;
        padding: 3mm 4mm;
        break-inside: avoid;
    }

    #msj-flyer-print .msj-flyer-heading h2 {
        font-size: 24pt;
    }

    #msj-flyer-print .msj-flyer-price strong {
        font-size: 20pt;
    }

    #msj-flyer-print .msj-flyer-profile img {
        width: 18mm;
        height: 22mm;
    }

    #msj-flyer-print .msj-flyer-disclaimer {
        font-size: 7.5pt;
        break-inside: avoid;
    }
}

/* Corporate disclosure is shared with the website and calculator reports. */
.msj-flyer-disclaimer .msj-print-disclosure {
    padding-top: 7px;
    border-top: 1px solid #dedcd8;
}
.msj-flyer-disclaimer .msj-print-disclosure strong { color: #202123; }
