/* KL Air & Weather Watch — a monsoon broadsheet.
   Light: humid paper, deep tropical ink. Dark: a city night under haze.
   The air itself sets the mood: the background haze thickens and warms with Kuala Lumpur's AQI. */

@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(fonts/fraunces-latin-opsz-normal.woff2) format('woff2-variations');
}
@font-face {
  font-family: 'Fraunces';
  font-style: italic;
  font-display: swap;
  font-weight: 100 900;
  src: url(fonts/fraunces-latin-opsz-italic.woff2) format('woff2-variations');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url(fonts/ibm-plex-mono-latin-400-normal.woff2) format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-display: swap;
  font-weight: 600;
  src: url(fonts/ibm-plex-mono-latin-600-normal.woff2) format('woff2');
}

:root {
  --font-serif: 'Fraunces', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;

  --bg: oklch(95.6% 0.014 95);
  --surface: oklch(98.4% 0.008 95);
  --surface-2: oklch(92.4% 0.018 95);
  --ink: oklch(23% 0.035 175);
  --ink-2: oklch(35% 0.03 175);
  --muted: oklch(45% 0.025 175);
  --rule: oklch(83% 0.02 95);
  --rule-strong: oklch(25% 0.035 175);
  --accent: oklch(46% 0.1 175);
  --temp: oklch(52% 0.17 40);
  --feels: oklch(50% 0.12 330);
  --low: oklch(48% 0.1 250);
  --rain: oklch(62% 0.09 235 / 0.5);
  --pm: oklch(30% 0.04 175);
  --shade: oklch(40% 0.03 250 / 0.06);
  --shadow: 0 1px 0 oklch(20% 0.03 175 / 0.06), 0 18px 40px -18px oklch(25% 0.05 175 / 0.35);

  /* US AQI categories: --c is the fill, --c-bg the soft surface, --c-ink text on that surface. */
  --good: oklch(68% 0.15 150);
  --good-bg: oklch(91% 0.06 150);
  --good-ink: oklch(32% 0.08 150);
  --moderate: oklch(84% 0.16 95);
  --moderate-bg: oklch(93% 0.08 95);
  --moderate-ink: oklch(36% 0.08 80);
  --sensitive: oklch(73% 0.17 55);
  --sensitive-bg: oklch(90% 0.07 60);
  --sensitive-ink: oklch(38% 0.11 45);
  --unhealthy: oklch(58% 0.21 27);
  --unhealthy-bg: oklch(88% 0.06 25);
  --unhealthy-ink: oklch(38% 0.14 27);
  --very-unhealthy: oklch(48% 0.17 320);
  --very-unhealthy-bg: oklch(89% 0.05 320);
  --very-unhealthy-ink: oklch(36% 0.13 320);
  --hazardous: oklch(36% 0.12 15);
  --hazardous-bg: oklch(86% 0.05 15);
  --hazardous-ink: oklch(32% 0.1 15);
  --unknown: oklch(70% 0.01 175);
  --unknown-bg: oklch(91% 0.008 175);
  --unknown-ink: oklch(35% 0.02 175);

  --haze-1: oklch(88% 0.06 200 / 0.55);
  --haze-2: oklch(90% 0.05 150 / 0.45);
  --grain-opacity: 0.06;

  --text-base: clamp(1rem, 0.96rem + 0.2vw, 1.08rem);
  --text-hero: clamp(6rem, 2.4rem + 14vw, 13.5rem);
  --text-h1: clamp(2.6rem, 1.6rem + 4.2vw, 5.4rem);
  --space-section: clamp(3.5rem, 2.2rem + 4.5vw, 7rem);
  --gutter: clamp(1rem, 0.4rem + 2.6vw, 2.75rem);
  --radius-s: 4px;
  --radius-m: 14px;
  --radius-l: 28px;
  --duration-fast: 140ms;
  --duration-normal: 300ms;
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: oklch(17% 0.022 235);
    --surface: oklch(21.5% 0.025 235);
    --surface-2: oklch(25% 0.026 235);
    --ink: oklch(93% 0.014 95);
    --ink-2: oklch(84% 0.016 95);
    --muted: oklch(74% 0.02 220);
    --rule: oklch(32% 0.025 235);
    --rule-strong: oklch(88% 0.014 95);
    --accent: oklch(78% 0.1 175);
    --temp: oklch(76% 0.14 50);
    --feels: oklch(76% 0.11 330);
    --low: oklch(76% 0.09 240);
    --rain: oklch(70% 0.09 235 / 0.42);
    --pm: oklch(90% 0.02 95);
    --shade: oklch(5% 0.02 250 / 0.35);
    --shadow: 0 1px 0 oklch(100% 0 0 / 0.04), 0 22px 50px -20px oklch(0% 0 0 / 0.7);
    --good-bg: oklch(32% 0.06 150);
    --good-ink: oklch(90% 0.08 150);
    --moderate-bg: oklch(34% 0.06 95);
    --moderate-ink: oklch(92% 0.1 95);
    --sensitive-bg: oklch(34% 0.07 55);
    --sensitive-ink: oklch(90% 0.09 60);
    --unhealthy-bg: oklch(32% 0.09 25);
    --unhealthy-ink: oklch(90% 0.06 25);
    --very-unhealthy-bg: oklch(31% 0.08 320);
    --very-unhealthy-ink: oklch(90% 0.05 320);
    --hazardous-bg: oklch(29% 0.07 15);
    --hazardous-ink: oklch(90% 0.05 15);
    --unknown-bg: oklch(28% 0.01 235);
    --unknown-ink: oklch(88% 0.01 235);
    --haze-1: oklch(40% 0.06 220 / 0.4);
    --haze-2: oklch(35% 0.05 170 / 0.3);
    --grain-opacity: 0.08;
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --bg: oklch(17% 0.022 235);
  --surface: oklch(21.5% 0.025 235);
  --surface-2: oklch(25% 0.026 235);
  --ink: oklch(93% 0.014 95);
  --ink-2: oklch(84% 0.016 95);
  --muted: oklch(74% 0.02 220);
  --rule: oklch(32% 0.025 235);
  --rule-strong: oklch(88% 0.014 95);
  --accent: oklch(78% 0.1 175);
  --temp: oklch(76% 0.14 50);
  --feels: oklch(76% 0.11 330);
  --low: oklch(76% 0.09 240);
  --rain: oklch(70% 0.09 235 / 0.42);
  --pm: oklch(90% 0.02 95);
  --shade: oklch(5% 0.02 250 / 0.35);
  --shadow: 0 1px 0 oklch(100% 0 0 / 0.04), 0 22px 50px -20px oklch(0% 0 0 / 0.7);
  --good-bg: oklch(32% 0.06 150);
  --good-ink: oklch(90% 0.08 150);
  --moderate-bg: oklch(34% 0.06 95);
  --moderate-ink: oklch(92% 0.1 95);
  --sensitive-bg: oklch(34% 0.07 55);
  --sensitive-ink: oklch(90% 0.09 60);
  --unhealthy-bg: oklch(32% 0.09 25);
  --unhealthy-ink: oklch(90% 0.06 25);
  --very-unhealthy-bg: oklch(31% 0.08 320);
  --very-unhealthy-ink: oklch(90% 0.05 320);
  --hazardous-bg: oklch(29% 0.07 15);
  --hazardous-ink: oklch(90% 0.05 15);
  --unknown-bg: oklch(28% 0.01 235);
  --unknown-ink: oklch(88% 0.01 235);
  --haze-1: oklch(40% 0.06 220 / 0.4);
  --haze-2: oklch(35% 0.05 170 / 0.3);
  --grain-opacity: 0.08;
  color-scheme: dark;
}

