/* Ghar Ki Hawa: indigo-washed walls, limewash with a pinch of neel, a jaali window and a touch of haldi. */
:root {
  --neel: #1d3a5c;
  --neel-2: #2f557f;
  --plaster: #edf1f3;
  --paper: #fbfcfd;
  --haldi: #e3a72f;
  --ink: #1b2430;
  --muted: #586273;
  --line: #cfd6dc;
  --r: 10px;
  font-family: "Noto Sans", "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans Devanagari", "Nirmala UI", sans-serif;
  color: var(--ink);
  background: var(--plaster);
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
body { margin: 0; }
.wrap { max-width: 36rem; margin: 0 auto; padding: 0 1rem; }
a { color: var(--neel-2); }

/* Header with a jaali lattice, like light coming through a carved window screen. */
.top {
  color: #fff;
  background-color: var(--neel);
  background-image:
    repeating-linear-gradient(45deg, rgba(255,255,255,.07) 0 2px, transparent 2px 16px),
    repeating-linear-gradient(-45deg, rgba(255,255,255,.07) 0 2px, transparent 2px 16px);
  padding: .75rem 0 1rem;
  border-bottom: 4px solid var(--haldi);
}
.top-row { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.brand { color: #fff; text-decoration: none; font-weight: 700; font-size: 1.15rem; display: flex; align-items: center; gap: .5rem; }
.roof { width: 1.1rem; height: 1rem; background: var(--haldi); clip-path: polygon(50% 0, 100% 45%, 100% 100%, 0 100%, 0 45%); }
.tagline { margin: .5rem 0 0; font-size: .95rem; opacity: .92; max-width: 30rem; }
.lang {
  font: inherit; font-size: .9rem; color: #fff; background: transparent;
  border: 1px solid rgba(255,255,255,.5); border-radius: 999px; padding: .3rem .8rem; cursor: pointer; white-space: nowrap;
}

main { padding-top: .5rem; padding-bottom: 1rem; }
h1 { font-size: 1.35rem; line-height: 1.3; margin: .25rem 0 1rem; color: var(--neel); }
h1:focus { outline: none; }
h2 { font-size: 1.05rem; margin: 0 0 .5rem; color: var(--neel); }
h3 { font-size: 1rem; margin: 1rem 0 .25rem; }
.progress { color: var(--muted); font-size: .85rem; margin: .5rem 0 0; min-height: 1.3em; }
.hint, small { color: var(--muted); font-size: .88rem; }
small { display: block; }
.label { margin: 0 0 .4rem; font-weight: 600; font-size: .92rem; }
.msg { color: #9b2c13; min-height: 1.2em; margin: .5rem 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.field { display: flex; flex-direction: column; gap: .25rem; font-size: .9rem; font-weight: 600; }
input[type=search], input[type=number], select {
  font: inherit; font-size: 1rem; width: 100%; padding: .65rem .7rem; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--r);
}
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible, .opt:focus-within {
  outline: 3px solid var(--haldi); outline-offset: 2px;
}

.cities { list-style: none; padding: 0; margin: .75rem 0; display: grid; gap: .4rem; }
.city {
  font: inherit; width: 100%; text-align: left; padding: .6rem .8rem; cursor: pointer;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); color: var(--ink);
}
.city small { display: inline; margin-left: .35rem; }
.city.on { border-color: var(--neel); box-shadow: inset 4px 0 0 var(--neel); }

.chips { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .25rem; margin-bottom: .9rem; }
.chip {
  font: inherit; font-size: .9rem; white-space: nowrap; padding: .45rem .8rem; cursor: pointer;
  background: var(--paper); color: var(--neel); border: 1px solid var(--neel-2); border-radius: 999px;
}
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; margin-bottom: .9rem; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: block; padding: .4rem .9rem; font-size: .9rem; }
.seg input:checked + span { background: var(--neel); color: #fff; }
.seg input:focus-visible + span { outline: 3px solid var(--haldi); }
.dims { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }

.options { display: grid; gap: .5rem; }
.opt {
  display: flex; gap: .7rem; align-items: flex-start; padding: .75rem .85rem; cursor: pointer;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--r);
}
.opt input { margin-top: .3rem; accent-color: var(--neel); width: 1.1rem; height: 1.1rem; flex: none; }
.opt:has(input:checked) { border-color: var(--neel); box-shadow: inset 4px 0 0 var(--neel); }
.sub { margin-top: .9rem; }
.with-unit { display: flex; gap: .4rem; }
.with-unit select { width: auto; }

/* Back is a text link beside the main button: one row at every width. */
.nav, .row, .fb-row { display: flex; flex-wrap: nowrap; align-items: center; gap: .75rem; margin-top: 1.25rem; }
.nav { justify-content: space-between; }
.nav .primary { margin-left: auto; }
.primary {
  font: inherit; font-weight: 700; white-space: nowrap; text-decoration: none; display: inline-block; cursor: pointer;
  padding: .7rem 1.3rem; color: #fff; background: var(--neel); border: 0; border-radius: var(--r);
  transition: background-color .15s ease, transform .1s ease;
}
.primary:hover { background: var(--neel-2); }
.primary:active { transform: translateY(1px); }
.primary:disabled { background: #9aa6b4; cursor: not-allowed; }
.link, .ghost {
  font: inherit; background: none; border: 0; padding: .5rem 0; color: var(--neel-2);
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer; white-space: nowrap;
}
[hidden] { display: none !important; }

.card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--r);
  padding: .9rem 1rem; margin: 0 0 .9rem; animation: rise .25s ease-out both;
}
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) { .card { animation: none; } .primary { transition: none; } }
.ln { margin: .25rem 0; }
.ln.outdoor, .ln.cadr { font-weight: 600; }
.ln.health { font-style: italic; }
.outdoor { border-left-width: 6px; }
/* CPCB AQI category colours */
.cat-good { border-left-color: #00b050; }
.cat-satisfactory { border-left-color: #92d050; }
.cat-moderate { border-left-color: #e6c300; }
.cat-poor { border-left-color: #ff9900; }
.cat-very_poor { border-left-color: #e00000; }
.cat-severe { border-left-color: #8b0000; }
.indoor table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.indoor th, .indoor td { text-align: left; padding: .45rem .3rem; border-top: 1px solid var(--line); vertical-align: top; }
.indoor thead th { border-top: 0; color: var(--muted); font-weight: 600; }
.indoor td { white-space: nowrap; font-weight: 700; }
.safety { background: #fff6e0; border-color: #ecd08a; }
.wa { background: #1f6f4a; }
.wa:hover { background: #1a5c3e; }
.fb-row { align-items: flex-end; }
.fb-row .field { flex: 1 1 0; min-width: 0; }
.fb-row .primary { padding-left: .9rem; padding-right: .9rem; }
.loading { color: var(--muted); }

.how { margin-top: 2rem; border-top: 1px solid var(--line); padding-top: .75rem; }
.how summary { cursor: pointer; font-weight: 700; color: var(--neel); }
.how .eq { font-family: "Noto Sans Mono", Menlo, Consolas, monospace; font-size: .9rem; background: var(--paper); padding: .5rem; border-radius: 6px; }
.how li { margin-bottom: .4rem; }
.src { font-size: .88rem; }

.foot { color: var(--muted); font-size: .85rem; padding-bottom: 2rem; }
.foot p { margin: .3rem 0; }

table.stats { width: 100%; border-collapse: collapse; background: var(--paper); font-size: .92rem; }
table.stats th, table.stats td { padding: .4rem .5rem; border-bottom: 1px solid var(--line); text-align: left; }

@media (max-width: 400px) {
  .primary { padding: .65rem 1rem; }
  .fb-row .primary { padding: .65rem .7rem; font-size: .9rem; }
  .dims { gap: .35rem; }
  .indoor table { font-size: .85rem; }
}
html[lang=hi] .ln.health { font-style: normal; }
.row { margin-bottom: .9rem; }
.chips { scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
@media (max-width: 400px) { .chip { font-size: .84rem; padding: .4rem .6rem; } .chips { gap: .3rem; } }
