/* SixColor Weather. Brand tokens from the SixColor customer brand kit. */
:root {
  color-scheme: light;
  /* the six (fixed in both themes; they ARE the brand) */
  --sc-magenta: #f3187b; --sc-orange: #fe9503; --sc-yellow: #fcd511;
  --sc-green: #8cc63f; --sc-blue: #25a0d9; --sc-purple: #93278e;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  /* light theme */
  --bg: #fafafd; --fg: #1a1a2e; --muted: #6a6a80; --muted2: #7a7a90;
  --card: #ffffff; --border: #e1e3ee; --hair: #eef0f6;
  --btn-bg: #1a1a2e; --btn-fg: #ffffff; --btn-hover: #25a0d9;
  --link: #1774a2; /* brand blue, darkened for AA text contrast on every light surface */
  --cloud: #d9dbe6; --cloud-edge: #7a7a90; --moon: #d7d1f5; --moon-edge: #93278e;
  --track: #eceef4;
  --alert-bg: #fff4e0; --alert-fg: #6b3d00; --alert-edge: #fe9503;
  --severe-bg: #fdecea; --severe-fg: #a4271f; --severe-edge: #e0483e;
  --shadow: 0 1px 2px rgba(26,26,46,.05), 0 8px 24px rgba(26,26,46,.06);
  --c-temp: #fe9503; --c-alt: #93278e; --c-wind: #25a0d9; --grid: #eef0f6;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #131320; --fg: #e9e9f2; --muted: #9a9ab2; --muted2: #8a8aa2;
    --card: #1d1d2b; --border: #2c2c3e; --hair: #262636;
    --btn-bg: #e9e9f2; --btn-fg: #131320; --btn-hover: #25a0d9;
    --link: #5bbbe6;
    --cloud: #4a4b63; --cloud-edge: #a3a4bd; --moon: #cfc8f0; --moon-edge: #b65bb1;
    --track: #2c2c3e;
    --alert-bg: #33260f; --alert-fg: #ffd08a; --alert-edge: #fe9503;
    --severe-bg: #3a1716; --severe-fg: #ffb3ad; --severe-edge: #e0483e;
    --shadow: none;
    --c-temp: #d47600; --c-alt: #a94aa4; --c-wind: #2596cc; --grid: #2a2a3b;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #131320; --fg: #e9e9f2; --muted: #9a9ab2; --muted2: #8a8aa2;
  --card: #1d1d2b; --border: #2c2c3e; --hair: #262636;
  --btn-bg: #e9e9f2; --btn-fg: #131320; --btn-hover: #25a0d9;
  --link: #5bbbe6;
  --cloud: #4a4b63; --cloud-edge: #a3a4bd; --moon: #cfc8f0; --moon-edge: #b65bb1;
  --track: #2c2c3e;
  --alert-bg: #33260f; --alert-fg: #ffd08a; --alert-edge: #fe9503;
  --severe-bg: #3a1716; --severe-fg: #ffb3ad; --severe-edge: #e0483e;
  --shadow: none;
  --c-temp: #d47600; --c-alt: #a94aa4; --c-wind: #2596cc; --grid: #2a2a3b;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 12px; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--fg);
  font: 16px/1.5 var(--sans); -webkit-font-smoothing: antialiased;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}
