/*activity bar and details*/

/*one hue per top-level category, assigned by activitybar.js*/
.activity-bar,
.activity-detail {
    --act-1: light-dark(#3b7ff0, #6690e8);
    --act-2: light-dark(#d64d84, #e37ba5);
    --act-3: light-dark(#3f9e63, #5cba7f);
    --act-4: light-dark(#c9820a, #d79b3a);
    --act-5: light-dark(#7c5cd6, #9a83e0);
    --act-6: light-dark(#0f9a9a, #35b3b3);
    --act-7: light-dark(#d1603a, #e0805c);
    --act-8: light-dark(#6b7280, #98a0ad);
    --act-9: light-dark(#1f8fb8, #45aad0);

    --act-afk: color-mix(in srgb, var(--text-color) 5%, transparent);
}

.activity-bar {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
    font-size: var(--text-xs);
    line-height: 1.3;
    color: var(--muted-color);
}

.activity-bar-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}

.activity-total {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.activity-total.is-muted {
    color: var(--muted-color);
}

.activity-track {
    display: flex;
    height: 8px;
    background: var(--surface-color);
    overflow: hidden;
}

.activity-track:empty {
    display: none;
}

.activity-seg {
    flex-basis: 0;
    min-width: 2px;
    background: var(--act-color);
    transition: filter 0.1s;
}

/*AFK is grey. Only the bar marks segments: the legend ranks active time only,
  so a swatch there is always real activity.*/
.activity-seg.afk {
    /*surface first, so a browser without color-mix() shows a segment not a gap*/
    background: var(--surface-color);
    background: var(--act-afk);
}

.activity-seg:hover,
.activity-seg:focus-visible,
.activity-seg.is-active {
    filter: brightness(1.25) saturate(1.15);
    outline: none;
}

.activity-detail>:first-child {
    margin-top: 0;
}

.activity-day-switch {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
}

@media (scripting: none) {
    .activity-day-switch {
        display: none;
    }
}

.activity-day-label {
    font-size: var(--text-sm);
    color: var(--muted-color);
    font-variant-numeric: tabular-nums;
}

.activity-day-toggle {
    font-family: inherit;
    font-size: var(--text-sm);
    color: var(--link-color);
    background: none;
    border: 1px solid var(--border-color);
    padding: 0.2rem 0.6rem;
    cursor: pointer;
    transition: color 0.1s, border-color 0.1s;
}

.activity-day-toggle:hover,
.activity-day-toggle:focus-visible {
    color: var(--link-hover-color);
    border-color: var(--link-hover-color);
}

.activity-day-toggle[aria-pressed="true"] {
    color: var(--muted-color);
}

.activity-day-toggle[aria-pressed="true"]:hover,
.activity-day-toggle[aria-pressed="true"]:focus-visible {
    color: var(--link-hover-color);
}

.activity-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr));
    gap: 0.75rem;
    margin: 0 0 1.25rem;
}

.activity-stats>div {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.activity-stats dt {
    font-size: var(--text-xs);
    color: var(--muted-color);
}

.activity-stats dd {
    font-size: var(--text-lg);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}

.activity-detail-bar {
    position: relative;
    margin-bottom: 1rem;
}

.activity-detail-bar .activity-track {
    height: 10px;
}

.activity-legend {
    list-style: none;
    margin: 0.75rem 0 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
    gap: 0.1rem 1.5rem;
}

ul.activity-legend {
    margin: 0 !important;
}


.activity-legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.2rem 0;
    font-size: var(--text-sm);
    min-width: 0;
    cursor: default;
}

.activity-legend-swatch {
    flex-shrink: 0;
    width: 10px;
    height: 10px;
    background: var(--act-color);
}

/*shown when a period was tracked but nothing was ever active*/
.activity-legend-empty {
    padding: 0.2rem 0;
    color: var(--muted-color);
}

.activity-legend-label {
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
}

.activity-legend-time,
.activity-legend-pct {
    font-variant-numeric: tabular-nums;
    color: var(--muted-color);
    white-space: nowrap;
}

.activity-legend-pct {
    width: 3.2rem;
    text-align: right;
}

.activity-hours-wrap {
    position: relative;
    margin: 1rem 0;
}

.activity-hours {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 6rem;
}

.activity-hour {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    height: 100%;
    min-width: 0;
}

.activity-hour-bar {
    display: block;
    height: var(--h);
    min-height: 1px;
    background: var(--act-1);
    transition: filter 0.1s;
}

.activity-hour.afk .activity-hour-bar {
    background: var(--surface-color);
    background: var(--act-afk);
}

.activity-hour.is-current .activity-hour-bar {
    box-shadow: inset 0 3px 0 0 color-mix(in srgb, currentColor 45%, transparent);
}

.activity-hour.is-upcoming {
    cursor: default;
}

.activity-hour.is-upcoming .activity-hour-bar {
    height: 3px;
    background: none;
    border-top: 1px dashed var(--border-color);
}

.activity-hour:hover .activity-hour-bar,
.activity-hour:focus-visible .activity-hour-bar {
    filter: brightness(1.25) saturate(1.15);
}

.activity-hour:focus-visible {
    outline: none;
}

.activity-hours-axis {
    position: relative;
    height: 0.9rem;
    margin-top: 0.35rem;
}

.activity-hours-axis span {
    position: absolute;
    left: var(--x);
    transform: translateX(-50%);
    color: var(--muted-color);
    font-size: var(--text-xs);
    font-variant-numeric: tabular-nums;
}

.activity-detail+.text-small {
    margin-top: 1.5rem;
}

@media (max-width: 600px) {
    .activity-hours {
        height: 4.5rem;
    }

    .activity-legend {
        grid-template-columns: minmax(0, 1fr);
    }
}