/* The mood of the page follows Kuala Lumpur's air: clear teal sky to brown smoke. */
.mood-moderate { --haze-1: oklch(88% 0.08 95 / 0.5); }
.mood-sensitive { --haze-1: oklch(82% 0.1 70 / 0.55); --haze-2: oklch(86% 0.06 50 / 0.5); }
.mood-unhealthy, .mood-very-unhealthy, .mood-hazardous { --haze-1: oklch(72% 0.11 50 / 0.6); --haze-2: oklch(70% 0.08 30 / 0.55); --grain-opacity: 0.1; }
:root[data-theme='dark'] .mood-moderate { --haze-1: oklch(40% 0.06 95 / 0.4); }
:root[data-theme='dark'] .mood-sensitive { --haze-1: oklch(42% 0.08 60 / 0.45); --haze-2: oklch(36% 0.06 40 / 0.35); }
:root[data-theme='dark'] .mood-unhealthy, :root[data-theme='dark'] .mood-very-unhealthy, :root[data-theme='dark'] .mood-hazardous { --haze-1: oklch(42% 0.1 45 / 0.6); --haze-2: oklch(35% 0.08 25 / 0.5); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .mood-moderate { --haze-1: oklch(40% 0.06 95 / 0.4); }
  :root:not([data-theme='light']) .mood-sensitive { --haze-1: oklch(42% 0.08 60 / 0.45); --haze-2: oklch(36% 0.06 40 / 0.35); }
  :root:not([data-theme='light']) .mood-unhealthy, :root:not([data-theme='light']) .mood-very-unhealthy, :root:not([data-theme='light']) .mood-hazardous { --haze-1: oklch(42% 0.1 45 / 0.6); --haze-2: oklch(35% 0.08 25 / 0.5); }
}

