/* ---------- sidebar ---------- */

#sidebar {
    position: fixed; /* float on top of the map, pinned to the screen */
    bottom: 8px;
    height: calc(100dvh - 80px); /* dvh = the height you can actually see (Safari bars included) */
    transition: height 0.3s; /*when height changes slide to new height over 0.3s*/
    left: 8px;
    width: 332px;
    border-radius: var(--radius-panel);
    padding: 16px;
    box-sizing: border-box;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);  /* soft shadow under the panel */
    border: 1px solid rgba(0, 0, 0, 0.10);       /* faint outline around the edge */
    z-index: 10;
    overflow-y: auto;

    background: rgba(255, 255, 255, 0.7);  /* white, but 70% solid, so the map shows through */
    backdrop-filter: blur(20px);           /* blur whatever is behind the panel */
    -webkit-backdrop-filter: blur(20px);  /* for the old version of Safari */

    scrollbar-width: thin;                               /* skinnier bar */
    scrollbar-color: rgba(0, 0, 0, 0.25) transparent;   /* thumb color, track color */
    scrollbar-gutter: stable both-edges;   /* always save room for the bar, same on both sides */
    overscroll-behavior: contain;   /* when the list hits its end, don't pass the swipe on to the page */
}

#sidebar.collapsed {
    height: 74px;       /* small: grabber + search only */
    overflow: hidden;   /* no scrollbar when small */
}

#grabber {
    width: 36px;
    height: 4px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.25);
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);   /* centered */
    cursor: pointer;
    touch-action: none;
}

#sidebar h2 {
    font-size: 20px;
    margin: 16px 0 8px; 
}

/* ---------- phone ---------- */

@media (max-width: 600px) { /* only on screens 600px wide or less */
    #sidebar {
        bottom: 0;
        left: 0;
        right: 0;      /* stretch edge to edge */
        width: auto;
        height: 50dvh;  /* big */
        border-radius: var(--radius-panel) var(--radius-panel) 0 0; /* round only the top corners */
        touch-action: none;  /* small/middle: finger drags the sheet instead of scrolling */
    }
    #sidebar.expanded {
        height: calc(100dvh - 72px);   /* full: stops just under the top bar */
        touch-action: pan-y;          /* full: finger scrolls the content */
    }
}

