/* Docked map card (category + stay popups).
 *
 * A pin popup anchored above its pin gets clipped by the header / banner when
 * the pin sits near the top of the map. Docked popups ignore the pin position
 * and sit as a wide, short card inside the bottom of the map, just above the
 * category rail (--ll-dock-bottom is measured by dockPopup() in
 * category-map-markers.js). The Mapbox popup stays the owner of open/close and
 * button wiring; only its placement and layout change. */

.mapboxgl-popup.ll-card-docked {
    position: absolute;
    top: auto !important;
    left: 50% !important;
    bottom: var(--ll-dock-bottom, 12px);
    transform: translateX(-50%) !important;
    width: min(680px, calc(100% - 24px));
    max-width: none !important;
    z-index: 60; /* above every map pin (markers.css puts pins at 50) */
    animation: ll-card-dock-in 180ms ease-out;
}

@keyframes ll-card-dock-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .mapboxgl-popup.ll-card-docked { animation: none; }
}

.mapboxgl-popup:is(.mapboxgl-popup.ll-card-docked, #map-news-panel.ll-card-docked-panel) .mapboxgl-popup-tip {
    display: none;
}

.mapboxgl-popup:is(.mapboxgl-popup.ll-card-docked, #map-news-panel.ll-card-docked-panel) .mapboxgl-popup-content {
    max-width: none !important;
    width: 100%;
    max-height: calc(var(--ll-dock-max-height, 60vh));
    overflow: auto;
}

/* Marketplace listing card: photo well beside title, price, stats, and actions.
 * Mapbox popups that are not the news panel keep a simpler wide row. */
.mapboxgl-popup.ll-card-docked .category-compact-card--market .category-compact-body {
    display: flex;
    gap: 20px;
    align-items: stretch;
}

.mapboxgl-popup.ll-card-docked .category-compact-thumb {
    width: 180px;
    height: 180px;
    flex: 0 0 180px;
}

:is(.mapboxgl-popup.ll-card-docked, #map-news-panel.ll-card-docked-panel) .category-compact-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

:is(.mapboxgl-popup.ll-card-docked, #map-news-panel.ll-card-docked-panel) .category-compact-excerpt {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

:is(.mapboxgl-popup.ll-card-docked, #map-news-panel.ll-card-docked-panel) .category-compact-address { display: none; }

:is(.mapboxgl-popup.ll-card-docked, #map-news-panel.ll-card-docked-panel) .mapboxgl-popup-close-button {
    top: 6px;
    right: 8px;
    width: 32px;
    height: 32px;
}

@media (max-width: 560px) {
    .mapboxgl-popup.ll-card-docked .category-compact-card--market .category-compact-body {
        flex-direction: column;
    }

    .mapboxgl-popup.ll-card-docked .category-compact-thumb {
        width: 100%;
        height: 140px;
        flex-basis: auto;
    }
}

/* Marker card panel (#map-news-panel, category mode) — the card a pin tap opens.
 * Same docked placement; !important beats the floating top-left rules in index.html. */
#map-news-panel.map-news-panel--category.ll-card-docked-panel {
    top: auto !important;
    left: 40% !important;
    bottom: var(--ll-dock-bottom, 12px) !important;
    width: min(760px, calc(100% - 24px)) !important;
    transform: translate(-50%, 0.65rem);
    transform-origin: bottom center;
}

#map-news-panel.map-news-panel--category.ll-card-docked-panel.is-open {
    transform: translateX(-50%);
    max-height: var(--ll-dock-max-height, 60vh);
    overflow-y: auto;
}

#map-news-panel.ll-card-docked-panel .category-compact-card {
    padding: 0;
}
