/* sgairquality.com — one stylesheet, no framework */
:root {
  --paper: #f2f4f5;
  --panel: #ffffff;
  --ink: #16202a;
  --muted: #56626e;
  --line: #d6dce1;
  --link: #1d5f96;

  --good: #2e8b57;
  --moderate: #2c77b8;
  --unhealthy: #c98f00;
  --very: #d9581a;
  --hazardous: #9e2328;
  --band: var(--moderate);

  /* hero sky, re-tinted per band by body[data-band] */
  --sky-top: #b9d6ea;
  --sky-bottom: #e6eef3;
  --skyline: #8aa2b5;
  --haze: 0;
  --hero-ink: var(--ink);

  --brand-disc: #2b3a4a;
  --brand-wave: #e6eef3;

  --font: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --gutter: clamp(16px, 4vw, 40px);
  --maxw: 1180px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #131a21;
    --panel: #1a232c;
    --ink: #e7ecf0;
    --muted: #9aa7b3;
    --line: #2c3843;
    --link: #8cc3ee;
    --unhealthy: #e2ab1c;
    --sky-top: #24384a;
    --sky-bottom: #182531;
    --skyline: #0f1820;
    --brand-disc: #e6eef3;
    --brand-wave: #2b3a4a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #131a21; --panel: #1a232c; --ink: #e7ecf0; --muted: #9aa7b3; --line: #2c3843; --link: #8cc3ee;
  --unhealthy: #e2ab1c; --sky-top: #24384a; --sky-bottom: #182531; --skyline: #0f1820;
  --brand-disc: #e6eef3; --brand-wave: #2b3a4a; color-scheme: dark;
}

