@import url("https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@400;500;600;700;800&display=swap");

:root {
  color-scheme: light;
  --ink: #172822;
  --muted: #65736c;
  --soft: #87938d;
  --line: #e0e7e1;
  --canvas: #f5f7f4;
  --paper: #fff;
  --green: #34765a;
  --green-dark: #24583f;
  --green-soft: #eaf2eb;
  --amber: #ab6c25;
  --rose: #bc5b4d;
  --blue: #5576a7;
  --shadow: 0 12px 36px rgb(36 57 44 / 6%);
  font-family: "DM Sans", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); }
button, select { font: inherit; }
button { color: inherit; }
.app-shell { max-width: 1540px; margin: auto; padding: 0 58px; }
.topbar { height: 74px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); font-family: Manrope, sans-serif; font-size: 16px; font-weight: 800; letter-spacing: -.7px; text-decoration: none; }
.brand-slash { padding: 0 1px; color: #84a08e; }
.brand-mark { width: 24px; height: 24px; display: flex; align-items: end; justify-content: center; gap: 2px; padding: 4px; border: 1px solid #c8d8cc; border-radius: 8px; background: #edf3ed; }
.brand-mark span { width: 3px; border-radius: 3px; background: var(--green); }
.brand-mark span:nth-child(1) { height: 7px; opacity: .5; }
.brand-mark span:nth-child(2) { height: 12px; opacity: .75; }
.brand-mark span:nth-child(3) { height: 16px; }
.topbar-meta { display: flex; align-items: center; gap: 23px; }
.live-indicator, .eyebrow, .mode-kicker { color: var(--soft); font-family: "DM Mono", monospace; font-size: 9px; letter-spacing: 1.05px; }
.live-indicator { display: inline-flex; align-items: flex-start; gap: 8px; color: #527262; }
.live-indicator > span:first-child, .coverage-dot, .footer-dot { width: 7px; height: 7px; display: inline-block; border-radius: 50%; background: #57966d; }
.live-indicator > span:first-child { box-shadow: 0 0 0 3px #dcebe0; }
.topbar-status { display: grid; gap: 4px; line-height: 1.15; }
.topbar-status > span { color: #87958c; font-size: 9px; letter-spacing: .5px; }
.icon-button { display: inline-flex; align-items: center; gap: 7px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 7px; background: var(--paper); color: #52645a; cursor: pointer; font-size: 11px; }
.icon-button:hover, .map-reset:hover { border-color: #a8bdad; color: var(--green-dark); }
.icon-button svg, .map-reset svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.4; }

.intro { display: grid; grid-template-columns: minmax(0,1.25fr) minmax(280px,.75fr); align-items: center; gap: clamp(30px,6vw,100px); padding: 40px 0 28px; }
.eyebrow { margin: 0 0 9px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-family: Manrope, sans-serif; font-size: clamp(36px, 4.4vw, 48px); font-weight: 700; letter-spacing: -3.1px; line-height: 1.02; }
h1 span { color: var(--green); }
.intro-copy { max-width: 400px; }
.intro-copy p { margin-bottom: 13px; color: #66746d; font-size: 13px; line-height: 1.7; }
.updated-label { color: #77847d; font-family: "DM Mono", monospace; font-size: 9px; }

.notice { position: relative; display: grid; grid-template-columns: 31px minmax(0,1fr) 25px; gap: 14px; padding: 18px 19px; border: 1px solid #dce8dc; border-radius: 10px; background: #eef4ed; }
.notice[hidden], .notice-reopen[hidden] { display: none; }
.notice-icon { width: 24px; height: 24px; display: grid; place-items: center; border: 1px solid #ccddcf; border-radius: 50%; color: var(--green-dark); font-family: Georgia, serif; font-size: 14px; font-style: italic; }
.notice-body h2 { margin: 1px 0 6px; font-family: Manrope, sans-serif; font-size: 13px; font-weight: 700; }
.notice-body p { margin-bottom: 5px; color: #52675a; font-size: 11px; line-height: 1.65; }
.notice-body p:last-child { margin-bottom: 0; }
.notice-body strong { color: #294c37; }
.notice-more { margin-top: 7px; color: var(--green-dark); font-size: 10px; }
.notice-more summary { width: fit-content; cursor: pointer; font-weight: 600; }
.notice-more p { margin: 7px 0 0; max-width: 1000px; }
.notice-dismiss { width: 26px; height: 26px; border: 0; border-radius: 50%; background: transparent; color: #718076; cursor: pointer; font-size: 21px; line-height: 1; }
.notice-dismiss:hover { background: #e1ebe1; }
.notice-reopen { display: block; margin: 9px 0 0 auto; padding: 5px 0; border: 0; background: transparent; color: #548067; cursor: pointer; font-size: 11px; font-weight: 600; }
.notice-reopen:hover { color: #274c37; text-decoration: underline; text-underline-offset: 3px; }

.dashboard { display: grid; grid-template-columns: minmax(0,1fr) 296px; align-items: start; gap: 20px; margin-top: 30px; }
.main-column { min-width: 0; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 14px; }
.section-heading h2, .inspector-header h2 { margin: 0; font-family: Manrope, sans-serif; font-size: 18px; font-weight: 700; letter-spacing: -.55px; }
.section-heading .eyebrow { margin-bottom: 5px; }
.mode-panel { display: grid; gap: 11px; padding: 12px 13px; border: 1px solid var(--line); border-bottom: 0; border-radius: 9px 9px 0 0; background: #fbfcfa; }
.mode-panel-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.mode-copy { display: grid; gap: 4px; min-width: 165px; }
.mode-kicker { font-size: 8px; }
.mode-description { color: #77847d; font-size: 10px; }
.mode-switch { display: inline-flex; gap: 3px; padding: 3px; border: 1px solid #e5eae5; border-radius: 7px; background: #f2f5f1; }
.mode-button { padding: 7px 10px; border: 0; border-radius: 5px; background: transparent; color: #718078; cursor: pointer; font-size: 10px; font-weight: 600; }
.mode-button.active { background: #fff; color: var(--green-dark); box-shadow: 0 1px 4px rgb(26 44 32 / 12%); }
.step-select-wrap { display: flex; align-items: center; gap: 7px; color: #78857d; font-size: 10px; }
.step-select-wrap select { max-width: 285px; padding: 7px 23px 7px 9px; border: 1px solid #dfe7df; border-radius: 6px; background: white; color: #42564a; font-size: 10px; }
.aqi-options { display: flex; align-items: center; gap: 10px; padding-top: 10px; border-top: 1px solid #e7ece7; color: #78857d; font-size: 10px; }
.aqi-options[hidden] { display: none; }
.aqi-options-label { color: #87938d; font-family: "DM Mono", monospace; font-size: 9px; letter-spacing: .8px; }
.select-field { display: inline-flex; align-items: center; gap: 7px; }
.select-field select { padding: 7px 23px 7px 9px; border: 1px solid #dfe7df; border-radius: 6px; background: white; color: #42564a; font-size: 10px; }

.map-card { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: 0 0 9px 9px; background: white; box-shadow: var(--shadow); }
.map-tools { position: absolute; z-index: 500; display: flex; align-items: start; justify-content: space-between; gap: 10px; width: calc(100% - 30px); margin: 13px 15px 0; pointer-events: none; }
.map-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; max-width: calc(100% - 90px); pointer-events: auto; }
.map-actions { display: flex; align-items: center; gap: 6px; pointer-events: auto; }
.map-style-control { display: inline-flex; align-items: center; gap: 6px; padding: 5px 7px 5px 9px; border: 1px solid #dfe6df; border-radius: 6px; background: rgb(255 255 255 / 94%); color: #53645a; font-size: 9px; }
.map-style-control select { padding: 2px 17px 2px 3px; border: 0; background: transparent; color: #53645a; cursor: pointer; font-size: 9px; }
.map-style-control select:focus-visible { outline: 2px solid #9bb9a2; outline-offset: 2px; }
.legend-chip { display: inline-flex; align-items: center; gap: 7px; padding: 7px 9px; border: 1px solid rgb(220 228 220 / 90%); border-radius: 6px; background: rgb(255 255 255 / 94%); color: #506056; box-shadow: 0 2px 7px rgb(31 49 36 / 6%); font-size: 9px; }
.legend-swatch { width: 17px; height: 17px; display: grid; place-items: center; border-radius: 50%; color: white; font-size: 8px; font-weight: 700; }
.map-reset { display: inline-flex; align-items: center; gap: 4px; padding: 7px 9px; border: 1px solid #dfe6df; border-radius: 6px; background: rgb(255 255 255 / 94%); color: #53645a; cursor: pointer; font-size: 9px; pointer-events: auto; }
#map { height: 450px; width: 100%; background: #e7eee7; }
.muted-map-tiles { filter: grayscale(.82) saturate(.55) brightness(1.04); }
.map-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 13px; color: #8a948e; font-family: "DM Mono", monospace; font-size: 8px; }
.map-footer > span:first-child { display: flex; align-items: center; gap: 6px; }
.footer-dot { width: 5px; height: 5px; background: #87988b; }
.measure-legend { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 7px; color: #66746d; }
.measure-chip { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.measure-swatch { width: 9px; height: 9px; border-radius: 50%; }
.leaflet-container { font: 11px "DM Sans", sans-serif; }
.leaflet-control-attribution { font-size: 8px !important; }
.sensor-marker { position: relative; display: grid; place-items: center; border: 2px solid rgb(255 255 255 / 95%); border-radius: 50%; background: var(--marker-color); color: #fff; box-shadow: 0 2px 7px rgb(19 37 26 / 30%); font-family: "DM Mono", monospace; font-size: 10px; font-weight: 500; }
.marker-value { line-height: 1; }
.marker-source { position: absolute; top: -4px; right: -4px; width: 13px; height: 13px; display: grid; place-items: center; border: 1px solid white; border-radius: 50%; background: #304238; color: white; font-family: "DM Sans", sans-serif; font-size: 7px; font-weight: 700; line-height: 1; }
.sensor-marker.uncorrected { border-style: dashed; }
.sensor-marker.anomaly, .sensor-marker.stale { border-style: dotted; border-width: 3px; opacity: .68; }
.leaflet-popup-content-wrapper { border-radius: 9px; box-shadow: 0 5px 20px rgb(20 35 25 / 15%); }
.leaflet-popup-content { min-width: 200px; margin: 12px 14px; }
.popup-title { margin-bottom: 3px; color: #25352b; font-weight: 700; }
.popup-anomaly { display: grid; gap: 4px; margin-bottom: 10px; padding: 8px 9px; border-left: 3px solid #c46b3d; border-radius: 4px; background: #fff3eb; color: #7a4b35; font-size: 10px; line-height: 1.45; }
.popup-anomaly strong { color: #9b4f2d; font-size: 10px; }
.popup-stale { display: grid; gap: 4px; margin-bottom: 10px; padding: 8px 9px; border-left: 3px solid #a89055; border-radius: 4px; background: #faf6e8; color: #75683e; font-size: 10px; line-height: 1.45; }
.popup-stale strong { color: #806f35; font-size: 10px; }
.popup-subtitle { margin-bottom: 10px; color: #849087; font-size: 9px; }
.popup-reading { display: flex; align-items: baseline; justify-content: space-between; padding: 7px 0 8px; border-top: 1px solid #edf0ed; color: #78847c; font-size: 10px; }
.popup-reading strong { color: #2d4435; font-family: Manrope, sans-serif; font-size: 17px; }
.popup-reading small { font-size: 9px; font-weight: 400; }
.popup-detail { color: #65736a; font-size: 9px; line-height: 1.6; }
.popup-link { display: inline-block; margin-top: 7px; color: #34765a; font-size: 9px; font-weight: 600; }
.popup-attribution { margin-top: 8px; padding-top: 7px; border-top: 1px solid #edf0ed; color: #7a877f; font-size: 9px; line-height: 1.45; }
.popup-attribution a { color: #548067; text-underline-offset: 2px; }

.source-list-section { margin-top: 26px; }
.source-disclosure { border-top: 1px solid var(--line); }
.source-summary { display: flex; align-items: center; justify-content: space-between; padding: 13px 2px; color: #33483a; cursor: pointer; font-family: Manrope, sans-serif; font-size: 15px; font-weight: 700; letter-spacing: -.35px; list-style: none; }
.source-summary::-webkit-details-marker { display: none; }
.source-summary::after { content: "+"; color: #75917d; font-family: "DM Sans", sans-serif; font-size: 20px; font-weight: 400; line-height: 1; }
.source-disclosure[open] .source-summary::after { content: "−"; }
.source-summary:focus-visible { border-radius: 4px; outline: 2px solid #9bb9a2; outline-offset: 2px; }
.source-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.source-card { position: relative; display: grid; grid-template-columns: 26px minmax(0,1fr) auto; gap: 11px; align-items: start; padding: 13px; border: 1px solid var(--line); border-radius: 8px; background: white; cursor: pointer; transition: border-color .15s, box-shadow .15s, opacity .15s; }
.source-card:hover, .source-card:focus-visible { border-color: #b4c9b8; box-shadow: 0 3px 12px rgb(30 50 35 / 6%); outline: none; }
.source-card.is-muted { opacity: .48; }
.source-card[aria-pressed="true"] { border-color: #a7c0ad; box-shadow: inset 0 0 0 1px #a7c0ad; }
.source-symbol { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 7px; background: var(--source-soft); color: var(--source-color); font-size: 11px; font-weight: 700; }
.source-main { min-width: 0; }
.source-main strong { display: block; margin: 1px 0 4px; font-family: Manrope, sans-serif; font-size: 11px; }
.source-main p { margin: 0; color: #78847d; font-size: 9px; line-height: 1.5; }
.source-count { padding-top: 2px; color: #7a877f; font-family: "DM Mono", monospace; font-size: 9px; white-space: nowrap; }
.source-card .source-expand { grid-column: 1 / -1; margin-top: 1px; color: #64746a; font-size: 9px; line-height: 1.55; text-align: center; }
.source-card .source-expand b { color: #364b3d; font-weight: 600; }
.nerd-steps { margin-top: 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.nerd-steps[hidden] { display: none; }
.nerd-steps > summary { display: flex; align-items: center; justify-content: space-between; padding: 12px 13px; color: #33483a; cursor: pointer; font-family: Manrope, sans-serif; font-size: 14px; font-weight: 700; list-style: none; }
.nerd-steps > summary::-webkit-details-marker { display: none; }
.nerd-steps > summary::after { content: "+"; color: #75917d; font-family: "DM Sans", sans-serif; font-size: 19px; font-weight: 400; line-height: 1; }
.nerd-steps[open] > summary::after { content: "−"; }
.nerd-steps .detail-steps { margin: 0; padding: 0 13px 4px; }
.nerd-steps-body { border-top: 1px solid #edf0ed; }
.nerd-formulas { margin: 0 13px 12px; border-top: 1px solid #edf0ed; }
.nerd-formulas summary { padding: 11px 0 7px; color: #548067; font-family: "DM Sans", sans-serif; font-size: 11px; font-weight: 600; }
.nerd-formulas summary::after { font-size: 16px; }
.formula-list { display: grid; gap: 9px; padding-bottom: 2px; }
.formula-card { display: grid; gap: 4px; padding: 9px; border-radius: 6px; background: #f5f8f4; color: #617268; font-size: 10px; line-height: 1.45; }
.formula-card strong { color: #405448; font-size: 10px; }
.formula-card code { display: block; overflow-wrap: anywhere; color: #33483a; font-family: "DM Mono", monospace; font-size: 10px; white-space: pre-wrap; }

.inspector { position: sticky; top: 18px; overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: #fff; box-shadow: var(--shadow); }
.inspector-header { display: flex; align-items: center; justify-content: space-between; padding: 17px 17px 15px; border-bottom: 1px solid #edf0ed; }
.inspector-header h2 { font-size: 15px; }
.inspector-header .eyebrow { margin-bottom: 5px; }
.inspector-mark { width: 27px; height: 27px; display: grid; place-items: center; border: 1px solid #e2eae3; border-radius: 50%; color: #648271; font-size: 14px; }
.inspector-content { padding: 15px 17px; }
.inspector-lead { margin-bottom: 16px; color: #5c6e62; font-size: 11px; line-height: 1.7; }
.note-card { display: grid; grid-template-columns: 22px 1fr; gap: 9px; padding: 12px 0; border-top: 1px solid #edf0ed; }
.note-index { color: #88a08f; font-family: "DM Mono", monospace; font-size: 9px; }
.note-card strong { display: block; margin-bottom: 4px; color: #33483a; font-size: 10px; }
.note-card p { margin: 0; color: #7c8880; font-size: 9px; line-height: 1.6; }
.detail-value { display: flex; align-items: baseline; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid #edf0ed; }
.detail-value span { color: #748178; font-size: 10px; }
.detail-value strong { font-family: Manrope, sans-serif; font-size: 20px; letter-spacing: -.5px; }
.detail-value small { color: #849087; font-family: "DM Sans",sans-serif; font-size: 9px; font-weight: 500; letter-spacing: 0; }
.detail-meta { display: grid; gap: 9px; padding: 13px 0; }
.detail-meta div { display: flex; justify-content: space-between; gap: 10px; color: #7c8880; font-size: 9px; }
.detail-meta strong { max-width: 60%; color: #47594d; font-weight: 600; text-align: right; }
.detail-steps { margin: 5px 0 0; padding: 0; list-style: none; counter-reset: steps; }
.detail-steps li { position: relative; padding: 10px 0 10px 25px; border-top: 1px solid #edf0ed; color: #6e7d73; counter-increment: steps; font-size: 9px; line-height: 1.55; }
.detail-steps li::before { position: absolute; top: 9px; left: 0; content: counter(steps, decimal-leading-zero); color: #8ba08f; font-family: "DM Mono",monospace; font-size: 8px; }
.detail-steps b { color: #405448; font-weight: 600; }
.detail-caveat { margin: 12px 0 0; padding: 10px; border-radius: 6px; background: #f2f6f1; color: #65756a; font-size: 9px; line-height: 1.55; }
.inspector-back { display: inline-flex; align-items: center; gap: 5px; margin: 0 0 12px; padding: 0; border: 0; background: none; color: #548067; cursor: pointer; font-size: 9px; font-weight: 600; }
.inspector-back:hover { color: #274c37; }
.page-footer { display: flex; justify-content: space-between; gap: 15px; margin: 30px 0 20px; padding-top: 12px; border-top: 1px solid var(--line); color: #89958d; font-family: "DM Mono", monospace; font-size: 8px; }
.page-footer a { color: #648271; text-underline-offset: 2px; }
.page-footer a:hover { color: var(--green-dark); }
.error-toast { position: fixed; z-index: 1000; right: 20px; bottom: 20px; max-width: min(420px, calc(100vw - 40px)); padding: 12px 15px; border: 1px solid #ecd4ca; border-radius: 8px; background: #fff8f4; color: #85503b; box-shadow: 0 4px 18px rgb(53 34 22 / 10%); font-size: 11px; line-height: 1.5; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; clip-path: inset(50%); }

@media (max-width: 1050px) {
  .app-shell { padding: 0 30px; }
  .dashboard { grid-template-columns: minmax(0,1fr) 260px; gap: 14px; }
  .mode-panel-header { align-items: flex-start; }
  #map { height: 410px; }
}
@media (max-width: 760px) {
  .app-shell { padding: 0 17px; }
  .topbar { height: 62px; }
  .live-indicator { font-size: 0; }
  .live-indicator > span:first-child { width: 8px; height: 8px; }
  .topbar-status { font-size: 10px; }
  .topbar-status > span { font-size: 10px; }
  .topbar-meta { gap: 12px; }
  .intro { display: block; padding: 31px 0 20px; }
  h1 { font-size: 45px; }
  .intro-copy { max-width: 520px; margin-top: 16px; }
  .notice { grid-template-columns: 26px minmax(0,1fr) 22px; gap: 9px; padding: 14px 12px; }
  .notice-body p { font-size: 10px; }
  .dashboard { grid-template-columns: minmax(0,1fr); margin-top: 24px; }
  .inspector { position: static; grid-row: 2; }
  .mode-panel-header { display: grid; gap: 10px; }
  .mode-switch { width: 100%; }
  .mode-button { flex: 1; padding-right: 5px; padding-left: 5px; font-size: 9px; }
  .step-select-wrap { width: 100%; }
  .step-select-wrap select { min-width: 0; flex: 1; }
  .aqi-options { width: 100%; flex-wrap: wrap; }
  .select-field { flex: 1; min-width: 145px; justify-content: space-between; }
  .select-field select { min-width: 0; flex: 1; }
  #map { height: min(112vw, 440px); min-height: 300px; }
  .map-tools { width: calc(100% - 22px); margin: 10px 11px 0; }
  .map-legend { max-width: calc(100% - 77px); }
  .legend-chip { padding: 6px 7px; font-size: 8px; }
  .source-list { grid-template-columns: 1fr; }
  .page-footer { flex-direction: column; gap: 7px; line-height: 1.5; }
}
@media (max-width: 420px) {
  .section-heading h2 { font-size: 16px; }
  .map-reset { padding: 6px 7px; }
}

/* Keep explanatory copy readable; tiny type is reserved for utility labels. */
.intro-copy p { font-size: 15px; }
.updated-label { font-size: 11px; }
.notice-body h2 { font-size: 15px; }
.notice-body p { font-size: 13px; }
.notice-more { font-size: 12px; }
.mode-kicker { font-size: 9px; }
.mode-description, .mode-button, .step-select-wrap, .step-select-wrap select { font-size: 12px; }
.aqi-options, .aqi-options select { font-size: 12px; }
.legend-chip, .map-reset { font-size: 11px; }
.map-footer { flex-wrap: wrap; font-size: 10px; }
.popup-subtitle, .popup-detail, .popup-link { font-size: 11px; }
.popup-reading { font-size: 12px; }
.popup-reading small { font-size: 11px; }
.source-main strong { font-size: 13px; }
.source-main p, .source-count, .source-card .source-expand { font-size: 11px; }
.inspector-lead { font-size: 13px; }
.note-card strong { font-size: 12px; }
.note-card p, .detail-value span, .detail-meta div,
.detail-steps li, .detail-caveat, .inspector-back { font-size: 11px; }

@media (max-width: 760px) {
  .notice-body p { font-size: 12px; }
  .mode-button { font-size: 11px; }
  .legend-chip { font-size: 10px; }
}
