/* The instruments.

   One stylesheet for every calculator. A page declares its controls and its
   outputs in markup and gets this layout; nothing here is per-tool.

   The five comfort colours are the only colours used, and only where they carry
   the meaning they carry in the app. */

.instrument {
  margin-top: clamp(1.5rem, 3vw, 2rem);
  padding: clamp(1.25rem, 3vw, 1.75rem);
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  max-width: 46rem;
}

.instrument > * + * { margin-top: 1.25rem; }

/* ---------- segmented switches ---------- */

.control-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: space-between;
}

.segmented {
  display: inline-flex;
  padding: 2px;
  background: var(--bg-elevated);
  border: 1px solid var(--stroke);
  border-radius: 999px;
}

.segmented button {
  appearance: none;
  border: 0;
  background: transparent;
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink-faint);
  cursor: pointer;
}

.segmented button[aria-pressed="true"] {
  background: var(--card);
  border: 1px solid var(--stroke);
  color: var(--ink);
}

/* ---------- sliders and fields ---------- */

.control + .control { margin-top: 1.1rem; }

.control-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}

.control-head label {
  font-size: 0.9rem;
  font-weight: 620;
  color: var(--ink);
}

.control-value {
  font-size: 1rem;
  font-weight: 640;
  color: var(--accent-ink);
  font-variant-numeric: tabular-nums;
}

.control input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  margin-top: 0.6rem;
  height: 2px;
  border-radius: 2px;
  background: var(--stroke-strong);
  cursor: pointer;
}

.control input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--card);
  border: 1.5px solid var(--accent);
  cursor: grab;
}

.control input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--card);
  border: 1.5px solid var(--accent);
  cursor: grab;
}

.control input[type="number"],
.control input[type="text"],
.control select {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.55rem 0.7rem;
  font: inherit;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  background: var(--bg-elevated);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-sm);
}

.control-hint {
  margin-top: 0.45rem;
  font-size: 0.82rem;
  color: var(--ink-faint);
}

.control[hidden] { display: none; }

/* ---------- the answer ---------- */

.answer-figure {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.45rem 1.25rem;
  padding-top: 1.5rem;
  padding-bottom: 1.5rem;
  border-top: 1px solid var(--stroke);
}

.answer-figure b {
  font-size: clamp(2.6rem, 8vw, 3.6rem);
  font-weight: 660;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.answer-figure > span {
  flex: 1 1 14rem;
  font-size: 0.92rem;
  color: var(--ink-soft);
  line-height: 1.45;
}

.answer-figure > span strong {
  display: inline-block;
  margin-top: 0.2rem;
  color: var(--ink);
}

.band {
  display: inline-block;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 640;
  letter-spacing: 0.02em;
  border: 1px solid currentColor;
}

.band--dry { color: var(--band-dry); }
.band--comfortable,
.band--veryComfortable { color: var(--band-comfortable); }
.band--moderate,
.band--sticky { color: var(--band-moderate); }
.band--humid,
.band--muggy { color: var(--band-humid); }
.band--damp,
.band--oppressive,
.band--miserable { color: var(--band-damp); }

/* Condensation reuses the same ramp: low is the comfortable end, saturated the
   damp end. Same meaning, same colours. */
.band--low { color: var(--band-comfortable); }
.band--saturated { color: var(--band-damp); }

/* ---------- the secondary readouts ---------- */

.readout-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr));
  margin: 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--stroke);
}

.readout {
  padding: 0.85rem 1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-sm);
}

