
/*
 * BestPropertyPlug — Project Search Mobile Final Polish V3.8.4
 *
 * Final mobile/tablet polish after V3.8.3:
 * 1) fix sticky-header overlap on hero
 * 2) clean metrics row
 * 3) shrink View Details + wishlist controls
 * 4) add safe bottom spacing above global mobile nav
 *
 * Scope: /projects only, loaded last from footer.
 */

/* =========================================================
   MOBILE HERO OFFSET — FIX STICKY HEADER OVERLAP
   ========================================================= */
@media (max-width: 767px) {
    html body .bppp2-hero {
        position: relative !important;
        z-index: 1 !important;
        padding-top: 18px !important;
        margin-top: 0 !important;
    }

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

    /* Ensure eyebrow / breadcrumb is not clipped under sticky global header. */
    html body .bppp2-hero small,
    html body .bppp2-hero [class*="eyebrow"],
    html body .bppp2-hero [class*="breadcrumb"] {
        position: relative !important;
        z-index: 2 !important;
    }

    /* If the sticky header occupies flow incorrectly, give the project page
       its own safe top breathing room without changing the global header. */
    html body:has(.bppp2-hero) main,
    html body:has(.bppp2-hero) .main-content,
    html body:has(.bppp2-hero) [role="main"] {
        scroll-margin-top: 92px !important;
    }
}

/* =========================================================
   METRICS ROW — CLEAN 3-COLUMN MOBILE PRESENTATION
   ========================================================= */
@media (max-width: 767px) {
    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(3, minmax(0, 1fr)) !important;
        gap: 2px !important;
        width: auto !important;
        margin: 0 8px 7px !important;
        padding: 7px 4px !important;
        border: 1px solid #dce9e2 !important;
        border-radius: 10px !important;
        background: #f5faf7 !important;
    }

    html body .bppp2-card .bppp2-stats > *,
    html body .bppp2-card .bppp2-meta > *,
    html body .bppp2-card [class*="stats"] > * {
        display: grid !important;
        grid-template-columns: 16px minmax(0, 1fr) !important;
        grid-template-rows: auto auto !important;
        column-gap: 3px !important;
        row-gap: 0 !important;
        align-items: center !important;
        justify-content: center !important;
        min-width: 0 !important;
        padding: 0 2px !important;
        text-align: left !important;
        overflow: hidden !important;
    }

    html body .bppp2-card .bppp2-stats svg,
    html body .bppp2-card .bppp2-meta svg,
    html body .bppp2-card [class*="stats"] svg {
        grid-column: 1 !important;
        grid-row: 1 / span 2 !important;
        width: 14px !important;
        height: 14px !important;
        max-width: 14px !important;
        max-height: 14px !important;
        margin: 0 !important;
    }

    html body .bppp2-card .bppp2-stats strong,
    html body .bppp2-card .bppp2-meta strong,
    html body .bppp2-card [class*="stats"] strong {
        grid-column: 2 !important;
        grid-row: 1 !important;
        display: block !important;
        overflow: hidden !important;
        font-size: 9px !important;
        line-height: 1.05 !important;
        font-weight: 800 !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }

    html body .bppp2-card .bppp2-stats small,
    html body .bppp2-card .bppp2-meta small,
    html body .bppp2-card [class*="stats"] small,
    html body .bppp2-card .bppp2-stats span:not(:has(svg)),
    html body .bppp2-card .bppp2-meta span:not(:has(svg)) {
        grid-column: 2 !important;
        grid-row: 2 !important;
        display: block !important;
        overflow: hidden !important;
        margin: 0 !important;
        color: #85948d !important;
        font-size: 7px !important;
        line-height: 1.05 !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }
}

