/**
 * Stylesheet for the theme co-occurrence heatmap (post 4).
 */

.hm-wrapper {
  background: #080c0f;
  padding: 28px 12px 0;
  font-family: 'Sintony', regularFont, sans-serif;
  color: #f0ebe3;
  box-sizing: border-box;
  width: 100%;
  /* No overflow:hidden — row-label column is capped so grid fits naturally;
     overflow:hidden would clip the 45°-rotated column labels below the grid */
}

.hm-title {
  text-align: center;
  font-size: clamp(16px, 1.9vw, 22px);
  font-family: 'Sintony', regularFont, sans-serif;
  font-weight: 700;
  color: #f0ebe3;
  margin-bottom: 20px;
  letter-spacing: 0.01em;
}

/* Outer flex: chart area left, legend right */
.hm-body {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.hm-chart-area {
  flex: 1;
  min-width: 0; /* allow flex child to shrink below intrinsic content size */
}

/* ── Main grid (row-label col + 10 data cols) ──
   Row-label column is capped at 115px so the 10 data columns always fit. */
.hm-grid {
  display: grid;
  grid-template-columns: minmax(0, 140px) repeat(10, 1fr);
  gap: 2px;
  width: 100%;
}

.hm-row-label {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 8px;
  font-size: clamp(9px, 1.1vw, 13px);
  color: #f0ebe3;
  /* allow wrapping so long labels don't blow out the column */
  white-space: normal;
  word-break: break-word;
  text-align: right;
  min-height: 32px;
}

.hm-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(8px, 1vw, 13px);
  font-weight: 500;
  border: 1px solid #1a1a2e;
  position: relative;
  color: inherit;
  text-decoration: none;
  transition: filter 0.12s;
  box-sizing: border-box;
}

.hm-cell.diagonal {
  background: #0a0a0f !important;
}

/* ── Clickable cells — permanent white frame signals interactivity ── */
a.hm-cell {
  cursor: pointer;
  text-decoration: none;
  box-shadow: inset 0 0 0 2px rgba(255, 140, 0, 0.75);
}

a.hm-cell:hover {
  background-color: #d966c8 !important;
  color: #f0ebe3 !important;
  box-shadow: inset 0 0 0 2px rgba(255, 140, 0, 1);
  z-index: 2;
}

/* ── Column label row (appended to same grid) ── */
.hm-col-label-spacer {
  /* intentionally empty — holds the row-label column width */
}

.hm-col-label-cell {
  position: relative;
  height: 6px;   /* minimal — labels extend below via overflow:visible */
  overflow: visible;
}

.hm-col-label-text {
  position: absolute;
  top: 6px;      /* just below the grid edge */
  left: 50%;
  /* shift right edge of text to column center, then rotate downward */
  transform: translateX(-100%) rotate(-45deg);
  transform-origin: top right;
  white-space: nowrap;
  font-size: clamp(9px, 1.1vw, 13px);
  color: #f0ebe3;
  font-family: 'Sintony', regularFont, sans-serif;
}

/* ── Axis label highlight on cell hover ── */
.hm-row-label.hm-axis-active {
  color: #d966c8;
  font-weight: 700;
}

.hm-col-label-cell.hm-axis-active .hm-col-label-text {
  color: #d966c8;
  font-weight: 700;
}

/* ── Color legend ── */
.hm-legend {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
}

.hm-legend-label {
  font-size: 10px;
  color: rgba(240, 235, 227, 0.65);
  margin-bottom: 6px;
  text-align: center;
  letter-spacing: 0.04em;
  line-height: 1.4;
}

.hm-legend-bar-wrap {
  display: flex;
  gap: 4px;
  align-items: stretch;
}

.hm-legend-canvas {
  width: 14px;
  flex-shrink: 0;
  border-radius: 2px;
}

.hm-legend-ticks {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-size: 10px;
  color: rgba(240, 235, 227, 0.75);
  /* Must match canvas height attribute */
  height: 200px;
}
