/*
╔═══════════════════════════════════════════════════════════════════╗
║ GITHUB HEATMAP — Contribution calendar styles                     ║
║ Fluid grid — fills available width, cells stay square             ║
╚═══════════════════════════════════════════════════════════════════╝
*/

/* ====================================================================
   CARD
   ==================================================================== */

.ghm-card {
    overflow-x: auto;
    min-height: 320px;
    overflow: hidden;
}

.ghm-body {
    min-width: 0;
}

.ghm-loading {
    font-family: var(--io-font-mono);
    font-size: var(--io-text-xs);
    color: var(--io-text-tertiary);
    padding: var(--io-space-xl) 0;
    text-align: center;
}

/* ====================================================================
   MONTH LABELS
   ==================================================================== */

.ghm-months {
    display: grid;
    gap: 3px;
    margin-bottom: 4px;
}

.ghm-month-label {
    font-family: var(--io-font-mono);
    font-size: 9px;
    color: var(--io-text-tertiary);
    text-align: left;
    user-select: none;
    overflow: hidden;
}

/* ====================================================================
   DAY GRID — fluid, fills container
   ==================================================================== */

.ghm-grid {
    display: grid;
    gap: 3px;
    grid-auto-flow: row;
}

.ghm-day-label {
    font-family: var(--io-font-mono);
    font-size: 9px;
    color: var(--io-text-tertiary);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 4px;
    user-select: none;
}

/* ====================================================================
   CELLS — square via aspect-ratio, size from grid 1fr
   ==================================================================== */

.ghm-cell {
    aspect-ratio: 1;
    border-radius: 2px;
    min-width: 0;
    transition: var(--io-transition-fast);
}

.ghm-cell:hover {
    outline: 1px solid var(--io-accent);
    outline-offset: 1px;
}

.ghm-empty { background: transparent; }

/* intensity levels */
.ghm-l0 { background: var(--io-surface-sunken); }
.ghm-l1 { background: var(--io-accent-subtle); }
.ghm-l2 { background: var(--io-accent-dim); }
.ghm-l3 { background: var(--io-accent); }
.ghm-l4 { background: var(--io-accent-bright); box-shadow: var(--io-glow-sm); }

/* ====================================================================
   FOOTER — TOTAL + LEGEND
   ==================================================================== */

.ghm-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: var(--io-space-md);
    flex-wrap: wrap;
    gap: var(--io-space-sm);
}

.ghm-total {
    font-family: var(--io-font-mono);
    font-size: var(--io-text-xs);
    color: var(--io-text-tertiary);
}

.ghm-legend {
    display: flex;
    align-items: center;
    gap: 3px;
}

.ghm-legend-cell {
    width: 12px;
    height: 12px;
    aspect-ratio: unset;
}

.ghm-legend-cell:hover {
    outline: none;
}

.ghm-legend-label {
    font-family: var(--io-font-mono);
    font-size: 9px;
    color: var(--io-text-tertiary);
    padding: 0 4px;
}

/* ====================================================================
   ORG BADGES
   ==================================================================== */

.ghm-orgs {
    display: flex;
    gap: var(--io-space-sm);
    flex-wrap: wrap;
    margin-top: var(--io-space-lg);
    padding-top: var(--io-space-md);
    border-top: 1px solid var(--io-border-subtle);
}

.ghm-org {
    display: flex;
    align-items: center;
    gap: var(--io-space-sm);
    padding: var(--io-space-xs) var(--io-space-md);
    background: var(--io-surface-sunken);
    border: 1px solid var(--io-border-subtle);
    border-radius: var(--io-radius-sm);
    text-decoration: none;
    color: var(--io-text-secondary);
    font-family: var(--io-font-mono);
    font-size: var(--io-text-xs);
    transition: var(--io-transition-base);
}

.ghm-org:hover {
    border-color: var(--io-accent);
    color: var(--io-text-primary);
}

.ghm-org img {
    width: 20px;
    height: 20px;
    border-radius: var(--io-radius-sm);
    object-fit: cover;
}


/* ====================================================================
   TOOLTIP — instant, positioned, themed
   ==================================================================== */

.ghm-tip {
    position: fixed;
    z-index: 9999;
    padding: var(--io-space-sm) var(--io-space-md);
    background: var(--io-surface-overlay);
    border: 1px solid var(--io-border);
    font-family: var(--io-font-mono);
    font-size: 13px;
    color: var(--io-text-primary);
    line-height: 1.5;
    pointer-events: none;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 80ms ease, transform 80ms ease;
    white-space: nowrap;
    max-width: 280px;
}

.ghm-tip.visible {
    opacity: 1;
    transform: translateY(0);
}

.ghm-tip strong {
    color: var(--io-accent);
    font-weight: 700;
}

.ghm-tip-date {
    font-size: 13px;
    color: var(--io-text-tertiary);
}


/* ====================================================================
   RESPONSIVE
   ==================================================================== */

@media (max-width: 640px) {
    .ghm-footer {
        justify-content: center;
    }

    .ghm-orgs {
        justify-content: center;
    }
}