// RapidCSS v 0.4
// This file stores all mixins which are used to develop CSS more rapidly.
// This basicly works like this: when you're still writing, I have already triple checked the same amount of code and made myself a coffee.

// Most of the mixins are self descriptive so if you have basic knowledge about LESS and CSS then you shouldnt have any problems.
// There are also few CSS3 mixins for making shadows, using border-radius bit faster etc.
// Please do not change default values of mixins without triple checking the output code.

// Clearfix
// Source: http://nicolasgallagher.com/micro-clearfix-hack/
//
// For modern browsers
// 1. The space content is one way to avoid an Opera bug when the
//    contenteditable attribute is included anywhere else in the document.
//    Otherwise it causes space to appear at the top and bottom of elements
//    that are clearfixed.
// 2. The use of `table` rather than `block` is only necessary if using
//    `:before` to contain the top-margins of child elements.
.clearfix() {
  &:before,
  &:after {
    content: " "; /* 1 */
    display: table; /* 2 */
  }
  &:after {
    clear: both;
  }
}

// line height and raw font-size if needed
.lh(@line-height) {
  line-height: @line-height;
}

.fs(@font-size) {
  font-size: @font-size;
}

.ls(@letter-spacing) {
  letter-spacing: @letter-spacing;
}

// equal font size and line height
.fslh(@size) { 
  font-size: @size;
  line-height: @size;
}

// padding and margin
.pt(@padding-top: 0) {
  padding-top: @padding-top;
}

.pr(@padding-right: 0) {
  padding-right: @padding-right;
}

.pb(@padding-bottom: 0) {
  padding-bottom: @padding-bottom;
}

.pl(@padding-left: 0) {
  padding-left: @padding-left;
}

.pyx(@y, @x) {
  padding: @y @x;
}

.p(@padding: 0) {
  padding: @padding;
}

.mt(@margin-top: 0) {
  margin-top: @margin-top;
}

.mr(@margin-right: 0) {
  margin-right: @margin-right;
}

.mb(@margin-bottom: 0) {
  margin-bottom: @margin-bottom;
}

.ml(@margin-left: 0) {
  margin-left: @margin-left;
}

.myx(@y, @x) {
  margin: @y @x;
}

.mc() {
  margin: 0 auto;
}

.m(@margin: 0) {
  margin: @margin;
}

// color and background
.c(@color) {
  color: @color;
}

.bg(@background: none) {
  background: @background;
}

.bgc(@background-color: none) {
  background-color: @background-color;
}

.bgi(@background-image: none) {
  background-image: @background-image;
}

.bgr(@background-repeat: no-repeat) {
  background-repeat: @background-repeat;
}

.bgp(@background-position) {
  background-position: @background-position;
}

// floats, position, display
.fl() {
  float: left;
}

.fr() {
  float: right;
}

.fn() {
  float: none;
}

.pos(@position: absolute) {
  position: @position;
}

.d(@display: block) {
  display: @display;
}

.dn() {
  display: none;
}

.w(@width: auto) {
  width: @width;
}

.h(@height: auto) {
  height: @height;
}

.hlh(@size) {
  .h(@size);
  .lh(@size);
}

.size(@width, @height) {
  .w(@width);
  .h(@height);
}

.eqsize(@size) {
  .w(@size);
  .h(@size);
}

.mxw(@max-width) {
  max-width: @max-width;
}

.mnw(@min-width) {
  min-width: @min-width;
}

.mxh(@max-height) {
  max-height: @max-height;
}

.mnh(@min-height: auto) {
  min-height: @min-height;
}

// other

.fw(@font-weight: normal) {
  font-weight: @font-weight;
}

.fst(@font-style: normal) {
  font-style: normal;
}

.ol(@outline: none) {
  outline: @outline;
}

.va(@vertical-align: middle) {
  vertical-align: @vertical-align;
}

.txa(@text-align: center) {
  text-align: @text-align;
}

.txd(@text-decoration: none) {
  text-decoration: @text-decoration;
}

.txt(@text-transform: uppercase) {
  text-transform: @text-transform;
}

.list-clean() {
  .p;
  .m;
  list-style: none;
}

// borders
.brd(@string: 0) {
  border: @string;
}

.brdw(@border-width) {
  border-width: @border-width;
}

.brds(@border-style) {
  border-style: @border-style;
}

.brdc(@border-color) {
  border-color: @border-color;
}

.brdt(@type: top, @string: 0) when (@type = top) {
  border-top: @string;
}

.brdt(@type: left, @string: 0) when (@type = left) {
  border-left: @string;
}

.brdt(@type: right, @string: 0) when (@type = right) {
  border-right: @string;
}

.brdt(@type: bottom, @string: 0) when (@type = bottom) {
  border-bottom: @string;
}

.ovf(@overflow: hidden) {
  overflow: @overflow;
}

.i-r(@media-repeat: no-repeat) {
  background-repeat: @media-repeat;
}

