
/*
 * BestPropertyPlug — Project Search 2-Column Enforcement V3.8.2
 *
 * Fixes the case where V3.8.1 loaded successfully but the mobile cards
 * remained one-column because older mobile rules were still forcing
 * project cards/wrappers to span the full grid width.
 *
 * Loaded from the GLOBAL FOOTER, projects-only, so this stylesheet is
 * emitted after the earlier project mobile styles.
 */

/* ---------------------------------------------------------
   PHONE: EXACT 2-COLUMN RESULT GRID
   --------------------------------------------------------- */
@media (max-width: 767px) {
    html body .bppp2-shell .bppp2-grid,
    html body .bppp2-results .bppp2-grid,
    html body .bppp2-grid {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        grid-auto-columns: minmax(0, 1fr) !important;
        grid-auto-flow: row !important;
        align-items: stretch !important;
        gap: 8px !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        overflow: visible !important;
    }

    /* Critical reset: older mobile CSS may force each item to span all columns. */
    html body .bppp2-grid > *,
    html body .bppp2-grid > .bppp2-card {
        grid-column: auto !important;
        grid-row: auto !important;
        grid-area: auto !important;
        align-self: stretch !important;
        justify-self: stretch !important;
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
        flex: none !important;
        margin: 0 !important;
    }

    html body .bppp2-grid > * > .bppp2-card,
    html body .bppp2-grid .bppp2-card {
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
        height: 100% !important;
        margin: 0 !important;
        flex: none !important;
        grid-column: auto !important;
        grid-row: auto !important;
        overflow: hidden !important;
        border-radius: 12px !important;
        border: 1px solid #dbe8e1 !important;
        background: #fff !important;
        box-shadow: 0 6px 16px rgba(10, 62, 42, .055) !important;
    }

    /* Thumbnail size comparable to the approved developer-unit 2-col cards. */
    html body .bppp2-card .bppp2-media,
    html body .bppp2-card .bppp2-card-media,
    html body .bppp2-card [class*="media"],
    html body .bppp2-card > a:first-child {
        position: relative !important;
        display: block !important;
        width: 100% !important;
        height: 132px !important;
        min-height: 132px !important;
        max-height: 132px !important;
        overflow: hidden !important;
    }

    html body .bppp2-card .bppp2-media img,
    html body .bppp2-card .bppp2-card-media img,
    html body .bppp2-card [class*="media"] img,
    html body .bppp2-card > a:first-child img,
    html body .bppp2-card img {
        display: block !important;
        width: 100% !important;
        height: 100% !important;
        min-height: 0 !important;
        object-fit: cover !important;
        object-position: center !important;
    }

    /* Content spacing */
    html body .bppp2-card .bppp2-card-body,
    html body .bppp2-card .bppp2-body,
    html body .bppp2-card .bppp2-content,
    html body .bppp2-card > div:not([class*="media"]) {
        min-width: 0 !important;
    }

    html body .bppp2-card h3,
    html body .bppp2-card h4,
    html body .bppp2-card .bppp2-title {
        display: -webkit-box !important;
        -webkit-box-orient: vertical !important;
        -webkit-line-clamp: 2 !important;
        overflow: hidden !important;
        min-height: 30px !important;
        max-height: 31px !important;
        margin: 7px 8px 3px !important;
        font-size: 11px !important;
        line-height: 1.34 !important;
        font-weight: 800 !important;
    }

    html body .bppp2-card .bppp2-location,
    html body .bppp2-card [class*="location"] {
        display: block !important;
        overflow: hidden !important;
        margin: 0 8px 6px !important;
        font-size: 9px !important;
        line-height: 1.2 !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }

    /* Compact 2x2 project metrics. */
    html body .bppp2-card .bppp2-stats,
    html body .bppp2-card .bppp2-meta,
    html body .bppp2-card [class*="stats"] {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 4px 5px !important;
        width: auto !important;
        margin: 0 8px 6px !important;
        padding: 6px !important;
        border-radius: 8px !important;
        font-size: 8px !important;
        line-height: 1.15 !important;
    }

    html body .bppp2-card .bppp2-stats > *,
    html body .bppp2-card .bppp2-meta > *,
    html body .bppp2-card [class*="stats"] > * {
        min-width: 0 !important;
    }

    html body .bppp2-card .bppp2-completion,
    html body .bppp2-card [class*="completion"] {
        margin: 5px 8px !important;
        font-size: 8.5px !important;
        line-height: 1.2 !important;
    }

    /* Price and CTA become compact enough for a half-width card. */
    html body .bppp2-card .bppp2-price {
        min-width: 0 !important;
        margin: 6px 8px 8px !important;
    }

    html body .bppp2-card .bppp2-price small {
        display: block !important;
        margin-bottom: 2px !important;
        font-size: 7.5px !important;
        line-height: 1.15 !important;
    }

    html body .bppp2-card .bppp2-price strong {
        display: block !important;
        overflow: hidden !important;
        font-size: 8.5px !important;
        line-height: 1.2 !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }

    html body .bppp2-card .bppp2-view-project {
        min-height: 28px !important;
        margin: 0 8px 8px auto !important;
        padding: 6px 8px !important;
        border-radius: 8px !important;
        font-size: 8px !important;
        line-height: 1 !important;
        gap: 3px !important;
        white-space: nowrap !important;
    }

    html body .bppp2-card .bppp2-view-project svg {
        width: 10px !important;
        height: 10px !important;
    }

    /* Compact project badges/favourite button. */
    html body .bppp2-card [class*="featured"],
    html body .bppp2-card [class*="badge"],
    html body .bppp2-card [class*="category"] {
        font-size: 7.5px !important;
        line-height: 1 !important;
    }

    /* Make pagination safe above fixed global bottom nav. */
    html body .bppp2-pagination,
    html body .bppp2-grid + .pagination,
    html body .pagination {
        position: relative !important;
        z-index: 2 !important;
        margin-bottom: 96px !important;
    }
}