.aqi-good { --c: var(--good); --c-bg: var(--good-bg); --c-ink: var(--good-ink); }
.aqi-moderate { --c: var(--moderate); --c-bg: var(--moderate-bg); --c-ink: var(--moderate-ink); }
.aqi-sensitive { --c: var(--sensitive); --c-bg: var(--sensitive-bg); --c-ink: var(--sensitive-ink); }
.aqi-unhealthy { --c: var(--unhealthy); --c-bg: var(--unhealthy-bg); --c-ink: var(--unhealthy-ink); }
.aqi-very-unhealthy { --c: var(--very-unhealthy); --c-bg: var(--very-unhealthy-bg); --c-ink: var(--very-unhealthy-ink); }
.aqi-hazardous { --c: var(--hazardous); --c-bg: var(--hazardous-bg); --c-ink: var(--hazardous-ink); }
.aqi-unknown { --c: var(--unknown); --c-bg: var(--unknown-bg); --c-ink: var(--unknown-ink); }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 var(--text-base) / 1.55 var(--font-serif);
  font-optical-sizing: auto;
  overflow-x: hidden;
}
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.18em; transition: color var(--duration-fast); }
a:hover { color: var(--accent); text-decoration-thickness: 2px; }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: var(--gutter); top: -4rem; z-index: 10; background: var(--ink); color: var(--bg); padding: 0.5rem 0.9rem; font-family: var(--font-mono); font-size: 0.85rem; }
.skip:focus { top: 0.6rem; }
main:focus { outline: none; }
.ms { font-style: italic; color: var(--muted); font-weight: 400; }
[hidden] { display: none !important; }

