.clearfix {
  *zoom: 1;
  &:before,
  &:after {
    display: table;
    content: "";
  }
  &:after {
    clear: both;
  }
}

#font {
  #family {
    .sans-serif() {
      font-family: Arial, Helvetica, sans-serif;
    }
  }
}

.sprite(@color: transparent, @left: left, @top: top) {
  background: @color @spriteURL no-repeat @left @top;
}

#gradient {
  .horizontal-three-colors(@startColor: #00b3ee, @midColor: #7a43b6, @colorStop: 50%, @endColor: #c3325f) {
    background-color: mix(@midColor, @endColor, 80%);
    background-image: -webkit-gradient(linear, 0 0, 100% 0, from(@startColor), color-stop(@colorStop, @midColor), to(@endColor));
    background-image: -webkit-linear-gradient(left, @startColor, @midColor @colorStop, @endColor);
    background-image: -moz-linear-gradient(left, @startColor, @midColor @colorStop, @endColor);
    background-image: -ms-linear-gradient(left, @startColor, @midColor @colorStop, @endColor);
    background-image: -o-linear-gradient(left, @startColor, @midColor @colorStop, @endColor);
    background-image: linear-gradient(left, @startColor, @midColor @colorStop, @endColor);
    background-repeat: no-repeat;
    filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=1)",@startColor,@endColor)); // IE9 and down, gets no color-stop at all for proper fallback
  }
}

// Border gradients
#border-gradient {
  .left-to-right(@widthSettings: 0 0 1px 0, @startColor: rgba(0,0,0,1), @endColor: transparent) {
    border-width: @widthSettings;
    -webkit-border-image:
    -webkit-gradient(linear, 100% 0, 0 0, from(@startColor), to(@endColor)) 1 100%;
    -webkit-border-image:
    -webkit-linear-gradient(right, @startColor, @endColor) 1 100%;
    -o-border-image:
    -o-linear-gradient(right, @startColor, @endColor) 1 100%;
    -moz-border-image:
    -moz-linear-gradient(right, @startColor, @endColor) 1 100%;
  }
  .right-to-left(@widthSettings: 0 0 1px 0, @startColor: rgba(0,0,0,1), @endColor: transparent) {
    border-width: @widthSettings;
    -webkit-border-image:
    -webkit-gradient(linear, 0 0, 100% 0, from(@startColor), to(@endColor)) 1 100%;
    -webkit-border-image:
    -webkit-linear-gradient(left, @startColor, @endColor) 1 100%;
    -o-border-image:
    -o-linear-gradient(left, @startColor, @endColor) 1 100%;
    -moz-border-image:
    -moz-linear-gradient(left, @startColor, end) 1 100%;
  }
  .bottom-to-top(@widthSettings: 0 0 0 1px, @startColor: rgba(0,0,0,1), @endColor: transparent) {
    border-width: @widthSettings;
    -webkit-border-image:
    -webkit-gradient(linear, 0 100%, 0 0, from(@startColor), to(@endColor)) 1 100%;
    -webkit-border-image:
    -webkit-linear-gradient(bottom, @startColor, @endColor) 1 100%;
    -o-border-image:
    -o-linear-gradient(bottom, @startColor, @endColor) 1 100%;
    -moz-border-image:
    -moz-linear-gradient(bottom, @startColor, end) 1 100%;
  }
  .top-to-bottom(@widthSettings: 0 0 0 1px, @startColor: rgba(0,0,0,1), @endColor: transparent) {
    border-width: @widthSettings;
    -webkit-border-image:
    -webkit-gradient(linear, 0 0, 0 100%, from(@startColor), to(@endColor)) 1 100%;
    -webkit-border-image:
    -webkit-linear-gradient(@startColor, @endColor) 1 100%;
    -o-border-image:
    -o-linear-gradient(@startColor, @endColor) 1 100%;
    -moz-border-image:
    -moz-linear-gradient(@startColor, end) 1 100%;
  }
}

// Mixin for generating button backgrounds
// ---------------------------------------
.buttonBackground(@startColor, @endColor) {
  // gradientBar will set the background to a pleasing blend of these, to support IE<=9
  .gradientBar(@startColor, @endColor);
  .reset-filter();

  // in these cases the gradient won't cover the background, so we override
  &:hover, &:active, &.active, &.disabled, &[disabled] {
    background-color: @endColor;
  }

  // IE 7 + 8 can't handle box-shadow to show active, so we darken a bit ourselves
  &:active,
  &.active {
    background-color: darken(@endColor, 10%) e("\9");
  }
}

// Gradient Bar Colors for buttons and alerts
.gradientBar(@primaryColor, @secondaryColor) {
  #gradient > .vertical(@primaryColor, @secondaryColor);
  border-color: @secondaryColor @secondaryColor darken(@secondaryColor, 15%);
  border-color: rgba(0,0,0,.1) rgba(0,0,0,.1) fadein(rgba(0,0,0,.1), 15%);
}

.border-radius(@radius: 5px) {
  -webkit-border-radius: @radius;
  -moz-border-radius: @radius;
  border-radius: @radius;
}

// IE7 likes to collapse whitespace on either side of the inline-block elements.
// Ems because we're attempting to match the width of a space character. Left
// version is for form buttons, which typically come after other elements, and
// right version is for icons, which come before. Applying both is ok, but it will
// mean that space between those elements will be .6em (~2 space characters) in IE7,
// instead of the 1 space in other browsers.
.ie7-restore-left-whitespace() {
  *margin-left: .3em;
  &:first-child {
    *margin-left: 0;
  }
}

.makeColumn(@columns: 1) {
  float: left;
  margin-left: @gridGutterWidth;
  width: (@gridColumnWidth * @columns) + (@gridGutterWidth * (@columns - 1));
}
