/* GitHub activity dashboard, adapted from github.com/oppenheimmer/github_dashboard.
   All selectors are scoped under .gh-dashboard except the activity tooltip,
   which the script appends to document.body. */

.gh-dashboard {
    display: grid;
    gap: 1.2rem;
}

/* Let panels shrink below the calendar's intrinsic width so the calendar
   scrolls inside .calendar-container instead of widening the page */
.gh-dashboard > * {
    min-width: 0;
}

.gh-dashboard .profile-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.78);
    box-shadow: 0 14px 35px rgba(18, 52, 77, 0.08);
}

.gh-dashboard .profile-left {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.gh-dashboard .avatar-stack {
    display: flex;
    align-items: center;
    gap: 0;
    min-width: 120px;
}

.gh-dashboard .avatar-stack .avatar {
    width: 74px;
    height: 74px;
    border-radius: 50%;
    border: 2px solid #ffffff;
    box-shadow: 0 1px 2px rgba(18, 52, 77, 0.1);
}

.gh-dashboard .avatar-stack .avatar + .avatar {
    margin-left: -18px;
}

.gh-dashboard .username {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    color: var(--muted);
    font-size: 14px;
    margin: 2px 0 8px 0;
    line-height: 1.5;
}

.gh-dashboard .user-handle {
    display: flex;
    align-items: center;
    gap: 6px;
}

.gh-dashboard .user-icon {
    width: 16px;
    height: 16px;
    fill: var(--muted);
    flex-shrink: 0;
}

.gh-dashboard .handle-text {
    color: var(--text);
    font-weight: 600;
}

.gh-dashboard .separator {
    color: var(--muted);
}

.gh-dashboard .follow-info {
    display: contents;
    font-size: 14px;
    color: var(--muted);
}

.gh-dashboard .stat-text {
    display: contents;
}

.gh-dashboard .followers-meta,
.gh-dashboard .following-meta,
.gh-dashboard .repos-meta,
.gh-dashboard .starred-meta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.gh-dashboard .followers-icon,
.gh-dashboard .following-icon,
.gh-dashboard .repos-icon {
    width: 20px;
    height: 20px;
    stroke: var(--muted);
}

.gh-dashboard .starred-icon {
    width: 15px;
    height: 15px;
    stroke: var(--muted);
    fill: none;
}

.gh-dashboard .stat-user {
    color: var(--text);
    font-weight: 600;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

.gh-dashboard .stat-marker {
    color: var(--muted);
    font-size: 14px;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
}

.gh-dashboard .stat-text strong {
    font-weight: 600;
    color: var(--text);
}

.gh-dashboard .stat-number {
    display: inline-block;
    min-width: 3ch;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.gh-dashboard .bio {
    grid-column: 1 / -1;
    font-size: 14px;
    color: var(--text);
    margin: 0;
}

.gh-dashboard .stacked-info {
    display: grid;
    grid-template-columns: max-content 14px repeat(4, auto);
    column-gap: 14px;
    row-gap: 8px;
    margin-top: 6px;
    align-items: center;
}

.gh-dashboard .profile-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    text-align: right;
    gap: 8px;
}

.gh-dashboard .user-commit-breakdown {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
}

.gh-dashboard .commit-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: rgba(248, 251, 253, 0.9);
    font-size: 12px;
    min-width: 220px;
}

.gh-dashboard .commit-pill img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border);
    cursor: pointer;
}

.gh-dashboard .commit-pill a {
    display: inline-block;
}

.gh-dashboard .commit-pill .pill-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.2;
}

.gh-dashboard .pill-username {
    font-weight: 600;
    color: var(--text);
}

.gh-dashboard .pill-role {
    color: var(--muted);
}

.gh-dashboard .pill-count {
    font-weight: 600;
    color: var(--text);
}

.gh-dashboard .contributions-section {
    padding: 1.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.78);
    box-shadow: 0 14px 35px rgba(18, 52, 77, 0.08);
}

