/*
 * Water-quality report card — the only stylesheet this feature adds.
 *
 * It sits on top of the site's own Kadence CSS and stays inside a .wq- prefix
 * so nothing here can reach another page. Colours are the locked brand pair
 * (navy #000080, cyan #00aeef); the grade colours are the traffic-light set
 * from Grok's prototype, kept so the report card reads the same as the
 * designs that were approved.
 */
.wq {
  --wq-navy: #000080;
  --wq-cyan: #00aeef;
  --wq-ink: #10233a;
  --wq-soft: #4a5c72;
  --wq-mute: #6b7c92;
  --wq-line: #dbe4ee;
  --wq-paper: #f3f8fc;
  --wq-white: #fff;
  --wq-green: #1f8f5f;
  --wq-amber: #c07a12;
  --wq-red: #c8362b;
  color: var(--wq-ink);
}

.wq * { box-sizing: border-box; }
.wq h2, .wq h3 { color: var(--wq-navy); line-height: 1.2; }
.wq p { margin: 0 0 12px; }
.wq a { color: var(--wq-navy); }

/* ---- the three pages ------------------------------------------------- */

.wq-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 22px 0 18px;
  padding: 6px;
  background: var(--wq-white);
  border: 1px solid var(--wq-line);
  border-radius: 12px;
}
.wq .wq-tab {
  flex: 1 1 auto;
  text-align: center;
  padding: 11px 16px;
  border-radius: 8px;
  font-weight: 700;
  color: var(--wq-navy);
  text-decoration: none;
}
.wq .wq-tab:hover, .wq .wq-tab:focus { background: var(--wq-paper); text-decoration: none; }
.wq .wq-tab.on { background: var(--wq-navy); color: #fff; }

/* ---- the lookup ------------------------------------------------------- */

.wq-lookup {
  background: var(--wq-paper);
  border: 1px solid var(--wq-line);
  border-radius: 14px;
  padding: 22px 24px;
  margin: 0 0 26px;
}
.wq-lookup h2 { margin: 0 0 6px; font-size: 1.6rem; }
.wq-lede { color: var(--wq-soft); max-width: 62ch; }

.wq-form { display: flex; gap: 10px; flex-wrap: wrap; margin: 16px 0 0; }
.wq-form input[type="text"] {
  flex: 1 1 260px;
  min-width: 0;
  padding: 13px 15px;
  font-size: 1.05rem;
  border: 2px solid var(--wq-line);
  border-radius: 10px;
  background: var(--wq-white);
  color: var(--wq-ink);
}
.wq-form input[type="text"]:focus {
  outline: none;
  border-color: var(--wq-cyan);
  box-shadow: 0 0 0 3px rgba(0, 174, 239, 0.22);
}

/* Every button rule is written as `.wq .wq-btn…` on purpose. A plain
   `.wq-btn-navy` loses to the `.wq a` colour above on specificity, which put
   navy text on a navy button — invisible. Two classes beat a class plus an
   element, so these hold. */
.wq .wq-btn {
  display: inline-block;
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.2;
  padding: 14px 22px;
  border: 2px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.wq .wq-btn-cyan { background: var(--wq-cyan); border-color: var(--wq-cyan); color: #04263a; }
.wq .wq-btn-navy { background: var(--wq-navy); border-color: var(--wq-navy); color: #fff; }
.wq .wq-btn-emergency { background: var(--wq-red); border-color: var(--wq-red); color: #fff; }
.wq .wq-btn:hover, .wq .wq-btn:focus { filter: brightness(1.07); text-decoration: none; }
.wq .wq-btn-cyan:hover, .wq .wq-btn-cyan:focus { color: #04263a; }
.wq .wq-btn-navy:hover, .wq .wq-btn-navy:focus,
.wq .wq-btn-emergency:hover, .wq .wq-btn-emergency:focus { color: #fff; }

.wq-status { min-height: 1.2em; margin: 10px 0 0; color: var(--wq-red); font-weight: 600; }

.wq-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 0; }
.wq .wq-chip {
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  background: var(--wq-white);
  border: 1px solid var(--wq-line);
  color: var(--wq-navy);
  border-radius: 99px;
  padding: 7px 8px 7px 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.wq .wq-chip:hover, .wq .wq-chip:focus { border-color: var(--wq-cyan); outline: none; }
.wq-chip-grade {
  font-size: 0.78rem;
  font-weight: 800;
  border-radius: 99px;
  padding: 2px 8px;
  color: #fff;
}

/* The header is sticky on this site; a deep-linked or freshly looked-up card
   would otherwise scroll to sit underneath it. */
#wq-result { scroll-margin-top: 110px; }

/* ---- the card --------------------------------------------------------- */

.wq-card {
  background: var(--wq-white);
  border: 1px solid var(--wq-line);
  border-radius: 14px;
  padding: 24px;
  box-shadow: 0 10px 34px rgba(16, 35, 58, 0.07);
}
.wq-card.wq-emergency { border-color: var(--wq-red); border-width: 2px; }

.wq-hero { display: grid; grid-template-columns: 170px 1fr; gap: 26px; align-items: start; }
.wq-hero h2 { margin: 4px 0 10px; font-size: 1.9rem; }

.wq-score { text-align: center; }
.wq-num {
  font-size: 4.1rem;
  font-weight: 800;
  line-height: 1;
  color: var(--wq-navy);
  font-variant-numeric: tabular-nums;
}
.wq-pill {
  display: inline-block;
  margin-top: 8px;
  font-weight: 800;
  font-size: 0.95rem;
  color: #fff;
  border-radius: 99px;
  padding: 4px 14px;
}
.wq-grade-A { background: var(--wq-green); }
.wq-grade-B { background: #4a9f3f; }
.wq-grade-C { background: var(--wq-amber); }
.wq-grade-D { background: #d1662a; }
.wq-grade-F { background: var(--wq-red); }
.wq-range { margin-top: 6px; font-size: 0.85rem; color: var(--wq-mute); }

.wq-kicker {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--wq-mute);
  margin: 0;
}
.wq-blurb { color: var(--wq-soft); max-width: 68ch; }
.wq-blurb strong { color: var(--wq-ink); }
.wq-actions { margin: 16px 0 0; }
.wq-micro { color: var(--wq-mute); font-size: 0.92rem; margin: 8px 0 0; }

.wq-card h3 { margin: 26px 0 12px; font-size: 1.15rem; }

/* ---- the bars --------------------------------------------------------- */

.wq-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  font-size: 0.83rem;
  color: var(--wq-mute);
  margin-bottom: 12px;
}
.wq-legend span::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 6px;
  vertical-align: -1px;
}
.wq-legend .g::before { background: var(--wq-green); }
.wq-legend .a::before { background: var(--wq-amber); }
.wq-legend .r::before { background: var(--wq-red); }

.wq-bar {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(120px, 1fr) 62px;
  gap: 16px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid var(--wq-line);
}
.wq-bar-name { font-weight: 700; }
.wq-bar-meta { font-size: 0.84rem; color: var(--wq-mute); }
.wq-bar-score {
  text-align: right;
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--wq-navy);
  font-variant-numeric: tabular-nums;
}
.wq-bar-na .wq-bar-score { font-size: 0.95rem; font-weight: 600; color: var(--wq-mute); }

/* The track is the limit scale: the mark sits where the reading falls on it,
   and the limit itself is the notch at 83.3% (100 of the 120 it runs to). */
.wq-track {
  position: relative;
  height: 12px;
  border-radius: 99px;
  background: linear-gradient(
    to right,
    #e4f2e9 0%, #e4f2e9 41.6%,
    #fbf0dc 41.6%, #fbf0dc 83.3%,
    #fadcd9 83.3%, #fadcd9 100%
  );
}
.wq-track::after {
  content: "";
  position: absolute;
  left: 83.3%;
  top: -4px;
  bottom: -4px;
  width: 2px;
  background: var(--wq-soft);
}
.wq-fill {
  position: absolute;
  top: -3px;
  width: 4px;
  height: 18px;
  border-radius: 2px;
  background: var(--wq-navy);
  transform: translateX(-2px);
}
.wq-track.red .wq-fill { background: var(--wq-red); }
.wq-bar-na .wq-track { background: #eef2f6; }

.wq-scoring, .wq-note {
  font-size: 0.88rem;
  color: var(--wq-mute);
  max-width: 80ch;
  margin: 14px 0 0;
}
.wq-links { margin: 18px 0 0; display: flex; flex-wrap: wrap; gap: 8px 20px; font-weight: 600; }

/* ---- the misses ------------------------------------------------------- */

.wq-miss h2 { margin: 0 0 12px; font-size: 1.6rem; }
.wq-near { margin: 0 0 14px; padding-left: 1.15em; }
.wq-near li { margin: 6px 0; }
.wq-muted { color: var(--wq-mute); }

/* ---- compare ---------------------------------------------------------- */

.wq-tablewrap { overflow-x: auto; border: 1px solid var(--wq-line); border-radius: 12px; }
.wq-table { border-collapse: collapse; width: 100%; font-size: 0.92rem; background: var(--wq-white); }
.wq-table th {
  text-align: left;
  font-size: 0.74rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--wq-mute);
  padding: 11px 12px;
  border-bottom: 1px solid var(--wq-line);
  white-space: nowrap;
}
.wq-table td { padding: 11px 12px; border-bottom: 1px solid var(--wq-line); }
.wq-table tr:last-child td { border-bottom: 0; }
.wq-table tbody tr:hover td { background: var(--wq-paper); }
.wq-num-cell { font-variant-numeric: tabular-nums; font-weight: 600; }
.wq-na { color: var(--wq-mute); }

/* ---- caveats ---------------------------------------------------------- */

.wq-caveats {
  margin: 26px 0 0;
  background: var(--wq-paper);
  border: 1px solid var(--wq-line);
  border-radius: 12px;
  padding: 18px 22px;
}
.wq-caveats h3 { margin: 0 0 8px; font-size: 1.05rem; }
.wq-caveats ul { margin: 0; padding-left: 1.15em; color: var(--wq-soft); font-size: 0.92rem; }
.wq-caveats li { margin: 6px 0; }

/* ---- map -------------------------------------------------------------- */

#wq-map {
  height: 560px;
  border: 1px solid var(--wq-line);
  border-radius: 14px;
  background: var(--wq-paper);
}
.wq-maplegend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  margin: 14px 0 0;
  font-size: 0.88rem;
  color: var(--wq-soft);
}
.wq-maplegend b { color: var(--wq-ink); }
.wq-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 7px;
  vertical-align: -1px;
}
.wq-dot-graded { background: var(--wq-cyan); border: 2px solid var(--wq-navy); }
.wq-dot-plain { background: #b9c8d8; }

/* ---- phones ----------------------------------------------------------- */

@media (max-width: 760px) {
  .wq-hero { grid-template-columns: 1fr; gap: 14px; }
  .wq-score { text-align: left; display: flex; align-items: baseline; gap: 14px; }
  .wq-num { font-size: 3.2rem; }
  .wq-range { margin-top: 0; }
  .wq-bar { grid-template-columns: 1fr 58px; grid-template-areas: "name score" "track track"; }
  .wq-bar > :first-child { grid-area: name; }
  .wq-bar .wq-track { grid-area: track; }
  .wq-bar-score { grid-area: score; }
  .wq-card { padding: 18px 16px; }
  .wq-lookup { padding: 18px 16px; }
  #wq-map { height: 420px; }
}
