/* ── Property detail right rail ─────────────────────────────────────────────
   Shared by /projects/{slug} and /properties/{slug}. Reuses the Property
   consultant panel styles from search-assistant.css, with detail-page
   placement (sticky column, always-visible sign-in / site-visit bars) and a
   mobile layout that stays a card instead of the full-bleed /search sheet. */

body.pmh-rail-page #dishaBtn { display: none !important; }

/* The Tailwind build has no arbitrary max-w-[1500px] utility, so the detail
   shells used to render full-bleed and the rail sat further right than on
   /search. Match the /search canvas width so the rail lands in the same
   top-right spot. */
.pmh-detail-shell {
    width: 100%;
    max-width: 1780px;
    margin-left: auto;
    margin-right: auto;
}

/* ── page layout: details left, rail right ─────────────────────────────── */

.pmh-detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
    align-items: start;
}

@media (min-width: 1024px) {
    /* Same column as /search so the rail does not appear to change width. */
    .pmh-detail-grid {
        grid-template-columns: minmax(0, 1fr) 360px;
        gap: 28px;
    }

    .pmh-detail-rail {
        position: sticky;
        top: 76px;                 /* same 68px navbar + 8px as /search */
        align-self: start;
        /* Anchor the rail at the same top-right spot as /search. The
           back/wishlist row above the grid only occupies the left side, so
           the rail can start in that band without overlap. */
        margin-top: -72px;
    }

    /* Project pages also have a breadcrumb row above the back buttons. */
    .pmh-detail-rail--crumb {
        margin-top: -110px;
    }
}

@media (max-width: 1023.98px) {
    /* Consultant first so the chat + visit CTA are always reachable. */
    .pmh-detail-rail { order: -1; }
}

.pmh-rail-col {
    display: flex;
    flex-direction: column;
}

/* ── collapsed CTA card (mirrors the /search card) ─────────────────────── */

.pmh-rail-cta {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border: 1px dashed var(--sage, #929783);
    border-radius: 16px;
    background: linear-gradient(135deg, #fbfcf9, #f3f5ec);
}

.pmh-rail-cta[hidden] { display: none !important; }

/* ── the chat panel ────────────────────────────────────────────────────── */

.pmh-rail-panel {
    height: clamp(340px, 55vh, 560px);
}

/* Desktop: identical panel geometry to the /search consultant. Same height
   formula means identical text wrapping, greeting and empty space, so the
   chat does not look different after moving from search to a detail page. */
@media (min-width: 1024px) {
    .pmh-rail-panel {
        height: min(72vh, calc(100vh - 210px), 690px);
        min-height: 380px;
    }
}

.pmh-rail-panel .pmh-ai-log { min-height: 0; }

/* Mobile: the rail sits first in-flow (order:-1 above) and gets the exact
   /search treatment — search-assistant.css scopes the white card, the
   first-screen --pmh-ai-fit height and the flattened lead bars to
   .pmh-detail-rail as well as #pmh-ai-col. This file only keeps the
   detail-grid ordering and the shared page gutter. */
@media (max-width: 1023.98px) {
    /* Rail column: full container width (not viewport) to avoid horizontal scroll */
    .pmh-detail-rail {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        margin-bottom: 1rem !important;
        padding: 0 !important;
    }

    /* Same side gutter as /search (--pmh-gutter: 14px, 10px under 374px).
       !important so it also wins over mobile-spacing-fix.css's fixed 14px
       on details.html and Tailwind's px-5 on builder-details.html. */
    .pmh-detail-shell {
        padding-left: var(--pmh-gutter, 14px) !important;
        padding-right: var(--pmh-gutter, 14px) !important;
    }

    /* The single-column grid's 28px gap + the rail's margin would leave a
       ~44px void under the chat card; /search uses a 14px gap. Zero the
       grid gap and let the rail margin be the only spacing. */
    .pmh-detail-grid { gap: 0 !important; }
    .pmh-detail-rail { margin-bottom: 0.875rem !important; }

    /* builder-details.html does not load mobile-spacing-fix.css, so its
       main kept Tailwind pt-8 (32px) while details.html got 16px. Match. */
    main.pmh-detail-shell {
        padding-top: 16px !important;
        padding-bottom: 20px !important;
    }
}

/* ── Phone: compact top chrome ────────────────────────────────────────────
   Breadcrumb + Back/Wishlist used to stack ~100px above the chat card.
   The current-page crumb duplicates the H1 right below, so it and its
   separator drop on phones; the action pills slim down to match. */
@media (max-width: 640px) {
    nav[aria-label="Breadcrumb"] {
        padding-top: 4px;
    }
    nav[aria-label="Breadcrumb"] ol {
        font-size: 12px;
        gap: 4px;
    }
    /* last two <li> = separator + current page (project name = the H1) */
    nav[aria-label="Breadcrumb"] ol li:nth-last-child(-n+2) {
        display: none;
    }

    /* details.html keeps Back/Wishlist as a standalone row; on project pages
       the same .pmh-detail-actions div now sits inside the breadcrumb nav
       (no pmh-detail-shell, no row padding) so only gap/buttons apply. */
    .pmh-detail-shell.pmh-detail-actions {
        padding-top: 2px !important;  /* beats mobile-spacing-fix's 10px !important */
        padding-bottom: 0 !important;
    }
    .pmh-detail-actions {
        gap: 6px;
    }
    .pmh-detail-actions .pmh-wish {
        margin-inline-start: 0;       /* gap handles the spacing; ms-2 would double it */
    }
    .pmh-detail-actions button {
        padding: 6px 12px;
        font-size: 13px;
    }
    .pmh-detail-actions .pmh-wish svg {
        width: 15px;
        height: 15px;
    }

    /* builder-details.html does not load mobile-spacing-fix.css, so its H1
       stayed text-3xl while details.html got 1.75rem. Same compact title. */
    .pmh-detail-main h1 {
        font-size: 1.75rem !important;
        line-height: 1.2 !important;
        margin-top: 12px !important;
    }
}

/* Extra small phones */
@media (max-width: 400px) {
    .pmh-rail .pmh-ai-input {
        height: 38px;
        padding: 0 12px;
        font-size: 13px;
    }
    
    .pmh-rail .pmh-ai-send {
        width: 38px;
        height: 38px;
    }
}

/* Similar cards use a stretched link so the whole tile is clickable. The CTA's
   hover/active transform would turn the link into its own containing block and
   collapse that overlay mid-press, so keep the colour hover but drop the move;
   the card's own .lift:hover supplies the motion. */
.pmh-detail-grid ~ section article a.stretched-link:hover,
.pmh-detail-grid ~ section article a.stretched-link:active {
    transform: none;
}