/* Extra-tight phones */
@media (max-width: 390px) {
    html body .bppp2-card .bppp2-stats,
    html body .bppp2-card .bppp2-meta,
    html body .bppp2-card [class*="stats"] {
        padding: 6px 3px !important;
    }

    html body .bppp2-card .bppp2-stats > *,
    html body .bppp2-card .bppp2-meta > *,
    html body .bppp2-card [class*="stats"] > * {
        grid-template-columns: 14px minmax(0, 1fr) !important;
        column-gap: 2px !important;
        padding: 0 1px !important;
    }

    html body .bppp2-card .bppp2-stats svg,
    html body .bppp2-card .bppp2-meta svg,
    html body .bppp2-card [class*="stats"] svg {
        width: 12px !important;
        height: 12px !important;
        max-width: 12px !important;
        max-height: 12px !important;
    }

    html body .bppp2-card .bppp2-stats strong,
    html body .bppp2-card .bppp2-meta strong,
    html body .bppp2-card [class*="stats"] strong {
        font-size: 8.5px !important;
    }

    html body .bppp2-card .bppp2-stats small,
    html body .bppp2-card .bppp2-meta small,
    html body .bppp2-card [class*="stats"] small {
        font-size: 6.5px !important;
    }
}

/* =========================================================
   SMALLER IMAGE CTA + WISHLIST
   ========================================================= */
@media (max-width: 767px) {
    html body .bppp2-card .bpp-v383-view-details {
        right: 7px !important;
        bottom: 7px !important;
        min-height: 24px !important;
        padding: 5px 7px !important;
        gap: 3px !important;
        border-radius: 999px !important;
        font-size: 7.2px !important;
        line-height: 1 !important;
        font-weight: 800 !important;
        box-shadow: 0 5px 14px rgba(8, 44, 30, .14) !important;
    }

    html body .bppp2-card .bpp-v383-view-details::after {
        font-size: 8px !important;
    }

    /* Wishlist / heart — do not overpower half-width cards. */
    html body .bppp2-card [class*="wishlist"],
    html body .bppp2-card [class*="favorite"],
    html body .bppp2-card [class*="heart"],
    html body .bppp2-card button[aria-label*="favorite" i],
    html body .bppp2-card button[aria-label*="wishlist" i] {
        transform: scale(.68) !important;
        transform-origin: top right !important;
    }

    /* If the favourite is a generic square button near top-right. */
    html body .bppp2-card [data-bpp-project-favorite],
    html body .bppp2-card [data-bpp-wishlist] {
        width: 32px !important;
        height: 32px !important;
        min-width: 32px !important;
        min-height: 32px !important;
    }
}

@media (min-width: 768px) and (max-width: 1199px) {
    html body .bppp2-card .bpp-v383-view-details {
        min-height: 29px !important;
        padding: 6px 9px !important;
        font-size: 8.5px !important;
    }

    html body .bppp2-card [class*="wishlist"],
    html body .bppp2-card [class*="favorite"],
    html body .bppp2-card [class*="heart"] {
        transform: scale(.82) !important;
        transform-origin: top right !important;
    }
}

/* =========================================================
   CARD TITLE / PRICE RHYTHM
   ========================================================= */
@media (max-width: 767px) {
    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: 10px !important;
        line-height: 1.35 !important;
        letter-spacing: -.01em !important;
    }

    html body .bppp2-card .bppp2-price {
        margin: auto 8px 9px !important;
        padding-top: 7px !important;
    }

    html body .bppp2-card .bppp2-price strong {
        font-size: 8px !important;
        line-height: 1.28 !important;
    }
}

/* =========================================================
   SAFE BOTTOM SPACE ABOVE GLOBAL MOBILE NAV
   ========================================================= */
@media (max-width: 767px) {
    html body .bppp2-shell,
    html body .bppp2-results,
    html body .bppp2-results-wrap,
    html body .bppp2-results-column {
        padding-bottom: 0 !important;
    }

    html body .bppp2-grid {
        margin-bottom: 20px !important;
    }

    html body .bppp2-pagination,
    html body .bppp2-grid + .pagination,
    html body .pagination {
        position: relative !important;
        z-index: 2 !important;
        margin-top: 18px !important;
        margin-bottom: 132px !important;
    }

    /* Fallback when pagination is absent/hidden. */
    html body:has(.bppp2-grid) main,
    html body:has(.bppp2-grid) .main-content,
    html body:has(.bppp2-grid) [role="main"] {
        padding-bottom: 112px !important;
    }
}

/* =========================================================
   TABLET METRICS POLISH
   ========================================================= */
@media (min-width: 768px) and (max-width: 1199px) {
    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(3, minmax(0, 1fr)) !important;
        align-items: center !important;
        gap: 6px !important;
    }

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

/* Desktop >=1200px intentionally untouched. */
