$track-w: 100%;
$track-h: .25em;
$thumb-d: 1.25em;
$track-c: $light-grey;
$filll-c: $accent;
@mixin track($fill: 0) {
    box-sizing: border-box;
    border: none;
    width: $track-w;
    height: $track-h;
    background: $track-c;
    @if $fill==1 {
        // .js & {
        background: linear-gradient($filll-c, $filll-c) 0/ var(--sx) 100% no-repeat $track-c;
        // }
    }
}

@mixin fill() {
    height: $track-h;
    background: $filll-c;
}

@mixin thumb($color, $border) {
    width: $thumb-d;
    height: $thumb-d;
    -webkit-appearance: none;
    cursor: ew-resize;
    background: $color;
    border: 0.2rem solid $border;
    border-radius: 1rem;
}

.lea-input-slider {
    position: relative;
    float: left;
    width: 100%;
    margin: 1.1rem 0;
    label {
        position: relative;
        float: left;
        margin-bottom: 0.5rem;
    }
    input {
        background: linear-gradient(to right, #{$accent} 0%, #{$accent} 0%, #{$light-grey} 0%, #{$light-grey} 100%);
        border: 0;
        border-radius: 0.5rem;
        height: 0.5rem;
        width: 100%;
        outline: none;
        transition: background 450ms ease-in;
        -webkit-appearance: none;
        margin: 0.5rem 0;
    }
    input[type='range'] {
        &,
        &::-webkit-slider-thumb {
            -webkit-appearance: none;
        }
        --range: calc(var(--max) - var(--min));
        --ratio: calc((var(--val) - var(--min))/var(--range));
        --sx: calc(.5*#{$thumb-d} + var(--ratio)*(100% - #{$thumb-d}));
        margin: 0;
        padding: 0;
        width: $track-w;
        height: $thumb-d;
        background: transparent;
        font: 1em/1 arial,
        sans-serif;
        &::-webkit-slider-runnable-track {
            @include track(1)
        }
        &::-moz-range-track {
            @include track
        }
        &::-ms-track {
            @include track
        }
        &::-moz-range-progress {
            @include fill
        }
        &::-ms-fill-lower {
            @include fill
        }
        &::-webkit-slider-thumb {
            margin-top: .5*($track-h - $thumb-d);
            @include thumb($white, $accent);
            transition: 0.5s;
        }
        &::-moz-range-thumb {
            @include thumb($white, $accent);
            transition: 0.5s;
        }
        &::-ms-thumb {
            margin-top: 0;
            @include thumb($white, $accent);
            transition: 0.5s;
        }
        &::-ms-tooltip {
            display: none
        }
        &:disabled {
            cursor: not-allowed;
            &::-webkit-slider-runnable-track {
                @include track(1);
                background: linear-gradient($grey, $grey) 0/ var(--sx) 100% no-repeat $track-c;
            }
            &::-moz-range-track {
                @include track;
                background: linear-gradient($grey, $grey) 0/ var(--sx) 100% no-repeat $track-c;
            }
            &::-ms-track {
                @include track;
                background: linear-gradient($grey, $grey) 0/ var(--sx) 100% no-repeat $track-c;
            }
            &::-moz-range-progress {
                @include fill;
                background: linear-gradient($grey, $grey) 0/ var(--sx) 100% no-repeat $track-c;
            }
            &::-ms-fill-lower {
                @include fill;
                background: linear-gradient($grey, $grey) 0/ var(--sx) 100% no-repeat $track-c;
            }
            &::-webkit-slider-thumb {
                margin-top: .5*($track-h - $thumb-d);
                @include thumb($light-grey, $grey);
                transition: 0.5s;
                cursor: not-allowed;
            }
            &::-moz-range-thumb {
                @include thumb($light-grey, $grey);
                transition: 0.5s;
                cursor: not-allowed;
            }
            &::-ms-thumb {
                margin-top: 0;
                @include thumb($light-grey, $grey);
                transition: 0.5s;
                cursor: not-allowed;
            }
        }
    }
}

.dark-mode {
    .lea-input-slider {
        input[type='range'] {
            &::-webkit-slider-thumb {
                margin-top: .5*($track-h - $thumb-d);
                @include thumb($darker-grey, $accent);
                transition: 0.5s;
            }
            &::-moz-range-thumb {
                @include thumb($darker-grey, $accent);
                transition: 0.5s;
            }
            &::-ms-thumb {
                margin-top: 0;
                @include thumb($darker-grey, $accent);
                transition: 0.5s;
            }
            &:disabled {
                &::-webkit-slider-thumb {
                    margin-top: .5*($track-h - $thumb-d);
                    @include thumb($darker-grey, $grey);
                    transition: 0.5s;
                    cursor: not-allowed;
                }
                &::-moz-range-thumb {
                    @include thumb($darker-grey, $grey);
                    transition: 0.5s;
                    cursor: not-allowed;
                }
                &::-ms-thumb {
                    margin-top: 0;
                    @include thumb($darker-grey, $grey);
                    transition: 0.5s;
                    cursor: not-allowed;
                }
            }
        }
    }
}