/* Small phones: still exactly 2 columns. */
@media (max-width: 390px) {
    html body .bppp2-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 7px !important;
    }

    html body .bppp2-card .bppp2-media,
    html body .bppp2-card .bppp2-card-media,
    html body .bppp2-card [class*="media"],
    html body .bppp2-card > a:first-child {
        height: 116px !important;
        min-height: 116px !important;
        max-height: 116px !important;
    }

    html body .bppp2-card h3,
    html body .bppp2-card h4,
    html body .bppp2-card .bppp2-title {
        min-height: 28px !important;
        max-height: 29px !important;
        font-size: 10.5px !important;
    }

    html body .bppp2-card .bppp2-view-project {
        font-size: 7.5px !important;
    }
}

/* ---------------------------------------------------------
   TABLET PORTRAIT: 2 COLUMNS
   --------------------------------------------------------- */
@media (min-width: 768px) and (max-width: 1023px) {
    html body .bppp2-shell .bppp2-grid,
    html body .bppp2-results .bppp2-grid,
    html body .bppp2-grid {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        grid-auto-flow: row !important;
        gap: 14px !important;
        width: 100% !important;
        min-width: 0 !important;
    }

    html body .bppp2-grid > *,
    html body .bppp2-grid > .bppp2-card,
    html body .bppp2-grid > * > .bppp2-card {
        grid-column: auto !important;
        grid-row: auto !important;
        grid-area: auto !important;
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
        margin: 0 !important;
        flex: none !important;
    }

    html body .bppp2-grid .bppp2-card {
        width: 100% !important;
    }
}

/* ---------------------------------------------------------
   TABLET LANDSCAPE: 3 COLUMNS
   --------------------------------------------------------- */
@media (min-width: 1024px) and (max-width: 1199px) {
    html body .bppp2-shell .bppp2-grid,
    html body .bppp2-results .bppp2-grid,
    html body .bppp2-grid {
        display: grid !important;
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        grid-auto-flow: row !important;
        gap: 12px !important;
        width: 100% !important;
        min-width: 0 !important;
    }

    html body .bppp2-grid > *,
    html body .bppp2-grid > .bppp2-card,
    html body .bppp2-grid > * > .bppp2-card {
        grid-column: auto !important;
        grid-row: auto !important;
        grid-area: auto !important;
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
        margin: 0 !important;
        flex: none !important;
    }

    html body .bppp2-grid .bppp2-card {
        width: 100% !important;
    }
}

/* Desktop remains completely under the existing desktop project-search CSS. */