a { color: var(--link); text-underline-offset: 2px; }
a:hover { color: var(--sc-blue); }
:focus-visible { outline: 2px solid var(--sc-blue); outline-offset: 2px; border-radius: 4px; }
h1, h2 { margin: 0; line-height: 1.2; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.muted { color: var(--muted); }
.pre { white-space: pre-line; }

/* brand bar */
.bar {
  height: 6px; position: sticky; top: 0; z-index: 20;
  background: linear-gradient(90deg, var(--sc-magenta) 0 16.6%, var(--sc-orange) 0 33.3%, var(--sc-yellow) 0 50%,
    var(--sc-green) 0 66.6%, var(--sc-blue) 0 83.3%, var(--sc-purple) 0);
}
.loading { position: fixed; top: 6px; left: 0; height: 2px; width: 0; background: var(--sc-blue); z-index: 21; opacity: 0; }
.loading.htmx-request { opacity: 1; width: 80%; transition: width 2s ease-out; }

/* header */
.top {
  display: grid; grid-template-columns: 1fr auto; gap: 12px 12px; align-items: center;
  max-width: 1120px; margin: 0 auto; padding: 14px 16px 6px;
}
.wordmark { font-weight: 800; font-size: 22px; letter-spacing: -.4px; line-height: 1; color: var(--fg); text-decoration: none; }
.wordmark b {
  background: linear-gradient(90deg, var(--sc-magenta), var(--sc-orange), var(--sc-yellow), var(--sc-green), var(--sc-blue), var(--sc-purple));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.wordmark span { font-weight: 600; font-size: 15px; letter-spacing: 0; color: var(--muted); margin-left: 8px; }
.search { grid-column: 1 / -1; grid-row: 2; display: flex; gap: 8px; }
.search input {
  flex: 1; min-width: 0; height: 44px; padding: 0 14px; font: 500 17px var(--sans);
  font-variant-numeric: tabular-nums; letter-spacing: .04em;
  color: var(--fg); background: var(--card); border: 1px solid var(--border); border-radius: 10px;
}
.search input::placeholder { color: var(--muted2); letter-spacing: 0; }
.btn {
  height: 44px; padding: 0 20px; border: 0; border-radius: 10px; cursor: pointer;
  background: var(--btn-bg); color: var(--btn-fg); font: 600 15px var(--sans); transition: background .15s, color .15s;
}
.btn:hover { background: var(--btn-hover); color: #fff; }

.themer { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--border); border-radius: 22px; background: var(--card); }
.themer button {
  font: 12px/1 var(--mono); padding: 8px 10px; min-height: 32px; border: 0; border-radius: 18px;
  background: none; color: var(--muted); cursor: pointer;
}
.themer button:hover { color: var(--fg); }
.themer button[aria-pressed="true"] { background: var(--bg); color: var(--fg); font-weight: 600; }

/* layout */
main { max-width: 1120px; margin: 0 auto; padding: 8px 16px 16px; }
.grid { display: grid; gap: 14px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 16px; box-shadow: var(--shadow); min-width: 0; }
.label { font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }

/* hero / home */
.hero { padding: 28px 0 12px; max-width: 40rem; }
.hero h1 { font-size: 28px; font-weight: 800; letter-spacing: -.5px; margin-bottom: 8px; text-wrap: balance; }
.hero .label { margin-top: 24px; }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-block; font: 14px var(--mono); padding: 8px 14px; border: 1px solid var(--border);
  border-radius: 20px; background: var(--card); color: var(--fg); text-decoration: none;
}
.chip:hover { border-color: var(--sc-blue); color: var(--fg); }
.offline-note { max-width: 1120px; margin: 8px auto 0; padding: 8px 16px; font-size: 14px; color: var(--muted); }
.offline-note::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--sc-orange); margin-right: 8px; vertical-align: 1px; }
.alert-inline { background: var(--severe-bg); color: var(--severe-fg); border: 1px solid var(--severe-edge); border-radius: 8px; padding: 10px 14px; }

/* alerts */
.alert { background: var(--alert-bg); color: var(--alert-fg); border-left: 4px solid var(--alert-edge); border-radius: 10px; margin-bottom: 12px; padding: 0 14px; }
.alert.severe { background: var(--severe-bg); color: var(--severe-fg); border-left-color: var(--severe-edge); }
.alert summary { display: flex; gap: 10px; align-items: center; padding: 12px 0; cursor: pointer; list-style: none; }
.alert summary::-webkit-details-marker { display: none; }
.alert summary .ic { color: var(--alert-edge); flex: none; }
.alert.severe summary .ic { color: var(--severe-edge); }
.alert .muted { color: inherit; opacity: .8; }
.alert p { margin: 0 0 12px; font-size: 15px; }