/* Atmosphere: two slow haze banks and film grain behind everything. */
.atmosphere { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.haze { position: absolute; border-radius: 50%; filter: blur(60px); will-change: transform; }
.haze-a { width: 90vmax; height: 50vmax; left: -20vmax; top: -22vmax; background: radial-gradient(closest-side, var(--haze-1), transparent); animation: drift-a 48s ease-in-out infinite alternate; }
.haze-b { width: 80vmax; height: 46vmax; right: -24vmax; top: 18vh; background: radial-gradient(closest-side, var(--haze-2), transparent); animation: drift-b 64s ease-in-out infinite alternate; }
.grain { position: absolute; inset: -50%; opacity: var(--grain-opacity); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.9 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
@keyframes drift-a { to { transform: translate3d(12vmax, 6vmax, 0) scale(1.08); } }
@keyframes drift-b { to { transform: translate3d(-14vmax, -4vmax, 0) scale(0.94); } }
@media (prefers-reduced-motion: reduce) {
  .haze { animation: none; }
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}

/* Masthead */
.masthead {
  display: flex; align-items: center; gap: 1rem 2rem; flex-wrap: wrap;
  padding: 1rem var(--gutter); border-bottom: 1px solid var(--rule-strong);
  position: relative;
}
.wordmark { display: flex; align-items: center; gap: 0.7rem; text-decoration: none; margin-right: auto; }
.wordmark:hover { color: inherit; }
.mark { width: 2.2rem; height: 2.2rem; flex: none; }
.mark-sun { fill: var(--sensitive); }
.mark-haze { fill: none; stroke: var(--ink); stroke-width: 2.2; stroke-linecap: round; }
.mark-haze-2 { opacity: 0.45; }
.wordmark-text { font-size: 1.12rem; line-height: 1.1; letter-spacing: -0.01em; }
.wordmark-text b { font-weight: 700; font-style: italic; }
.wordmark-ms { display: block; font-size: 0.78rem; letter-spacing: 0; }
.masthead nav ul { display: flex; flex-wrap: wrap; gap: 0.2rem 1.3rem; margin: 0; padding: 0; list-style: none; }
.masthead nav a { display: inline-flex; flex-direction: column; text-decoration: none; font-family: var(--font-mono); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; padding: 0.3rem 0; border-bottom: 2px solid transparent; transition: border-color var(--duration-normal) var(--ease-out-expo), color var(--duration-fast); }
.masthead nav a:hover { border-bottom-color: var(--rule-strong); color: var(--ink); }
.masthead nav a[aria-current='page'] { border-bottom-color: var(--accent); }
.nav-ms { font-family: var(--font-serif); text-transform: none; letter-spacing: 0; font-size: 0.78rem; }
.theme-toggle { inline-size: 2.4rem; block-size: 2.4rem; display: grid; place-items: center; border: 1px solid var(--rule-strong); border-radius: 50%; background: var(--surface); color: var(--ink); cursor: pointer; transition: transform var(--duration-normal) var(--ease-out-expo); }
.theme-toggle:hover { transform: rotate(-24deg); }
.theme-toggle:active { transform: rotate(-24deg) scale(0.92); }
.theme-toggle svg { width: 1.2rem; height: 1.2rem; fill: none; stroke: currentColor; stroke-width: 1.6; }
.theme-toggle .half { fill: currentColor; stroke: none; }

/* Haze banner */
.haze-banner { display: grid; grid-template-columns: auto 1fr; gap: 0.3rem 1.4rem; align-items: baseline; padding: 0.95rem var(--gutter); border-bottom: 1px solid var(--rule-strong); }
.haze-banner.level-notice { background: var(--sensitive-bg); color: var(--sensitive-ink); }
.haze-banner.level-alert { background: var(--unhealthy); color: oklch(99% 0.01 95); }
.haze-banner.level-alert .ms { color: inherit; opacity: 0.85; }
.hb-kicker { margin: 0; font-family: var(--font-mono); font-weight: 600; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.1em; }
.hb-kicker .ms { display: block; font-family: var(--font-serif); text-transform: none; letter-spacing: 0; font-weight: 400; }
.hb-text { margin: 0; max-width: 72ch; }
.hb-text a { font-weight: 600; }
.hb-text a:hover { color: inherit; }
.stale-note { margin: 0; padding: 0.7rem var(--gutter); background: var(--ink); color: var(--bg); font-family: var(--font-mono); font-size: 0.85rem; }

main { padding: 0 var(--gutter) var(--space-section); max-width: 92rem; margin: 0 auto; }

/* Hero */
.hero { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(1.5rem, 4vw, 4rem); align-items: start; padding-top: clamp(2rem, 4vw, 4rem); }
.eyebrow { margin: 0 0 0.6rem; font-family: var(--font-mono); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }
.eyebrow .ms { font-family: var(--font-serif); text-transform: none; letter-spacing: 0; }
.hero-place { margin: 0; font-size: var(--text-h1); font-weight: 300; font-style: italic; line-height: 0.95; letter-spacing: -0.03em; font-variation-settings: 'opsz' 144; }
.hero-state { margin: 0.6rem 0 0; color: var(--ink-2); }
.temp-row { display: flex; align-items: center; gap: clamp(0.5rem, 2vw, 2rem); margin-top: clamp(0.5rem, 2vw, 1.5rem); }
.temp { margin: 0; font-size: var(--text-hero); font-weight: 200; line-height: 0.82; letter-spacing: -0.06em; font-variation-settings: 'opsz' 144; font-variant-numeric: lining-nums; }
.deg { font-size: 0.28em; font-weight: 400; letter-spacing: 0; vertical-align: 1.6em; margin-left: 0.15em; color: var(--muted); }
.wx { fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.wx .i-sun { fill: var(--moderate); stroke: none; }
.wx .i-ray { stroke: var(--sensitive); }
.wx .i-cloud { fill: var(--surface); }
.wx .i-drop { stroke: var(--low); stroke-width: 1.8; }
.wx .i-bolt { stroke: var(--sensitive); stroke-width: 1.8; }
.wx-hero { width: clamp(4.5rem, 10vw, 8rem); height: auto; flex: none; }
.condition { margin: 0.8rem 0 0; font-size: clamp(1.3rem, 1rem + 1vw, 1.9rem); font-weight: 400; }
.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin: 1.8rem 0 0; border-top: 1px solid var(--rule-strong); }
.facts div { padding: 0.8rem 1rem 0.2rem 0; border-right: 1px solid var(--rule); }
.facts div + div { padding-left: 1rem; }
.facts div:last-child { border-right: 0; }
.facts dt { font-family: var(--font-mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); }
.facts dt .ms { display: block; font-family: var(--font-serif); text-transform: none; letter-spacing: 0; font-size: 0.8rem; }
.facts dd { margin: 0.25rem 0 0; font-size: clamp(1.5rem, 1.1rem + 1.2vw, 2.3rem); font-weight: 300; font-variant-numeric: tabular-nums; }
.air-peek { display: none; margin: 0.9rem 0 0; }
.air-peek a { text-decoration: none; display: inline-flex; align-items: center; gap: 0.6rem; font-family: var(--font-mono); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; }
.air-peek .chip { text-transform: none; letter-spacing: 0; font-family: var(--font-serif); }
.note { margin: 1.2rem 0 0; color: var(--ink-2); max-width: 54ch; }

.hero-air {
  position: relative; padding: clamp(1.3rem, 2.6vw, 2.2rem); border-radius: var(--radius-l);
  background: linear-gradient(160deg, var(--c-bg), var(--surface) 70%);
  color: var(--ink); box-shadow: var(--shadow); border: 1px solid color-mix(in oklch, var(--c) 40%, transparent);
  margin-top: clamp(0rem, 3vw, 2.5rem);
}
.hero-air::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 6px; border-radius: var(--radius-l) 0 0 var(--radius-l); background: var(--c); }
.gauge { display: block; width: 100%; max-width: 19rem; height: auto; margin: 0.2rem auto 0; overflow: visible; }
.g-seg { fill: none; stroke: var(--c); stroke-width: 16; stroke-linecap: butt; opacity: 0.85; }
.g-tick { font-family: var(--font-mono); font-size: 9px; fill: var(--muted); }
.g-needle { fill: var(--ink); }
.g-needle circle { fill: var(--ink); stroke: var(--surface); stroke-width: 3; }
.aqi-number { display: flex; align-items: baseline; justify-content: center; gap: 0.5rem; margin: -0.6rem 0 0; }
.aqi-value { font-size: clamp(3.6rem, 2.6rem + 3vw, 5.6rem); font-weight: 300; line-height: 1; letter-spacing: -0.04em; font-variation-settings: 'opsz' 144; }
.aqi-unit { font-family: var(--font-mono); font-size: 0.8rem; color: var(--muted); }
.aqi-band { margin: 0.2rem 0 0; text-align: center; font-size: 1.25rem; font-weight: 600; color: var(--c-ink); }
.aqi-band .ms { display: block; font-size: 1rem; font-weight: 400; color: var(--c-ink); opacity: 0.85; }
.advice { margin: 1rem 0 0; font-size: 1.04rem; }
.advice-ms { margin-top: 0.35rem; font-style: italic; color: var(--ink-2); font-size: 0.97rem; }
.pollutants { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.4rem; margin: 1.2rem 0 0; padding: 0.8rem 0 0; border-top: 1px solid color-mix(in oklch, var(--c) 35%, var(--rule)); }
.pollutants dt { font-family: var(--font-mono); font-size: 0.72rem; color: var(--muted); }
.pollutants dd { margin: 0; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.pollutants small { font-family: var(--font-mono); font-size: 0.6rem; color: var(--muted); }
.who { margin: 1rem 0 0; font-size: 0.95rem; color: var(--ink-2); }
.model-time { margin: 0.8rem 0 0; font-family: var(--font-mono); font-size: 0.72rem; color: var(--muted); }

/* Sections */
.block { margin-top: var(--space-section); }
.block-head { display: grid; grid-template-columns: auto 1fr; align-items: end; gap: 1.2rem; border-bottom: 1px solid var(--rule-strong); padding-bottom: 0.7rem; margin-bottom: 1.4rem; }
.block-num { margin: 0; font-family: var(--font-mono); font-weight: 600; font-size: clamp(2.2rem, 1.4rem + 3vw, 4.2rem); line-height: 0.8; letter-spacing: -0.04em; color: transparent; -webkit-text-stroke: 1.2px var(--ink); }
.block h2, .page-head h1 { margin: 0; font-weight: 400; letter-spacing: -0.02em; line-height: 1.05; }
.block h2 { font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.5rem); }
.block h2 .ms, .page-head h1 .ms { font-size: 0.55em; display: block; letter-spacing: 0; margin-top: 0.2rem; }
.lede { max-width: 66ch; color: var(--ink-2); font-size: 1.08rem; margin: 0 0 1.3rem; }
.fine { font-family: var(--font-mono); font-size: 0.76rem; color: var(--muted); margin: 0.9rem 0 0; }
.empty { color: var(--muted); font-style: italic; }
.page-head { padding-top: clamp(2rem, 4vw, 4rem); max-width: 60rem; }
.page-head h1 { font-size: var(--text-h1); font-weight: 300; font-style: italic; letter-spacing: -0.03em; margin-bottom: 1rem; }

/* Charts */
.charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(1rem, 3vw, 2.5rem); }
.chart { margin: 0; padding: 1.1rem 1.1rem 0.8rem; background: var(--surface); border-radius: var(--radius-m); box-shadow: var(--shadow); border: 1px solid var(--rule); }
.chart figcaption { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 0.3rem 1rem; margin-bottom: 0.5rem; }
.chart-title { font-weight: 600; font-size: 1.05rem; }
.chart-title .ms { font-weight: 400; font-size: 0.9rem; }
.legend { display: flex; flex-wrap: wrap; gap: 0.2rem 0.9rem; margin: 0; padding: 0; list-style: none; font-family: var(--font-mono); font-size: 0.72rem; color: var(--muted); }
.key { display: inline-flex; align-items: center; gap: 0.35rem; }
.swatch { display: inline-block; width: 0.85rem; height: 0.85rem; border-radius: 2px; background: var(--c, var(--muted)); }
.key.s-temp .swatch { background: var(--temp); height: 3px; }
.key.s-feels .swatch { background: var(--feels); height: 3px; }
.key.s-low .swatch { background: var(--low); height: 3px; }
.key.s-rain .swatch { background: var(--rain); }
.key.s-aqi .swatch { background: var(--ink); height: 3px; }
.key.s-pm .swatch { background: var(--pm); height: 3px; }
.key.s-aqibar .swatch { background: linear-gradient(90deg, var(--good), var(--moderate), var(--sensitive), var(--unhealthy)); }
.key.s-pmbar .swatch { background: var(--accent); }
.key-night .swatch { background: var(--shade); outline: 1px solid var(--rule); }
.chart-scroll { overflow-x: auto; scrollbar-width: thin; }
.chart svg { display: block; width: 100%; min-width: 36rem; height: auto; overflow: visible; }
.chart .heat-svg { min-width: 44rem; }
.chart .tick, .chart .unit, .chart .row-label { font-family: var(--font-mono); font-size: 11px; fill: var(--muted); }
.chart .row-label { fill: var(--ink-2); font-size: 11.5px; }
.chart .grid { stroke: var(--rule); stroke-width: 1; }
.chart .xtick { stroke: var(--rule-strong); }
.chart .shade { fill: var(--shade); }
.chart .band { opacity: 0.22; }
.chart .band-good { fill: var(--good); }
.chart .band-moderate { fill: var(--moderate); }
.chart .band-sensitive { fill: var(--sensitive); }
.chart .band-unhealthy { fill: var(--unhealthy); }
.chart .band-very-unhealthy { fill: var(--very-unhealthy); }
.chart .band-hazardous { fill: var(--hazardous); }
.chart .line { fill: none; stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.chart .s-temp { stroke: var(--temp); }
.chart .s-feels { stroke: var(--feels); stroke-dasharray: 5 4; stroke-width: 1.8; }
.chart .s-low { stroke: var(--low); }
.chart .s-aqi { stroke: var(--ink); stroke-width: 2.6; }
.chart .s-pm { stroke: var(--pm); stroke-dasharray: 2 3; stroke-width: 2; }
.chart .bar.s-rain { fill: var(--rain); }
.chart .bar.s-aqibar { fill: var(--c); }
.chart .bar.s-pmbar { fill: var(--accent); }
.chart .cell { fill: var(--c); stroke: var(--surface); transition: opacity var(--duration-fast); }
.chart .cell.aqi-unknown { fill: var(--surface-2); }
.chart .cell.on { stroke: var(--ink); stroke-width: 2; }
.chart .marker { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 2 3; }
.chart .hit { fill: transparent; }
.chart .hit.on { fill: color-mix(in oklch, var(--ink) 7%, transparent); }
.chart .cursor { stroke: var(--ink); stroke-width: 1; opacity: 0; transition: opacity var(--duration-fast); }
.chart .cursor.on { opacity: 0.5; }
.readout { margin: 0.4rem 0 0; min-height: 1.3em; font-family: var(--font-mono); font-size: 0.74rem; color: var(--ink-2); }

details.chart-data { margin-top: 1rem; }
details.chart-data summary { display: inline-block; cursor: pointer; font-family: var(--font-mono); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; padding: 0.45rem 0.8rem; border: 1px solid var(--rule-strong); border-radius: 999px; transition: background var(--duration-fast), color var(--duration-fast); }
details.chart-data summary:hover { background: var(--ink); color: var(--bg); }
details.chart-data summary:hover .ms, details.chart-data summary:hover span { color: inherit; }
details.chart-data summary::-webkit-details-marker { display: none; }
details.chart-data summary span { text-transform: none; letter-spacing: 0; font-family: var(--font-serif); font-style: italic; color: var(--muted); }
.table-scroll { overflow-x: auto; margin-top: 0.8rem; }
table { border-collapse: collapse; width: 100%; font-size: 0.92rem; font-variant-numeric: tabular-nums; }
caption { text-align: left; font-family: var(--font-mono); font-size: 0.75rem; color: var(--muted); padding-bottom: 0.5rem; }
th, td { text-align: left; padding: 0.45rem 0.9rem 0.45rem 0; border-bottom: 1px solid var(--rule); vertical-align: baseline; }
thead th { font-family: var(--font-mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 600; border-bottom-color: var(--rule-strong); white-space: nowrap; }
tbody th { font-weight: 600; white-space: nowrap; }
.aqi-row .swatch { margin-right: 0.5rem; vertical-align: -0.1em; }

/* 7 days */
.days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0; margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--rule-strong); }
.day { padding: 1rem 0.9rem 1.1rem; border-right: 1px solid var(--rule); position: relative; transition: background var(--duration-normal) var(--ease-out-expo); }
.day:last-child { border-right: 0; }
.day:hover { background: var(--surface); }
.day-today { background: var(--surface); }
.day-today::before { content: ''; position: absolute; inset: -1px 0 auto; height: 3px; background: var(--accent); }
.day p { margin: 0; }
.day-name { font-weight: 600; font-size: 1.05rem; }
.day-name .ms { display: block; font-weight: 400; font-size: 0.85rem; }
.day-date { font-family: var(--font-mono); font-size: 0.72rem; color: var(--muted); }
.wx-day { width: 2.8rem; height: 2.8rem; margin: 0.6rem 0 0.2rem; }
.day-cond { font-size: 0.88rem; color: var(--ink-2); min-height: 2.6em; line-height: 1.3; }
.day-temps { margin-top: 0.4rem !important; font-variant-numeric: tabular-nums; }
.day-temps .hi { font-size: 1.6rem; font-weight: 400; }
.day-temps .lo { font-size: 1.05rem; color: var(--muted); }
.day-rain { font-family: var(--font-mono); font-size: 0.75rem; color: var(--low); margin-top: 0.2rem !important; }
.day-aqi { margin-top: 0.6rem !important; }
.day-aqi-none { font-family: var(--font-mono); font-size: 0.66rem; color: var(--muted); }
.chip { display: inline-flex; align-items: baseline; gap: 0.35rem; padding: 0.15rem 0.55rem; border-radius: 999px; background: var(--c-bg); color: var(--c-ink); border: 1px solid color-mix(in oklch, var(--c) 55%, transparent); font-size: 0.85rem; white-space: nowrap; }
.chip b { font-family: var(--font-mono); font-weight: 600; }
.chip-s { font-size: 0.75rem; }
.days .chip-label { display: none; }

