/* ==========================================================================
   Weather page — "chart plate" styling, matching the site's Atlas aesthetic
   (parchment + sienna, EB Garamond + IBM Plex Mono).
   ========================================================================== */

:root {
    /* site-wide star cursor (mirrors main.css), reduced to a dot over the map */
    --cursor-plus: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'><g fill='%23b8431f'><polygon points='12,2 10,9.8 14,9.8'/><polygon points='22,12 14.2,10 14.2,14'/><polygon points='12,22 10,14.2 14,14.2'/><polygon points='2,12 9.8,10 9.8,14'/></g><circle cx='12' cy='12' r='1' fill='%232b1f15'/></svg>") 12 12, crosshair;
    --cursor-plus-click: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'><g fill='%23b8431f'><polygon points='12,2 10,9.8 14,9.8'/><polygon points='22,12 14.2,10 14.2,14'/><polygon points='12,22 10,14.2 14,14.2'/><polygon points='2,12 9.8,10 9.8,14'/></g><rect x='10' y='10' width='4' height='4' fill='%232b1f15'/></svg>") 12 12, pointer;
    --cursor-dot: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><circle cx='6' cy='6' r='2.6' fill='%23b8431f'/><circle cx='6' cy='6' r='0.9' fill='%232b1f15'/></svg>") 6 6, crosshair;
    --bg: #f4efe5;
    --ink: #2b1f15;
    --muted: #6b5840;
    --faint: #a8967a;
    --accent: #b8431f;
    --rule: rgba(43, 31, 21, 0.10);
    --rule-strong: rgba(43, 31, 21, 0.25);
    --card: #fbf8f1;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { cursor: var(--cursor-plus); }
a, button, input[type="range"], label, select, summary {
    cursor: var(--cursor-plus-click);
}
#map, #map .leaflet-grab, #map .leaflet-interactive, #map .leaflet-container {
    cursor: var(--cursor-dot);
}

body {
    background: var(--bg);
    color: var(--ink);
    font-family: 'EB Garamond', Georgia, serif;
    font-size: 17px;
    line-height: 1.45;
}

.mono { font-family: 'IBM Plex Mono', monospace; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

main { max-width: 780px; margin: 0 auto; padding: 0 0.75rem 2rem; }

/* ---------------- header plate ---------------- */

.plate {
    max-width: 780px;
    margin: 0 auto;
    padding: 1.2rem 0.75rem 0;
    position: relative;
}
.plate h1 {
    font-size: 2.3rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    margin-top: 0.3rem;
}
.plate-sub-row {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin: 0.25rem 0 0.8rem;
}
.plate-sub {
    font-size: 0.72rem;
    color: var(--muted);
    letter-spacing: 0.12em;
}
#loc-btn.picking { background: var(--accent); border-color: var(--accent); color: #fff; }
#map.picking { cursor: crosshair; }
#map.picking .leaflet-grab { cursor: crosshair; }
.plate-rule {
    border-top: 1px solid var(--rule-strong);
    border-bottom: 1px solid var(--rule-strong);
    height: 4px;   /* double rule, chart-plate style */
}

/* ---------------- map section ---------------- */

.mode-row { display: flex; gap: 0.4rem; margin-bottom: 0.55rem; }
.mode-btn {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.78rem;
    letter-spacing: 0.05em;
    padding: 0.35rem 0.8rem;
    background: none;
    border: 1px solid var(--rule-strong);
    color: var(--muted);
    cursor: var(--cursor-plus-click);
}
.mode-btn.active {
    background: var(--ink);
    border-color: var(--ink);
    color: var(--bg);
}

#map-wrap { position: relative; }
#map {
    height: 62vh;
    min-height: 340px;
    border: 1px solid var(--rule-strong);
    background: #e9e2d2;
}

/* Sepia-tone the basemap only — data panes stay untouched. */
.leaflet-pane.basemap-pane { filter: sepia(0.28) saturate(0.75) brightness(1.02); }

/* Honest pixels: never let the browser smooth data rasters. */
.leaflet-pane.data-pane img { image-rendering: pixelated; }

