:root { color-scheme: light; font-family: system-ui, sans-serif; color: #172c40; background: #f4f7fa; }
* { box-sizing: border-box; }
body { margin: 0; font-size: 1rem; line-height: 1.55; }
main { max-width: 46rem; margin: auto; padding: 2.5rem 1.25rem; }
a { color: #125b94; text-underline-offset: .18em; }
a:hover { color: #073451; }
header { margin-bottom: 2rem; border-bottom: 1px solid #ccd7e2; padding-bottom: 1.25rem; }
header p { margin: .35rem 0 0; color: #516274; }
.brand { font-size: 1.6rem; font-weight: 750; text-decoration: none; color: #172c40; }
.brand span { font-weight: 400; }
label { display: block; font-weight: 650; margin-bottom: .45rem; }
.search { display: flex; gap: .6rem; max-width: 620px; }
input, button { font: inherit; padding: .75rem 1rem; border-radius: .4rem; }
input { min-width: 0; flex: 1; border: 1px solid #8498ab; background: white; color: inherit; }
select { font: inherit; padding: .6rem 2.5rem .6rem .75rem; color: inherit; background: white; border: 1px solid #8498ab; border-radius: .4rem; max-width: 100%; }
.sounding-label { margin-top: 1rem; }
button { border: 1px solid #125b94; background: #125b94; color: white; font-weight: 650; cursor: pointer; }
button:hover { background: #073f6a; }
:focus-visible { outline: 3px solid #c26b0c; outline-offset: 3px; }
nav { display: flex; gap: .5rem 1.25rem; flex-wrap: wrap; margin: 1rem 0 2.5rem; }
h1 { font-size: 2.1rem; letter-spacing: -.04em; margin: 0; }
h2 { font-size: 1.3rem; margin: 0 0 1rem; }
h2 span { display: inline-block; font-weight: 400; font-size: 1rem; margin-left: .5rem; }
h3 { font-size: 1rem; font-weight: 550; margin: 0; }
section { margin: 2rem 0; }
.place-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.muted { color: #516274; font-size: .9rem; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; }
article { background: white; padding: 1.25rem; border: 1px solid #d6e0e8; border-radius: .5rem; }
.value { font-size: 2rem; font-weight: 650; margin: .5rem 0; }
.value span { font-size: 1rem; font-weight: 400; }
article .muted { margin: 0; }
.notice { padding: 1rem; border-left: 4px solid #b36716; background: #fff2df; }
details { margin: 2rem 0; }
summary { cursor: pointer; font-weight: 600; }
.hash { overflow-wrap: anywhere; font-size: .9rem; }
.observation-chart, .forecast-chart { overflow: hidden; background: white; border: 1px solid #d6e0e8; border-radius: .5rem; }
.observation-chart svg, .forecast-chart svg { display: block; width: 100%; max-width: 100%; height: auto; }
.chart-legend { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; padding: 0; list-style: none; font-size: .9rem; }
.chart-legend li { display: flex; align-items: center; gap: .5rem; }
.swatch { display: inline-block; width: 1.25rem; height: .2rem; background: #9d2016; }
.swatch.level850 { width: .85rem; height: .85rem; border-radius: 50%; background: #1565d8; }
.swatch.level500 { width: .85rem; height: .85rem; border-radius: 50%; background: white; border: 3px solid #f07800; }
.swatch.rain { background: #1671ad; }
.swatch.wind { background: #147558; }
.swatch.gust { background: repeating-linear-gradient(to right, #6454a4 0 5px, transparent 5px 8px); }
.meps-player { border-top: 1px solid #ccd7e2; padding-top: 2rem; margin-top: 3rem; }
.precipitation-legend span { display: inline-block; width: 1rem; height: 1rem; border-radius: .15rem; }
.rain-key { background: #199c3d; }
.snow-key { background: #226fe6; }
.freezing-key { background: #da262a; }
.other-key { background: #70707d; }
.missing-key { background: repeating-linear-gradient(45deg, #a2a5aa 0 3px, #e5e6e8 3px 6px); }
.forecast-controls { display: flex; align-items: center; flex-wrap: wrap; gap: .6rem; margin: 1rem 0; }
.forecast-controls button { padding: .5rem .85rem; }
button:disabled { opacity: .55; cursor: default; }
.forecast-time { font-weight: 650; }
.forecast-slider { display: block; width: 100%; accent-color: #125b94; margin: .5rem 0 1rem; padding: 0; height: 2rem; cursor: pointer; }
.forecast-image-wrap { max-width: 640px; margin: auto; }
.forecast-image { display: block; width: 100%; height: auto; border: 1px solid #ccd7e2; border-radius: .5rem; }
[hidden] { display: none !important; }
.skewt-player { border-top: 1px solid #ccd7e2; padding-top: 2rem; }
.swatch.skewt-temperature { background: #c62828; }
.swatch.skewt-dewpoint { background: #2e7d32; }
.swatch.skewt-dry { background: #e2a86b; }
.swatch.skewt-moist { background: repeating-linear-gradient(to right, #5fa37a 0 4px, transparent 4px 7px); }
.skewt-chart { max-width: 34rem; margin: auto; background: white; border: 1px solid #d6e0e8; border-radius: .5rem; overflow: hidden; }
.skewt-chart svg { display: block; width: 100%; height: auto; }
.skewt-table-wrap { overflow-x: auto; }
.skewt-table { width: 100%; border-collapse: collapse; font-size: .9rem; font-variant-numeric: tabular-nums; }
.skewt-table th, .skewt-table td { padding: .35rem .5rem; text-align: right; border-bottom: 1px solid #e1e8ef; }
.skewt-status:empty { display: none; }
.welcome { padding: 2rem 0 3rem; max-width: 600px; }
footer { border-top: 1px solid #ccd7e2; margin-top: 3rem; padding-top: 1.25rem; color: #516274; font-size: .9rem; }

/* Fluid layouts and touch controls for iPhone, Android, and desktop. */
html { scroll-padding-top: calc(4rem + env(safe-area-inset-top)); }
main { padding-left: max(1rem, env(safe-area-inset-left)); padding-right: max(1rem, env(safe-area-inset-right)); padding-bottom: max(2rem, env(safe-area-inset-bottom)); }
main > *, article, .forecast-view { min-width: 0; }
input, select, button, summary { font-size: 1rem; min-height: 44px; }
button, summary, a, input[type="range"] { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
input[type="range"] { touch-action: pan-y; }
summary { padding: .65rem 0; }
details { margin: .75rem 0; }
.search-options { margin: .4rem 0; }
.search-options summary { color: #516274; font-weight: 400; }
.search-options select { width: 100%; max-width: 28rem; }
.section-links { position: sticky; top: 0; z-index: 10; display: flex; flex-wrap: nowrap; gap: .25rem; margin: .5rem 0 1.5rem; padding: .4rem 0; background: #f4f7fa; border-bottom: 1px solid #ccd7e2; }
.section-links a { display: flex; justify-content: center; align-items: center; min-height: 44px; padding: .5rem .65rem; flex: 1; color: #172c40; font-weight: 650; text-decoration: none; border-radius: .4rem; }
.section-links a:hover, .section-links a:focus-visible { background: #e2ebf3; }
section, h2 { scroll-margin-top: .5rem; }
h1, h2, h3, p, dd, output { overflow-wrap: anywhere; }
.chart-readout { min-height: 1.5rem; }
.chart-value-controls input { display: block; width: 100%; padding: 0; height: 44px; accent-color: #125b94; }
.chart-value-controls output { display: block; margin: .5rem 0; }
.chart-legend li { min-width: 0; }
.chart-legend span { flex-shrink: 0; }
.forecast-toolbar { max-width: 32rem; padding: .75rem; background: #f4f7fa; border: 1px solid #ccd7e2; border-radius: .5rem; margin: .5rem auto 0; }
.forecast-controls { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .5rem; margin: .5rem 0; }
.forecast-controls button { padding: .5rem .25rem; min-height: 48px; }
.forecast-time { display: block; text-align: center; font-size: 1rem; }
.forecast-slider { height: 44px; margin: 0; }
.forecast-slider::-webkit-slider-thumb { min-width: 24px; min-height: 24px; }
.forecast-slider::-moz-range-thumb { width: 24px; height: 24px; }
.forecast-image-wrap { display: flex; justify-content: center; }
.forecast-layer { width: 100%; margin-bottom: .5rem; }
.meps-heading { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .25rem 1rem; }
.meps-heading h2 { margin-bottom: .5rem; }
.forecast-scale-menu { position: relative; margin: 0 0 .75rem; }
.forecast-scale-menu > summary { display: inline-flex; align-items: center; min-height: 44px; padding: .35rem .8rem; border: 1px solid #8498ab; border-radius: 999px; background: white; font-weight: 600; font-size: .9rem; list-style: none; }
.forecast-scale-menu > summary::-webkit-details-marker { display: none; }
.forecast-scale-current { margin-left: .3em; }
.forecast-scale-menu > summary::after { content: "▾"; margin-left: .4rem; }
.forecast-scale-menu[open] > summary::after { content: "▴"; }
.forecast-scale { margin: .5rem 0 0; padding: .75rem; border: 1px solid #ccd7e2; border-radius: .5rem; background: white; min-width: 0; }
.forecast-scale label { display: flex; align-items: center; gap: .6rem; min-height: 44px; margin: 0; font-weight: 500; }
.forecast-scale input { min-height: 0; width: 1.15rem; height: 1.15rem; flex: none; accent-color: #125b94; }
.forecast-scale p { margin: .25rem 0 0; }
.forecast-download { margin: .75rem 0 1rem; padding: .75rem; border: 1px solid #ccd7e2; border-radius: .5rem; background: white; }
.forecast-download-title { min-height: 0; font-size: .9rem; margin: 0 0 .4rem; }
.forecast-download-progress { display: block; width: 100%; height: 1rem; accent-color: #125b94; }
.forecast-download-details { margin: .4rem 0 0; color: #516274; font-size: .9rem; font-variant-numeric: tabular-nums; }
.forecast-layer-title { text-align: center; font-weight: 650; font-size: .9rem; margin: 0 0 .25rem; }
.scalar-legend { margin: .5rem 0 1rem; }
.scalar-legend p { margin: .25rem 0; font-size: .9rem; }
.cloud-depth-legend span { display: inline-block; width: 1rem; height: 1rem; border-radius: .15rem; border: 1px solid #8498ab; }
.cloud-high-key { background: #f2f2f2; }
.cloud-medium-key { background: #a5a5a5; }
.cloud-low-key { background: #5c5c5c; }
.cloud-clear-key { background: #33413a; }
.forecast-image { width: auto; max-width: 100%; height: auto; max-height: min(680px, 58vh, calc(100vh - 19rem)); max-height: min(680px, 58svh, calc(100svh - 19rem)); object-fit: contain; background: #e3eef4; scroll-margin-top: .5rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
@media (max-width: 600px) {
    main { padding-top: max(1rem, env(safe-area-inset-top)); }
    header { margin-bottom: 1rem; padding-bottom: .75rem; }
    header p { display: none; }
    .search { flex-direction: column; }
    .search button { width: 100%; }
    .section-links { font-size: .9rem; margin-bottom: 1rem; padding-top: max(.4rem, env(safe-area-inset-top)); }
    .section-links a { padding: .4rem .2rem; }
    h1 { font-size: 1.75rem; }
    h2 span { display: block; margin: .15rem 0 0; }
    section { margin: 1.5rem 0; }
    .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
    article { padding: .75rem; }
    .value { font-size: 1.7rem; }
    .chart-legend { gap: .4rem 1rem; }
    .meps-player { margin-top: 2rem; padding-top: 1.5rem; }
    .load-forecast, .skewt-load { width: 100%; }
    .skewt-player { padding-top: 1.5rem; }
    .forecast-toolbar { padding-bottom: max(.5rem, env(safe-area-inset-bottom)); }
    footer { margin-top: 2rem; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* Search suggestions keep individual FMI stations distinct on phones and desktop. */
.station-search { position: relative; flex: 1; min-width: 0; }
.station-search > input:not([type="hidden"]) { display: block; width: 100%; }
.station-suggestions { position: absolute; z-index: 30; top: 100%; left: 0; right: 0; max-height: 20rem; overflow-y: auto; margin: .25rem 0 0; padding: .25rem; list-style: none; background: white; border: 1px solid #8498ab; border-radius: .4rem; box-shadow: 0 6px 16px #172c4020; }
.station-suggestions [role="option"] { display: flex; flex-direction: column; justify-content: center; min-height: 48px; padding: .5rem .65rem; border-radius: .25rem; cursor: pointer; overflow-wrap: anywhere; }
.station-suggestions [role="option"]:hover, .station-suggestions [aria-selected="true"] { background: #e2ebf3; }
.station-suggestions .station-detail { color: #516274; font-size: .8rem; }
.station-search-status { margin: .4rem 0; min-height: 1.25rem; }
.measured-station { margin: -.25rem 0 1rem; }

/* Optional observations stay in one closed panel until explicitly opened. */
.observed-weather { border: 1px solid #ccd7e2; border-radius: .5rem; background: white; margin: 2rem 0; }
.observed-weather > summary { padding: .85rem 1rem; }
.observed-content { padding: 0 1rem 1rem; }
.observed-tools { display: flex; align-items: end; flex-wrap: wrap; gap: .5rem; }
.observed-tools label { flex: 1; min-width: 10rem; }
.observed-layer { display: block; width: 100%; margin-top: .25rem; }
.observed-status:empty { display: none; }
.observed-legend { display: flex; flex-wrap: wrap; gap: .5rem 1rem; padding: 0; list-style: none; font-size: .85rem; }
.observed-legend li { display: flex; align-items: center; gap: .4rem; }
.observed-key { display: inline-block; width: .85rem; height: .85rem; flex-shrink: 0; border-radius: .15rem; }
.rain-light { background: #3aa84f; } .rain-moderate { background: #ebcd39; }
.rain-heavy { background: #d54139; } .rain-intense { background: #8941ab; }
.lightning-recent { background: #d4493d; } .lightning-middle { background: #df942f; } .lightning-older { background: #dfc33b; }
.observed-sources { padding-left: 1.25rem; overflow-wrap: anywhere; font-size: .85rem; }
.observed-sources li { margin: .5rem 0; }

.forecast-map-legend { display: block; width: 100%; max-width: 480px; height: auto; margin: .5rem auto 1rem; border-radius: .25rem; }