/* Tile map */
.tiles { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); grid-template-rows: repeat(8, auto); gap: 0.5rem; margin: 0; padding: 0; list-style: none; }
.c0 { grid-column: 1; } .c1 { grid-column: 2; } .c2 { grid-column: 3; } .c3 { grid-column: 4; } .c4 { grid-column: 5; } .c5 { grid-column: 6; } .c6 { grid-column: 7; } .c7 { grid-column: 8; } .c8 { grid-column: 9; }
.r0 { grid-row: 1; } .r1 { grid-row: 2; } .r2 { grid-row: 3; } .r3 { grid-row: 4; } .r4 { grid-row: 5; } .r5 { grid-row: 6; } .r6 { grid-row: 7; } .r7 { grid-row: 8; }
.tile a {
  display: flex; flex-direction: column; justify-content: space-between; min-height: 6.6rem; height: 100%; padding: 0.6rem 0.65rem;
  border-radius: var(--radius-s) var(--radius-m) var(--radius-s) var(--radius-m);
  background: var(--c-bg); color: var(--c-ink); text-decoration: none; border: 1px solid color-mix(in oklch, var(--c) 50%, transparent);
  box-shadow: 0 1px 0 color-mix(in oklch, var(--c) 30%, transparent);
  transition: transform var(--duration-normal) var(--ease-out-expo), box-shadow var(--duration-normal) var(--ease-out-expo);
}
.tile a:hover { transform: translateY(-3px); box-shadow: var(--shadow); color: var(--c-ink); }
.tile a:active { transform: translateY(0) scale(0.98); }
.tile-aqi { font-family: var(--font-mono); font-weight: 600; font-size: 1.5rem; line-height: 1; }
.tile-name { font-weight: 600; font-size: 0.92rem; line-height: 1.15; margin-top: 0.5rem; }
.tile-meta { font-family: var(--font-mono); font-size: 0.62rem; line-height: 1.3; opacity: 0.9; margin-top: 0.2rem; }
.map-legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; margin: 1.2rem 0 0; padding: 0; list-style: none; font-family: var(--font-mono); font-size: 0.74rem; color: var(--ink-2); }
.map-legend li { display: inline-flex; align-items: center; gap: 0.4rem; }

