/* BreatheEasy styles: mobile-first, high-contrast, print-friendly. */
:root {
  --ink: #12222b; --muted: #4a5d68; --bg: #f4f7f6; --card: #ffffff; --line: #d5e0e0;
  --brand: #0f4c5c; --brand-2: #1b7a8c; --accent: #e36414;
  --green: #1d7a3a; --green-bg: #e3f4e8; --yellow: #8a6a00; --yellow-bg: #fff6d1; --red: #b3261e; --red-bg: #fde7e5;
  --radius: 6px; --shadow: none;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Charter, "Bitstream Charter", Georgia, serif;
}
h1, h2, h3 { font-family: var(--serif); font-weight: 700; }
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 64px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; animation: none !important; } }
body { overflow-wrap: break-word; /* long unbroken place names wrap instead of widening the page */  margin: 0; font: 16px/1.55 var(--font); color: var(--ink); background: var(--bg); -webkit-text-size-adjust: 100%; }
.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px; }
a { color: var(--brand-2); }
a:hover { color: var(--brand); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 8px; top: -60px; background: var(--brand); color: #fff; padding: 10px 14px; border-radius: 4px; z-index: 100; }
.skip:focus { top: 8px; color: #fff; }

/* header */
.top { background: #fff; color: var(--ink); border-bottom: 1px solid var(--line); }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 14px; padding-bottom: 14px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.logo { width: 36px; height: 36px; flex: none; }
.logo rect { fill: var(--brand); }
.logo path { stroke: #fff; stroke-width: 5; fill: none; stroke-linecap: round; }
.name { margin: 0; line-height: 1.2; font-size: 1.35rem; color: var(--brand); }
.tagline { margin: 0; font-size: .92rem; color: var(--muted); }
.lang select { background: #fff; color: var(--ink); border: 1.5px solid #9fb3b8; border-radius: 4px; padding: 8px 10px; font: inherit; min-height: 44px; min-width: 76px; }
.lang option { color: var(--ink); }
.safety { background: #fff8e6; color: #3d2e00; border-bottom: 1px solid #f0dca0; font-size: .86rem; }
@media (min-width: 640px) { .safety { font-size: .92rem; } }
.safety p { margin: 6px 0; }
.safety .wrap { padding-top: 6px; padding-bottom: 6px; }
.safety-911 { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.btn-911 { display: inline-flex; align-items: center; min-height: 40px; padding: 6px 14px; border-radius: 4px; background: var(--red); color: #fff !important; font-weight: 700; text-decoration: none; }

/* tabs */
.tabs { position: sticky; top: 0; z-index: 20; background: #fff; border-bottom: 1px solid var(--line); }
.tabs-row { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs a { flex: none; padding: 12px 9px; font-size: .95rem; min-height: 44px; color: var(--muted); text-decoration: none; font-weight: 600; border-bottom: 3px solid transparent; }
.tabs a:hover, .tabs a:focus-visible { color: var(--brand); border-bottom-color: var(--brand-2); }
/* more tabs to the right (Spanish labels at phone width): fade the edge so the cut-off tab reads as 'scroll for more' */
.tabs-row.more { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent); }

main { padding-top: 8px; padding-bottom: 48px; outline: none; }
section { padding-top: 24px; }
h2 { font-size: 1.45rem; margin: 0 0 6px; }
h3 { font-size: 1.12rem; margin: 18px 0 8px; }
h4 { font-size: 1rem; margin: 16px 0 6px; }
.lead { color: var(--muted); margin: 0 0 12px; }
.fine { color: var(--muted); font-size: .86rem; }
.status { color: var(--muted); min-height: 1.2em; margin: 6px 0; }
.status-warn { color: var(--ink); font-weight: 600; border-left: 4px solid #e8a33d; padding-left: 8px; }
.sub { margin-top: 22px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin: 12px 0; }
.section-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 10px; }
.loc { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; max-width: 100%; }
.loc label { font-weight: 600; font-size: .92rem; }

/* buttons + inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 10px 16px; border-radius: 4px; border: 1.5px solid var(--brand); background: var(--brand); color: #fff; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { background: #0b3a47; }
.btn.ghost { background: #fff; color: var(--brand); }
.btn.ghost:hover { background: #eaf3f4; }
.btn.danger { background: #fff; color: var(--red); border-color: var(--red); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.share-box { margin-top: 14px; padding: 14px; border: 1px solid #d5e3e6; border-radius: 4px; background: #f6fafb; }
.share-box label { display: block; font-weight: 700; margin-bottom: 6px; }
.share-box textarea { width: 100%; box-sizing: border-box; font: inherit; font-size: 0.95rem; line-height: 1.45; padding: 10px; border: 1px solid #b9cdd1; border-radius: 4px; resize: vertical; }
select, input[type=number], input[type=text], input[type=search], input[type=tel], input[type=date], textarea {
  font: inherit; color: var(--ink); background: #fff; border: 1.5px solid #9fb3b8; border-radius: 4px; padding: 10px 12px; min-height: 44px; width: 100%;
}
.loc select { width: auto; max-width: 100%; min-width: 0; text-overflow: ellipsis; } /* a long searched city name must not widen the page */
textarea { resize: vertical; }
.form .field { margin-bottom: 14px; }
.field label { display: block; font-weight: 600; margin-bottom: 4px; }
.hint { margin: 4px 0 0; font-size: .86rem; color: var(--muted); }
.row2 { display: grid; gap: 0 16px; grid-template-columns: 1fr; }
fieldset { border: 1px solid var(--line); border-radius: 4px; padding: 10px 12px 6px; margin: 0 0 14px; }
legend { font-weight: 700; padding: 0 6px; display: flex; align-items: center; gap: 8px; }
.checks { display: grid; grid-template-columns: 1fr; gap: 2px 14px; }
.chk { display: flex; align-items: flex-start; gap: 10px; padding: 8px 4px; min-height: 44px; cursor: pointer; font-weight: 500; }
.chk input { width: 22px; height: 22px; margin: 1px 0 0; flex: none; accent-color: var(--brand); }
.check-inline { display: flex; align-items: center; }
.check-inline label { display: flex; gap: 10px; align-items: center; font-weight: 600; }
.check-inline input { width: 22px; height: 22px; accent-color: var(--brand); }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.dot.y { background: #e0b400; } .dot.r { background: var(--red); } .dot.d { background: #5b0e0a; }
.sym.danger { border-color: #e7b3ae; background: #fff7f6; }
.zone-g textarea { border-left: 5px solid var(--green); }
.zone-y textarea { border-left: 5px solid #e0b400; }
.zone-r textarea { border-left: 5px solid var(--red); }

/* plan card */
.plan-card { border-top: 6px solid var(--line); }
.plan-card[data-cat=good] { border-top-color: #00b300; }
.plan-card[data-cat=moderate] { border-top-color: #e6c800; }
.plan-card[data-cat=usg] { border-top-color: #ff7e00; }
.plan-card[data-cat=unhealthy] { border-top-color: #ff0000; }
.plan-card[data-cat=very] { border-top-color: #8f3f97; }
.plan-card[data-cat=hazardous] { border-top-color: #7e0023; }
.pc-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.eyebrow { margin: 0; font-size: .9rem; font-weight: 600; color: var(--muted); }
.pc-top h3 { margin: 2px 0 0; font-size: 1.3rem; }
.aqi-badge { flex: none; width: 92px; height: 92px; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; background: #e7eeee; color: var(--ink); border: 3px solid rgba(0, 0, 0, .12); }
.aqi-num { font-size: 2rem; font-weight: 800; line-height: 1; }
.aqi-label { font-size: .78rem; font-weight: 700; letter-spacing: .06em; }
.pc-cat { font-weight: 700; font-size: 1.1rem; margin: 8px 0 4px; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 8px 0; font-size: .95rem; }
/* phones: cap the label column so long values (the Spanish pollen note) get the width, not the label */
@media (max-width: 480px) { .facts { grid-template-columns: minmax(0, 38%) minmax(0, 1fr); } }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; }
.guidance { margin: 0; padding-left: 1.2em; }
.guidance li { margin: 6px 0; }
.gi-g_plan_exercise { font-weight: 600; }
.gi-g_follow_plan { font-weight: 600; }
.outlook { margin-top: 12px; padding: 12px; background: #f1f6f6; border-radius: 4px; }
.outlook h4 { margin-top: 0; }
.outlook p { margin: 0; }
.risk { display: inline-block; padding: 2px 8px; border-radius: 3px; font-weight: 700; }
.risk-low { background: var(--green-bg); color: var(--green); }
.risk-elevated { background: var(--yellow-bg); color: var(--yellow); }
.risk-high { background: var(--red-bg); color: var(--red); }

/* strip */
.strip { list-style: none; padding: 0; margin: 8px 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.day { background: #fff; border: 1px solid var(--line); border-radius: 4px; padding: 12px; display: grid; gap: 4px; justify-items: start; }
.d-name { font-weight: 700; }
.d-aqi { font-size: 1.3rem; font-weight: 800; padding: 2px 10px; border-radius: 3px; border: 1px solid rgba(0, 0, 0, .1); }
.d-cat { font-size: .88rem; }
.d-dom { font-size: .8rem; color: var(--muted); }

/* check-in result */
.result { border-radius: var(--radius); padding: 16px 18px; margin: 12px 0; border: 2px solid var(--line); background: #fff; }
.result.zone-green { border-color: var(--green); background: var(--green-bg); }
.result.zone-yellow { border-color: #e0b400; background: var(--yellow-bg); }
.result.zone-red { border-color: var(--red); background: var(--red-bg); }
.zone-name { font-size: 1.25rem; font-weight: 800; margin: 0 0 4px; }
.result blockquote { margin: 6px 0 10px; padding: 10px 14px; background: #fff; border-left: 4px solid currentColor; border-radius: 0; white-space: pre-wrap; }
.says { font-weight: 700; margin: 8px 0 0; }
.danger-alert { background: var(--red); color: #fff; padding: 12px 14px; border-radius: 4px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.danger-alert .btn-911 { background: #fff; color: var(--red) !important; }
.red-call { font-weight: 600; }

/* insights */
.demo-banner { background: #fff8e6; color: #3d2e00; border: 2px dashed #8a6a00; border-radius: 4px; padding: 10px 14px; font-weight: 700; }
.wchart { margin: 10px 0; display: grid; gap: 8px; }
.wrow { display: grid; grid-template-columns: 9.5em 1fr; align-items: center; gap: 8px; font-size: .92rem; }
.wtrack { position: relative; height: 16px; background: #eef3f3; border-radius: 2px; }
.wtrack::before { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 2px; background: #9fb3b8; }
.wbar { position: absolute; top: 0; height: 100%; border-radius: 2px; }
.wbar.pos { left: 50%; background: var(--accent); }
.wbar.neg { right: 50%; background: var(--brand-2); }
.sr-table { width: 100%; border-collapse: collapse; font-size: .9rem; margin-top: 8px; }
.sr-table th, .sr-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.why { padding-left: 1.2em; }
.why li.up::marker { color: var(--accent); }
.history { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 6px; }
.h-item { display: flex; gap: 10px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 4px; padding: 8px 12px; font-size: .92rem; }
.zchip { font-weight: 700; font-size: .8rem; padding: 2px 8px; border-radius: 3px; white-space: nowrap; }
.z-green { background: var(--green-bg); color: var(--green); }
.z-yellow { background: var(--yellow-bg); color: var(--yellow); }
.z-red { background: var(--red-bg); color: var(--red); }

.prose p, .prose li { max-width: 70ch; }
.sources li { margin: 6px 0; }
.foot { border-top: 1px solid var(--line); color: var(--muted); font-size: .88rem; padding: 18px 0 28px; }

@media (min-width: 640px) {
  .row2 { grid-template-columns: 1fr 1fr; }
  .checks { grid-template-columns: 1fr 1fr; }
  .strip { grid-template-columns: repeat(4, 1fr); }
  .aqi-badge { width: 108px; height: 108px; }
  .aqi-num { font-size: 2.4rem; }
  .card { padding: 22px 24px; }
}

@media print {
  h1, h2, h3 { font-family: var(--font); }
  .tabs, .skip, .no-print, .actions, #checkin, #plan, #insights, #about, .loc, .foot, .status { display: none !important; }
  body { background: #fff; }
  .top { background: #fff; color: #000; }
  .logo rect { fill: #0f4c5c; }
  .card { box-shadow: none; border: 1px solid #999; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: .8em; }
  /* one Letter page: tighter type and spacing, cards never split, the 911 line stays as text */
  @page { size: letter; margin: 0.45in; }
  body { font-size: 9.5pt; line-height: 1.28; }
  .logo { width: 28px; height: 28px; }
  .lang { display: none !important; }
  .top-row { padding-top: 2px; padding-bottom: 2px; }
  .safety p { margin: 2px 0; }
  main { padding-top: 0; }
  main { padding-bottom: 0; }
  .aqi-badge { width: 72px !important; height: 72px !important; }
  .aqi-num { font-size: 22pt !important; }
  #pc-h { font-size: 13pt; margin: 2px 0; }
  h3 { margin: 6px 0 3px; }
  .outlook { padding: 6px 10px; margin-top: 6px; }
  .strip > li { padding: 6px 8px; }
  .strip h3, .strip p { margin: 2px 0; }
  .top .wrap, .safety .wrap { padding-top: 4px; padding-bottom: 4px; }
  .btn-911 { display: none !important; }
  section { padding-top: 6px; }
  h2 { font-size: 14pt; margin: 2px 0 4px; }
  .card { padding: 10px 12px; margin: 6px 0; }
  .plan-card, .strip > li { break-inside: avoid; }
  .facts { margin: 4px 0; font-size: 10pt; gap: 1px 10px; }
  .guidance li { margin: 2px 0; }
  .strip { grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 4px 0; }
}

/* explain a past day */
.btn-mini { margin-left: auto; min-height: 40px; padding: 6px 12px; font-size: .85rem; }
.h-text { min-width: 0; }
.ex-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 700; margin: 10px 0 4px; }
.ex-now { font-weight: 600; }
.ex-before { color: var(--muted); }
.ex-list { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 8px; }
.ex-row { display: grid; grid-template-columns: minmax(0, 11em) 1fr auto; gap: 8px; align-items: center; font-size: .9rem; }
.ex-edge { grid-template-columns: 1fr auto; font-weight: 700; border-top: 1px dashed var(--line); padding-top: 6px; }
.ex-edge:first-child { border-top: 0; border-bottom: 1px dashed var(--line); padding: 0 0 6px; }
.ex-val { white-space: nowrap; font-variant-numeric: tabular-nums; }
.ex-row.up .ex-val { color: #a3470c; }
.ex-row.down .ex-val { color: var(--brand); }
@media (max-width: 480px) { .ex-row { grid-template-columns: 1fr auto; } .ex-row .wtrack { grid-column: 1 / -1; grid-row: 2; } }

/* SYNTHETIC model check */
.trust { margin-top: 16px; }
.synth-tag { display: inline-block; background: #fff8e6; color: #3d2e00; border: 2px dashed #8a6a00; border-radius: 4px; padding: 4px 10px; font-weight: 700; font-size: .85rem; margin: 0 0 6px; }
.trust-grid { display: grid; gap: 18px; }
@media (min-width: 760px) { .trust-grid { grid-template-columns: 1fr 1fr; } }
.tfig { margin: 0; min-width: 0; }
.tfig figcaption { margin-bottom: 6px; }
.tchart { max-width: 360px; }
.tsvg { width: 100%; height: auto; display: block; }
.tsvg .ax { stroke: #9fb3b8; stroke-width: 1; }
.tsvg .axl { font-size: 11px; fill: var(--muted); }
.tsvg .tick { font-size: 10px; fill: var(--muted); }
.tsvg .diag { stroke: #7d8f95; stroke-dasharray: 4 4; stroke-width: 1.2; }
.tsvg .ln { fill: none; stroke-width: 2.4; }
.tsvg .ln.model { stroke: var(--accent); }
.tsvg .ln.base { stroke: #7d8f95; stroke-dasharray: 2 3; }
.tsvg .ln.best { stroke: var(--brand-2); stroke-dasharray: 6 4; }
.tsvg .dot { fill: var(--accent); stroke: #fff; stroke-width: 1.5; }
#rel-table th[scope="row"] { white-space: nowrap; }

/* Windows High Contrast / forced-colors: keep focus and card edges visible */
@media (forced-colors: active) {
  .card { border: 1px solid CanvasText; }
  :focus-visible { outline: 3px solid Highlight; outline-offset: 2px; }
  button, select, input { border: 1px solid ButtonText; }
}

/* place search */
.place-search { margin: 10px 0 4px; }
.place-search label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 4px; }
.ps-row { display: flex; gap: 8px; }
.ps-row input { flex: 1 1 auto; min-width: 0; min-height: 44px; }
.place-results { list-style: none; margin: 6px 0 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.place-results:empty { display: none; }
.place-results button { width: 100%; min-width: 0; justify-content: flex-start; text-align: left; font-weight: 600; overflow-wrap: anywhere; }
.try-demo { margin-top: 10px; }
.try-demo[hidden] { display: none; }
.demo-tag { display: inline-block; margin-left: 8px; padding: 2px 8px; border-radius: 3px; background: #fff8e6; color: #3d2e00; border: 1.5px dashed #8a6a00; font-size: .8rem; font-weight: 700; }

/* Spanish users: hidden until js/app.js has applied the Spanish strings (no flash of English); always shown after 3 s. */
html.i18n-wait body { visibility: hidden; animation: i18n-reveal 0s linear 3s forwards; }
@keyframes i18n-reveal { to { visibility: visible; } }

/* Form errors (check-in, plan): red text, AA on white; empty ones take no space. */
.form-err { color: var(--red); font-weight: 600; margin: 6px 0; }
.form-err:empty { display: none; }
