// FIXME: Theres most likely an absolute ton in here that can be cleaned up and
// simplified

@function shadow($level) {
    @if $color-scheme == "light" {
        @if $level == 1 {
            @return
                0 1px 3px rgba(black, 0.12),
                0 1px 2px rgba(black, 0.24);
        } @else if $level == 2 {
            @return
                0 3px 4px rgba(black, 0.15),
                0 3px 3px -3px rgba(black, 0.35);
        } @else if $level == 3 {
            @return
                0 3px 8px 2px rgba(black, 0.1),
                0 5px 5px -3px rgba(black, 0.4),
                0 8px 5px 1px rgba(black, 0.1);
        } @else if $level == 4 {
            @return
                0 2px 4px 2px rgba(black, 0.1),
                0 15px 12px -10px rgba(black, 0.4),
                0 8px 14px 4px rgba(black, 0.15);
        }
    } @else if $color-scheme == "dark" {
        @if $level == 1 {
            @return
                0 1px 3px rgba(black, 0.42),
                0 1px 2px rgba(black, 0.44);
        } @else if $level == 2 {
            @return
                0 3px 4px rgba(black, 0.25),
                0 3px 3px -3px rgba(black, 0.45);
        } @else if $level == 3 {
            @return
                0 3px 8px 2px rgba(black, 0.2),
                0 5px 5px -3px rgba(black, 0.5),
                0 8px 5px 1px rgba(black, 0.2);
        } @else if $level == 4 {
            @return
                0 2px 4px 2px rgba(black, 0.2),
                0 15px 12px -10px rgba(black, 0.5),
                0 8px 14px 4px rgba(black, 0.25);
        }
    }
}

@function highlight($sides: "full") {
    $highlight:
        inset 1px 0 0 0 scale-color($highlight_color, $alpha: -93%),
        inset -1px 0 0 0 scale-color($highlight_color, $alpha: -93%);

    @if $sides == "top" or $sides == "full" {
        $highlight:
            inset 0 1px 0 0 scale-color($highlight_color, $alpha: -70%),
            $highlight;
    }

    @if $sides == "bottom" or $sides == "full" {
        $highlight:
            inset 0 -1px 0 0 scale-color($highlight_color, $alpha: -80%),
            $highlight;
    }

    @return $highlight;
}

@function outset-shadow($level) {
    @if $level == 1 {
        @return 0 1px 1px rgba(black, 0.05);
    } @else if $level == 2 {
        @return
            0 1px 1px rgba(black, 0.07),
            0 1px 2px rgba(black, 0.08);
    } @else if $level == 3 {
        @return
            0 1px 3px rgba(black, 0.12),
            0 1px 2px rgba(black, 0.24);
    }
}

@function inset-shadow($state: "") {
    @if $state == "disabled" {
        @return
            0 1px 0 0 scale-color($highlight_color, $alpha: -70%),
            inset 0 1px 1px rgba(black, 0.05);
    }

    @return
        0 1px 0 0 scale-color($highlight_color, $alpha: -70%),
        inset 0 1px 1px rgba(black, 0.05),
        inset 0 0 1px 1px rgba(black, 0.05);
}
