.chip {
    $amber: #9a5c00;

    margin-left: auto;
    align-self: center;
    max-width: 100%;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    background-color: rgba($secondary_color, 0.09);
    color: $secondary_color;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    box-sizing: border-box;
    transition: 0.2s ease background-color;
    &:hover,
    &:focus {
        color: $secondary_color;
        background-color: rgba($secondary_color, 0.15);
    }
    &:focus {
        outline: none !important;
        box-shadow: none;
    }
    // Keyboard only; a rounded ring since the browser outline ignores border-radius.
    &:focus-visible {
        box-shadow: 0 0 0 2px $white_color, 0 0 0 4px rgba($secondary_color, 0.45);
    }
    .dot {
        position: relative;
        flex: 0 0 8px;
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background-color: currentColor;
        &::after {
            content: "";
            position: absolute;
            inset: 0;
            border-radius: 50%;
            background-color: currentColor;
            animation: chipPulse 1.6s ease-out infinite;
        }
    }
    .title {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 260px;
    }
    .percent {
        font-variant-numeric: tabular-nums;
        font-weight: 700;
    }
    .state {
        font-weight: 700;
    }
    &.paused {
        color: $amber;
        background-color: #fdf4e6;
        &:hover,
        &:focus {
            color: $amber;
            background-color: #fbebd0;
        }
        .dot::after {
            animation: none;
        }
    }
}

@keyframes chipPulse {
    from {
        transform: scale(1);
        opacity: 0.6;
    }
    to {
        transform: scale(2.6);
        opacity: 0;
    }
}
