/* Charts: thin marks, hairline grid, text in ink tokens (never in the series colour). */

.chart-card {
  display: grid;
  gap: var(--sp-2);
}

.chart-card__head {
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
}

.chart-card__title {
  font-size: var(--fs-14);
  font-weight: 600;
}

.chart-card__note {
  color: var(--text-3);
  font-size: var(--fs-12);
}

.chart-card__toggle {
  margin-left: auto;
  padding: 2px 8px;
  border-radius: var(--r-xs);
  color: var(--sky-strong);
  font-size: var(--fs-12);
  font-weight: 500;
}

.chart-card__toggle:hover {
  background: var(--sky-wash);
}

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

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1) var(--sp-4);
  color: var(--text-2);
  font-size: var(--fs-12);
}

.chart-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chart-legend__key {
  display: inline-block;
  background: var(--key-color);
}

.chart-legend__key--line {
  width: 14px;
  height: 2px;
  border-radius: 1px;
}

.chart-legend__key--area {
  width: 12px;
  height: 10px;
  border-radius: 3px;
  border-top: 2px solid var(--key-color);
  background: color-mix(in srgb, var(--key-color) 22%, transparent);
}

.chart-legend__key--bar {
  width: 12px;
  height: 8px;
  border-radius: 2px;
}

.chart-legend__key--tick {
  width: 2px;
  height: 12px;
  border-radius: 1px;
  background: var(--text-1);
}

.chart {
  position: relative;
  border-radius: var(--r-sm);
}

.chart:focus-visible {
  box-shadow: var(--focus-ring);
}

.chart__svg {
  overflow: visible;
  font-family: var(--font-ui);
}

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

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

.chart__axis-label {
  fill: var(--text-3);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.chart__row-label {
  fill: var(--text-2);
  font-size: 12px;
}

.chart__row-label--emphasis {
  fill: var(--text-1);
  font-weight: 600;
}

.chart__value-label {
  fill: var(--text-1);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.chart__area {
  fill: var(--series-color);
  fill-opacity: 0.14;
  stroke: none;
}

.chart__line {
  fill: none;
  stroke: var(--series-color);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.chart__column,
.chart__bar {
  fill: var(--series-color);
  transition: fill-opacity var(--dur-fast) var(--ease-out);
}

.chart__column.is-active {
  fill-opacity: 0.75;
}

.chart__swatch {
  fill: var(--series-color);
}

.chart__tick {
  stroke: var(--text-1);
  stroke-width: 2;
  stroke-linecap: round;
}

.chart__band {
  fill: transparent;
}

.chart__band.is-active {
  fill: rgba(255, 255, 255, 0.04);
}

.chart__marker {
  stroke: var(--text-2);
  stroke-width: 1;
  stroke-opacity: 0.7;
}

.chart__marker-label {
  fill: var(--text-2);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.chart__playhead {
  stroke: var(--text-1);
  stroke-width: 1.5;
}

.chart__crosshair {
  stroke: var(--text-2);
  stroke-width: 1;
}

.chart__dot {
  fill: var(--series-color);
  stroke: var(--ink-900);
  stroke-width: 2;
}

.chart__tooltip {
  position: absolute;
  z-index: 2;
  transform: translate(-50%, -100%);
  display: grid;
  gap: 2px;
  min-width: 96px;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  background: rgba(4, 13, 21, 0.96);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-panel);
  pointer-events: none;
  white-space: nowrap;
}

.chart__tooltip-title {
  color: var(--text-2);
  font-size: var(--fs-11);
  font-weight: 500;
}

.chart__tooltip-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-12);
}

.chart__tooltip-key {
  width: 10px;
  height: 2px;
  border-radius: 1px;
  background: var(--key-color);
}

.chart__tooltip-value {
  color: var(--text-1);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.chart__tooltip-label {
  color: var(--text-3);
}

/* Table twin */
.data-table__scroll {
  max-height: 260px;
  overflow: auto;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-12);
}

.data-table th,
.data-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.data-table th:first-child {
  text-align: left;
  font-weight: 500;
}

.data-table thead th {
  position: sticky;
  top: 0;
  background: var(--ink-850);
  color: var(--text-3);
  font-weight: 500;
}

/* Top paths: not a chart, a ranked list with a share bar */
.paths {
  display: grid;
  gap: var(--sp-2);
}

.path {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px var(--sp-3);
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: rgba(4, 14, 24, 0.45);
  border: 1px solid var(--line);
}

.path__zones {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.path__zone {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px 0 6px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.06);
  font-size: var(--fs-12);
  white-space: nowrap;
}

.path__zone::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--zone-color, var(--text-3));
}

.path__arrow {
  width: 12px;
  height: 12px;
  color: var(--text-3);
}

.path__numbers {
  display: grid;
  justify-items: end;
  font-size: var(--fs-12);
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.path__visits {
  color: var(--text-1);
  font-size: var(--fs-14);
  font-weight: 600;
}

.path__share {
  grid-column: 1 / -1;
  height: 4px;
  border-radius: 2px;
  background: rgba(150, 196, 226, 0.1);
  overflow: hidden;
}

.path__share > span {
  display: block;
  height: 100%;
  width: calc(var(--fill, 0) * 100%);
  border-radius: 2px;
  background: var(--chart-1);
}
