/* Live conditions map + station tables (see assets/conditions-map.js) */

.cmap {
    height: 520px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    z-index: 0;
}
.cmap--tall { height: 640px; }

.cmap-status {
    font-size: 0.8rem;
    color: #64748b;
    margin: 0.6rem 0 0;
}
.cmap-status--warn { color: #b45309; font-weight: 600; }

.cmap-legend {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.8rem;
    color: #475569;
    margin: 0.5rem 0 0;
}
.cmap-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1.5px solid #fff;
    box-shadow: 0 0 0 1px #94a3b8;
    margin-right: 0.3rem;
    vertical-align: -1px;
}
/* Square legend swatch turned into a diamond */
.cmap-dot--diamond { border-radius: 0; transform: rotate(45deg); width: 9px; height: 9px; margin: 0 0.45rem 0 0.15rem; vertical-align: 0; }
.cmap-dot--ok { background: #1e3c72; }
.cmap-dot--flag { background: #9ca3af; }

/* Map markers: SNOTEL circle, NWAC diamond. Large enough to tap, white outline so overlaps stay readable. */
.cmap-pin { background: none; border: 0; }
.cmap-pin > span {
    display: block;
    width: 16px;
    height: 16px;
    margin: 1px;
    background: #1e3c72;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px #475569, 0 1px 3px rgba(0, 0, 0, 0.35);
}
.cmap-pin-circle { border-radius: 50%; }
.cmap-pin-diamond { transform: rotate(45deg) scale(0.85); }
.cmap-pin--flag { background: #9ca3af !important; }
.cmap-pin:hover > span { background: #2a5298; }

.cmap-areas {
    margin-top: 1rem;
    font-size: 0.9rem;
}
.cmap-areas summary { cursor: pointer; color: #1e3c72; font-weight: 600; }
.cmap-areas ul {
    list-style: none;
    columns: 2 220px;
    margin: 0.5rem 0 0;
    padding: 0;
}
.cmap-areas li { padding: 0.15rem 0; }

/* Popup + card content */
.cmap-popup .leaflet-popup-content {
    margin: 12px 14px;
    font-size: 0.85rem;
    line-height: 1.35;
}
.cmap-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1e3c72;
    margin: 0 0 0.35rem;
}
h3.cmap-title { font-size: 1.15rem; margin-bottom: 0.5rem; }
.cmap-note { font-size: 0.8rem; font-style: italic; color: #475569; margin: 0 0 0.5rem; }

.cmap-scroll { overflow-x: auto; }
.cmap-table {
    border-collapse: collapse;
    width: 100%;
    font-size: 0.8rem;
    white-space: nowrap;
}
.cmap-table th,
.cmap-table td {
    padding: 0.25rem 0.4rem;
    text-align: right;
    border-bottom: 1px solid #e2e8f0;
}
.cmap-table thead th {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: #64748b;
    text-align: right;
}
.cmap-table thead th:first-child,
.cmap-table tbody th { text-align: left; }
.cmap-table tbody th { font-weight: 600; color: #0f172a; }
.cmap-table th small {
    display: block;
    font-weight: 400;
    font-size: 0.65rem;
    color: #64748b;
}
.cmap-row--flag td,
.cmap-row--flag th { background: #fffbeb; }
.cmap-warn { color: #b45309; }

.cmap-cautions {
    list-style: none;
    margin: 0.5rem 0 0;
    padding: 0;
    font-size: 0.75rem;
    color: #92400e;
}
.cmap-cautions li::before { content: '\26A0\00a0'; }

.cmap-checks {
    list-style: none;
    margin: 0.6rem 0 0;
    padding: 0;
    display: grid;
    gap: 0.25rem;
}
.cmap-check { display: flex; gap: 0.5rem; align-items: baseline; }
.cmap-check small { color: #64748b; }
.cmap-badge {
    flex: 0 0 2.2rem;
    text-align: center;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.05rem 0;
    background: #e2e8f0;
    color: #475569;
}
.cmap-check--yes .cmap-badge { background: #1e3c72; color: #fff; }

.cmap-more {
    display: inline-block;
    margin-top: 0.7rem;
    font-weight: 600;
    color: #2a5298;
}

/* Standalone page: every area as a card */
.cmap-all {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}
.cmap-card {
    border: 1px solid #e2e8f0;
    border-left: 4px solid #2a5298;
    border-radius: 8px;
    padding: 1rem;
    background: #fff;
}

@media (max-width: 600px) {
    /* One finger drags the map, so leave room to scroll the page above and below it */
    .cmap { height: min(62vh, 380px); }
    .cmap--tall { height: min(68vh, 440px); }
    .cmap-all { grid-template-columns: 1fr; }
}

/* Top-right watershed readout + tabs for areas that share a watershed */
.cmap-info {
    background: rgba(255, 255, 255, 0.92);
    border-radius: 6px;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.3);
    padding: 0.4rem 0.7rem;
    max-width: 240px;
    font-size: 0.8rem;
    color: #475569;
}
.cmap-info strong { display: block; color: #1e3c72; font-size: 0.9rem; }

.cmap-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin: 0 0 0.6rem;
}
.cmap-tab {
    border: 1px solid #cbd5e1;
    background: #f8fbff;
    color: #1e3c72;
    border-radius: 999px;
    padding: 0.2rem 0.65rem;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
}
.cmap-tab[aria-selected="true"] { background: #1e3c72; border-color: #1e3c72; color: #fff; }
.cmap-panel[hidden] { display: none; }

@media (max-width: 600px) {
    .cmap-info { display: none; }
    .cmap-card { padding: 0.75rem; }
    .cmap-popup .leaflet-popup-content { margin: 10px; }
}
.cmap-card { min-width: 0; }

/* Webcam buttons + viewer */
.cmap-cams { display: flex; flex-wrap: wrap; gap: 0.3rem; align-items: center; margin: 0 0 0.6rem; font-size: 0.78rem; color: #475569; }
.cmap-cam {
    border: 1px solid #cbd5e1; background: #f8fbff; color: #1e3c72; border-radius: 999px;
    padding: 0.2rem 0.65rem; font-size: 0.78rem; font-weight: 600; cursor: pointer;
}
.cmap-cam:hover { background: #e3f2fd; }
.cmap-modal {
    position: fixed; inset: 0; z-index: 10000; background: rgba(15, 23, 42, 0.75);
    display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.cmap-modal[hidden] { display: none; }
.cmap-modal-box {
    position: relative; background: #fff; border-radius: 8px; padding: 1rem;
    width: min(900px, 100%); max-height: 100%; overflow: auto;
}
.cmap-modal-title { font-weight: 700; color: #1e3c72; margin: 0 2rem 0.6rem 0; }
.cmap-modal-close {
    position: absolute; top: 0.4rem; right: 0.6rem; border: 0; background: none;
    font-size: 1.8rem; line-height: 1; cursor: pointer; color: #475569;
}
.cmap-video { position: relative; aspect-ratio: 16 / 9; }
.cmap-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* Decluttered card: headline tiles, quiet chips, details for the rest */
.cmap-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.35rem; margin: 0.4rem 0 0; }
.cmap-tile { background: #f1f5f9; border-radius: 6px; padding: 0.35rem 0.2rem; text-align: center; min-width: 0; }
.cmap-tile span { display: block; font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.02em; color: #64748b; }
.cmap-tile strong { display: block; font-size: 0.9rem; color: #0f172a; white-space: nowrap; }
.cmap-tile--humid { background: #dbeafe; }
.cmap-tile--humid span { color: #1e40af; }
.cmap-from { font-size: 0.72rem; color: #64748b; margin: 0.25rem 0 0; }

.cmap-chips { list-style: none; display: flex; flex-wrap: wrap; gap: 0.3rem; margin: 0.6rem 0 0; padding: 0; }
.cmap-chip {
    font-size: 0.72rem; padding: 0.15rem 0.55rem; border-radius: 999px;
    background: #f1f5f9; color: #94a3b8; cursor: help;
}
.cmap-chip--yes { background: #1e3c72; color: #fff; font-weight: 600; }

.cmap-stations { margin-top: 0.6rem; font-size: 0.8rem; }
.cmap-stations summary { cursor: pointer; color: #1e3c72; font-weight: 600; }
.cmap-stations .cmap-scroll { margin-top: 0.4rem; }

.cmap-cams { margin-top: 0.6rem; }
.cmap-more { margin-top: 0.6rem; }

@media (max-width: 600px) {
    .cmap-tiles { grid-template-columns: repeat(3, 1fr); }
}

/* Station picker + basin name tooltip */
.cmap-picks { display: flex; flex-wrap: wrap; gap: 0.25rem; margin: 0.5rem 0 0; }
.cmap-pick {
    border: 1px solid #cbd5e1; background: #fff; color: #1e3c72; border-radius: 6px;
    padding: 0.15rem 0.5rem; font-size: 0.72rem; font-weight: 600; cursor: pointer;
}
.cmap-pick small { font-weight: 400; color: #64748b; }
.cmap-pick[aria-pressed="true"] { background: #1e3c72; border-color: #1e3c72; color: #fff; }
.cmap-pick[aria-pressed="true"] small { color: #cbd5e1; }
.cmap-tiles--flag .cmap-tile strong { color: #94a3b8; }
.cmap-basin-tip { font-weight: 700; color: #1e3c72; }