/* now */
.place { font-size: 15px; font-weight: 600; color: var(--muted); }
.now-main { display: flex; align-items: center; gap: 14px; margin: 10px 0 14px; }
.ic-big { width: 84px; height: 84px; flex: none; }
.temp { font-size: 64px; font-weight: 800; letter-spacing: -2px; line-height: 1; font-variant-numeric: tabular-nums; }
.temp span { font-size: 22px; font-weight: 600; letter-spacing: 0; color: var(--muted); vertical-align: top; margin-left: 2px; }
.cond { font-size: 18px; font-weight: 600; margin-top: 4px; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 16px; margin: 0; padding-top: 12px; border-top: 1px solid var(--hair); }
.stats dt { font-size: 12px; color: var(--muted); }
.stats dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.src { font-size: 13px; margin: 14px 0 0; }
.note { font-size: 13px; color: var(--alert-fg); background: var(--alert-bg); border-radius: 8px; padding: 6px 10px; margin: 8px 0 0; }

/* hourly strip */
.hours {
  list-style: none; margin: 0 -16px; padding: 0 16px 4px; display: flex; gap: 6px;
  overflow-x: auto; scroll-snap-type: x proximity; overscroll-behavior-x: contain; scrollbar-width: thin;
}
.hours li {
  flex: 0 0 60px; scroll-snap-align: start; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 0; border-radius: 12px; background: var(--bg); font-variant-numeric: tabular-nums;
}
.hours li:first-child { background: var(--track); }
.h-time { font-size: 12px; color: var(--muted); white-space: nowrap; }
.h-temp { font-weight: 700; font-size: 17px; }
.h-pop { font-size: 12px; color: var(--link); display: inline-flex; align-items: center; gap: 1px; }
.h-pop .ic { width: 11px; height: 11px; }
.dim { color: var(--muted); } /* low-chance: muted, still AA */

/* daily */
.days { list-style: none; margin: 0; padding: 0; }
.days li + li { border-top: 1px solid var(--hair); }
.days summary {
  display: grid; grid-template-columns: 4.2em 28px 2.6em 2.4em 1fr 2.4em; align-items: center; gap: 8px;
  padding: 11px 0; cursor: pointer; list-style: none; font-variant-numeric: tabular-nums;
}
.days summary::-webkit-details-marker { display: none; }
.d-name { font-weight: 600; }
.d-pop { font-size: 13px; color: var(--link); text-align: right; }
.d-lo { color: var(--muted); text-align: right; }
.d-hi { font-weight: 700; }
.range { width: 100%; height: 6px; display: block; }
.range-track { fill: var(--track); }
.range-fill { fill: var(--sc-orange); }
.days details[open] summary { padding-bottom: 4px; }
.days details p { margin: 0 0 10px; font-size: 14px; }
.d-short { font-weight: 600; }

.ic { width: 24px; height: 24px; display: block; }