.readout dt {
  font-size: 0.75rem;
  font-weight: 640;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.readout dd {
  margin: 0.35rem 0 0;
  font-size: 1.35rem;
  font-weight: 640;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.readout-note {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.8rem;
  color: var(--ink-faint);
}

/* ---------- flags and notes ---------- */

.panel-note {
  padding: 0.85rem 1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.panel-note strong { color: var(--ink); }
.panel-note[hidden] { display: none; }

.noscript-note {
  margin-top: 1rem;
  max-width: 46rem;
  font-size: 0.9rem;
  color: var(--ink-faint);
}

.instrument-source {
  margin-top: 0.85rem;
  max-width: 46rem;
  font-size: 0.82rem;
  color: var(--ink-faint);
}

/* ---------- live readings ---------- */

.live-place {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}

.live-place input[type="search"] {
  flex: 1 1 12rem;
  padding: 0.55rem 0.75rem;
  font: inherit;
  color: var(--ink);
  background: var(--bg-elevated);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-sm);
}

.live-place button,
.live-locate {
  appearance: none;
  padding: 0.55rem 0.95rem;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 620;
  color: var(--ink);
  background: var(--bg-elevated);
  border: 1px solid var(--stroke-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.live-place button:hover,
.live-locate:hover { border-color: var(--accent); color: var(--accent-ink); }

/* The search field's label is redundant beside a placeholder that says the same
   thing, but removing it would leave the input unnamed for a screen reader. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.live-status {
  margin-top: 0.75rem;
  font-size: 0.88rem;
  color: var(--ink-faint);
  min-height: 1.4em;
}

.live-status[data-state="error"] { color: var(--band-dry); }

/* Search results are a listbox, not a menu of links: choosing one changes the
   reading in place rather than navigating. */
.live-results {
  list-style: none;
  margin: 0.6rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}

.live-results:empty { display: none; }

.live-results button {
  width: 100%;
  text-align: left;
  padding: 0.5rem 0.7rem;
  font: inherit;
  font-size: 0.9rem;
  color: var(--ink-soft);
  background: var(--bg-elevated);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.live-results button:hover { color: var(--ink); border-color: var(--stroke-strong); }
.live-results small { color: var(--ink-faint); }

/* ---------- the hourly forecast strip ---------- */

.hours {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(3.6rem, 1fr);
  gap: 0.35rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  -webkit-overflow-scrolling: touch;
}

.hour {
  text-align: center;
  padding: 0.6rem 0.3rem;
  border: 1px solid var(--stroke);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  font-size: 0.8rem;
}

.hour__time { color: var(--ink-faint); font-size: 0.72rem; }
.hour__rh { display: block; margin-top: 0.3rem; font-weight: 640; color: var(--ink); }
.hour__dew { display: block; margin-top: 0.15rem; color: var(--ink-soft); font-size: 0.75rem; }

/* A 2px cap under each hour, coloured by comfort band — the only place the ramp
   appears in quantity, and it is carrying the reading. */
.hour__band {
  display: block;
  height: 2px;
  border-radius: 2px;
  margin-top: 0.45rem;
}

.hour__band--dry { background: var(--band-dry); }
.hour__band--comfortable { background: var(--band-comfortable); }
.hour__band--moderate { background: var(--band-moderate); }
.hour__band--humid { background: var(--band-humid); }
.hour__band--damp { background: var(--band-damp); }

/* ---------- printable charts ---------- */

.chart-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.chart-table th,
.chart-table td {
  border: 1px solid var(--stroke);
  padding: 0.35rem 0.4rem;
  text-align: center;
  white-space: nowrap;
}

.chart-table thead th {
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.chart-table tbody th { color: var(--ink); font-weight: 620; }

.chart-table td[data-band] { color: var(--ink); font-weight: 600; }
.chart-table td[data-band="dry"] { background: color-mix(in srgb, var(--band-dry) 14%, transparent); }
.chart-table td[data-band="veryComfortable"],
.chart-table td[data-band="comfortable"] { background: color-mix(in srgb, var(--band-comfortable) 14%, transparent); }
.chart-table td[data-band="sticky"] { background: color-mix(in srgb, var(--band-moderate) 16%, transparent); }
.chart-table td[data-band="muggy"] { background: color-mix(in srgb, var(--band-humid) 16%, transparent); }
.chart-table td[data-band="oppressive"],
.chart-table td[data-band="miserable"] { background: color-mix(in srgb, var(--band-damp) 18%, transparent); }

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  margin-top: 0.9rem;
  padding: 0;
  list-style: none;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.chart-legend li { display: flex; align-items: center; gap: 0.45rem; }

.chart-legend i {
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 3px;
  border: 1px solid var(--stroke-strong);
}

@media print {
  .site-header,
  .site-footer,
  .breadcrumb,
  .article-rail,
  .product-cta,
  .related,
  .faq,
  .answer-block,
  .segmented,
  .noscript-note { display: none !important; }

  .chart-table { font-size: 9pt; }
  .chart-table td[data-band] { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .instrument { border: 0; padding: 0; }
}
