/* ============================================================================
   BTB Calendar Heatmap — styles
   Drop into your main stylesheet or include as a standalone <link>.
   Matches BTB dark palette (dark bg, light text, green accent).
   ============================================================================ */

.heatmap-wrapper {
  margin: 2.5rem 0;
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  overflow-x: auto;
}

.heatmap-title {
  margin: 0 0 0.3rem;
  font-size: 1.25rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.92);
}

.heatmap-subtitle {
  margin: 0 0 1.25rem;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.5);
}

/* ---------- Grid ---------- */

.heatmap-grid {
  display: inline-flex;
  flex-direction: column;
  min-width: max-content;
  width: 100%;
}

.heatmap-row {
  display: flex;
  align-items: center;
  gap: 2px;
}

.heatmap-row + .heatmap-row {
  margin-top: 2px;
}

.heatmap-header-row {
  margin-bottom: 4px;
}

.heatmap-month-label {
  width: 36px;
  flex-shrink: 0;
  font-size: 0.7rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.6);
  text-align: right;
  padding-right: 6px;
  letter-spacing: 0.03em;
}

.heatmap-day-label {
  width: 22px;
  height: 16px;
  flex: 1 0 22px;
  max-width: 34px;
  font-size: 0.55rem;
  color: rgba(255, 255, 255, 0.35);
  text-align: center;
  line-height: 16px;
}

/* ---------- Cells ---------- */

.heatmap-cell {
  width: 22px;
  height: 22px;
  flex: 1 0 22px;
  max-width: 34px;
  border-radius: 3px;
  position: relative;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.heatmap-cell--invalid {
  /* Invisible — date doesn't exist (e.g. Feb 30) */
  visibility: hidden;
}

.heatmap-cell--active:hover,
.heatmap-cell--active:focus {
  transform: scale(1.35);
  box-shadow: 0 0 8px rgba(56, 189, 139, 0.6);
  z-index: 2;
  outline: none;
}

.heatmap-cell__count {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.55rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.85);
  pointer-events: none;
}

/* ---------- Today highlight ---------- */

.heatmap-cell--today {
  outline: 2px solid rgba(239, 68, 68, 0.85);
  outline-offset: -1px;
  z-index: 1;
}

/* ---------- Legend ---------- */

.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 1rem;
}

.heatmap-legend__label {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.45);
  padding: 0 4px;
}

.heatmap-legend__swatch {
  width: 16px;
  height: 16px;
  border-radius: 3px;
}

/* ---------- Tooltip ---------- */

.heatmap-tooltip {
  display: none;
  position: absolute;
  z-index: 1000;
  padding: 0.75rem 1rem;
  background: rgba(15, 20, 28, 0.97);
  border: 1px solid rgba(56, 189, 139, 0.3);
  border-radius: 8px;
  font-size: 0.8rem;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.88);
  pointer-events: none;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  max-height: 320px;
  overflow-y: auto;
}

.heatmap-tooltip strong {
  color: rgba(56, 189, 139, 1);
  font-weight: 600;
}

.heatmap-tooltip__year {
  color: rgba(56, 189, 139, 0.8);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.heatmap-tooltip__band {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.75rem;
}

/* ---------- Loading / error ---------- */

.heatmap-loading,
.heatmap-error {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.4);
  padding: 1rem 0;
}

.heatmap-error {
  color: rgba(255, 120, 120, 0.7);
}

/* ---------- Responsive ---------- */

@media (max-width: 860px) {
  .heatmap-wrapper {
    padding: 1rem;
  }
  .heatmap-cell {
    width: 16px;
    height: 16px;
  }
  .heatmap-day-label {
    width: 16px;
    font-size: 0.45rem;
  }
  .heatmap-month-label {
    width: 28px;
    font-size: 0.6rem;
  }
  .heatmap-cell__count {
    font-size: 0.45rem;
  }
}

@media (max-width: 580px) {
  .heatmap-cell {
    width: 12px;
    height: 12px;
    border-radius: 2px;
  }
  .heatmap-day-label {
    width: 12px;
    display: none; /* too small to read — hide day numbers on mobile */
  }
  .heatmap-month-label {
    width: 24px;
    font-size: 0.5rem;
  }
  .heatmap-cell__count {
    display: none; /* hide all counts on mobile — color tells the story */
  }
}
