//
// Mixins and funcs for check boxes and radio buttons
//

@mixin check($t, $c:$bg_color, $tc:$fg_color, $checked: false)
{
    // Check/Radio drawing function
    //
    // $t:        check/radio type,
    // $c:        base button color for colored* types
    // $tc:       optional text color for colored* types
    // $checked:  bool to chose between checked/unchecked
    //
    // possible $t values:
    // normal, hover, active, insensitive, backdrop, backdrop-insensitive

    $_border_color:     if($c == $checkradio_bg_color, $c, $alt_borders_color);
    $_dim_border_color: transparentize($_border_color, if($variant == 'light', 0.3, 0.7));

    @if $t == normal
    {
        background-clip:  if($checked, border-box, padding-box);
        background-image: linear-gradient(to bottom, lighten($c, 5%) 20%, $c 90%);
        border-color:     $_border_color;
        box-shadow:       0 1px transparentize(black, 0.95);
        color:            $tc;
    }

    @if $t == hover
    {
        background-image: if($c == white, image(darken($c, 5%)), linear-gradient(to bottom, lighten($c, 9%) 10%, lighten($c, 4%) 90%));
    }

    @if $t == active
    {
        box-shadow: inset 0 1px 1px 0px if($variant == 'light', rgba(0, 0, 0, 0.2), black);
    }

    @if $t == insensitive
    {
        box-shadow: none;
        color:      transparentize($tc, 0.3);
    }

    @if $t == backdrop
    {
        background-image: image($c);
        box-shadow:       none;
        color:            $tc;
    }

    @if $t == backdrop-insensitive
    {
        box-shadow: none;
        color:      transparentize($tc, 0.3);
    }
}