#map-loading {
    position: absolute;
    inset: 0;
    z-index: 940;
    background: rgba(244, 239, 229, 0.45);
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
#map-loading[hidden] { display: none; }
#map-loading .spin {
    width: 34px; height: 34px;
    border: 3px solid rgba(184, 67, 31, 0.25);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: wxspin 0.9s linear infinite;
}
@keyframes wxspin { to { transform: rotate(360deg); } }
#map-loading span { font-size: 0.66rem; letter-spacing: 0.14em; color: var(--muted); }

#map-tip {
    position: absolute;
    z-index: 960;
    background: var(--card);
    border: 1px solid var(--rule-strong);
    padding: 0.18rem 0.5rem;
    font-size: 0.68rem;
    color: var(--ink);
    pointer-events: none;
    white-space: nowrap;
}

#map-banner {
    position: absolute;
    top: 0; left: 0; right: 0;
    z-index: 900;
    background: rgba(184, 67, 31, 0.92);
    color: #fff;
    font-size: 0.74rem;
    padding: 0.35rem 0.6rem;
}

/* ---------------- time readout + slider ---------------- */

#radar-controls { margin-top: 0.55rem; }

#hrrr-mode-row { font-size: 0.72rem; margin-bottom: 0.45rem; }
.row-label { color: var(--faint); letter-spacing: 0.1em; font-size: 0.62rem; margin-right: 0.2rem; }
.mini-btn {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    background: none;
    border: 1px solid var(--rule-strong);
    color: var(--muted);
    cursor: var(--cursor-plus-click);
}
.mini-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
#avg-mode-wrap { margin-left: 0.6rem; }

#fs-btn {
    position: absolute;
    top: 10px; right: 10px;
    z-index: 950;
    width: 34px; height: 34px;
    font-size: 1.05rem;
    line-height: 1;
    background: var(--card);
    border: 1px solid var(--rule-strong);
    color: var(--ink);
    cursor: var(--cursor-plus-click);
}
#goes-larger {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 950;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.72rem;
    padding: 0.35rem 0.7rem;
    background: var(--card);
    border: 1px solid var(--rule-strong);
    color: var(--ink);
    cursor: var(--cursor-plus-click);
}
#goes-larger:hover { border-color: var(--accent); color: var(--accent); }

#map-wrap.fullscreen {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: var(--bg);
}
#map-wrap.fullscreen #map { height: 100%; min-height: 0; border: none; }
body.no-scroll { overflow: hidden; }

.goes-opacity-row { margin-top: 0.45rem; font-size: 0.72rem; display: flex; align-items: center; gap: 0.5rem; }
#goes-opacity { flex: 1; max-width: 260px; accent-color: var(--accent); }

#time-readout {
    font-size: 0.82rem;
    letter-spacing: 0.02em;
    min-height: 1.3em;
}
#time-readout .src { color: var(--muted); }
#time-readout .fx  { color: var(--accent); }

#slider-wrap { margin-top: 0.45rem; }

#slider-groups {
    display: flex;
    justify-content: space-between;
    font-size: 0.62rem;
    letter-spacing: 0.14em;
    color: var(--faint);
    margin-bottom: 0.15rem;
}
#grp-fx { color: #c68a6e; }

#slider-track { position: relative; height: 40px; }

#time-slider {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    margin: 0;
    z-index: 5;
    cursor: var(--cursor-plus-click);
}
#time-slider::-webkit-slider-runnable-track { height: 100%; background: transparent; }
#time-slider::-moz-range-track { height: 100%; background: transparent; }
#time-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px; height: 30px;
    margin-top: 5px;
    background: var(--accent);
    border: 1px solid var(--ink);
    border-radius: 2px;
}
#time-slider::-moz-range-thumb {
    width: 12px; height: 28px;
    background: var(--accent);
    border: 1px solid var(--ink);
    border-radius: 2px;
}

#ticks {
    position: absolute;
    left: 7px; right: 7px;   /* align with thumb travel */
    top: 0; bottom: 0;
    pointer-events: none;
}
.tick {
    position: absolute;
    top: 12px;
    width: 2px; height: 16px;
    margin-left: -1px;
    background: var(--faint);
    opacity: 0.5;
}
.tick.loaded { background: var(--ink); opacity: 0.75; }
.tick.fx { background: #c68a6e; }
.tick.fx.loaded { background: var(--accent); opacity: 0.9; }
.tick.hour { height: 22px; top: 9px; }

#now-divider {
    position: absolute;
    top: 2px; bottom: 2px;
    width: 0;
    border-left: 1px dashed var(--ink);
    pointer-events: none;
}
#now-divider span {
    position: absolute;
    top: -2px; left: 3px;
    font-size: 0.58rem;
    letter-spacing: 0.1em;
    color: var(--muted);
}

