/* Charts: thin marks, hairline grids one step off the card, text in text colours and never in a series colour. */

.chart-card {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 18px 20px 18px;
}

.chart-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.chart-heading {
  min-width: 0;
}

.chart-head-side {
  display: flex;
  flex: none;
  align-items: center;
  gap: 12px;
}

.chart-toggle {
  height: 26px;
  padding: 0 9px;
  border: 0;
  border-radius: 7px;
  background: none;
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 550;
  cursor: pointer;
}

.chart-toggle:hover,
.chart-toggle[aria-pressed='true'] {
  color: var(--ink);
  background: var(--surface-hover);
}

.chart-headline {
  margin-top: 10px;
}

.headline {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  font-size: 12.5px;
  color: var(--ink-3);
}

.headline b {
  color: var(--ink);
  font-size: 15px;
  font-weight: 650;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--ink-2);
}

.legend-key {
  flex: none;
}

.legend-key-box {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.legend-key-line {
  width: 14px;
  height: 2px;
  border-radius: 1px;
}

.legend-count {
  color: var(--ink-3);
}

.legend-below {
  margin-top: 10px;
}

.chart-plot {
  margin-top: 14px;
}

.chart-plot[hidden],
.chart-table-holder[hidden] {
  display: none;
}

.chart-table-holder {
  margin-top: 12px;
  max-height: 320px;
  overflow-y: auto;
}

.chart-canvas {
  position: relative;
  width: 100%;
}

.chart-svg {
  display: block;
  overflow: visible;
}

.chart-gridline {
  stroke: var(--grid);
  stroke-width: 1;
}

.chart-baseline {
  stroke: var(--axis);
  stroke-width: 1;
}

.chart-tick {
  fill: var(--axis-text);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.chart-line {
  fill: none;
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.chart-wash {
  opacity: 0.1;
}

.chart-end,
.chart-point {
  stroke: var(--surface);
  stroke-width: 2;
}

.chart-cross {
  stroke: var(--ink-3);
  stroke-width: 1;
  pointer-events: none;
}

.chart-catcher {
  fill: transparent;
  outline: none;
  touch-action: pan-y;
  cursor: crosshair;
}

.chart-catcher:focus-visible {
  stroke: var(--accent);
  stroke-width: 1.5;
}

.chart-column {
  transition: opacity 0.1s;
}

.is-hovering .chart-column {
  opacity: 0.45;
}

.is-hovering .chart-column.is-hot {
  opacity: 1;
}

.chart-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 160px;
  border-radius: 10px;
  background: var(--surface-sunk);
  color: var(--ink-3);
  font-size: 13px;
  text-align: center;
  padding: 16px;
}

.tooltip {
  position: absolute;
  z-index: 5;
  min-width: 140px;
  padding: 9px 11px;
  border-radius: 10px;
  background: var(--surface);
  box-shadow:
    0 0 0 1px var(--line),
    var(--shadow-lift);
  pointer-events: none;
}

.tooltip[hidden] {
  display: none;
}

.tooltip-title {
  margin-bottom: 5px;
  font-size: 12px;
  color: var(--ink-3);
}

.tooltip-row {
  display: grid;
  grid-template-columns: 14px auto 1fr;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  line-height: 1.6;
}

.tooltip-key {
  width: 12px;
  height: 2px;
  border-radius: 1px;
}

.tooltip-value {
  color: var(--ink);
  font-weight: 650;
}

.tooltip-name {
  color: var(--ink-2);
  white-space: nowrap;
}

/* Ranked bars and the funnel */
.ranked,
.funnel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ranked-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 2px 12px;
  margin-bottom: 6px;
  font-size: 13px;
}

/* the name keeps room for itself; a long figure beside it drops to its own line rather than cut the name */
.ranked-name {
  flex: 1 1 110px;
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ranked-value {
  flex: none;
  margin-left: auto;
  color: var(--ink);
  font-weight: 600;
}

.ranked-note {
  margin-left: 8px;
  color: var(--ink-3);
  font-weight: 400;
}

.ranked-track {
  height: 8px;
}

.ranked-bar {
  height: 8px;
  min-width: 2px;
  border-radius: 0 4px 4px 0;
  background: var(--series-1);
}

.funnel-kept {
  margin-top: 4px;
  font-size: 12px;
  color: var(--ink-3);
}

/* One whole split into parts */
.segment-bar {
  display: flex;
  gap: 2px;
  height: 28px;
}

.segment-block {
  display: flex;
  align-items: center;
  min-width: 3px;
  padding-left: 8px;
  border-radius: 4px;
  overflow: hidden;
}

.segment-share {
  color: #ffffff;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

/* Meter */
.meter-numbers {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}

.meter-value {
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.meter-of {
  font-size: 13px;
  color: var(--ink-3);
}

.meter-track {
  position: relative;
  height: 8px;
  margin-top: 10px;
  border-radius: 4px;
  background: var(--meter-track);
}

.meter-fill {
  height: 100%;
  min-width: 2px;
  border-radius: 4px;
  background: var(--accent);
}

.meter-warning .meter-fill {
  background: var(--warning);
}

.meter-critical .meter-fill {
  background: var(--critical);
}

.meter-warn {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 2px;
  margin-left: -1px;
  border-radius: 1px;
  background: var(--ink-3);
}

.meter-state {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 9px;
  font-size: 12.5px;
  color: var(--ink-2);
}

.meter-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.meter-warning .meter-dot {
  background: var(--warning);
}

.meter-critical .meter-dot {
  background: var(--critical);
}

/* Sparkline */
.spark {
  display: block;
  width: 100%;
  height: 32px;
  overflow: visible;
}

.spark-line {
  fill: none;
  stroke: var(--series-quiet);
  stroke-width: 1.5;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.tile:hover .spark-line {
  stroke: var(--accent);
}

@media (forced-colors: active) {
  .ranked-bar,
  .meter-fill,
  .segment-block {
    forced-color-adjust: none;
    border: 1px solid CanvasText;
  }
}
