/**
 * Print-only rules for Hero listing details (details.php).
 * Screen layout is unchanged; everything is scoped to @media print.
 * Tuned toward flyer/PDF-style output (tight hierarchy, minimal chrome).
 */

@media print {
    @page {
        size: letter;
        margin: 0.4in 0.45in;
    }

    html {
        font-size: 11pt;
    }

    body {
        background: #fff !important;
        color: #111 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif !important;
        line-height: 1.45;
    }

    /* --- Site chrome --- */
    #header,
    #footer {
        display: none !important;
    }

    #testimonials-carousel,
    #latest-blogs {
        display: none !important;
    }

    /*
     * "Areas We Cover" — dynamicContent/areas.mustache (lowerContent).
     * Do not use :has(a.service-area-link) alone: when no area links render, the heading still shows
     * and our rule missed (matches screenshot: title after agent with blank body).
     * Testimonials/latest blogs use <section>; this wrapper + h1.center.fw-300 is unique here.
     */
    div.p-t-3.p-b-3.background-white:has(> .container h1.center.fw-300),
    div.p-t-3.p-b-3.background-white:has(a.service-area-link) {
        display: none !important;
    }

    .listings.container {
        display: none !important;
    }

    .container:has(#map-listing),
    .container:has(#map-streetview),
    #map-listing,
    #map-streetview,
    #local-content-widget,
    #no-street-view {
        display: none !important;
    }

    #vpPlayer {
        display: none !important;
    }

    .listing-detail > .row.hidden-md-up {
        display: none !important;
    }

    .col-lg-3 > .widget.hidden-sm-down,
    #rental-app-cta {
        display: none !important;
    }

    .col-lg-3 .widget:has(ul.nav-style-secondary) {
        display: none !important;
    }

    .call-to-action-small {
        display: none !important;
    }

    #owl-thumbs,
    .owl-thumbs-placeholder {
        display: none !important;
    }

    .listing-details-label,
    .demo-not-for-sale-label {
        display: none !important;
    }

    #pinterest-images {
        display: none !important;
    }

    /* --- Flyer column (reference PDF: narrow centered sheet) --- */
    .inner-main-content .container.p-t-2 {
        max-width: 7.25in !important;
        margin-left: auto !important;
        margin-right: auto !important;
        padding-top: 0 !important;
    }

    .listing-detail .row {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    /* Stack main + sidebar: hero & facts first, agent / brokerage below like PDF page flow */
    .listing-detail.col-lg-9 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        width: 100% !important;
        padding-right: 0 !important;
    }

    .listing-detail + .col-lg-3 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        width: 100% !important;
        padding-left: 0 !important;
        margin-top: 0.35in;
        padding-top: 0.35in;
        border-top: 1px solid #ccc;
    }

    /* --- Hero image --- */
    .gallery.owl-carousel .owl-nav {
        display: none !important;
    }

    .gallery.owl-carousel .owl-stage-outer {
        overflow: visible !important;
        height: auto !important;
    }

    .gallery.owl-carousel .owl-stage {
        transform: none !important;
        transition: none !important;
        width: 100% !important;
        left: 0 !important;
    }

    .gallery.owl-carousel .owl-item {
        float: none !important;
        width: 100% !important;
        left: auto !important;
    }

    .gallery.owl-carousel .owl-item:not(.active) {
        display: none !important;
    }

    .gallery {
        margin-bottom: 0.35in !important;
    }

    .gallery-item {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        background-repeat: no-repeat;
        background-position: center center !important;
        position: relative;
        page-break-inside: avoid;
        max-height: 3.75in !important;
        height: 3.75in !important;
        min-height: 2.5in !important;
    }

    .gallery-item .owl-resubscribe-overlay {
        display: none !important;
    }

    /* --- Headline facts (PDF-style: address band + grid of labels) --- */
    .listing-attributes-main {
        display: grid !important;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.5rem 1rem;
        align-items: start;
        page-break-inside: avoid;
        margin-bottom: 0.35in !important;
        padding-bottom: 0.35in !important;
        border-bottom: 2px solid #111 !important;
    }

    .listing-attributes-main .listing-detail-attribute {
        float: none !important;
        width: auto !important;
        min-height: 0 !important;
        margin-bottom: 0 !important;
    }

    .listing-attributes-main .listing-detail-attribute:nth-child(1) {
        grid-column: 1 / -1;
        padding-bottom: 0.2in;
        margin-bottom: 0.15in !important;
        border-bottom: 1px solid #ddd;
    }

    .listing-attributes-main .listing-detail-attribute .key {
        font-size: 0.65rem !important;
        letter-spacing: 0.14em !important;
        font-weight: 700 !important;
        color: #444 !important;
        margin-bottom: 0.2rem !important;
    }

    .listing-attributes-main .listing-detail-attribute:nth-child(1) .value {
        font-size: 1.65rem !important;
        font-weight: 700 !important;
        line-height: 1.25 !important;
        color: #000 !important;
    }

    .listing-attributes-main .listing-detail-attribute:not(:nth-child(1)) .value {
        font-size: 1.05rem !important;
        font-weight: 600 !important;
        color: #111 !important;
    }

    /* --- Property Attributes / Description blocks --- */
    .listing-detail .col-lg-7,
    .listing-detail .col-lg-5 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        width: 100% !important;
    }

    .overview {
        page-break-inside: avoid;
    }

    .overview h5.key {
        font-size: 0.7rem !important;
        letter-spacing: 0.16em !important;
        text-transform: uppercase !important;
        font-weight: 700 !important;
        color: #222 !important;
        border-bottom: 2px solid #111 !important;
        padding-bottom: 0.35rem !important;
        margin: 0 0 0.6rem !important;
    }

    .overview p {
        margin-bottom: 0.75rem !important;
        color: #222 !important;
        text-align: justify;
        hyphens: auto;
    }

    /* MLS feature sections */
    .listing-detail h2 {
        font-size: 0.78rem !important;
        letter-spacing: 0.14em !important;
        text-transform: uppercase !important;
        font-weight: 700 !important;
        border-bottom: 2px solid #111 !important;
        padding: 0.5rem 0 !important;
        margin: 1.25rem 0 0.6rem !important;
        color: #000 !important;
        background: none !important;
    }

    h2:has(+ ul.amenities),
    ul.amenities {
        display: none !important;
    }

    .valuation {
        display: none !important;
    }

    .listing-detail h2:has(+ .valuation),
    .listing-detail h2:has(+ p + .valuation) {
        display: none !important;
    }

    .listing-detail h2 + p:has(+ .valuation) {
        display: none !important;
    }

    table.table {
        page-break-inside: auto;
        font-size: 0.85rem !important;
        border-color: #ccc !important;
    }

    table.table thead {
        display: table-header-group;
    }

    table.table th,
    table.table td {
        padding: 0.35rem 0.45rem !important;
    }

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

    /* Agent / brokerage column (PDF-style contact band) */
    .listing-detail + .col-lg-3 .widget:has(h2.widgettitle__) {
        text-align: center !important;
        max-width: 5.5in;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    .listing-detail + .col-lg-3 .widget h2.widgettitle__ {
        font-size: 0.7rem !important;
        letter-spacing: 0.2em !important;
        text-transform: uppercase !important;
        font-weight: 700 !important;
        margin-bottom: 0.75rem !important;
        border-bottom: none !important;
    }

    .listing-detail + .col-lg-3 a {
        word-break: break-word;
    }

    /* Listed-by / disclaimer blocks stay readable */
    .listing-detail + .col-lg-3 .widget:not(:has(h2.widgettitle__)) {
        text-align: left !important;
        font-size: 0.85rem !important;
    }

    /* Links: don’t print raw URLs after href */
    .listing-detail a[href^='http']:after,
    .listing-detail + .col-lg-3 a[href^='http']:after {
        content: none !important;
    }

    .listing-detail a,
    .listing-detail + .col-lg-3 a {
        color: inherit !important;
        text-decoration: none !important;
    }

    /* Small legal copy */
    .listing-detail .container .row p[style*='font-size: 14px'],
    .listing-detail .container .row p[style*='color: #666'] {
        font-size: 8pt !important;
        line-height: 1.35 !important;
        color: #444 !important;
    }
}
