:root {
  --ink: #171b24;
  --muted: #5c6470;
  --paper: #f6f4ee;
  --card: #ffffff;
  --line: #e1ded3;
  --teal: #223b66;
  --teal-dark: #16263f;
  --amber: #c3781f;
  --red: #b3261e;
  --shadow: 0 18px 50px rgba(23, 27, 36, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--paper); }
button, input { font: inherit; }
button { cursor: pointer; }
a { color: var(--teal-dark); }
.shell { width: min(1180px, calc(100% - 36px)); margin: 0 auto; }
.site-header { padding: 54px 0 42px; color: white; background: linear-gradient(120deg, #101828, #223b66 65%, #3a5a99); }
.header-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 40px; align-items: end; }
.eyebrow { margin: 0 0 8px; text-transform: uppercase; letter-spacing: .14em; font-size: .75rem; font-weight: 800; }
h1 { margin: 0; max-width: 800px; font-size: clamp(2.4rem, 7vw, 5.8rem); line-height: .92; letter-spacing: -.055em; }
.intro { max-width: 760px; margin: 24px 0 0; font-size: 1.07rem; line-height: 1.7; color: rgba(255,255,255,.86); }
.header-mark { display: grid; place-items: center; width: 150px; height: 150px; border: 1px solid rgba(255,255,255,.35); border-radius: 50%; }
.header-mark span { display: block; font-size: 3.8rem; font-weight: 850; line-height: .9; }
.header-mark small { display: block; text-transform: uppercase; letter-spacing: .18em; }
.main-shell { padding: 0 0 72px; }
.search-panel { position: relative; z-index: 2; display: grid; grid-template-columns: 1fr minmax(320px, 1.5fr); gap: 18px 32px; align-items: center; margin-top: -24px; padding: 24px 28px; background: var(--card); border: 1px solid rgba(16,33,43,.1); border-radius: 18px; box-shadow: var(--shadow); }
.search-panel h2 { margin: 0 0 3px; font-size: 1.25rem; }
.search-panel p { margin: 0; color: var(--muted); }
.zip-form { display: flex; gap: 10px; }
.zip-form input { min-width: 0; flex: 1; padding: 15px 17px; border: 1px solid #aebbc0; border-radius: 10px; background: white; font-size: 1.1rem; letter-spacing: .05em; }
.zip-form input:focus { outline: 3px solid rgba(8,127,117,.18); border-color: var(--teal); }
.zip-form button { padding: 14px 22px; border: 0; border-radius: 10px; color: white; background: var(--teal); font-weight: 800; }
.zip-form button:hover { background: var(--teal-dark); }
.profile-field { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; padding-top: 4px; }
.profile-field label { font-size: .85rem; font-weight: 700; color: var(--muted); }
.profile-field select { padding: 9px 12px; border: 1px solid #aebbc0; border-radius: 8px; background: white; font-size: .92rem; }
.profile-note { grid-column: 1 / -1; margin: 0; font-size: .8rem; color: var(--muted); }
.demo-controls { grid-column: 2; display: flex; gap: 18px; }
.text-button { padding: 0; border: 0; color: var(--teal-dark); background: none; font-size: .85rem; text-decoration: underline; text-underline-offset: 3px; }
.form-message { grid-column: 2; min-height: 1.2em; color: var(--red) !important; font-weight: 700; }
.welcome-panel { display: grid; grid-template-columns: 1fr 1.25fr; gap: 60px; padding: 86px 0 34px; }
.welcome-copy h2 { max-width: 500px; margin: 0 0 18px; font-size: clamp(2rem, 4vw, 3.6rem); line-height: 1; letter-spacing: -.04em; }
.welcome-copy p:last-child { max-width: 560px; line-height: 1.7; color: var(--muted); }
.gate-list { border-top: 1px solid var(--line); }
.gate-list > div { display: grid; grid-template-columns: 48px 1fr; gap: 16px; padding: 19px 0; border-bottom: 1px solid var(--line); }
.gate-list span { color: var(--teal); font-weight: 850; }
.gate-list p { margin: 0; color: var(--muted); line-height: 1.45; }
.gate-list strong { display: block; color: var(--ink); }
.loading-panel { display: flex; gap: 18px; align-items: center; margin-top: 36px; padding: 25px; border: 1px solid var(--line); border-radius: 15px; background: var(--card); }
.loading-panel span { display: block; margin-top: 5px; color: var(--muted); }
.spinner { width: 34px; height: 34px; border: 4px solid #d7e5e2; border-top-color: var(--teal); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.hidden { display: none !important; }
.result-head { display: flex; justify-content: space-between; gap: 22px; align-items: end; padding: 46px 0 22px; border-bottom: 1px solid var(--line); }
.result-head h2 { margin: 0; font-size: clamp(2rem, 5vw, 4rem); letter-spacing: -.05em; }
.result-head p { margin: 8px 0 0; color: var(--muted); }
.status-badge { flex: 0 0 auto; padding: 9px 13px; border-radius: 999px; font-size: .82rem; font-weight: 850; }
.status-badge.available { color: #07554f; background: #dff6ef; }
.status-badge.withheld { color: #8b2a22; background: #fee8e6; }
.withheld-card { margin-top: 28px; padding: 30px; border: 2px solid #e6a49d; border-radius: 18px; background: #fff7f6; }
.withheld-kicker { color: var(--red); font-size: .82rem; font-weight: 850; text-transform: uppercase; letter-spacing: .12em; }
.profile-alert { display: flex; gap: 14px; align-items: flex-start; padding: 18px 20px; border-radius: 14px; margin: 0 0 22px; border: 1px solid #f0d6ad; background: #fdf3e2; }
.profile-alert.is-clear { border-color: #bfe0d4; background: #eaf7f1; }
.profile-alert .mark { flex: 0 0 auto; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; font-weight: 850; color: white; background: var(--amber); }
.profile-alert.is-clear .mark { background: var(--teal); }
.profile-alert strong { display: block; margin-bottom: 3px; }
.profile-alert p { margin: 0; color: var(--muted); line-height: 1.5; }
.withheld-card h3 { margin: 8px 0 10px; font-size: clamp(1.7rem, 4vw, 2.8rem); }
.withheld-card > p { max-width: 800px; color: #74413c; line-height: 1.6; }
.reason-list { display: grid; gap: 10px; margin: 24px 0 0; padding: 0; list-style: none; }
.reason-list li { padding: 14px 16px 14px 44px; position: relative; border: 1px solid #efc5c0; border-radius: 10px; background: white; }
.reason-list li::before { content: "!"; position: absolute; left: 15px; top: 13px; display: grid; place-items: center; width: 20px; height: 20px; color: white; background: var(--red); border-radius: 50%; font-size: .75rem; font-weight: 900; }
.diagnostic-grid, .metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; margin-top: 22px; }
.metric-card, .diagnostic-card { padding: 18px; border: 1px solid var(--line); border-radius: 13px; background: var(--card); }
.metric-card small, .diagnostic-card small { display: block; color: var(--muted); font-weight: 700; }
.metric-card strong, .diagnostic-card strong { display: block; margin-top: 7px; font-size: 1.45rem; }
.metric-card span, .diagnostic-card span { display: block; margin-top: 5px; color: var(--muted); font-size: .82rem; }
.forecast-layout { display: grid; grid-template-columns: 1.6fr .7fr; gap: 18px; margin-top: 18px; }
.chart-card, .context-card, .hourly-card, .sources-card { border: 1px solid var(--line); border-radius: 16px; background: var(--card); box-shadow: 0 10px 35px rgba(16,33,43,.045); }
.chart-card { padding: 20px; overflow: hidden; }
.card-head { display: flex; justify-content: space-between; gap: 15px; align-items: baseline; margin-bottom: 12px; }
.card-head h3 { margin: 0; font-size: 1.15rem; }
.card-head p { margin: 0; color: var(--muted); font-size: .82rem; }
#aqi-chart { display: block; width: 100%; min-height: 365px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 8px; color: var(--muted); font-size: .78rem; }
.legend-key { display: inline-flex; gap: 6px; align-items: center; }
.legend-swatch { width: 18px; height: 6px; border-radius: 4px; }
.context-card { padding: 20px; }
.context-block + .context-block { margin-top: 23px; padding-top: 20px; border-top: 1px solid var(--line); }
.context-block h3 { margin: 0 0 8px; font-size: .9rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.context-block strong { font-size: 1.3rem; }
.context-block p { margin: 7px 0 0; color: var(--muted); line-height: 1.5; }
.hourly-card { margin-top: 18px; padding: 20px; }
.hourly-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
.hourly-table { width: 100%; min-width: 900px; border-collapse: collapse; font-size: .86rem; }
.hourly-table th { position: sticky; top: 0; padding: 11px 12px; text-align: left; color: var(--muted); background: #f3f5f1; }
.hourly-table td { padding: 11px 12px; border-top: 1px solid var(--line); vertical-align: top; }
.aqi-pill { display: inline-flex; min-width: 42px; justify-content: center; padding: 4px 8px; border-radius: 999px; color: #10212b; background: #eee; font-weight: 850; }
.aqi-pill.dark { color: white; }
.sources-card { margin-top: 18px; padding: 20px; }
.source-list { display: grid; gap: 10px; }
.source-row { display: grid; grid-template-columns: 1.1fr .9fr 2fr; gap: 15px; padding: 12px 0; border-top: 1px solid var(--line); }
.source-row:first-child { border-top: 0; }
.source-row strong { display: block; }
.source-row span, .source-row p { margin: 0; color: var(--muted); font-size: .86rem; line-height: 1.45; }
.source-state { text-transform: uppercase; letter-spacing: .08em; font-weight: 850; font-size: .7rem !important; color: var(--teal-dark) !important; }
.method-details { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.method-details summary { cursor: pointer; font-weight: 800; }
.method-details p, .method-details li { color: var(--muted); line-height: 1.6; }
.site-footer { padding: 30px 0 40px; color: #d8e9e6; background: #102f35; }
.footer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }
.footer-grid p { margin: 0; line-height: 1.6; font-size: .85rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
@media (max-width: 860px) {
  .header-mark { display: none; }
  .search-panel { grid-template-columns: 1fr; }
  .demo-controls, .form-message { grid-column: 1; }
  .welcome-panel, .forecast-layout, .footer-grid { grid-template-columns: 1fr; }
  .diagnostic-grid, .metric-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .source-row { grid-template-columns: 1fr; gap: 5px; }
}
@media (max-width: 560px) {
  .shell { width: min(100% - 22px, 1180px); }
  .site-header { padding-top: 38px; }
  .search-panel { padding: 20px; }
  .zip-form { flex-direction: column; }
  .demo-controls { flex-direction: column; gap: 8px; align-items: flex-start; }
  .result-head { align-items: flex-start; flex-direction: column; }
  .diagnostic-grid, .metric-grid { grid-template-columns: 1fr; }
  .welcome-panel { padding-top: 60px; }
}

.tracking-notice {
  grid-column: 1 / -1;
  padding-top: 18px;
  border-top: 1px solid rgba(216,233,230,.25);
}