.states-table .chip { font-size: 0.78rem; }

/* Alerts */
.alert-log { list-style: none; margin: 0; padding: 0; }
.alert-item { display: grid; grid-template-columns: 14rem 1fr; gap: 1rem; padding: 0.9rem 0 0.9rem 1rem; border-bottom: 1px solid var(--rule); border-left: 4px solid var(--c); }
.alert-item p { margin: 0; }
.al-when { font-family: var(--font-mono); font-size: 0.8rem; color: var(--muted); }

/* Method */
.prose { max-width: 50rem; }
.prose h2 { font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.4rem); border-bottom: 1px solid var(--rule-strong); padding-bottom: 0.5rem; margin-bottom: 1rem; }
.prose h3 { font-size: 1.3rem; font-weight: 600; margin: 2rem 0 0.4rem; }
.prose p, .prose li { max-width: 68ch; }
.prose li + li { margin-top: 0.5rem; }
.prose table { margin: 0.5rem 0 1.2rem; }

/* Footer */
.colophon { border-top: 1px solid var(--rule-strong); padding: 2rem var(--gutter) 3rem; font-size: 0.9rem; color: var(--ink-2); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.3rem 3rem; }
.colophon p { margin: 0 0 0.8rem; max-width: 70ch; }
.attribution { font-size: 1rem; color: var(--ink); }
.attribution a:first-child { font-weight: 600; }
.freshness { font-family: var(--font-mono); font-size: 0.76rem; }
.is-stale .freshness { color: var(--unhealthy-ink); }

