.averages {
    @include flex-center;
    margin-bottom: $spacing * 0.5;
}

.averages__legend {
    width: 50px;
    font-size: $small-font;
}

.averages__inner {
    flex: 1;
    @include flex-center;
    justify-content: space-around;
}

.averages__item {
    position: relative;
    font-size: $smaller-font;
    flex: 1;
    @include flex-center;
    span {
        // position: absolute;
        display: block;
        // width: 80px;
        // left: -45px;
        text-align: center;
    }
}

.averages__item__inner {
    display: block;
    border: 1px solid $border-color;
    padding: $spacing/3 $spacing/2;
    position: relative;
    border: 1px solid $border-color;
    &:after,
    &:before {
        top: 100%;
        left: 50%;
        border: solid transparent;
        content: ' ';
        height: 0;
        width: 0;
        position: absolute;
        pointer-events: none;
    }

    &:after {
        border-color: rgba(136, 183, 213, 0);
        border-top-color: $bg-color;
        border-width: 6px;
        margin-left: -6px;
    }
    &:before {
        border-color: rgba(194, 225, 245, 0);
        border-top-color: $border-color;
        border-width: 7px;
        margin-left: -7px;
    }
    .averages__item--aggregated & {
        border: 1px solid $purple;
        color: $purple;
        &:before {
            border-top-color: $purple;
        }
    }
}
