/*---------------------------------------------------
    LESS Elements 0.6
  ---------------------------------------------------
    A set of useful LESS mixins by Dmitry Fadeyev
    Special thanks for mixin suggestions to:
      Kris Van Herzeele,
      Benoit Adam,
      Portenart Emile-Victor,
      Ryan Faerman

    More info at: http://lesselements.com
-----------------------------------------------------*/

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

@sprite32: 32px;

.spriteGrid-32(@x, @y) {
    background-position: -((@x*@sprite32)-@sprite32) -((@y*@sprite32)-@sprite32);
}

.horizontal-gradient (@startColor: #555, @endColor: #333) {
    background-color: @endColor;
    background-repeat: repeat-x;
    background-image: -khtml-gradient(linear, left top, right top, from(@startColor), to(@endColor)); /* Konqueror */
    background-image: -moz-linear-gradient(left, @startColor, @endColor); /* FF 3.6+ */
    background-image: -ms-linear-gradient(left, @startColor, @endColor); /* IE10 */
    background-image: -webkit-gradient(linear, left top, right top, color-stop(0%, @startColor), color-stop(100%, @endColor)); /* Safari 4+, Chrome 2+ */
    background-image: -webkit-linear-gradient(left, @startColor, @endColor); /* Safari 5.1+, Chrome 10+ */
    background-image: -o-linear-gradient(left, @startColor, @endColor); /* Opera 11.10 */
    filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=1)",@startColor,@endColor)); /* IE6 & IE7 */
    -ms-filter: %("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=1)",@startColor,@endColor); /* IE8+ */
    background-image: linear-gradient(left, @startColor, @endColor); /* the standard */
}

.vertical-gradient (@startColor: #555, @endColor: #333) {
    background-color: @endColor;
    background-repeat: repeat-x;
    background-image: -khtml-gradient(linear, left top, left bottom, from(@startColor), to(@endColor)); /* Konqueror */
    background-image: -moz-linear-gradient(@startColor, @endColor); /* FF 3.6+ */
    background-image: -ms-linear-gradient(@startColor, @endColor); /* IE10 */
    background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, @startColor), color-stop(100%, @endColor)); /* Safari 4+, Chrome 2+ */
    background-image: -webkit-linear-gradient(@startColor, @endColor); /* Safari 5.1+, Chrome 10+ */
    background-image: -o-linear-gradient(@startColor, @endColor); /* Opera 11.10 */
    filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=0)",@startColor,@endColor)); /* IE6 & IE7 */
    -ms-filter: %("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=0)",@startColor,@endColor); /* IE8+ */
    background-image: linear-gradient(@startColor, @endColor); /* the standard */
}

.vertical-gradient-3 (@startColor: #00b3ee, @midColor: #7a43b6, @endColor: #c3325f, @colorStop: 0.5) {
    background-color: @endColor;
    background-repeat: no-repeat;
    background-image: -webkit-gradient(linear, 0 0, 0 100%, from(@startColor), color-stop(@colorStop, @midColor), to(@endColor));
    background-image: -webkit-linear-gradient(top, @startColor 0%, @midColor @colorStop, @endColor 100%);
    background-image: -moz-linear-gradient(top, @startColor 0%, @midColor @colorStop, @endColor 100%);
    background-image: -o-linear-gradient(top, @startColor 0%, @midColor @colorStop, @endColor 100%);
    background-image: -ms-linear-gradient(top, @startColor 0%, @midColor @colorStop, @endColor 100%);
    background-image: linear-gradient(top, @startColor 0%, @midColor @colorStop, @endColor 100%);
    filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=0)",@startColor,@endColor)); /* IE6 & IE7 */
    -ms-filter: %("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=0)",@startColor,@endColor); /* IE8+ */
}

.vertical-gradient-4 (@startColor: #00b3ee, @color1: #7a43b6, @color2, @endColor: #c3325f, @colorStop1: 50%, @colorStop2: 51%) {
    background-color: @endColor;
    background-repeat: no-repeat;
    background-image: -webkit-gradient(linear, left top, left bottom, from(@startColor), color-stop(@colorStop1, @color1), color-stop(@colorStop2, @color2), to(@endColor));
    background-image: -webkit-linear-gradient(top, @startColor 0%, @color1 @colorStop1, @color2 @colorStop2, @endColor 100%);
    background-image: -moz-linear-gradient(top, @startColor 0%, @color1 @colorStop1, @color2 @colorStop2, @endColor 100%);
    background-image: -o-linear-gradient(top, @startColor 0%, @color1 @colorStop1, @color2 @colorStop2, @endColor 100%);
    background-image: -ms-linear-gradient(top, @startColor 0%, @color1 @colorStop1, @color2 @colorStop2, @endColor 100%);
    background-image: linear-gradient(top, @startColor 0%, @color1 @colorStop1, @color2 @colorStop2, @endColor 100%);
    filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=0)",@startColor,@endColor)); /* IE6 & IE7 */
    -ms-filter: %("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=0)",@startColor,@endColor); /* IE8+ */
}

.absolute-center(@offsetTop: 0, @offsetLeft: 0) {
    position: absolute;
    top: 50%;
    width: 100%;
    margin-top: @offsetTop;
    margin-left: @offsetLeft;
}

.bordered(@top-color: #EEE, @right-color: #EEE, @bottom-color: #EEE, @left-color: #EEE) {
    border-top: solid 1px @top-color;.box-shadow(inset 0 1px 0 rgba(255,255,255,0.1));
    border-left: solid 1px @left-color;
    border-right: solid 1px @right-color;
    border-bottom: solid 1px @bottom-color;
}

