/* City panel — the feed of a picked city, docked to the right of the map.

   Hidden until a bubble is clicked, then slides in OVER the canvas. The canvas
   itself is never resized: animating #map's width makes MapLibre re-render at a
   new size every frame (it watches the container via trackResize), which reads
   as shimmering. Instead map.js eases the map's `padding` so the picked city
   sits in the visible half — same effect, no per-frame resize.
   All z-indexes here are local — .map-main owns a stacking context. */

.map-main { --panel-w: 400px; }

/* DOM overlays (not the canvas) do move aside — no re-render, no shimmer. */
.map-region-wrap {
    right: 12px;
    transition: right .26s cubic-bezier(.2, .8, .25, 1);
}
.map-main.has-panel .map-region-wrap { right: calc(12px + var(--panel-w)); }

.map-empty {
    right: 0;
    transition: right .26s cubic-bezier(.2, .8, .25, 1);
}
.map-main.has-panel .map-empty { right: var(--panel-w); }

.map-panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: var(--panel-w);
    max-width: 100%;
    z-index: 1200;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    border-left: 1px solid var(--border);
    box-shadow: -8px 0 24px rgba(0, 0, 0, .18);   /* it floats over the map */
    transform: translateX(100%);
    transition: transform .26s cubic-bezier(.2, .8, .25, 1);
}
.map-main.has-panel .map-panel { transform: none; }
.map-panel[hidden] { display: none; }   /* hidden must win over display:flex */

.map-panel-head {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    flex: none;
    padding: 14px 14px 10px;
    border-bottom: 1px solid var(--border);
}

.map-panel-titles {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.map-panel-title {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    overflow-wrap: anywhere;
}

.map-panel-sub {
    margin: 0;
    font-size: 12.5px;
    color: var(--text-muted, #6b7280);
    overflow-wrap: anywhere;
}

.map-panel-close { margin-left: auto; flex-shrink: 0; }

/* The panel scrolls itself — it is the feed list's IntersectionObserver root.
   `overscroll-behavior: contain` keeps a wheel at the end of the list from
   chaining into the map underneath and zooming it. */
.map-panel-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 12px 14px 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Phones: bottom sheet instead of a side dock — the map keeps its full width
   (--panel-w stays 0), so no resize is needed while it animates. */
@media (max-width: 640px) {
    /* The sheet covers the bottom, so nothing shifts sideways. */
    .map-region-wrap,
    .map-main.has-panel .map-region-wrap { right: 8px; }
    .map-main.has-panel .map-empty { right: 0; }
    .map-panel {
        top: auto;
        left: 0;
        right: 0;
        width: auto;
        height: 72vh;
        max-height: calc(100% - 40px);
        border-left: none;
        border-top: 1px solid var(--border);
        border-radius: 14px 14px 0 0;
        box-shadow: 0 -8px 32px rgba(0, 0, 0, .35);
        transform: translateY(100%);
    }
    .map-panel-body { padding-bottom: max(24px, env(safe-area-inset-bottom)); }
}
