/* /weather/ page + the small homepage card (.wxm) — builds on styles.css tokens and economy.css bits (.econ-hero, .ec-faq, .mk-live) */
:root { --wx-cloud: #E6ECF5; --wx-cloud-s: #B7C3D6; --wx-moon: #C9D3E6; }
:root[data-theme="dark"] { --wx-cloud: #A9B7CE; --wx-cloud-s: #6F7F9A; }
.wx .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wx-wrap { padding-bottom: 30px; }
.wx-sec { padding-block: 10px; }
.wx-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 16px 18px; min-width: 0; box-shadow: var(--shadow); margin-top: 14px; }
.wx-card h2 { margin: 0 0 10px; font-size: 1.1rem; font-weight: 800; }
.wx-fine { margin: 6px 0 0; font-size: .76rem; color: var(--text-mute); line-height: 1.75; }
.wx-src { max-width: 980px; }
.wx-note { margin: 0; color: var(--text-dim); }
.wx-hero-sub { color: var(--text-dim); }
.wx h1 { margin: 6px 0 4px; font-size: clamp(1.4rem, 3.2vw, 2.2rem); font-weight: 800; line-height: 1.35; }

/* picker row */
.wx-picker { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 14px; }
.wx-sel select {
  font: inherit; font-size: .95rem; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: 99px; padding: 8px 16px; min-width: 190px; max-width: 100%; cursor: pointer;
}
.wx-btn {
  display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: .85rem; font-weight: 700; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 99px; padding: 8px 14px; transition: background .2s;
}
.wx-btn:hover { background: var(--surface-2); }
.wx-btn svg { width: 16px; height: 16px; }
.wx-btn.on { background: var(--green); color: #1B1E15; border-color: transparent; }
.wx-picker .econ-status { margin-inline-start: auto; }
.wx-msg { margin: 10px 0 0; font-size: .86rem; font-weight: 600; color: var(--accent); }
.wx-msg a { color: inherit; text-decoration: underline; }

/* now + air quality */
.wx-now-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 14px; }
.wx-now-top { display: flex; align-items: center; gap: 14px; }
.wx-now-ico .wx-ico { width: 96px; height: 96px; }
.wx-temp { font-size: clamp(2.6rem, 6vw, 3.6rem); font-weight: 800; line-height: 1.05; direction: ltr; unicode-bidi: isolate; }
.wx-cond { font-size: 1.1rem; font-weight: 700; color: var(--text-dim); }
.wx-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 14px; margin: 14px 0 0; }
.wx-facts div { background: var(--inset); border-radius: var(--r-sm); padding: 8px 10px; }
.wx-facts dt { font-size: .74rem; color: var(--text-mute); }
.wx-facts dd { margin: 2px 0 0; font-weight: 800; font-size: 1rem; }
.wx-facts small { font-weight: 600; color: var(--text-mute); font-size: .7rem; }
.wx-local { margin: 10px 0 0; font-size: .78rem; color: var(--text-mute); }