.legend-row { margin-top: 0.5rem; }
#dbz-canvas {
    display: block;
    width: 100%;
    height: 13px;
    image-rendering: pixelated;   /* the legend obeys the same rule as the data */
    border: 1px solid var(--rule-strong);
}
#dbz-labels {
    position: relative;
    height: 1.1rem;
    font-size: 0.62rem;
    color: var(--muted);
}
#dbz-labels span { position: absolute; transform: translateX(-50%); }
#dbz-labels .unit { right: 0; left: auto; transform: none; color: var(--faint); }
#ir-canvas {
    display: block;
    width: 100%;
    height: 13px;
    image-rendering: pixelated;
    border: 1px solid var(--rule-strong);
}
#ir-labels {
    position: relative;
    height: 1.1rem;
    font-size: 0.62rem;
    color: var(--muted);
}
#ir-labels span { position: absolute; transform: translateX(-50%); }
#ir-labels .unit { right: 0; left: auto; transform: none; color: var(--faint); }
#ir-legend { margin-top: 0.5rem; }

/* ---------------- MRMS controls ---------------- */

#mrms-controls { margin-top: 0.6rem; }
.mrms-btn-row { display: flex; gap: 0.4rem; }
.mrms-btn {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.78rem;
    padding: 0.3rem 0.75rem;
    background: none;
    border: 1px solid var(--rule-strong);
    color: var(--muted);
    cursor: var(--cursor-plus-click);
}
.mrms-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

#mrms-valid { font-size: 0.72rem; color: var(--muted); margin-top: 0.4rem; }

#mrms-legend {
    display: flex;
    margin-top: 0.45rem;
    border: 1px solid var(--rule-strong);
    overflow: hidden;
}
.mrms-bin { flex: 1; }
.mrms-bin .swatch { height: 16px; }
.mrms-bin .lbl {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.58rem;
    color: var(--muted);
    text-align: left;
    padding: 1px 0 1px 2px;
    border-left: 1px solid var(--rule);
}

.data-notes {
    margin-top: 0.8rem;
    border: 1px solid var(--rule);
    background: var(--card);
}
.data-notes summary {
    cursor: var(--cursor-plus-click);
    padding: 0.4rem 0.65rem;
    font-size: 0.68rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
    list-style-position: inside;
}
.data-notes summary:hover { color: var(--accent); }
.data-notes .dn-body {
    padding: 0.1rem 0.85rem 0.6rem;
    border-top: 1px solid var(--rule);
    font-size: 0.86rem;
    line-height: 1.5;
}
.data-notes .dn-body p { margin-top: 0.55rem; }
.data-notes .dn-body strong { font-weight: 600; }

/* ---------------- forecast section ---------------- */

.forecast-section { margin-top: 1.2rem; }
.map-section { margin-top: 2.2rem; }
.forecast-section h2 {
    font-size: 1.45rem;
    font-weight: 500;
}
.src-tag {
    font-size: 0.68rem;
    letter-spacing: 0.12em;
    color: var(--bg);
    background: var(--ink);
    padding: 0.15rem 0.45rem;
    vertical-align: 0.25em;
}
#fc-meta { font-size: 0.7rem; color: var(--muted); letter-spacing: 0.04em; margin: 0.25rem 0 0.8rem; }

#day-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.5rem;
}
.day-card {
    background: var(--card);
    border: 1px solid var(--rule);
    padding: 0.55rem 0.65rem 0.6rem;
}
.day-card .dc-day { font-size: 1.02rem; font-weight: 600; }
.day-card .dc-date { font-size: 0.62rem; color: var(--faint); letter-spacing: 0.08em; }
.day-card .dc-temps { margin-top: 0.35rem; font-size: 0.98rem; }
.day-card .dc-temps .hi { color: var(--accent); font-weight: 500; }
.day-card .dc-temps .lo { color: var(--muted); }
.day-card .dc-temps .sd { font-size: 0.7rem; color: var(--faint); }
.day-card .dc-nbm { font-size: 0.68rem; color: var(--faint); margin-top: 0.15rem; }
.day-card .dc-nbm .sd { color: var(--faint); }
.day-card .dc-nbm .diverge { color: var(--accent); }
.day-card .dc-precip { font-size: 0.78rem; color: var(--muted); margin-top: 0.35rem; }
.day-card .dc-wind { font-size: 0.68rem; color: var(--faint); margin-top: 0.15rem; }

