@function contrast($bg, $light, $dark, $lightness:50%) {
  @return if(lightness($bg) >= $lightness, $dark, $light);
}

@mixin noselect() {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

@mixin borderradius($radius: $border-radius-primary) {
  border-radius: $radius;
  -webkit-border-radius: $radius;
  -moz-border-radius: $radius;
}
@mixin borderradius-top-left($radius: $border-radius-primary) {
  border-top-left-radius: $radius;
  -webkit-border-top-left-radius: $radius;
  -moz-border-radius-topleft: $radius;
}
@mixin borderradius-top-right($radius: $border-radius-primary) {
  border-top-right-radius: $radius;
  -webkit-border-top-right-radius: $radius;
  -moz-border-radius-topright: $radius;
}
@mixin borderradius-bottom-left($radius: $border-radius-primary) {
  border-bottom-left-radius: $radius;
  -webkit-border-bottom-left-radius: $radius;
  -moz-border-radius-bottomleft: $radius;
}
@mixin borderradius-bottom-right($radius: $border-radius-primary) {
  border-bottom-right-radius: $radius;
  -webkit-border-bottom-right-radius: $radius;
  -moz-border-radius-bottomright: $radius;
}

@mixin transition($transition) {
  -webkit-transition: $transition;
  -moz-transition: $transition;
  -o-transition: $transition;
  -ms-transition: $transition;
  transition: $transition;
}


@mixin boxshadow($definition...) {
  box-shadow: $definition;
  -webkit-box-shadow: $definition;
  -moz-box-shadow: $definition;
}


@mixin boxsizing($value) {
  box-sizing: $value;
  -webkit-box-sizing: $value;
  -moz-box-sizing: $value;
  -o-box-sizing: $value;
}


@mixin ul($style: default) {
  @if $style == default {
    list-style: disc;
    padding-left: 2em;
  }
  @if $style == plain {
    list-style: none;
    padding-left: 0;
    margin: 0;
  }
  @if $style == inline {
    padding-left: 0;
    margin: 0;
    li {
      display: inline;
    }
  }
  @if $style == table {
    padding-left: 0;
    margin: 0;
    display: table;
    li {
      display: table-cell;
    }
  }
}

@mixin dl($style: default) {
  @if $style == default {
    margin-top: 1em;
    margin-bottom: 1em;
    > dt {
      font-weight: bold;
    }
    > dd {
      margin-left: 2.5em;
    }
  }

  @if $style == plain {
    margin-top: 0em;
    margin-bottom: 0em;
    > dt {
      font-weight: inherit;
    }
    > dd {
      margin-left: 0em;
    }
  }
}

@mixin clearfix() {
  zoom: 1;
  &:before, &:after {
    content: "\0020";
    display: block;
    height: 0;
    visibility: hidden;
  }
  &:after { clear: both; }
}
