/* Homepage season-vs-normal bar charts (see assets/normals.js) */

.normals-desc { color: #475569; margin: -0.75rem 0 1.25rem; font-size: 0.95rem; }

/* Bars on the left, map on the right; stacked (map first) on narrow screens */
.normals-body { display: grid; grid-template-columns: minmax(0, 640px) minmax(300px, 1fr); gap: 1.5rem 2rem; align-items: start; }
.normals-grid { min-width: 0; }
.normals-mapwrap { position: sticky; top: 1rem; }
.normals-mapwrap[hidden] { display: none; }
#normals-map { height: 440px; border-radius: 8px; border: 1px solid #cbd5e1; background: #e2e8f0; }
.normals-legend-bar { height: 0.6rem; border-radius: 3px; margin-top: 0.6rem; border: 1px solid #cbd5e1; }
.normals-legend-labels { display: flex; justify-content: space-between; font-size: 0.72rem; color: #475569; margin-top: 0.2rem; }

/* Same look as the site's other selectors (.tool-row-selector select) */
.normals-picker { display: flex; flex-wrap: wrap; gap: 0.75rem 1.25rem; margin-bottom: 1rem; }
.normals-picker label { display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 600; color: #1e3c72; }
.normals-picker select {
    appearance: none;
    -webkit-appearance: none;
    min-width: 11rem;
    max-width: 100%;
    padding: 0.4rem 2rem 0.4rem 0.6rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #ffffff;
    color: #0f172a;
    font-size: 0.95rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="%231e3c72" viewBox="0 0 16 16"><path d="M4.646 6.646a.5.5 0 0 1 .708 0L8 9.293l2.646-2.647a.5.5 0 0 1 .708.708l-3 3a.5.5 0 0 1-.708 0l-3-3a.5.5 0 0 1 0-.708z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 0.6rem center;
    background-size: 16px 16px;
}
.normals-picker select:focus { outline: none; border-color: #1e3c72; box-shadow: 0 0 0 3px rgba(30,60,114,0.15); }

.normals-chart h3 { margin: 0; font-size: 1.05rem; }
.normals-sub { color: #64748b; font-size: 0.8rem; margin: 0 0 0.5rem; }

.nbars { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.35rem; }
.nbar { display: grid; grid-template-columns: 9.5rem 1fr 3.9rem; align-items: center; gap: 0.5rem; font-size: 0.8rem; }
.nbar-name { color: #0f172a; font-weight: 600; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nbar-name small { display: block; font-weight: 400; font-size: 0.68rem; color: #64748b; overflow: hidden; text-overflow: ellipsis; }
.nbar-val { text-align: right; font-variant-numeric: tabular-nums; color: #334155; }

.nbar-track { position: relative; height: 0.85rem; background: #f1f5f9; border-radius: 3px; }
.nbar-fill { position: absolute; top: 0; bottom: 0; border-radius: 3px; }
/* Fill colors are set inline from the shared red-blue scale in normals.js */
.nbar-fill { background: #2a5298; }

/* "Normal" marker: centered on the percent and temperature charts; a movable tick on inch charts */
.nbar-track--mid::after {
    content: '';
    position: absolute;
    top: -2px;
    bottom: -2px;
    left: 50%;
    border-left: 1.5px solid #475569;
}

.normals-empty, .normals-status { color: #64748b; font-size: 0.85rem; font-style: italic; }
.normals-foot { color: #64748b; font-size: 0.75rem; margin: 1rem 0 0; }

@media (max-width: 900px) {
    .normals-body { grid-template-columns: 1fr; }
    .normals-mapwrap { position: static; order: -1; }
    #normals-map { height: 280px; }

    /* Phone-friendly pickers: one per row, full width */
    .normals-picker { display: grid; grid-template-columns: 1fr; gap: 0.6rem; }
    .normals-picker label { display: grid; grid-template-columns: 6.5rem 1fr; align-items: center; }
    .normals-picker select { width: 100%; min-width: 0; padding: 0.55rem 2rem 0.55rem 0.7rem; font-size: 1rem; }

    /* Bigger rows to tap */
    .nbar { min-height: 2.6rem; font-size: 0.85rem; }
}

@media (max-width: 480px) {
    .nbar { grid-template-columns: 6.5rem 1fr 3.4rem; }
}

/* Details panel under the map on phones (the same content as the popup) */
.normals-detail { position: relative; margin-top: 0.75rem; padding: 0.7rem 0.8rem; border: 1px solid #cbd5e1; border-radius: 8px; background: #ffffff; }
.normals-detail[hidden] { display: none; }
.normals-detail .normals-pop { width: 100%; }
.np-close { position: absolute; top: 0.2rem; right: 0.4rem; width: 2.4rem; height: 2.4rem; border: 0; background: transparent; font-size: 1.7rem; line-height: 1; color: #475569; cursor: pointer; }

/* Mini charts in the map popup */
.normals-popup .leaflet-popup-content { margin: 0.7rem 0.8rem; }
.normals-pop { width: 300px; max-width: 100%; font-size: 0.8rem; }
.normals-pop h4 { margin: 0; font-size: 1rem; color: #1e3c72; }
.np-sub { color: #64748b; font-size: 0.72rem; margin-bottom: 0.4rem; }
.np-chart { margin-top: 0.45rem; }
.np-title { font-weight: 600; font-size: 0.74rem; color: #0f172a; }
.np-chart svg { display: block; width: 100%; height: auto; }
.np-grid { stroke: #e2e8f0; stroke-width: 1; }
.np-band { fill: #94a3b8; fill-opacity: 0.28; }
.np-freeze { stroke: #64748b; stroke-width: 1; stroke-dasharray: 2 3; }
.np-axis { font-size: 8.5px; fill: #64748b; }
.np-cap { color: #475569; font-size: 0.68rem; }
.np-empty { color: #64748b; font-size: 0.72rem; font-style: italic; margin: 0.3rem 0 0.1rem; }
.np-key { margin-top: 0.5rem; color: #475569; font-size: 0.68rem; display: flex; align-items: center; gap: 0.3rem; }
.np-k { display: inline-block; width: 1.1rem; height: 0; border-top: 2px solid #2a5298; margin-left: 0.4rem; }
.np-k:first-child { margin-left: 0; }
.np-k--med { border-top: 2px dashed #64748b; }
.normals--map .nbar { cursor: pointer; }

/* Linked hover between a bar and its map dot */
.nbar { padding: 0.15rem 0.25rem; border-radius: 4px; outline: none; }
.nbar.is-hot, .nbar:focus-visible { background: #e8eefb; box-shadow: 0 0 0 1px #2a5298; }

.nbar-tick { position: absolute; top: -2px; bottom: -2px; border-left: 2px solid #0f172a; }
.normals-grid h3 { margin: 0; font-size: 1.05rem; }