.wx-gauge { max-width: 270px; margin: 4px auto 0; text-align: center; }
.wx-gauge-svg { display: block; width: 100%; height: auto; direction: ltr; }
.wx-needle { transform-origin: 60px 62px; transform: rotate(var(--a)); animation: wx-needle 1.3s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes wx-needle { from { transform: rotate(0deg); } }
.wx-gauge-val b { display: block; font-size: 2.3rem; line-height: 1; font-weight: 800; color: var(--aq); }
.wx-gauge-val span { font-weight: 700; font-size: .95rem; }
.wx-adv { margin: 12px 0 0; padding: 10px 12px; border-radius: var(--r-sm); background: var(--inset); border-inline-start: 4px solid var(--aq, var(--border)); font-size: .9rem; line-height: 1.8; }
.wx-aq .wx-adv { border-inline-start-color: var(--aq); }
.wx-pm { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 12px 0 0; }
.wx-pm div { background: var(--inset); border-radius: var(--r-sm); padding: 8px 10px; text-align: center; }
.wx-pm dt { font-size: .72rem; color: var(--text-mute); }
.wx-pm dd { margin: 2px 0 0; font-weight: 800; }
.wx-pm small { display: block; font-weight: 600; color: var(--text-mute); font-size: .66rem; }

/* dust banner */
.wx-dustbar { display: flex; gap: 12px; align-items: flex-start; margin-top: 14px; padding: 12px 14px; border-radius: var(--r); border: 1px solid; }
.wx-dustbar svg { width: 30px; height: 30px; flex: none; margin-top: 2px; animation: wx-gust 3s ease-in-out infinite alternate; }
.wx-dustbar p { margin: 3px 0 0; font-size: .9rem; line-height: 1.8; color: var(--text); }
.wx-dustbar.lvl1 { background: rgba(227, 160, 8, .12); border-color: rgba(227, 160, 8, .5); color: #A66F00; }
.wx-dustbar.lvl2 { background: rgba(224, 56, 43, .12); border-color: rgba(224, 56, 43, .55); color: #C42B1F; }
:root[data-theme="dark"] .wx-dustbar.lvl1 { color: #F2B632; } :root[data-theme="dark"] .wx-dustbar.lvl2 { color: #FF6B5E; }
@keyframes wx-gust { from { transform: translateX(-3px); } to { transform: translateX(3px); } }

/* 24 h strip */
.wx-hours { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x proximity; scrollbar-width: thin; }
.wx-h { flex: 0 0 66px; scroll-snap-align: start; display: grid; justify-items: center; gap: 2px; padding: 8px 4px; border-radius: var(--r); background: var(--inset); }
.wx-h.now { background: var(--chip-fill); border: 1px solid var(--chip-border); }
.wx-h .wx-ico { width: 38px; height: 38px; }
.wx-h-t { font-size: .74rem; color: var(--text-mute); font-weight: 600; }
.wx-h b { font-size: .95rem; direction: ltr; }
.wx-h-r { font-size: .7rem; color: #3B82D6; font-weight: 700; min-height: 1em; }

/* AQI next 24 h */
.wx-bars { display: flex; align-items: flex-end; gap: 3px; height: 110px; margin-bottom: 20px; direction: ltr; }
.wx-bar { position: relative; flex: 1; height: 100%; display: flex; align-items: flex-end; }
.wx-bar i { display: block; width: 100%; height: var(--h); background: var(--aq); border-radius: 4px 4px 0 0; transform-origin: bottom; animation: wx-grow .9s cubic-bezier(.2, .8, .2, 1) both; }
.wx-bar span { position: absolute; bottom: -17px; inset-inline: -4px; text-align: center; font-size: .66rem; color: var(--text-mute); }
@keyframes wx-grow { from { transform: scaleY(0); } }

/* 7 days */
.wx-days { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.wx-days li { display: grid; grid-template-columns: minmax(78px, 1.1fr) 40px minmax(0, 1.3fr) 40px 38px minmax(60px, 1.5fr) 38px; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border-soft); }
.wx-days li:last-child { border-bottom: 0; }
.wx-days .wx-ico { width: 36px; height: 36px; }
.wx-d-n b { display: block; font-size: .92rem; } .wx-d-n small { color: var(--text-mute); font-size: .72rem; }
.wx-d-c { font-size: .85rem; color: var(--text-dim); }
.wx-d-r { font-size: .74rem; color: #3B82D6; font-weight: 700; text-align: center; }
.wx-d-lo, .wx-d-hi { font-weight: 800; font-size: .92rem; direction: ltr; }
.wx-d-lo { text-align: end; color: var(--text-dim); font-weight: 600; } .wx-d-hi { text-align: start; }
.wx-range { position: relative; height: 7px; border-radius: 99px; background: var(--inset); }
.wx-range i { position: absolute; top: 0; bottom: 0; border-radius: 99px; background: linear-gradient(90deg, #5AA9F0, #F2B632, #E8573B); inset-inline-start: 0; }
:root[dir="rtl"] .wx-range i, [dir="rtl"] .wx-range i { background: linear-gradient(270deg, #5AA9F0, #F2B632, #E8573B); }

/* overview */
.wx-ov-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.wx-rank { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
.wx-rank a { display: grid; grid-template-columns: minmax(104px, 1.4fr) minmax(30px, 1fr) auto; align-items: center; gap: 10px; padding: 6px 4px; border-radius: var(--r-sm); text-decoration: none; color: inherit; }
.wx-rank a:hover { background: var(--inset); }
.wx-rank small { grid-column: 1 / -1; color: var(--text-mute); font-size: .72rem; margin-top: -4px; }
.wx-rank-n { font-weight: 700; white-space: nowrap; }
.wx-rank-bar { height: 8px; border-radius: 99px; background: var(--inset); overflow: hidden; direction: ltr; }
.wx-rank-bar i { display: block; height: 100%; width: var(--w); background: var(--aq); border-radius: 99px; animation: wx-barw 1s cubic-bezier(.2, .8, .2, 1) both; transform-origin: left; }
@keyframes wx-barw { from { transform: scaleX(0); } }
.wx-dustlist { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.wx-dustlist a { display: flex; justify-content: space-between; gap: 10px; padding: 8px 12px; border-radius: var(--r-sm); text-decoration: none; color: inherit; border-inline-start: 4px solid; }
.wx-dustlist .lvl1 a { background: rgba(227, 160, 8, .1); border-color: #E3A008; } .wx-dustlist .lvl2 a { background: rgba(224, 56, 43, .1); border-color: #E0382B; }
.wx-dustlist span { font-size: .84rem; color: var(--text-dim); } .wx-dustlist small { color: var(--text-mute); }

.wx-cities { display: grid; grid-template-columns: repeat(auto-fill, minmax(235px, 1fr)); gap: 8px; }
.wx-city { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--border-soft); text-decoration: none; color: inherit; transition: transform .2s, border-color .2s; }
.wx-city:hover { transform: translateY(-2px); border-color: var(--green); }
.wx-city.on { border-color: var(--green); background: var(--chip-fill); }
.wx-city-i .wx-ico { width: 38px; height: 38px; display: block; }
.wx-city-n { flex: 1; min-width: 0; display: grid; }
.wx-city-n b { font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .wx-city-n small { color: var(--text-mute); font-size: .72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wx-city-t { font-weight: 800; direction: ltr; }
.wx-mine .wx-city { max-width: 460px; }

/* AQI chip */
.aq-chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-weight: 800; font-size: .8rem; white-space: nowrap;
  background: color-mix(in srgb, var(--aq, #8C9179) 16%, transparent); border: 1px solid color-mix(in srgb, var(--aq, #8C9179) 45%, transparent); }
.aq-chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--aq); }
.aq-na { color: var(--text-mute); }

/* icons (inline SVG, animated with CSS only) */
.wx-ico { display: block; width: 48px; height: 48px; overflow: visible; }
.wx-cloud { fill: var(--wx-cloud); stroke: var(--wx-cloud-s); stroke-width: 1.2; }
.wx-moon { fill: var(--wx-moon); }
.wx-rays { transform-origin: 32px 32px; animation: wx-spin 26s linear infinite; }
.wx-sun circle { animation: wx-pulse 3.6s ease-in-out infinite alternate; transform-origin: 32px 32px; }
.wx-drift { animation: wx-drift 7s ease-in-out infinite alternate; }
.wx-drop { animation: wx-fall 1s linear infinite; opacity: 0; }
.wx-drop-s { animation-duration: 1.5s; opacity: 0; } .wx-drop-f { animation-duration: .65s; }
.wx-flake { animation: wx-snow 2.4s linear infinite; opacity: 0; }
.wx-bolt { animation: wx-flash 2.6s linear infinite; }
.wx-fogl { animation: wx-fog 4.5s ease-in-out infinite alternate; }
@keyframes wx-spin { to { transform: rotate(360deg); } }
@keyframes wx-pulse { to { transform: scale(1.08); } }
@keyframes wx-drift { from { transform: translateX(-2px); } to { transform: translateX(3px); } }
@keyframes wx-fall { 0% { transform: translate(0, -5px); opacity: 0; } 25% { opacity: 1; } 100% { transform: translate(-3px, 6px); opacity: 0; } }
@keyframes wx-snow { 0% { transform: translate(0, -6px); opacity: 0; } 25% { opacity: 1; } 100% { transform: translate(3px, 6px); opacity: 0; } }
@keyframes wx-flash { 0%, 55%, 100% { opacity: 1; } 60% { opacity: .15; } 65% { opacity: 1; } 70% { opacity: .3; } }
@keyframes wx-fog { from { transform: translateX(-3px); } to { transform: translateX(3px); } }

/* homepage / "my city" mini card */
.wxm { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--border); color: inherit; text-decoration: none; }
.wxm:hover { border-color: var(--green); }
.wxm-ico .wx-ico { width: 44px; height: 44px; }
.wxm-t { font-size: 1.7rem; font-weight: 800; direction: ltr; }
.wxm-n { flex: 1; min-width: 0; display: grid; } .wxm-n small { color: var(--text-mute); font-size: .75rem; }
.wxm-aq { display: grid; justify-items: center; gap: 2px; } .wxm-aq small { color: var(--text-mute); font-size: .66rem; font-weight: 700; }

@media (max-width: 960px) {
  .wx-now-grid, .wx-ov-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .wx-picker .econ-status { margin-inline-start: 0; flex-basis: 100%; }
  .wx-sel { flex: 1 1 100%; } .wx-sel select { width: 100%; }
  .wx-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wx-now-ico .wx-ico { width: 78px; height: 78px; }
  .wx-days li { grid-template-columns: minmax(70px, 1.2fr) 36px 34px 1fr 34px; }
  .wx-d-c, .wx-d-r { display: none; }
  .wx-bars { gap: 2px; }
  .wx-rank small { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .wx-rays, .wx-sun circle, .wx-drift, .wx-drop, .wx-flake, .wx-bolt, .wx-fogl, .wx-needle, .wx-bar i, .wx-rank-bar i, .wx-dustbar svg { animation: none !important; }
  .wx-drop, .wx-flake { opacity: 1; }
}
