/* The compact place card for an empty spot on the map (bloxless-place-card.html): only this
   card shows, at the bottom of the map, as map apps do. Tokens only (design-system/AI_RULES.md).

   #block-details is a full-size layer over the map. While it holds the card it must let map
   clicks through (so another spot can be picked) and paint nothing of its own. */
#block-details:has(> .bloxless-place-card) {
    background: transparent;
    pointer-events: none;
}

.bloxless-place-card {
    --place-card-edge: var(--map-home-edge, var(--ds-space-4));
    position: fixed;
    z-index: 3;
    /* Above the map's credit line, on the home action's line (map-home.css). */
    bottom: var(--ds-space-12);
    left: 50%;
    transform: translateX(-50%);
    box-sizing: border-box;
    display: flex;
    gap: var(--ds-space-4);
    width: min(560px, calc(100vw - 2 * var(--place-card-edge)));
    padding: var(--ds-space-3);
    padding-right: var(--ds-space-12);
    border-radius: var(--ds-radius-lg);
    background: var(--ds-card);
    box-shadow: var(--ds-shadow-elevated);
    color: var(--ds-ink);
    font-family: var(--ds-font-sans);
    pointer-events: auto;
}

.bloxless-place-card__media {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: stretch;
    width: 112px;
    min-height: 96px;
    border-radius: var(--ds-radius-md);
    background: var(--ds-brand-tint);
    color: var(--ds-brand-strong);
}

.bloxless-place-card__media .material-icons-outlined {
    font-size: var(--ds-space-10);
}

.bloxless-place-card__body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.bloxless-place-card__title {
    margin: 0;
    color: var(--ds-ink);
    font: 600 var(--ds-font-size-h4)/var(--ds-line-height-h4) var(--ds-font-sans);
    overflow-wrap: anywhere;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}

/* Focused by script so the place is announced; it is not a control. */
.bloxless-place-card__title:focus {
    outline: none;
}

.bloxless-place-card__address {
    margin: var(--ds-space-1) 0 0;
    color: var(--ds-ink-soft);
    font: 400 var(--ds-font-size-bodySm)/var(--ds-line-height-bodySm) var(--ds-font-sans);
    overflow-wrap: anywhere;
}

.bloxless-place-card__coordinates {
    margin: var(--ds-space-1) 0 0;
    padding: 0;
    border: 0;
    background: none;
    color: var(--ds-link);
    font: 400 var(--ds-font-size-bodySm)/var(--ds-line-height-bodySm) var(--ds-font-sans);
    font-variant-numeric: tabular-nums;
    cursor: pointer;
}

.bloxless-place-card__coordinates:hover {
    color: var(--ds-link-hover);
    text-decoration: underline;
}

.bloxless-place-card__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--ds-space-2);
    margin-top: var(--ds-space-3);
}

.bloxless-place-card__primary {
    display: inline-flex;
    align-items: center;
    gap: var(--ds-space-2);
    min-height: var(--ds-space-10);
    padding: 0 var(--ds-space-4);
    border: 0;
    border-radius: var(--ds-radius-pill);
    background: var(--ds-brand);
    color: var(--ds-on-cta);
    font: 600 var(--ds-font-size-bodySm)/var(--ds-line-height-bodySm) var(--ds-font-sans);
    white-space: nowrap;
    cursor: pointer;
}

.bloxless-place-card__primary:hover {
    background: var(--ds-brand-hover);
}

.bloxless-place-card__primary .material-icons-outlined {
    font-size: var(--ds-font-size-h3);
}

.bloxless-place-card__icon-button,
.bloxless-place-card__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: var(--ds-space-10);
    height: var(--ds-space-10);
    padding: 0;
    border-radius: var(--ds-radius-pill);
    color: var(--ds-ink-soft);
    text-decoration: none;
    cursor: pointer;
}

.bloxless-place-card__icon-button {
    border: 1px solid var(--ds-line);
    background: var(--ds-card);
    color: var(--ds-brand-strong);
}

.bloxless-place-card__icon-button:hover {
    background: var(--ds-brand-tint);
}

.bloxless-place-card__close {
    position: absolute;
    top: var(--ds-space-1);
    right: var(--ds-space-1);
    border: 0;
    background: transparent;
}

.bloxless-place-card__close:hover {
    background: var(--ds-surface);
    color: var(--ds-ink);
}

.bloxless-place-card :is(button, a):focus-visible {
    outline: 3px solid var(--ds-focus);
    outline-offset: 2px;
}

.bloxless-place-card__note {
    margin: 0;
    color: var(--ds-ink-soft);
    font: 400 var(--ds-font-size-caption)/var(--ds-line-height-caption) var(--ds-font-sans);
}

/* Copy results; empty (and so invisible) the rest of the time. */
.bloxless-place-card__status {
    position: absolute;
    left: 50%;
    bottom: calc(100% + var(--ds-space-2));
    transform: translateX(-50%);
    margin: 0;
    padding: 0;
    border-radius: var(--ds-radius-pill);
    color: var(--ds-card);
    font: 400 var(--ds-font-size-caption)/var(--ds-line-height-caption) var(--ds-font-sans);
    white-space: nowrap;
    pointer-events: none;
}

.bloxless-place-card__status:not(:empty) {
    padding: var(--ds-space-1) var(--ds-space-3);
    background: var(--ds-ink);
}

/* Phones: full width at the edge margin, just above the 66px tab bar (.bottom-nav in
   search-results.css). A small picture sits beside the name, and the actions take the
   card's whole width below them so they stay on one line. */
@media (max-width: 812px) {
    .bloxless-place-card {
        bottom: calc(66px + var(--place-card-edge));
        display: grid;
        grid-template-columns: var(--ds-space-16) minmax(0, 1fr);
        align-items: start;
        column-gap: var(--ds-space-3);
        row-gap: 0;
        padding-right: var(--ds-space-3);
    }

    /* Only the name runs under the close button; leave it the button's room. */
    .bloxless-place-card__title {
        padding-right: var(--ds-space-8);
    }

    /* Its children join the card's grid; the wrapper carries no meaning of its own. */
    .bloxless-place-card__body {
        display: contents;
    }

    .bloxless-place-card__media {
        grid-column: 1;
        grid-row: 1 / span 3;
        align-self: start;
        width: var(--ds-space-16);
        min-height: var(--ds-space-16);
    }

    .bloxless-place-card__media .material-icons-outlined {
        font-size: var(--ds-space-8);
    }

    .bloxless-place-card :is(.bloxless-place-card__title, .bloxless-place-card__address, .bloxless-place-card__coordinates) {
        grid-column: 2;
        justify-self: start;
    }

    .bloxless-place-card__actions {
        grid-column: 1 / -1;
        flex-wrap: nowrap;
    }

    .bloxless-place-card__primary {
        flex: 1;
        justify-content: center;
    }
}
