/* === heatmap.css — GitHub-style contribution calendar for personal-* sites
 * Self-contained, mirrors existing personal.css palette tokens.
 * Grid fully fluid: 53 weeks compress to whatever the container gives them,
 * no horizontal scroll, min cell size 3px (still recognizable on retina).
 */

html, body { overflow-x: clip; }

.heatmap {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  grid-template-rows: auto auto auto auto auto;
  column-gap: 6px;
  row-gap: 4px;
  margin-top: 16px;
  margin-bottom: 8px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: visible;
}

.heatmap__header {
  grid-column: 1 / -1;
  grid-row: 1;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.heatmap__total {
  font-size: 14px;
  color: var(--fg);
  font-weight: 400;
}

.heatmap__settings {
  font-size: 12px;
  color: var(--dim);
}

.heatmap__settings-caret {
  font-size: 10px;
  margin-left: 2px;
  display: inline-block;
  transform: translateY(-1px);
}

.heatmap__months {
  grid-column: 2;
  grid-row: 2;
  display: grid;
  grid-template-columns: repeat(53, minmax(4px, 1fr));
  grid-template-rows: 18px;
  column-gap: 2px;
  font-size: 11px;
  color: var(--dim);
  letter-spacing: 0.02em;
  min-width: 0;
}

.heatmap__month {
  font-size: 11px;
  line-height: 18px;
  white-space: nowrap;
  text-align: left;
  overflow: hidden;
  text-overflow: clip;
}

.heatmap__weekdays {
  grid-column: 1;
  grid-row: 3;
  display: grid;
  grid-template-rows: repeat(7, 1fr);
  row-gap: 2px;
  font-size: 10px;
  color: var(--dim);
  align-items: center;
  min-width: 0;
}

.heatmap__weekday {
  font-size: 10px;
  line-height: 1;
  white-space: nowrap;
  text-align: right;
  padding-right: 4px;
  overflow: hidden;
}

.heatmap__grid {
  grid-column: 2;
  grid-row: 3;
  display: grid;
  grid-template-columns: repeat(53, minmax(4px, 1fr));
  grid-template-rows: repeat(7, 1fr);
  grid-auto-flow: column dense;
  column-gap: 2px;
  row-gap: 2px;
  min-width: 0;
}

.heatmap__footer {
  grid-column: 1 / -1;
  grid-row: 5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.heatmap__learn {
  font-size: 11px;
  color: var(--dim);
}

.heatmap__cell {
  aspect-ratio: 1;
  border-radius: 1.5px;
  background: var(--line);
  border: 1px solid transparent;
  transition: transform 0.08s ease, border-color 0.08s ease;
  cursor: default;
  overflow: hidden;
}

.heatmap__cell:hover {
  border-color: var(--accent);
  transform: scale(1.4);
  z-index: 2;
}

.heatmap__cell--lvl-1 { background: rgba(0, 255, 156, 0.20); }
.heatmap__cell--lvl-2 { background: rgba(0, 255, 156, 0.45); }
.heatmap__cell--lvl-3 { background: rgba(0, 255, 156, 0.70); }
.heatmap__cell--lvl-4 { background: var(--accent); }

.heatmap__legend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--dim);
  margin-top: 10px;
}

.heatmap__legend-label {
  font-size: 11px;
  margin: 0 4px;
}

.heatmap__legend .heatmap__cell {
  width: 10px;
  height: 10px;
  aspect-ratio: auto;
  display: inline-block;
  cursor: default;
  border-radius: 2px;
}

.heatmap__legend .heatmap__cell:hover {
  transform: none;
  border-color: transparent;
}

@media (max-width: 720px) {
  .heatmap {
    grid-template-columns: 22px minmax(0, 1fr);
    column-gap: 4px;
  }
  .heatmap__months,
  .heatmap__grid {
    grid-template-columns: repeat(53, minmax(3px, 1fr));
    column-gap: 2px;
  }
  .heatmap__cell { border-radius: 1px; }
  .heatmap__month { font-size: 9px; letter-spacing: 0; }
  .heatmap__weekday { font-size: 9px; padding-right: 2px; }
  .heatmap__weekdays { row-gap: 2px; }
}