.fc-loading { color: var(--muted); font-size: 0.8rem; }
.wfo-key { font-family: 'IBM Plex Mono', monospace; font-size: 0.7rem; }

/* ---------------- observations ---------------- */

.obs-section { margin-top: 2.2rem; }
.obs-section h2 { font-size: 1.45rem; font-weight: 500; }
.now-strip {
    font-size: 0.85rem;
    margin: 1.1rem 0 0;
    padding-bottom: 0.7rem;
    border-bottom: 1px solid var(--rule);
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.3rem 1.2rem;
}
#sun-times { white-space: nowrap; opacity: 0.75; font-size: 0.78rem; }
#sun-times > span + span { margin-left: 0.9rem; }
.sun-glyph { vertical-align: -1px; margin-right: 3px; }

/* ===== Site header + hamburger (matches the rest of the site; adapted
   from the shared header styles with this page's palette vars). The
   thought-cloud corner map (cloud-hud.js) docks its trigger into this
   header automatically, like on the other visual pages. ===== */
:root { --header-height: 64px; }
body { padding-top: var(--header-height); }
.site-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    height: var(--header-height);
    padding: 0 1.5rem;
    background: linear-gradient(to bottom, var(--bg) 0%, var(--bg) 80%, transparent 100%);
    font-family: 'EB Garamond', Georgia, serif;
    font-size: 0.875rem;
}
.site-nav { display: flex; align-items: center; gap: 1.5rem; }
.nav-item { position: relative; display: flex; align-items: center; }
.nav-link {
    color: var(--muted);
    text-decoration: none;
    letter-spacing: 0.02em;
    transition: color 0.15s ease;
    padding: 0.5rem 0;
    display: block;
}
.nav-link:hover { color: var(--ink); text-decoration: none; }
.nav-link em { font-style: italic; }
.nav-link.active { color: var(--accent); }
.nav-item.static-breadcrumb { display: flex; align-items: center; }
.breadcrumb-divider { margin: 0 0.5rem; color: var(--faint); flex-shrink: 0; }
.breadcrumb-current {
    color: var(--faint);
    font-style: italic;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 30vw;
    display: inline-block;
    padding: 0.5rem 0;
}
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 24px; height: 24px;
    background: none; border: none; padding: 0;
    margin-left: auto;
}
.hamburger span {
    display: block;
    width: 100%; height: 2px;
    background: var(--ink);
    transition: transform 0.15s ease, opacity 0.15s ease;
}
.mobile-menu {
    position: fixed;
    inset: 0;
    background: var(--bg);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0s 0.25s;
}
.mobile-menu.open {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.25s ease, visibility 0s 0s;
}
.mobile-menu-content { padding: calc(var(--header-height) + 2rem) 1.5rem 2rem; }
.mobile-menu .mobile-nav-item { margin-bottom: 1.5rem; }
.mobile-menu .mobile-nav-link {
    display: block;
    font-size: 1.25rem;
    color: var(--ink);
    text-decoration: none;
    margin-bottom: 0.5rem;
}
.mobile-menu .mobile-nav-link em { font-style: italic; }
.mobile-menu .mobile-nav-link.active { color: var(--accent); }
@media (max-width: 768px) {
    :root { --header-height: 56px; }
    .site-header { padding: 0 1rem; }
    .site-nav { display: none; }
    .hamburger { display: flex; }
    .site-header.menu-open .hamburger span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }
    .site-header.menu-open .hamburger span:nth-child(2) { opacity: 0; }
    .site-header.menu-open .hamburger span:nth-child(3) {
        transform: rotate(-45deg) translate(5px, -5px);
    }
}
/* (the cloud-hud trigger and the hamburger both carry margin-left: auto —
   whichever is visible ends up right-aligned; the hud hides itself below
   1024 px, the hamburger only shows below 768 px) */

/* Aurora watch banner — appears only when forecast Kp crosses the
   latitude-derived threshold */
