/* ==========================================================================
   HEATMAP AKTIVITAS — NihongoDo
   Mirip GitHub contribution graph. Digunakan di Home dan Kana Hub.
   ========================================================================== */

.heatmap-wrap {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 600px; /* scroll horizontal di layar kecil */
}

/* ─── HEADER (statistik + legenda) ──────────────────────── */
.heatmap-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.hm-stats {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.hm-stat {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
}
.hm-stat strong {
  color: var(--text);
  font-weight: 700;
}
.hm-legend {
  display: flex;
  align-items: center;
  gap: 3px;
}
.hm-leg-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-ghost);
  margin: 0 4px;
}

/* ─── LABEL HARI (Sen–Min) ───────────────────────────────── */
.heatmap-day-labels {
  display: grid;
  grid-template-rows: repeat(7, 14px);
  gap: 2px;
  float: left;
  margin-right: 4px;
}
.heatmap-day-labels span {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-ghost);
  line-height: 14px;
}

/* ─── GRID ───────────────────────────────────────────────── */
.heatmap-grid {
  display: grid;
  grid-template-rows: repeat(7, 14px);
  grid-auto-columns: 14px;
  grid-auto-flow: column;
  gap: 2px;
}

/* ─── CELLS ──────────────────────────────────────────────── */
.hm-cell {
  width: 14px;
  height: 14px;
  border-radius: 2px;
  cursor: default;
  transition:
    transform var(--dur-fast) var(--ease),
    opacity var(--dur-fast);
}
.hm-cell:hover {
  transform: scale(1.3);
  z-index: 1;
  position: relative;
}
.hm-pad {
  visibility: hidden;
  pointer-events: none;
}

/* Level 0 = tidak ada aktivitas */
.hm-l0 {
  background: var(--ink-4);
}
/* Level 1–4 = intensitas meningkat */
.hm-l1 {
  background: rgba(99, 102, 241, 0.25);
}
.hm-l2 {
  background: rgba(99, 102, 241, 0.45);
}
.hm-l3 {
  background: rgba(99, 102, 241, 0.7);
}
.hm-l4 {
  background: var(--indigo-light);
  box-shadow: 0 0 4px rgba(99, 102, 241, 0.4);
}

/* Dark theme overrides untuk kontras lebih baik */
/* 4.7: #ebedf0 → var(--ink-4) agar ikut design token */
[data-theme="light"] .hm-l0 {
  background: var(--ink-4);
}
[data-theme="light"] .hm-l1 {
  background: rgba(53, 80, 122, 0.22);
}
[data-theme="light"] .hm-l2 {
  background: rgba(53, 80, 122, 0.42);
}
[data-theme="light"] .hm-l3 {
  background: rgba(53, 80, 122, 0.68);
}
[data-theme="light"] .hm-l4 {
  background: var(--indigo);
}

/* ─── LABEL BULAN ────────────────────────────────────────── */
.heatmap-month-labels {
  display: grid;
  grid-auto-columns: 14px;
  grid-auto-flow: column;
  gap: 2px;
  margin-top: 4px;
}
.heatmap-month-labels span {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-ghost);
  white-space: nowrap;
}

/* ─── WRAPPER SCROLL ─────────────────────────────────────── */
.heatmap-scroll-wrap {
  overflow-x: auto;
  padding-bottom: 4px;
  /* Scrollbar minimal */
  scrollbar-width: thin;
  scrollbar-color: var(--ink-5) transparent;
}
.heatmap-scroll-wrap::-webkit-scrollbar {
  height: 4px;
}
.heatmap-scroll-wrap::-webkit-scrollbar-track {
  background: transparent;
}
.heatmap-scroll-wrap::-webkit-scrollbar-thumb {
  background: var(--ink-5);
  border-radius: 2px;
}
