/**
 * Print-only rules for Material listing details (details.php).
 * Scoped to @media print — screen layout unchanged.
 */

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

    html {
        font-size: 11pt;
    }

    body.inner-page {
        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;
    }

    /* --- Global chrome --- */
    nav.navbar.fixed-top,
    #search-filters-header,
    #details-footer,
    #material-modals {
        display: none !important;
    }

    /* Office-site sidebar is only listing actions — omit from print. Agent contact uses .sidebar. */
    body.inner-page > .container > .row > .col-lg-3:not(.sidebar) {
        display: none !important;
    }

    /* Maps & interactive embeds */
    #listing-location,
    #valuation-graph,
    section.details-carousel {
        display: none !important;
    }

    /* "Areas That We Cover" — Material listingDetails.mustache section#areas (explicit; beats stray overrides) */
    body.inner-page section#areas,
    section#areas {
        display: none !important;
    }

    #rental-app-cta,
    #calculator {
        display: none !important;
    }

    /* Long amenities checklist (MLS facts remain in #listing-attributes) */
    section#amenties {
        display: none !important;
    }

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

    /* Narrow centered column */
    body.inner-page > .container {
        max-width: 7.25in !important;
        margin-left: auto !important;
        margin-right: auto !important;
        padding-top: 0 !important;
    }

    body.inner-page > .container > .row {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    /* Stack main + sidebar full width (sidebar below content) */
    body.inner-page > .container > .row > .col-lg-9 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        width: 100% !important;
        padding-right: 0 !important;
    }

    body.inner-page > .container > .row > .col-lg-3.sidebar {
        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 / Owl gallery --- */
    #image-carousel .gallery.owl-carousel .owl-nav {
        display: none !important;
    }

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

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

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

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

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

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

    /* --- Listing headline (#listing-info) --- */
    #listing-info {
        page-break-inside: avoid;
        margin-bottom: 0.35in !important;
        padding-bottom: 0.35in !important;
        border-bottom: 2px solid #111 !important;
    }

    #listing-info h1 {
        font-size: 1.65rem !important;
        font-weight: 700 !important;
        line-height: 1.25 !important;
        margin-bottom: 0.25rem !important;
        color: #000 !important;
    }

    #listing-info .text-muted {
        font-size: 0.95rem !important;
        font-weight: 600 !important;
        color: #333 !important;
        margin-bottom: 0.75rem !important;
    }

    #listing-info .price {
        font-size: 1.35rem !important;
        font-weight: 700 !important;
        margin-right: 1rem !important;
    }

    #listing-info .beds,
    #listing-info .baths,
    #listing-info .sqft {
        font-size: 0.75rem !important;
        text-transform: uppercase !important;
        letter-spacing: 0.08em !important;
        margin-right: 0.75rem !important;
        color: #444 !important;
    }

    #listing-info .beds .value,
    #listing-info .baths .value,
    #listing-info .sqft .value {
        font-weight: 700 !important;
        color: #111 !important;
    }

    /* Mortgage calculator promo column */
    #listing-info .row > .col-lg-3 {
        display: none !important;
    }

    /* --- Remarks --- */
    #listing-remarks p {
        text-align: justify;
        hyphens: auto;
        color: #222 !important;
    }

    /* --- MLS attribute grid --- */
    #listing-attributes {
        padding-top: 0.35rem !important;
    }

    #listing-attributes .attributes-list {
        display: grid !important;
        grid-template-columns: minmax(100px, 140px) 1fr minmax(100px, 140px) 1fr;
        gap: 0.35rem 0.75rem;
        align-items: baseline;
        list-style: none !important;
        padding-left: 0 !important;
        margin-bottom: 0 !important;
    }

    #listing-attributes .attributes-list .list-item {
        float: none !important;
        width: auto !important;
        max-width: none !important;
        flex: none !important;
        padding: 0 !important;
    }

    #listing-attributes .attributes-list .list-item.key {
        font-size: 0.65rem !important;
        letter-spacing: 0.12em !important;
        text-transform: uppercase !important;
        font-weight: 700 !important;
        color: #444 !important;
    }

    #listing-attributes .attributes-list .list-item.value {
        font-size: 0.95rem !important;
        font-weight: 600 !important;
        color: #111 !important;
    }

    #listing-attributes .icon.ic-2x {
        display: none !important;
    }

    #listing-attributes h1 {
        font-size: 0.85rem !important;
        letter-spacing: 0.14em !important;
        text-transform: uppercase !important;
        font-weight: 700 !important;
        margin-bottom: 0.75rem !important;
    }

    /* --- Feature sections --- */
    section .features-block .icon.ic-2x,
    #schools .icon.ic-2x,
    #price-history .icon.ic-2x {
        display: none !important;
    }

    #listing-features h1,
    #schools h1,
    #price-history h1 {
        font-size: 0.85rem !important;
        letter-spacing: 0.12em !important;
        text-transform: uppercase !important;
        border-bottom: 2px solid #111 !important;
        padding-bottom: 0.35rem !important;
        margin: 1rem 0 0.65rem !important;
    }

    #listing-features h2,
    #interior-features h2,
    #exterior-features h2,
    #room-details h2 {
        font-size: 0.78rem !important;
        letter-spacing: 0.12em !important;
        text-transform: uppercase !important;
        margin: 0.75rem 0 0.5rem !important;
    }

    .features-block .key {
        font-size: 0.65rem !important;
        letter-spacing: 0.06em !important;
        text-transform: uppercase !important;
        color: #555 !important;
    }

    .features-block .value {
        font-size: 0.9rem !important;
        margin-bottom: 0.35rem !important;
    }

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

    #details-disclaimer {
        font-size: 8pt !important;
        line-height: 1.35 !important;
        color: #444 !important;
    }

    #details-disclaimer a {
        color: inherit !important;
        text-decoration: none !important;
    }

    #details-disclaimer a:after {
        content: none !important;
    }

    a[href^='http']:after {
        content: none !important;
    }

    .inner-page a {
        color: inherit !important;
        text-decoration: none !important;
    }
}