@media (max-width: 1100px) {
  .tiles { grid-template-columns: repeat(9, minmax(0, 1fr)); }
  .tile-meta { display: none; }
  .tile a { min-height: 5.2rem; }
  .tile-name { font-size: 0.8rem; }
}
@media (max-width: 900px) {
  .hero { grid-template-columns: minmax(0, 1fr); }
  .hero-air { margin-top: 0; }
  .air-peek { display: block; }
  .charts { grid-template-columns: minmax(0, 1fr); }
  .days { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(8.4rem, 1fr); overflow-x: auto; scroll-snap-type: x mandatory; }
  .day { scroll-snap-align: start; }
  .colophon { grid-template-columns: minmax(0, 1fr); }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: none; }
  .tiles > .tile { grid-column: auto; grid-row: auto; }
  .tile a { min-height: 0; flex-direction: row; align-items: center; gap: 0.8rem; justify-content: flex-start; }
  .tile-aqi { font-size: 1.25rem; min-width: 2.6ch; }
  .tile-name { margin: 0; font-size: 0.95rem; }
}
@media (max-width: 640px) {
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .facts div:nth-child(2) { border-right: 0; }
  .facts div:nth-child(3) { padding-left: 0; }
  .pollutants { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tiles { grid-template-columns: minmax(0, 1fr); }
  .haze-banner { grid-template-columns: minmax(0, 1fr); }
  .alert-item { grid-template-columns: minmax(0, 1fr); gap: 0.2rem; }
  .masthead nav ul { gap: 0.2rem 0.9rem; }
  .nav-ms { display: none; }
  .masthead { display: grid; grid-template-columns: 1fr auto; }
  .masthead nav { grid-column: 1 / -1; grid-row: 2; }
}
@media print {
  .atmosphere, .theme-toggle, .skip { display: none; }
}
