/* map.css — Screen 2, Option 2A (map + ranked list) and Leaflet theming. */

.map-screen {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
    gap: 16.8px;
    align-items: start;
}

.map-card {
    position: relative;
    isolation: isolate; /* keep the z-500 overlays below the header / tab bar */
    border-radius: 14px;
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
#spots-map {
    width: 100%;
    aspect-ratio: 4 / 3;
    background: radial-gradient(120% 100% at 30% 20%, #1d2136, #0f111c);
    touch-action: none;
}

.map-legend {
    position: absolute;
    left: 11.2px;
    bottom: 11.2px;
    z-index: 500;
    display: flex;
    gap: 11.2px;
    flex-wrap: wrap;
    padding: 8.4px 11.2px;
    border-radius: 8px;
    background: rgba(22, 24, 38, 0.82);
    box-shadow: var(--shadow-sm);
}
.map-legend span {
    display: flex;
    align-items: center;
    gap: 5.6px;
    font-size: 11px;
    color: var(--color-neutral-300);
}
.map-legend i {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    display: inline-block;
}

.map-conditions-pill {
    position: absolute;
    right: 11.2px;
    top: 11.2px;
    z-index: 500;
    display: flex;
    align-items: center;
    gap: 5.6px;
    padding: 5.6px 11.2px;
    border-radius: 999px;
    background: rgba(22, 24, 38, 0.85);
    box-shadow: var(--shadow-sm);
    font-size: 12px;
}
.map-conditions-pill[hidden] { display: none; }
.map-conditions-pill .ph { color: var(--color-accent); }

/* ── Ranked list ───────────────────────────────────────────────────────── */
.spots-panel {
    padding: 16.8px 0;
    border-radius: 14px;
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
}
.spots-panel-head {
    display: flex;
    align-items: center;
    gap: 11.2px;
    flex-wrap: wrap;
    padding: 0 16.8px 11.2px;
}
.spots-panel-head h6 { margin: 0; color: var(--color-neutral-400); }
.spots-panel-head .seg { margin-left: auto; }

.spots-list { max-height: 520px; overflow: auto; }
.spot-row {
    display: grid;
    grid-template-columns: 26px 1fr auto;
    gap: 11.2px;
    align-items: center;
    padding: 9px 16.8px;
    width: 100%;
    background: transparent;
    border: 0;
    font: inherit;
    color: var(--color-text);
    text-align: left;
    cursor: pointer;
}
.spot-row:hover { background: rgba(233, 233, 237, 0.05); }
.spot-row:focus-visible { outline: 2px solid var(--color-accent); outline-offset: -2px; }
.spot-rank { font-size: 12px; color: var(--color-neutral-600); font-variant-numeric: tabular-nums; }
.spot-name { font-size: 14px; }
.spot-meta { font-size: 11px; color: var(--color-neutral-600); }
.spot-score {
    display: inline-grid;
    place-items: center;
    min-width: 38px;
    padding: 3px 8px;
    border-radius: 6px;
    font-family: var(--font-heading);
    font-size: 15px;
    font-variant-numeric: tabular-nums;
}

/* ── Dark basemap via filter on plain OSM raster tiles ─────────────────── */
.is-dark-map .leaflet-tile-pane {
    filter: invert(1) hue-rotate(180deg) brightness(0.92) contrast(0.9) saturate(0.8);
}

/* ── Leaflet chrome → tokens ───────────────────────────────────────────── */
/* isolation: Leaflet's panes/controls use z-index 400–1000; without their own
   stacking context they'd paint over the sticky header and the mobile tab
   bar (z 20/30) and swallow taps on it. */
.leaflet-container { background: transparent; font: inherit; isolation: isolate; }
.leaflet-bar a,
.leaflet-bar a:hover {
    background: var(--color-surface);
    color: var(--color-text);
    border-bottom-color: var(--color-divider);
}
.leaflet-bar {
    border: 1px solid var(--color-divider);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.leaflet-tooltip {
    background: var(--color-surface);
    border: 1px solid #3f424d;
    border-radius: 8px;
    color: var(--color-text);
    font-size: 12px;
    box-shadow: var(--shadow-md);
}
.leaflet-tooltip::before { display: none; }
.leaflet-control-attribution {
    background: rgba(22, 24, 38, 0.7) !important;
    color: var(--color-neutral-500) !important;
}
.leaflet-control-attribution a { color: var(--color-neutral-400) !important; }

/* Spot dot marker (divIcon). */
.spot-dot {
    display: block;
    border-radius: 50%;
}
.leaflet-marker-icon.spot-dot-wrap { background: none; border: 0; overflow: visible; }

@media (max-width: 700px) {
    .map-screen { grid-template-columns: minmax(0, 1fr); }
    .map-screen > * { min-width: 0; }
    #spots-map { aspect-ratio: 1 / 1; }
    .spots-list { max-height: none; overflow: visible; }
}
