/* Search grids and city sidebars; homepage and profile strips stay unchanged. */
/* City overview strips keep a visible next-card preview, with or without filters. */
@media (min-width:768px) {
    .city-marketplace.desktop-filters-open .city-filter-form.room-policy-filter-view .mobile-filter-primary,
    .city-marketplace.desktop-filters-open .city-filter-form.room-policy-filter-view .mobile-filter-household {
        gap:12px;
    }
    .city-marketplace.desktop-filters-open .city-filter-form.room-policy-filter-view .mobile-filter-primary > h3 {
        margin:0;
        padding-top:8px;
    }
    .city-marketplace.desktop-filters-open .city-filter-form.room-policy-filter-view .mobile-filter-primary > [data-filter-choice="smoking"] {
        margin-top:-4px;
    }
    .city-marketplace.desktop-filters-open .city-filter-form.room-policy-filter-view .filter-pets-section {
        gap:8px;
        padding-top:8px;
    }
    .city-marketplace.desktop-filters-open .city-filter-form.room-policy-filter-view .filter-pets-section > h3 {
        margin:0;
    }
    .city-marketplace.desktop-filters-open .city-filter-form.room-policy-filter-view .mobile-filter-scroll-content {
        gap:12px;
        padding-bottom:6px;
    }
    .city-marketplace.desktop-filters-open .city-filter-form.room-policy-filter-view :is(.mobile-filter-primary,.mobile-filter-household) > fieldset:not(.filter-range-slider) {
        padding-top:8px;
    }
    .city-marketplace.desktop-filters-open .city-filter-form.room-policy-filter-view fieldset > legend {
        margin-bottom:6px;
    }
    .city-marketplace.desktop-filters-open .city-filter-form.room-policy-filter-view .filter-show-interests {
        margin-top:4px;
        padding-block:4px;
    }
    .city-marketplace.desktop-filters-open .city-filter-form.room-policy-filter-view .mobile-filter-pills {
        row-gap:6px;
    }
    .city-marketplace.desktop-filters-open .city-filter-form :is([data-amenities],.filter-home-amenities) .mobile-filter-pills {
        display:grid;
        grid-template-columns:repeat(2,minmax(0,1fr));
        gap:6px;
    }
    .city-marketplace.desktop-filters-open .city-filter-form :is([data-amenities],.filter-home-amenities) .mobile-filter-pills label {
        width:100%;
        min-width:0;
    }
    .city-marketplace.desktop-filters-open .city-filter-form :is([data-amenities],.filter-home-amenities) .mobile-filter-pills label > span {
        height:100%;
        padding:6px;
        white-space:normal;
        line-height:1.35;
    }
    .city-marketplace.location-marketplace:not(.city-intent-page) > .state-hero {
        padding-bottom:0;
    }
    .city-marketplace.location-marketplace:not(.city-intent-page) > .listing-section.marketplace-strip {
        margin-top:0;
        padding-top:6px;
    }
    .city-marketplace:not(.city-intent-page) .marketplace-strip {
        container-type:inline-size;
    }
    .city-marketplace:not(.city-intent-page) .marketplace-strip .listing-strip {
        /* Reserve 30% of the next card inside the actual scroll viewport.
           Remove the inherited end gutter/negative margin so it cannot be
           clipped by the page after the width calculation. */
        grid-auto-columns:calc((100% - 12px)/1.3);
        padding-inline-end:0;
        margin-inline-end:0;
        min-width:0;
        overflow-x:auto;
    }
    @container (min-width:500px) {
        .city-marketplace:not(.city-intent-page) .marketplace-strip .listing-strip {
            grid-auto-columns:calc((100% - 24px)/2.3);
        }
    }
    @container (min-width:760px) {
        .city-marketplace:not(.city-intent-page) .marketplace-strip .listing-strip {
            grid-auto-columns:calc((100% - 36px)/3.3);
        }
    }
    @container (min-width:980px) {
        .city-marketplace:not(.city-intent-page) .marketplace-strip .listing-strip {
            grid-auto-columns:calc((100% - 48px)/4.3);
        }
    }
    @container (min-width:1120px) {
        .city-marketplace:not(.city-intent-page) .marketplace-strip .listing-strip {
            grid-auto-columns:calc((100% - 60px)/6);
        }
    }
    .city-marketplace:not(.city-intent-page) .marketplace-strip .listing-view-more-image {
        aspect-ratio:auto;
        align-self:stretch;
    }
    .city-marketplace:not(.city-intent-page) .marketplace-strip .listing-view-more-collage {
        flex:none;
        aspect-ratio:1;
    }
    .city-marketplace:not(.city-intent-page) .marketplace-strip .listing-view-more-collage img {
        inset:0;
        width:100%;
        height:100%;
        object-fit:contain;
    }
}
.state-page.city-intent-page.location-marketplace,
.search-results-page.page-container {
    box-sizing:border-box;
    width:100%;
    max-width:var(--page-max);
    margin-inline:auto;
    padding-inline:var(--page-gutter);
}
/* The results panel must not add a second gutter at tablet widths. */
.location-marketplace.city-intent-page > .city-results {
    padding-inline:0;
}
/* Avoid stacking paragraph margin on top of the card's bottom padding. */
:is(.search-results-page,.city-intent-page) .marketplace-result-grid .mini-result-card .mini-result-card-copy {
    padding-bottom:9px;
}
:is(.search-results-page,.city-intent-page) .marketplace-result-grid .mini-result-card .mini-result-card-summary {
    margin-bottom:0;
}
@media (max-width:767px) {
    .state-page.city-intent-page.location-marketplace,
    .search-results-page.page-container { padding-inline:12px; }
}
@media (max-width:359px) {
    .state-page.city-intent-page.location-marketplace,
    .search-results-page.page-container { padding-inline:8px; }
}
@media (min-width:768px) {
    .location-marketplace.city-intent-page > .state-hero { padding-bottom:0; }
    .location-marketplace.city-intent-page > .city-results { padding-top:0; }
    .search-results-page .results-heading-row { margin-top:0; }
    /* Reserve a real sidebar lane; the closed grid keeps its full width. */
    .state-page.city-marketplace.location-marketplace.desktop-filters-open {
        padding-left:0;
        margin-left:max(320px,calc((100% - var(--page-max))/2 + 320px));
        margin-right:0;
        width:calc(100% - 320px);
        max-width:calc(var(--page-max) - 320px);
    }
    .city-marketplace.location-marketplace.desktop-filters-open .city-filters-disclosure[open] .city-filters-expanded {
        left:max(16px,calc((100% - var(--page-max))/2 + 16px));
        width:288px;
    }
    .city-marketplace.location-marketplace.desktop-filters-open .mobile-filter-scroll-content {
        padding-bottom:8px;
    }
    .city-marketplace.location-marketplace.desktop-filters-open .mobile-filter-scroll-content > :last-child {
        margin-bottom:0;
    }
    .city-intent-page.desktop-filters-open .marketplace-result-grid,
    .city-intent-page.desktop-filters-open .marketplace-result-grid.featured-quad-grid.featured-three-across {
        grid-template-columns:repeat(auto-fill,minmax(min(100%,max(200px,calc((100% - 28px)/3))),1fr));
    }
}
@media (min-width:768px) and (max-width:1023px) {
    .city-intent-page.location-marketplace.desktop-filters-open .marketplace-result-grid > .featured-listing-card--quad {
        grid-column:1 / -1;
    }
    .city-marketplace.location-marketplace.desktop-filters-open .rn-search-controls {
        flex-wrap:wrap;
        row-gap:10px;
    }
}
@media (min-width:600px) {
    :is(.search-results-page,.city-intent-page) .marketplace-result-grid,
    :is(.search-results-page,.city-intent-page) .marketplace-result-grid.featured-quad-grid.featured-three-across {
        /* Add a column when cards have room, rather than at unrelated viewport
           breakpoints. The percentage floor caps the grid at four columns. */
        grid-template-columns:repeat(auto-fill,minmax(max(200px,calc((100% - 42px)/4)),1fr));
    }
    :is(.search-results-page,.city-intent-page) .marketplace-result-grid.featured-three-across > .mini-result-card {
        grid-column:auto;
    }
    :is(.search-results-page,.city-intent-page) .marketplace-result-grid.featured-three-across > .featured-listing-card--quad {
        grid-column:span 2;
    }
}