.gh-dashboard .all-years-container {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.gh-dashboard .year-section {
    width: 100%;
}

.gh-dashboard .year-header {
    font-size: 14px;
    color: var(--text);
    margin-bottom: 16px;
    font-weight: 600;
}

.gh-dashboard .calendar-container {
    overflow-x: auto;
    /* keep vertical clipped: subpixel rounding otherwise leaves ~1px of
       phantom overflow that spawns a vertical scrollbar */
    overflow-y: hidden;
}

.gh-dashboard .months-labels {
    display: flex;
    margin-bottom: 8px;
    margin-left: 20px;
    font-size: 12px;
    color: var(--muted);
}

.gh-dashboard .months-labels .month-label {
    text-align: left;
    padding-left: 2px;
    display: inline-block;
    /* keep JS-computed widths so labels stay aligned with month blocks
       when the calendar scrolls horizontally */
    flex-shrink: 0;
}

.gh-dashboard .calendar-grid {
    display: flex;
    gap: 3px;
}

.gh-dashboard .days-labels {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-right: 4px;
}

.gh-dashboard .days-labels span {
    height: 10px;
    font-size: 9px;
    color: var(--muted);
    text-align: center;
    line-height: 10px;
    width: 10px;
}

.gh-dashboard .contribution-grid {
    display: flex;
    gap: 8px;
    min-width: 800px;
}

.gh-dashboard .month-block {
    flex-shrink: 0;
    display: grid;
    grid-template-rows: repeat(7, 10px);
    grid-auto-flow: column;
    gap: 3px;
    position: relative;
}

.gh-dashboard .month-block::after {
    content: '';
    position: absolute;
    right: -4px;
    top: 0;
    bottom: 0;
    width: 1px;
    background-color: var(--border);
}

.gh-dashboard .month-block:last-child::after {
    display: none;
}

.gh-dashboard .contribution-day {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    cursor: pointer;
    position: relative;
    border: none;
    transition: transform 0.1s ease;
}

.gh-dashboard .contribution-day.level-0 {
    background-color: rgba(18, 52, 77, 0.1);
}

.gh-dashboard .contribution-day.level-1 {
    background-color: #9be9a8;
}

.gh-dashboard .contribution-day.level-2 {
    background-color: #40c463;
}

.gh-dashboard .contribution-day.level-3 {
    background-color: #30a14e;
}

.gh-dashboard .contribution-day.level-4 {
    background-color: #216e39;
}

/* Mobile-only stacked calendar (built by renderMobileCalendar in
   dashboard.js); the @media block below swaps it in for .year-section. */
.gh-dashboard .mobile-calendar {
    display: none;
}

.gh-dashboard .contribution-day:hover {
    transform: scale(1.2);
    outline: 1px solid rgba(18, 52, 77, 0.2);
    outline-offset: 2px;
}

/* Tooltip is appended to document.body, so it stays unscoped. */
.activity-tooltip {
    position: absolute;
    background: var(--surface-strong);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 14px 35px rgba(18, 52, 77, 0.16);
    padding: 12px;
    z-index: 1000;
    min-width: 220px;
    max-width: 260px;
    font-family: "Source Sans 3", sans-serif;
}

.activity-tooltip .tooltip-title {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 8px;
}

.activity-tooltip .user-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 8px;
}

.activity-tooltip .user-row:last-child {
    margin-bottom: 0;
}

.activity-tooltip .user-row img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border);
}

.activity-tooltip .user-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    line-height: 1.2;
}

.activity-tooltip .user-meta .user-handle {
    font-weight: 600;
    color: var(--text);
    font-size: 13px;
}

.activity-tooltip .user-meta .user-activity {
    color: var(--muted);
    font-size: 12px;
}

@media (max-width: 768px) {
    .gh-dashboard .profile-header {
        flex-direction: column;
        gap: 16px;
        align-items: center;
        text-align: center;
    }

    .gh-dashboard .profile-left {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .gh-dashboard .avatar-stack {
        justify-content: center;
    }

    /* Keep only the avatar stack and handles line on mobile:
       stats (followers/following/repos/starred) and commit pills stay desktop-only. */
    .gh-dashboard .profile-right,
    .gh-dashboard .stacked-info {
        display: none;
    }

    /* Swap the horizontally scrolling year calendars for the stacked
       last-12-months view: months flow top-down, no horizontal scroll. */
    .gh-dashboard .year-section {
        display: none;
    }

    .gh-dashboard .mobile-calendar {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 20px 12px;
        justify-items: center;
    }

    .gh-dashboard .mobile-calendar .year-header {
        grid-column: 1 / -1;
        margin-bottom: 0;
        text-align: center;
    }

    .gh-dashboard .mobile-month {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 6px;
    }

    .gh-dashboard .mobile-month-label {
        font-size: 12px;
        font-weight: 600;
        color: var(--muted);
    }

    .gh-dashboard .mobile-weekdays {
        display: grid;
        grid-template-columns: repeat(7, 16px);
        gap: 6px;
        justify-content: center;
    }

    .gh-dashboard .mobile-weekdays span {
        font-size: 9px;
        line-height: 1;
        color: var(--muted);
        text-align: center;
    }

    /* Reorient the shared month block to a traditional calendar:
       days of the week as columns, weeks flowing down as rows. */
    .gh-dashboard .mobile-calendar .month-block {
        grid-template-rows: none;
        grid-template-columns: repeat(7, 16px);
        grid-auto-flow: row;
        gap: 6px;
    }

    .gh-dashboard .mobile-calendar .month-block::after {
        display: none;
    }

    .gh-dashboard .mobile-calendar .contribution-day {
        width: 16px;
        height: 16px;
    }
}