.drop-shadow(@x-axis: 0, @y-axis: 1px, @blur: 2px, @alpha: 0.1) {
    -webkit-box-shadow: @x-axis @y-axis @blur rgba(0, 0, 0, @alpha);
    -moz-box-shadow: @x-axis @y-axis @blur rgba(0, 0, 0, @alpha);
    box-shadow: @x-axis @y-axis @blur rgba(0, 0, 0, @alpha);
}

.text-shadow(@x: 2px, @y: 1px, @blur: 2px, @color: #555) {
    text-shadow: @x @y @blur @color;
    -moz-text-shadow: @x @y @blur @color;
    -webkit-text-shadow: @x @y @blur @color;
    /*
        filter: progid:DXImageTransform.Microsoft.dropshadow(OffX=@horizontalOffset, OffY=verticalOffset, Color='@color', Positive='true');
        -ms-filter: "progid:DXImageTransform.Microsoft.dropshadow(OffX=@horizontalOffset, OffY=verticalOffset, Color='@color', Positive='true')";
        *zoom: 1;
    */
}

.text-overflow(@property: ellipsis) {
    -o-text-overflow: ellipsis;
    -ms-text-overflow: ellipsis;
    text-overflow: ellipsis;
}

.rounded(@radius: 2px) {
    -webkit-border-radius: @radius;
    -moz-border-radius: @radius;
    border-radius: @radius;
    -moz-background-clip: padding; -webkit-background-clip: padding-box; background-clip: padding-box;
}

.border-radius(@topright: 0, @bottomright: 0, @bottomleft: 0, @topleft: 0) {
    -webkit-border-top-right-radius: @topright;
    -webkit-border-bottom-right-radius: @bottomright;
    -webkit-border-bottom-left-radius: @bottomleft;
    -webkit-border-top-left-radius: @topleft;
    -moz-border-radius-topright: @topright;
    -moz-border-radius-bottomright: @bottomright;
    -moz-border-radius-bottomleft: @bottomleft;
    -moz-border-radius-topleft: @topleft;
    border-top-right-radius: @topright;
    border-bottom-right-radius: @bottomright;
    border-bottom-left-radius: @bottomleft;
    border-top-left-radius: @topleft;
    -moz-background-clip: padding; -webkit-background-clip: padding-box; background-clip: padding-box;
}

.opacity(@opacity: 0.5) {
    @opacityPercentage: @opacity * 100;
    -moz-opacity: @opacity;
    -khtml-opacity: @opacity;
    -webkit-opacity: @opacity;
    opacity: @opacity;
   -ms-filter: ~"progid:DXImageTransform.Microsoft.Alpha(opacity=@{opacityPercentage})";
    filter: ~"alpha(opacity=@{opacityPercentage})";
}

.transition-duration(@duration: 0.2s) {
    -moz-transition-duration: @duration;
    -webkit-transition-duration: @duration;
    transition-duration: @duration;
}

.rotation(@deg:5deg){
    -webkit-transform: rotate(@deg);
    -moz-transform: rotate(@deg);
    transform: rotate(@deg);
}

.scale(@ratio:1.5){
    -webkit-transform:scale(@ratio);
    -moz-transform:scale(@ratio);
    transform:scale(@ratio);
}

.transition(@duration:0.2s, @ease:ease-out) {
    -webkit-transition: all @duration @ease;
    -moz-transition: all @duration @ease;
    transition: all @duration @ease;
}

.transition-opacity(@duration:0.2s, @ease:ease-out) {
    -webkit-transition: opacity @duration @ease;
    -moz-transition: opacity @duration @ease;
    transition: opacity @duration @ease;
}

.inner-shadow(@horizontal:0, @vertical:1px, @blur:2px, @alpha: 0.4) {
    -webkit-box-shadow: inset @horizontal @vertical @blur rgba(0, 0, 0, @alpha);
    -moz-box-shadow: inset @horizontal @vertical @blur rgba(0, 0, 0, @alpha);
    box-shadow: inset @horizontal @vertical @blur rgba(0, 0, 0, @alpha);
}

.box-shadow(@arguments) {
    -webkit-box-shadow: @arguments;
    -moz-box-shadow: @arguments;
    box-shadow: @arguments;
}

.columns(@colwidth: 250px, @colcount: 0, @colgap: 50px, @columnRuleColor: #EEE, @columnRuleStyle: solid, @columnRuleWidth: 1px) {
    -moz-column-width: @colwidth;
    -moz-column-count: @colcount;
    -moz-column-gap: @colgap;
    -moz-column-rule-color: @columnRuleColor;
    -moz-column-rule-style: @columnRuleStyle;
    -moz-column-rule-width: @columnRuleWidth;
    -webkit-column-width: @colwidth;
    -webkit-column-count: @colcount;
    -webkit-column-gap: @colgap;
    -webkit-column-rule-color: @columnRuleColor;
    -webkit-column-rule-style: @columnRuleStyle;
    -webkit-column-rule-width: @columnRuleWidth;
    column-width: @colwidth;
    column-count: @colcount;
    column-gap: @colgap;
    column-rule-color: @columnRuleColor;
    column-rule-style: @columnRuleStyle;
    column-rule-width: @columnRuleWidth;
}

.translate(@x:0, @y:0) {
    -moz-transform: translate(@x, @y);
    -webkit-transform: translate(@x, @y);
    -o-transform: translate(@x, @y);
    -ms-transform: translate(@x, @y);
    transform: translate(@x, @y);
}

.unselectable() {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.no-focus-outline() {
    outline: none;
    &::-moz-focus-inner {
        outline: none;
        border: 0;
    }
}

.word-wrap() {
    // white-space: pre-wrap; /* css-3 */
    // white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
    // white-space: -pre-wrap; /* Opera 4-6 */
    // white-space: -o-pre-wrap; /* Opera 7 */
    word-wrap: break-word; /* Internet Explorer 5.5+ */
}

