/**
 * heatmap.css — companion styles for radar/team/lib/heatmap.js primitive.
 *
 * Theme-adaptive palette using CSS custom properties + фирменные цвета
 * radar-os (primary #3AA7E2 blue scale, hover #6EC1FF).
 * Row labels use `currentColor` — inherits от parent text color (works
 * автоматом на dark и light themes без override).
 * Cell b0 (empty) — subtle rgba independent of theme + prefers-color-scheme
 * light adaptation.
 *
 * Consumer может override любую variable через `.heatmap-grid { --var: X; }`.
 *
 * Block 3006 initial + Block 3013 R5 theme refactor (task radar-os--631).
 */

.heatmap-grid {
  /* Theme-adaptive CSS variables (default dark theme, radar-os brand). */
  --heatmap-bg:              transparent;
  --heatmap-corner:          transparent;
  --heatmap-row-label:       currentColor;
  --heatmap-row-sublabel:    currentColor;
  --heatmap-col-header:      currentColor;
  --heatmap-hover-outline:   #6EC1FF;
  --heatmap-row-hover-bg:    rgba(58, 167, 226, 0.08);
  --heatmap-cell-b0:         rgba(255, 255, 255, 0.04);
  --heatmap-cell-b1:         rgba(58, 167, 226, 0.20);
  --heatmap-cell-b2:         rgba(58, 167, 226, 0.35);
  --heatmap-cell-b3:         rgba(58, 167, 226, 0.50);
  --heatmap-cell-b4:         rgba(58, 167, 226, 0.65);
  --heatmap-cell-b5:         rgba(58, 167, 226, 0.80);
  --heatmap-cell-b6:         rgba(58, 167, 226, 0.92);
  --heatmap-cell-b7:         #3AA7E2;

  display: grid;
  gap: 3px;
  padding: 12px;
  align-items: center;
  overflow-x: auto;
  background: var(--heatmap-bg);
  border-radius: 8px;
}

/* Light theme adaptation — dark cell b0 на светлом фоне. */
@media (prefers-color-scheme: light) {
  .heatmap-grid {
    --heatmap-cell-b0: rgba(0, 0, 0, 0.05);
  }
}

.heatmap-corner {
  background: var(--heatmap-corner);
}

.heatmap-col-header {
  font-size: 10px;
  color: var(--heatmap-col-header);
  opacity: 0.55;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-bottom: 4px;
  min-width: 14px;
}

.heatmap-row-label {
  font-size: 13px;
  color: var(--heatmap-row-label);
  cursor: pointer;
  padding-right: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 0.15s ease;
}

/* Block 3020 R6: full-row hover через display:contents wrapper.
   `:hover` на wrapper подсвечивает label + все cells той же row. */
.heatmap-row:hover .heatmap-row-label,
.heatmap-row:hover .heatmap-cell {
  background: var(--heatmap-row-hover-bg);
}

.heatmap-row-name {
  display: block;
  font-weight: 500;
}

.heatmap-row-sublabel {
  display: block;
  font-size: 11px;
  color: var(--heatmap-row-sublabel);
  opacity: 0.6;
  margin-top: 2px;
}

.heatmap-cell {
  width: 100%;
  height: 22px;
  border-radius: 2px;
  cursor: pointer;
  transition: outline 0.1s ease;
}

.heatmap-cell:hover {
  outline: 1px solid var(--heatmap-hover-outline);
  outline-offset: 1px;
}

/* Brightness scale — radar-os primary blue (var-driven, override-friendly). */
.heatmap-cell--b0 { background: var(--heatmap-cell-b0); cursor: default; }
.heatmap-cell--b0:hover { outline: none; }

.heatmap-cell--b1 { background: var(--heatmap-cell-b1); }
.heatmap-cell--b2 { background: var(--heatmap-cell-b2); }
.heatmap-cell--b3 { background: var(--heatmap-cell-b3); }
.heatmap-cell--b4 { background: var(--heatmap-cell-b4); }
.heatmap-cell--b5 { background: var(--heatmap-cell-b5); }
.heatmap-cell--b6 { background: var(--heatmap-cell-b6); }
.heatmap-cell--b7 { background: var(--heatmap-cell-b7); }

/* Empty state. */
.heatmap-empty {
  padding: 32px;
  text-align: center;
  color: currentColor;
  opacity: 0.6;
  font-style: italic;
}

/* Responsive — allow horizontal scroll on narrow viewports. */
@media (max-width: 900px) {
  .heatmap-grid {
    padding: 8px;
    gap: 2px;
  }
  .heatmap-col-header {
    font-size: 9px;
  }
  .heatmap-row-label {
    font-size: 12px;
    padding-right: 4px;
  }
}