.i-p(@media-position: left top) {
  background-position: @media-position;
}

.i-c(@media-color: transparent) {
  background-color: @media-color;
}

.vis(@visibility: hidden) {
  visibility: @visibility;
}

.z(@z-index: 1) {
  z-index: @z-index;
}

.i-r(@media-repeat: no-repeat) {
  background-repeat: @media-repeat;
}

.i-p(@media-position: left top) {
  background-position: @media-position;
}

.i-c(@media-color: transparent) {
  background-color: @media-color;
}

.i(@media-name) {
  background-image: ~"url(@{media-path}/@{media-name})";
  .i-r();
  .i-p();
  .i-c();
}

.hide-text() {
  font: 0/0 a;
  color: transparent;
  text-shadow: none;
  background-color: transparent;
  border: 0;
}


// CSS3

.box-sizing() {
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  -ms-box-sizing: border-box;
  box-sizing: border-box;
}

.text-shadow(@string: 0 1px 3px rgba(0, 0, 0, 0.25)) {
  text-shadow: @string;
}

.text-shadow(@string) when (@string = reset) {
  text-shadow: 0 0 0;
}

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

.box-shadow(@string) when (@string = reset) {
  .box-shadow(0 0 0);
}

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

.inner-shadow(@x: 0, @y: 1px, @blur: 2px, @spread: 0, @alpha: 0.25) {
  -webkit-box-shadow: inset @x @y @blur @spread rgba(0, 0, 0, @alpha);
  -moz-box-shadow:    inset @x @y @blur @spread rgba(0, 0, 0, @alpha);
  box-shadow:         inset @x @y @blur @spread rgba(0, 0, 0, @alpha);
}

// Border Radius
.border-radius(@radius) {
  -webkit-border-radius: @radius;
     -moz-border-radius: @radius;
          border-radius: @radius;
}

.border-radius(@radius) when (@radius = reset) {
  .border-radius(0);
}

// Single Corner Border Radius
.border-top-left-radius(@radius) {
  -webkit-border-top-left-radius: @radius;
      -moz-border-radius-topleft: @radius;
          border-top-left-radius: @radius;
}
.border-top-right-radius(@radius) {
  -webkit-border-top-right-radius: @radius;
      -moz-border-radius-topright: @radius;
          border-top-right-radius: @radius;
}
.border-bottom-right-radius(@radius) {
  -webkit-border-bottom-right-radius: @radius;
      -moz-border-radius-bottomright: @radius;
          border-bottom-right-radius: @radius;
}
.border-bottom-left-radius(@radius) {
  -webkit-border-bottom-left-radius: @radius;
      -moz-border-radius-bottomleft: @radius;
          border-bottom-left-radius: @radius;
}

// Single Side Border Radius
.border-top-radius(@radius) {
  .border-top-right-radius(@radius);
  .border-top-left-radius(@radius);
}
.border-right-radius(@radius) {
  .border-top-right-radius(@radius);
  .border-bottom-right-radius(@radius);
}
.border-bottom-radius(@radius) {
  .border-bottom-right-radius(@radius);
  .border-bottom-left-radius(@radius);
}
.border-left-radius(@radius) {
  .border-top-left-radius(@radius);
  .border-bottom-left-radius(@radius);
}

.reset-radius() {
  -webkit-border-radius: 0;
     -moz-border-radius: 0;
          border-radius: 0;
}

// Transitions
.transition(@transition) {
  -webkit-transition: @transition;
     -moz-transition: @transition;
       -o-transition: @transition;
          transition: @transition;
}
.transition-delay(@transition-delay) {
  -webkit-transition-delay: @transition-delay;
     -moz-transition-delay: @transition-delay;
       -o-transition-delay: @transition-delay;
          transition-delay: @transition-delay;
}
.transition-duration(@transition-duration) {
  -webkit-transition-duration: @transition-duration;
     -moz-transition-duration: @transition-duration;
       -o-transition-duration: @transition-duration;
          transition-duration: @transition-duration;
}

// Opacity

.opacity(@opacity) {
  opacity: @opacity;
  // IE8 filter
  @opacity-ie: (@opacity * 100);
  filter: ~"alpha(opacity=@{opacity-ie})";
}

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

// Background sizing
.background-size(@size) {
  -webkit-background-size: @size;
     -moz-background-size: @size;
       -o-background-size: @size;
          background-size: @size;
}

// Transformations
.rotate(@degrees) {
  -webkit-transform: rotate(@degrees);
     -moz-transform: rotate(@degrees);
      -ms-transform: rotate(@degrees);
       -o-transform: rotate(@degrees);
          transform: rotate(@degrees);
}

// Reset filters for IE
.reset-filter() {
  filter: e(%("progid:DXImageTransform.Microsoft.gradient(enabled = false)"));
}

// debug
.dbg(@color: red) {
  .brd(1px solid @color);
}