#aurora-banner {
    margin: 1.1rem 0 -0.4rem;
    border: 1px solid var(--accent);
    background: rgba(184, 67, 31, 0.07);
    font-size: 0.8rem;
}
#aurora-head {
    padding: 0.45rem 0.7rem;
    cursor: var(--cursor-plus-click);
    color: var(--accent);
    letter-spacing: 0.04em;
}
#aurora-head .aurora-more { text-decoration: underline; opacity: 0.8; }
#aurora-detail {
    padding: 0.15rem 0.7rem 0.55rem;
    line-height: 1.55;
    font-size: 0.74rem;
}
#aurora-detail a { color: var(--accent); }

/* NWS active-alerts banner shares the aurora banner's look */
#alert-banner {
    margin: 1.1rem 0 -0.4rem;
    border: 1px solid var(--accent);
    background: rgba(184, 67, 31, 0.07);
    font-size: 0.8rem;
}
#alert-head {
    padding: 0.45rem 0.7rem;
    cursor: var(--cursor-plus-click);
    color: var(--accent);
    letter-spacing: 0.04em;
}
#alert-detail {
    padding: 0.15rem 0.7rem 0.55rem;
    line-height: 1.55;
    font-size: 0.74rem;
}
.alert-block + .alert-block { margin-top: 0.6rem; }

/* chart hit-rects are tap targets — give them the site click cursor */
#climo-chart svg rect { cursor: var(--cursor-plus-click); }

/* Forecast verification panel (on-demand) */
#verif-table { border-collapse: collapse; font-size: 0.74rem; margin: 0.3rem 0 0.5rem; }
#verif-table th { text-align: left; font-weight: 400; color: var(--faint); padding: 0 1.1em 0.25em 0; }
#verif-table td { padding: 0.12em 1.1em 0.12em 0; }
.verif-sum { margin: 0.3rem 0; }
.verif-note { color: var(--faint); font-size: 0.7rem; margin-top: 0.35rem; }
#obs-current .big { font-size: 1.5rem; color: var(--accent); font-weight: 500; }
#obs-current .age { color: var(--faint); font-size: 0.7rem; }
#obs-week { border-collapse: collapse; font-size: 0.74rem; width: 100%; max-width: 430px; }
#obs-week th {
    text-align: left; font-weight: 400; color: var(--faint);
    font-size: 0.62rem; letter-spacing: 0.1em;
    border-bottom: 1px solid var(--rule-strong); padding: 0.15rem 0.9rem 0.2rem 0;
}
#obs-week td { padding: 0.18rem 0.9rem 0.18rem 0; border-bottom: 1px solid var(--rule); color: var(--muted); }
#obs-week td:first-child { color: var(--ink); }

/* ---------------- climo chart ---------------- */

.climo-section { margin-top: 2.2rem; }
.climo-section h2 { font-size: 1.45rem; font-weight: 500; }
#climo-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1.1rem;
    font-size: 0.66rem;
    color: var(--muted);
    margin: 0.4rem 0 0.5rem;
}
#climo-legend .lg { display: inline-flex; align-items: center; gap: 0.35rem; }
#climo-legend .sw { width: 11px; height: 11px; display: inline-block; }
#climo-chart { position: relative; }
#climo-chart svg { display: block; }
#climo-chart .cc-tick { fill: var(--faint); font-family: 'IBM Plex Mono', monospace; }
#climo-chart .cc-panel {
    fill: var(--muted);
    font-family: 'IBM Plex Mono', monospace;
    letter-spacing: 0.12em;
}
#cc-tip {
    position: absolute;
    background: var(--card);
    border: 1px solid var(--rule-strong);
    padding: 0.2rem 0.5rem;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.66rem;
    color: var(--ink);
    pointer-events: none;
    max-width: min(270px, 78vw);   /* wraps on mobile instead of overflowing */
    line-height: 1.5;
    z-index: 10;
}

/* ---------------- footer ---------------- */

.attrib {
    max-width: 780px;
    margin: 2.5rem auto 0;
    padding: 0.8rem 0.75rem 1.6rem;
    border-top: 1px solid var(--rule-strong);
    font-size: 0.62rem;
    line-height: 1.7;
    color: var(--faint);
}
.attrib a { color: var(--muted); }

/* ---------------- responsive ---------------- */

@media (max-width: 640px) {
    body { font-size: 16px; }
    .plate h1 { font-size: 1.9rem; }
    #map { height: 52vh; }
    #day-cards { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); }
}
