/* Compass — Heatmap styles */

.cmp-heat-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 14px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  margin-bottom: 16px;
}
.cmp-heat-control-group {
  display: flex; flex-direction: column; gap: 6px;
  min-width: 140px;
}
.cmp-heat-search { flex: 1; min-width: 200px; }

/* Matrix */
.cmp-heat-matrix-wrap {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 16px;
  align-items: start;
}
.cmp-heat-matrix {
  display: grid;
  grid-template-columns: 160px repeat(4, 1fr);
  gap: 4px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
}
.cmp-heat-corner {
  display: flex; flex-direction: column; gap: 4px;
  padding: 12px 14px;
}
.cmp-heat-colhead {
  display: flex; align-items: end; justify-content: center;
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-mute);
  padding: 12px 8px 8px;
}
.cmp-heat-rowhead {
  display: flex; align-items: center;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}
.cmp-heat-cell {
  border: none;
  border-radius: var(--r-md);
  padding: 16px 12px;
  min-height: 72px;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: transform 160ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 160ms;
  text-align: center;
}
.cmp-heat-cell:hover {
  transform: scale(1.04);
  box-shadow: var(--shadow-md);
  z-index: 2;
}
.cmp-heat-cell.empty {
  background: repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 4px, transparent 4px, transparent 8px);
}
.cmp-heat-cell-value {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.cmp-heat-cell-meta {
  font-size: 10px;
  opacity: 0.7;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.cmp-heat-side { display: flex; flex-direction: column; gap: 12px; }
.cmp-heat-legend {
  display: flex; flex-direction: column; gap: 8px;
  margin-top: 12px;
}
.cmp-heat-gradient {
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--heat-0), var(--heat-1), var(--heat-2), var(--heat-3), var(--heat-4), var(--heat-5));
}
.cmp-heat-legend-labels {
  display: flex; justify-content: space-between;
  font-size: 11px; color: var(--ink-mute);
}
.cmp-heat-role-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 0;
  font-size: 12px;
  border-bottom: 1px solid var(--hairline);
}
.cmp-heat-role-row:last-child { border-bottom: none; }
.cmp-heat-hover-value {
  margin-top: 6px;
}
.cmp-heat-hover-meta {
  margin-top: 4px;
  font-size: var(--body-xs-size);
  line-height: var(--body-xs-line);
  color: var(--ink-mute);
}
.cmp-heat-role-inline {
  font-size: var(--body-sm-size);
  line-height: var(--body-sm-line);
  font-weight: 500;
}
.cmp-heat-role-meta {
  font-size: var(--body-2xs-size);
  line-height: var(--body-2xs-line);
  color: var(--ink-mute);
}
.cmp-heat-empty {
  color: var(--ink-fade);
  font-size: var(--body-sm-size);
  line-height: var(--body-sm-line);
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  padding: 20px;
}

/* Table view */
.cmp-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cmp-table th {
  text-align: left;
  padding: 16px 18px;
  font-size: 10px; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-mute);
  background: var(--surface-2);
  border-bottom: 1px solid var(--hairline);
}
.cmp-table td {
  padding: 16px 18px;
  border-bottom: 1px solid var(--hairline);
  vertical-align: middle;
}
.cmp-table tr:last-child td { border-bottom: none; }
.cmp-table tbody tr:hover { background: var(--surface-2); }

/* Distribution */
.cmp-dist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 12px;
}
.cmp-dist-card {
  padding: 20px;
  display: flex; flex-direction: column; gap: 14px;
}
.cmp-dist-bar {
  position: relative;
  height: 32px;
}
.cmp-dist-track {
  position: absolute; top: 50%; left: 0; right: 0;
  height: 4px;
  background: var(--surface-3);
  border-radius: 999px;
  transform: translateY(-50%);
}
.cmp-dist-range {
  position: absolute; top: 50%;
  height: 8px;
  background: linear-gradient(90deg, var(--accent-soft), var(--accent));
  border-radius: 999px;
  transform: translateY(-50%);
}
.cmp-dist-mid {
  position: absolute; top: 50%;
  width: 14px; height: 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 3px solid var(--accent);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.cmp-dist-labels {
  display: flex; justify-content: space-between;
  font-size: 11px;
  color: var(--ink);
}

@media (max-width: 1100px) {
  .cmp-heat-matrix-wrap { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .cmp-heat-controls {
    padding: 12px;
    gap: 10px;
  }
  .cmp-heat-control-group, .cmp-heat-search {
    min-width: 100%;
    width: 100%;
  }
  /* Keep the matrix as a CSS grid on mobile — switching it to
     display:block collapsed every cell into its own row. Shrink the
     column track sizes instead so the four founder columns fit on
     a phone, and let the cell value/meta shrink with them. */
  .cmp-heat-matrix {
    grid-template-columns: 96px repeat(4, minmax(56px, 1fr));
    gap: 3px;
    padding: 10px;
  }
  .cmp-heat-rowhead {
    padding: 0 8px;
    font-size: 12px;
  }
  .cmp-heat-colhead {
    font-size: 9px;
    padding: 8px 2px 4px;
  }
  .cmp-heat-cell {
    padding: 10px 4px;
    min-height: 60px;
  }
  .cmp-heat-cell-value { font-size: 13px; }
  .cmp-heat-cell-meta { font-size: 9px; }
  /* Stacked-row layout — the wide six-column heatmap table truncates
     the salary + ESOP ranges under ~420px. Switch to one card per row
     with label/value pairs so every value is visible. */
  .cmp-table { display: block; }
  .cmp-table thead { display: none; }
  .cmp-table tbody, .cmp-table tr { display: block; width: 100%; }
  .cmp-table tr {
    padding: 12px 14px;
    border-top: 1px solid var(--hairline);
  }
  .cmp-table tr:first-child { border-top: none; }
  .cmp-table td {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    padding: 4px 0;
    border-top: none;
    white-space: normal;
  }
  .cmp-table td:first-child {
    display: block;
    padding-bottom: 6px;
  }
  .cmp-table td:not(:first-child)::before {
    content: attr(data-label);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-mute);
    flex-shrink: 0;
  }
  .cmp-dist-grid {
    grid-template-columns: 1fr;
  }
  .cmp-dist-card {
    padding: 14px;
  }
}
