/* Chart furniture shared by every page that draws its charts with
   js/ui/weather-chart.js's helpers: the legend chips (wxLegend, wireLegend)
   and the floating tooltip (wxTooltip, wxTtRow). /explore and /nutrient's
   Dashboard load it; /weather keeps its own copy in css/weather.css, which
   weather_legend_toggle_test holds.

   Scoped under `body .hh-chart` — the box a chart is drawn into carries the
   class: modern-neutral.css loads after the page sheets and its own
   selectors are up to three classes deep, so a bare `.wx-legend` would lose. */

body .hh-chart .wx-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 0.4rem;
  margin: 0 0 0.75rem;
}

body .hh-chart .wx-legend .legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: none;
  border: none;
  font: inherit;
  font-size: 0.85rem;
  color: var(--text-primary, #0f172a);
  padding: 4px 6px;
  min-height: 32px;
  border-radius: 4px;
  cursor: pointer;
  transition: opacity 0.15s ease, background 0.15s ease;
}

body .hh-chart .wx-legend .legend-item:hover {
  background: var(--surface, #f1f5f2);
}

body .hh-chart .wx-legend .legend-item:focus-visible {
  outline: 2px solid var(--accent, #166534);
  outline-offset: 1px;
}

body .hh-chart .wx-legend .legend-item[aria-pressed="false"] {
  opacity: 0.4;
}

body .hh-chart .wx-legend .legend-color {
  display: inline-block;
  width: 14px;
  height: 3px;
  border-radius: 2px;
}

body .hh-chart .wx-chart-tooltip {
  position: absolute;
  pointer-events: none;
  z-index: 5;
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 6px;
  padding: 6px 9px;
  font-size: 0.75rem;
  color: var(--text-primary, #0f172a);
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.16);
  min-width: 120px;
}

body .hh-chart .wx-tt-header {
  font-weight: 600;
  margin-bottom: 4px;
}

body .hh-chart .wx-tt-row {
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1.5;
  white-space: nowrap;
}

body .hh-chart .wx-tt-swatch {
  display: inline-block;
  width: 10px;
  height: 3px;
  border-radius: 2px;
  flex-shrink: 0;
}

body .hh-chart .wx-tt-label {
  flex: 1;
  color: var(--text-secondary, #475569);
}

body .hh-chart .wx-tt-value {
  font-weight: 600;
  margin-left: 8px;
  font-variant-numeric: tabular-nums;
}