/* charts (server-rendered SVG) */
.fig { margin: 0 0 18px; }
.fig figcaption { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; font-size: 13px; margin-bottom: 4px; }
.fig-t { font-weight: 700; font-size: 14px; }
.legend { display: inline-flex; gap: 12px; margin-left: auto; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.key { display: inline-block; width: 16px; height: 0; border-top: 2px solid; }
.k-temp { border-color: var(--c-temp); }
.k-feels, .k-gust { border-color: var(--c-alt); border-top-style: dashed; }
.k-wind { border-color: var(--c-wind); }
.chart { display: block; width: 100%; height: auto; overflow: visible; font: 17px var(--sans); }
@media (min-width: 640px) { .chart { font-size: 12px; } }
.chart .grid line { stroke: var(--grid); stroke-width: 1; }
.chart .tick text { fill: var(--muted); font-variant-numeric: tabular-nums; }
.chart .val { fill: var(--fg); font-weight: 700; font-variant-numeric: tabular-nums; }
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { stroke: none; opacity: .1; }
.s-temp { stroke: var(--c-temp); } .area.s-temp { fill: var(--c-temp); } .dot.s-temp { fill: var(--c-temp); }
.s-wind { stroke: var(--c-wind); } .dot.s-wind { fill: var(--c-wind); }
.s-feels, .s-gust { stroke: var(--c-alt); stroke-dasharray: 5 4; }
.chart .dot { stroke: var(--card); stroke-width: 2; }
.chart .bar { fill: var(--c-wind); }
.chart .hits rect { fill: transparent; }
.chart .hits line { stroke: var(--muted); stroke-width: 1; opacity: 0; }
.chart .hits g:hover line { opacity: .6; }
.tablev summary { cursor: pointer; font-size: 14px; color: var(--link); padding: 4px 0; }
.tablewrap { overflow-x: auto; margin-top: 8px; }
.tablev table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tablev th, .tablev td { text-align: right; padding: 6px 8px; border-bottom: 1px solid var(--hair); }
.tablev th:first-child { text-align: left; font-weight: 600; }
.tablev thead th { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted2); }
.d-extra { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--muted); }
.aqi { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: 0; box-shadow: 0 0 0 1px var(--border); }
.aqi-good { background: #00e400; } .aqi-moderate { background: #ffff00; } .aqi-usg { background: #ff7e00; }
.aqi-unhealthy { background: #ff0000; } .aqi-very { background: #8f3f97; } .aqi-hazardous { background: #7e0023; }

/* column wrappers: flattened on mobile, real columns on desktop */
.col { display: contents; }
#now { order: 1; } #hourly { order: 2; } #daily { order: 3; } #trends { order: 4; }

/* map page */
.mapwrap { display: grid; gap: 12px; }
.map { height: calc(100dvh - 300px); min-height: 340px; max-height: 620px; border-radius: 16px; border: 1px solid var(--border); overflow: hidden; background: var(--track); z-index: 0; }
.map-nojs { padding: 24px; }
.leaflet-container { font: 13px var(--sans); }
.leaflet-control-attribution { font-size: 10px; }
.mapctl { display: grid; gap: 14px; align-content: start; min-width: 0; }
.mapctl > * { min-width: 0; }
.radar-ctl { display: flex; align-items: center; gap: 10px; }
.radar-ctl.off { opacity: .45; }
.radar-ctl input[type=range] { flex: 1; min-width: 0; accent-color: var(--sc-blue); }
.ftime { display: block; font: 13px var(--mono); color: var(--muted); margin-top: -8px; font-variant-numeric: tabular-nums; }
.basemap { filter: saturate(.55) brightness(1.03); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .basemap { filter: invert(1) hue-rotate(180deg) brightness(.82) contrast(.9) saturate(.35); } }
:root[data-theme="dark"] .basemap { filter: invert(1) hue-rotate(180deg) brightness(.82) contrast(.9) saturate(.35); }
.btn-sm { height: 36px; padding: 0 14px; font-size: 14px; min-width: 72px; }
.layers { border: 0; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; }
.layers legend { padding: 0; }
.layers label { display: flex; align-items: center; gap: 8px; font-size: 14px; min-height: 32px; cursor: pointer; }
.layers input { width: 18px; height: 18px; accent-color: var(--sc-blue); }
.opacity { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.opacity input { flex: 1; min-width: 0; accent-color: var(--sc-blue); }
.legends { display: grid; gap: 12px; }
.lg-t { font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.lg-t .muted { font-weight: 400; }
.lg-bar { height: 10px; border-radius: 5px; box-shadow: inset 0 0 0 1px var(--border); }
.lg-ticks { display: flex; justify-content: space-between; font: 11px var(--sans); color: var(--muted); margin-top: 3px; font-variant-numeric: tabular-nums; }
.lg-note { font-size: 12px; margin: 4px 0 0; }
.lg-radar { background: linear-gradient(90deg, #04e9e7, #019ff4 10%, #0300f4 18%, #02fd02 27%, #01c501 34%, #008e00 41%, #fdf802 50%, #e5bc00 57%, #fd9500 64%, #fd0000 72%, #d40000 79%, #bc0000 86%, #f800fd 93%, #9854c6); }
.lg-temp { background: linear-gradient(90deg, #ff94ff, #9900ff 16.7%, #0808ff 25%, #3b86ff 33.3%, #08fffb 41.7%, #30ff87 50%, #1aff00 58.3%, #a1ff00 66.7%, #fffb00 75%, #ffbb00 83.3%, #fa7d00 91.7%, #b84000); }
.lg-rain { background: linear-gradient(90deg, #14c8fa 0 7%, #3d85c6 7% 14%, #001432 14% 21%, #00fa14 21% 28%, #00a00f 28% 35%, #00640a 35% 42%, #fafa00 42% 49%, #ffd966 49% 56%, #fa9600 56% 63%, #fa0000 63% 70%, #af0000 70% 77%, #7d0000 77% 84%, #fa00fa 84% 90%, #7d4be1 90% 95%, #dcdcdc 95%); }
.lg-snow { background: linear-gradient(90deg, #abc1bf 0 9%, #66c1c4 9% 18%, #63a9cb 18% 27%, #5079c8 27% 36%, #3c3fc2 36% 45%, #5720c3 45% 54%, #7d01bb 54% 63%, #b404b1 63% 72%, #a91377 72% 81%, #992b50 81% 90%, #8b4545 90%); }
.lg-wind { background: linear-gradient(90deg, rgba(214,238,249,.2), #d6eef9 10%, #9bd3ee 20%, #5bbbe6 30%, #25a0d9 50%, #1b7fb0 70%, #135d82); }
.map-src { font-size: 12px; margin: 0; }
@media (min-width: 1024px) {
  .is-map main { max-width: none; padding: 8px 24px 16px; }
  .is-map .top, .is-map .tabs { max-width: none; padding-left: 24px; padding-right: 24px; }
  .mapwrap { grid-template-columns: minmax(0, 1fr) 320px; }
  .map { height: calc(100vh - 170px); max-height: none; }
  .is-map .foot { display: none; }
}

/* footer + tabs */
.foot { max-width: 1120px; margin: 0 auto; padding: 8px 16px 24px; font-size: 13px; color: var(--muted); }
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; display: grid; grid-template-columns: repeat(4, 1fr);
  background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom);
}
.tabs a {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 10px; min-height: 56px;
  font-size: 11px; font-weight: 600; color: var(--muted); text-decoration: none;
}
.tabs a:hover, .tabs a[aria-current="page"] { color: var(--link); }

/* tablet+ */
@media (min-width: 640px) {
  .top { grid-template-columns: auto 1fr auto; padding-top: 18px; }
  .search { grid-column: 2; grid-row: 1; max-width: 360px; justify-self: center; width: 100%; }
  .stats { grid-template-columns: repeat(3, 1fr); }
}
/* desktop */
@media (min-width: 1024px) {
  body { padding-bottom: 0; display: flex; flex-direction: column; }
  .bar { order: 0; } .top { order: 1; } .tabs { order: 2; } .offline-note { order: 3; } main { order: 3; } .foot { order: 4; }
  .top, main, .foot { width: 100%; }
  .tabs { position: static; width: 100%; max-width: 1120px; margin: 4px auto 6px; border: 0; background: none; backdrop-filter: none; display: flex; gap: 8px; padding: 0 16px; }
  .tabs a { flex-direction: row; gap: 6px; min-height: 0; padding: 8px 14px; border: 1px solid var(--border); border-radius: 20px; font-size: 13px; }
  .tabs .ic { width: 16px; height: 16px; }
  .grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .col { display: grid; gap: 14px; min-width: 0; }
  .temp { font-size: 80px; }
  .ic-big { width: 104px; height: 104px; }
  .hours li { flex-basis: 64px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