/* band → sky. The hero literally gets hazier as the PSI rises. */
body[data-band="good"]      { --band: var(--good);      --sky-top: #9ccbec; --sky-bottom: #e3f0f8; --haze: 0; }
body[data-band="moderate"]  { --band: var(--moderate);  --sky-top: #b5cfdf; --sky-bottom: #e6ecef; --haze: .15; }
body[data-band="unhealthy"] { --band: var(--unhealthy); --sky-top: #c9c2ae; --sky-bottom: #e9e3d6; --skyline: #9c9483; --haze: .45; }
body[data-band="very"]      { --band: var(--very);      --sky-top: #b99a78; --sky-bottom: #dcc8ae; --skyline: #8d7660; --haze: .65; }
body[data-band="hazardous"] { --band: var(--hazardous); --sky-top: #6f4f45; --sky-bottom: #a07f6b; --skyline: #4f3a33; --haze: .8; --hero-ink: #fbefe6; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) body[data-band="unhealthy"] { --sky-top: #3d3a30; --sky-bottom: #26261f; --skyline: #15140f; }
  :root:not([data-theme="light"]) body[data-band="very"]      { --sky-top: #4a3726; --sky-bottom: #2b2119; --skyline: #160f0a; }
  :root:not([data-theme="light"]) body[data-band="hazardous"] { --sky-top: #4f2522; --sky-bottom: #2c1615; --skyline: #120807; --hero-ink: #fbefe6; }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.55;
  font-variation-settings: "wdth" 100;
}
a { color: var(--link); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; border-radius: 2px; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .5em; }
h2 { font-size: clamp(1.4rem, 2.6vw, 1.85rem); font-weight: 700; font-variation-settings: "wdth" 88; letter-spacing: -.01em; }
h3 { font-size: 1.1rem; font-weight: 650; }
p { margin: 0 0 .9em; }
small { font-weight: 400; color: var(--muted); }
.muted { color: var(--muted); }
.meta { color: var(--muted); font-size: .9rem; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--panel); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }

/* ---------- header ---------- */
.site-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  max-width: var(--maxw); margin: 0 auto; padding: 14px var(--gutter);
}
.home .site-head { position: absolute; left: 0; right: 0; z-index: 3; color: var(--hero-ink); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font-weight: 700; font-variation-settings: "wdth" 80; font-size: 1.15rem; }
.site-head nav { display: flex; gap: 4px 18px; flex-wrap: wrap; }
.site-head nav a { color: inherit; text-decoration: none; font-size: .95rem; padding: 4px 0; border-bottom: 2px solid transparent; }
.site-head nav a:hover { border-bottom-color: currentColor; }
.site-head nav a[aria-current="page"] { border-bottom-color: var(--band); font-weight: 650; }

/* ---------- hero ---------- */
.hero { position: relative; overflow: hidden; color: var(--hero-ink); padding: 92px 0 0; min-height: 560px; }
.sky { position: absolute; inset: 0; background: linear-gradient(180deg, var(--sky-top), var(--sky-bottom)); transition: background 1.2s ease; }
.skyline { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 150px; fill: var(--skyline); transition: fill 1.2s ease; }
.haze-layer {
  position: absolute; inset: 0; z-index: 1; opacity: var(--haze); transition: opacity 1.6s ease;
  background:
    radial-gradient(120% 60% at 30% 85%, var(--sky-bottom) 0%, transparent 70%),
    linear-gradient(180deg, transparent 20%, var(--sky-bottom) 90%);
}
.hero-inner {
  position: relative; z-index: 2;
  max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter) 150px;
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 32px 48px; align-items: center;
}
.hero h1 { font-size: clamp(1.6rem, 3.4vw, 2.4rem); font-weight: 700; font-variation-settings: "wdth" 85; margin-bottom: .2em; }
.hero-sub { margin: 0; opacity: .85; }
.psi-readout { display: flex; align-items: flex-end; gap: 18px; flex-wrap: wrap; margin: 4px 0 6px; }
.psi-num {
  font-size: clamp(6.5rem, 19vw, 12.5rem); line-height: .86; font-weight: 800;
  font-variation-settings: "wdth" 62; letter-spacing: -.02em; font-variant-numeric: tabular-nums;
}
.psi-band {
  display: inline-block; padding: 6px 14px 7px; border-radius: 999px;
  background: var(--band); color: #fff; font-weight: 700; font-size: 1.05rem;
}
body[data-band="unhealthy"] .psi-band { color: #241b00; }
.advice { max-width: 46ch; font-size: 1.08rem; }
.stamp { font-size: .92rem; display: flex; gap: 6px 10px; align-items: center; flex-wrap: wrap; }
.stamp #psi-time { flex-basis: 100%; order: 2; }

/* region compass: N on top, W–C–E across, S below */
.compass {
  display: grid; gap: 8px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-areas: ". n ." "w c e" ". s .";
}
.reg-north { grid-area: n; } .reg-west { grid-area: w; } .reg-central { grid-area: c; }
.reg-east { grid-area: e; } .reg-south { grid-area: s; }
.reg {
  --rb: var(--line);
  background: color-mix(in srgb, var(--panel) 82%, transparent);
  backdrop-filter: blur(4px);
  border-radius: 10px; padding: 10px 12px 11px; border-top: 6px solid var(--rb);
  display: flex; flex-direction: column; min-height: 104px; color: var(--ink);
}
.reg[data-band="good"] { --rb: var(--good); }
.reg[data-band="moderate"] { --rb: var(--moderate); }
.reg[data-band="unhealthy"] { --rb: var(--unhealthy); }
.reg[data-band="very"] { --rb: var(--very); }
.reg[data-band="hazardous"] { --rb: var(--hazardous); }
.reg-name { font-size: .88rem; color: var(--muted); }
.reg-psi { font-size: 2.6rem; line-height: 1; font-weight: 800; font-variation-settings: "wdth" 70; font-variant-numeric: tabular-nums; margin: 4px 0; }
.reg-pm { font-size: .82rem; color: var(--muted); margin-top: auto; }

/* ---------- blocks ---------- */
.block { max-width: var(--maxw); margin: 0 auto; padding: 48px var(--gutter) 8px; }
.block.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px; }
.block-head { margin-bottom: 18px; max-width: 70ch; }
.block-head p { color: var(--muted); margin: 0; }
.lede { font-size: 1.15rem; max-width: 68ch; }
.points { padding-left: 1.2em; max-width: 72ch; }
.points li { margin-bottom: .5em; }
.sub { margin-top: 28px; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
table { border-collapse: collapse; width: 100%; font-size: .97rem; }
caption { text-align: left; padding: 12px 14px 0; color: var(--muted); font-size: .9rem; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { font-size: .85rem; color: var(--muted); font-weight: 600; white-space: nowrap; }
tbody tr:last-child > * { border-bottom: 0; }
.readings td, .readings th { white-space: nowrap; }
.readings td { font-variant-numeric: tabular-nums; }
.pill { display: inline-block; min-width: 3.2em; text-align: center; padding: 2px 8px; border-radius: 999px; color: #fff; font-weight: 700; }
.pill.good { background: var(--good); } .pill.moderate { background: var(--moderate); }
.pill.unhealthy { background: var(--unhealthy); color: #241b00; } .pill.very { background: var(--very); } .pill.hazardous { background: var(--hazardous); }
.pm-tag { color: var(--muted); font-size: .85rem; margin-left: 6px; }

.health .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; vertical-align: 1px; }
.health th[scope="row"] { min-width: 12em; }
.b-good .dot { background: var(--good); } .b-unhealthy .dot { background: var(--unhealthy); }
.b-very .dot { background: var(--very); } .b-hazardous .dot { background: var(--hazardous); }

/* chart */
.chart { margin: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 10px 8px; }
.chart svg { display: block; width: 100%; height: auto; }
.chart-empty { padding: 60px 10px; text-align: center; }
.chart .grid line { stroke: var(--line); }
.chart .axis text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .band-good { fill: var(--good); } .chart .band-moderate { fill: var(--moderate); }
.chart .band-unhealthy { fill: var(--unhealthy); } .chart .band-very { fill: var(--very); } .chart .band-hazardous { fill: var(--hazardous); }
.chart .bands rect { opacity: .09; }
.chart .bands text { font-size: 10.5px; font-family: var(--font); fill: var(--muted); }
.chart .obs { fill: none; stroke: var(--ink); stroke-width: 2.4; stroke-linejoin: round; }
.chart .fc { fill: none; stroke: var(--ink); stroke-width: 2; stroke-dasharray: 5 5; opacity: .75; }
.chart .now line { stroke: var(--muted); stroke-dasharray: 2 3; }
.chart .now text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart figcaption { font-size: .85rem; color: var(--muted); padding: 6px 6px 0; }

/* forecast days */
.days { list-style: none; margin: 0 0 10px; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.day { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 10px 12px 12px; border-left: 5px solid var(--db, var(--line)); display: flex; flex-direction: column; min-width: 0; }
.day[data-band="good"] { --db: var(--good); } .day[data-band="moderate"] { --db: var(--moderate); }
.day[data-band="unhealthy"] { --db: var(--unhealthy); } .day[data-band="very"] { --db: var(--very); } .day[data-band="hazardous"] { --db: var(--hazardous); }
.day-name { font-weight: 650; white-space: nowrap; font-size: .95rem; font-variation-settings: "wdth" 88; }
.day-psi { font-size: 2.2rem; line-height: 1.05; font-weight: 800; font-variation-settings: "wdth" 70; display: block; font-variant-numeric: tabular-nums; }
.day-band { font-size: .88rem; color: var(--ink); white-space: nowrap; }
.day-range { font-size: .78rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

.outlook { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; }
.outlook-range { font-size: 1.35rem; font-weight: 700; font-variation-settings: "wdth" 85; margin-bottom: .35em; }
.outlook .meta { margin: 0; }
.wind { margin-top: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; }
.wind-row { display: flex; align-items: center; gap: 14px; }
.wind-arrow { width: 54px; height: 54px; flex: none; }
.wind-arrow path { fill: var(--ink); }
.wind-arrow circle { fill: none; stroke: var(--line); stroke-width: 2; }
.wind p:last-child { margin-bottom: 0; }

/* cards */
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 22px; }
.card { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.card:hover { border-color: var(--ink); }
.card-k { font-weight: 700; font-variation-settings: "wdth" 85; font-size: 1.1rem; }
.card-t { color: var(--muted); }

/* timeline: dates are a real sequence here */
.timeline { list-style: none; margin: 0; padding: 0; max-width: 820px; }
.timeline li { display: grid; grid-template-columns: 7.5em minmax(0, 1fr); gap: 18px; padding: 16px 0; border-top: 1px solid var(--line); }
.timeline time { color: var(--muted); font-size: .92rem; font-variant-numeric: tabular-nums; padding-top: 2px; }
.timeline h3 { margin-bottom: .3em; }
.timeline p { margin-bottom: .4em; }
.src { font-size: .9rem; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.tag { font-size: .78rem; padding: 1px 8px; border-radius: 4px; border: 1px solid var(--line); color: var(--muted); }

/* faq */
.faq { max-width: 820px; border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; list-style: none; padding: 14px 32px 14px 0; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 4px; top: 10px; font-size: 1.5rem; color: var(--muted); }
.faq details[open] summary::after { content: "–"; }
.faq summary h3 { display: inline; font-size: 1.05rem; }
.faq details p { margin: 0 0 16px; max-width: 70ch; }

/* sub pages */
.page { max-width: 880px; margin: 0 auto; padding: 24px var(--gutter) 24px; }
.page-head { padding: 24px 0 8px; border-bottom: 1px solid var(--line); margin-bottom: 28px; }
.page-head h1 { font-size: clamp(2rem, 5vw, 3.2rem); font-weight: 800; font-variation-settings: "wdth" 75; letter-spacing: -.01em; }
.crumb { font-size: .9rem; color: var(--muted); }
.page section { margin-bottom: 40px; }
.links { padding-left: 1.2em; } .links li { margin-bottom: .5em; }
.stat { font-size: 1.1rem; } .stat strong { font-size: 2.4rem; font-weight: 800; font-variation-settings: "wdth" 70; margin-right: 4px; }
.bars td { width: 70%; }
.bars .bar { display: inline-block; height: 12px; width: var(--w); background: var(--very); border-radius: 2px; vertical-align: middle; margin-right: 10px; max-width: calc(100% - 4.5em); }
.bars .bar-n { font-variant-numeric: tabular-nums; }
.trend-fig { margin: 22px 0 0; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.trend-fig svg { width: 100%; height: auto; display: block; }
.trend-fig rect { fill: var(--very); opacity: .85; }
.trend-fig text { font-family: var(--font); font-size: 11px; fill: var(--muted); text-anchor: middle; }
.trend-fig text.v { fill: var(--ink); font-weight: 600; }
.trend-fig figcaption { font-size: .85rem; color: var(--muted); margin-top: 6px; }

/* footer */
.site-foot { margin-top: 56px; border-top: 1px solid var(--line); background: var(--panel); }
.foot-grid { max-width: var(--maxw); margin: 0 auto; padding: 32px var(--gutter) 8px; display: grid; grid-template-columns: 1.3fr 1.5fr .8fr; gap: 28px; font-size: .92rem; color: var(--muted); }
.foot-brand, .foot-h { color: var(--ink); font-weight: 700; margin-bottom: .4em; }
.foot-links { list-style: none; padding: 0; margin: 0; } .foot-links li { margin-bottom: 4px; }
.credits {
  max-width: var(--maxw); margin: 0 auto; padding: 18px var(--gutter) 28px;
  display: flex; gap: 8px 28px; flex-wrap: wrap; font-weight: 650; font-variation-settings: "wdth" 85; font-size: .98rem;
  border-top: 1px solid var(--line);
}

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .hero-inner { grid-template-columns: minmax(0, 1fr); padding-bottom: 110px; }
  .block.two { grid-template-columns: minmax(0, 1fr); }
  .cards { grid-template-columns: minmax(0, 1fr); }
  .foot-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .days { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home .site-head { position: relative; }
  .hero { padding-top: 8px; min-height: 0; }
  .site-head nav { gap: 2px 14px; }
  .reg { min-height: 88px; padding: 8px 10px; }
  .reg-psi { font-size: 2rem; }
  .timeline li { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .skyline { height: 110px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- v2: outlook band, map, headlines, season, credits ---------- */
.outlook { border-left: 6px solid var(--ob, var(--line)); }
.outlook[data-band="good"] { --ob: var(--good); } .outlook[data-band="moderate"] { --ob: var(--moderate); }
.outlook[data-band="unhealthy"] { --ob: var(--unhealthy); } .outlook[data-band="very"] { --ob: var(--very); } .outlook[data-band="hazardous"] { --ob: var(--hazardous); }
.outlook p { max-width: 68ch; }

.map-wrap { position: relative; }
.map-tools { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.map-btn { font: inherit; font-size: .92rem; padding: 6px 14px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; }
.map-btn[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.map { height: clamp(380px, 62vh, 620px); border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--panel); }
.map-placeholder { padding: 40px 20px; text-align: center; max-width: 60ch; margin: 0 auto; }
.legend { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 6px 22px; font-size: .9rem; color: var(--muted); }
.lg { display: inline-block; width: 12px; height: 12px; margin-right: 7px; vertical-align: -1px; border-radius: 50%; }
.lg-hot { background: #e3461c; }
.lg-mod { background: rgba(232, 150, 42, .45); border: 1px solid #d9821b; border-radius: 2px; }
.lg-den { background: rgba(168, 56, 43, .5); border: 1px solid #a8382b; border-radius: 2px; }
.lg-sg { background: var(--unhealthy); box-shadow: 0 0 0 2px #fff inset; }
.iw { font-family: var(--font); font-size: 13px; line-height: 1.4; color: #16202a; }

.hl-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; }
.hl-cols h3 { font-size: 1.05rem; padding-bottom: 8px; border-bottom: 2px solid var(--ink); }
.headlines { list-style: none; margin: 0; padding: 0; }
.headlines li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.headlines a { color: var(--ink); text-decoration: none; font-weight: 550; line-height: 1.35; display: block; }
.headlines a:hover { text-decoration: underline; }
.hl-meta { display: block; font-size: .84rem; color: var(--muted); margin-top: 3px; }
.page .headlines { max-width: 760px; }

.season { margin: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 10px 10px; }
.season svg { display: block; width: 100%; height: auto; }
.season .grid line { stroke: var(--line); }
.season .grid text, .season > svg > text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.season text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.season .limit { stroke: var(--unhealthy); stroke-dasharray: 4 4; }
.season rect.band-good { fill: var(--good); } .season rect.band-moderate { fill: var(--moderate); }
.season rect.band-unhealthy { fill: var(--unhealthy); } .season rect.band-very { fill: var(--very); } .season rect.band-hazardous { fill: var(--hazardous); }
.season figcaption { font-size: .92rem; color: var(--muted); padding: 8px 6px 0; max-width: 80ch; }
.season figcaption strong { color: var(--ink); }

.credits a { color: inherit; text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); }
.credits a:hover { text-decoration-color: currentColor; }

@media (max-width: 900px) {
  .hl-cols { grid-template-columns: minmax(0, 1fr); gap: 8px; }
}

/* live badge */
.live { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: .85rem; padding: 3px 10px 3px 8px; border-radius: 999px; background: color-mix(in srgb, var(--panel) 70%, transparent); color: var(--ink); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #d23c2a; box-shadow: 0 0 0 0 rgba(210, 60, 42, .55); animation: live-pulse 2s ease-out infinite; }
@keyframes live-pulse { 0% { box-shadow: 0 0 0 0 rgba(210, 60, 42, .55); } 70% { box-shadow: 0 0 0 8px rgba(210, 60, 42, 0); } 100% { box-shadow: 0 0 0 0 rgba(210, 60, 42, 0); } }
