/* ==========================================================================
   Base styles: opinionated defaults
   ========================================================================== */

html,
button,
input,
select,
textarea {
  color: @off-black;
}

/**
 * Remove text-shadow in selection highlight: h5bp.com/i
 * These selection rule sets have to be separate.
 * Customize the background color to match your design.
 */
::-moz-selection {
  background: @light-blue;
  text-shadow: none;
}

::selection {
  background: @light-blue;
  text-shadow: none;
}

/**
 * A better looking default horizontal rule
 */
hr {
  display: block;
  height: 1px;
  border: 0;
  border-top: 1px solid @light-gray;
  margin: @spacing-l 0;
  padding: 0;
}

/**
 * Remove the gap between images, videos, audio and canvas and the bottom of
 * their containers: h5bp.com/i/440
 */
audio,
canvas,
img,
video {
  vertical-align: middle;
}

/**
 * Remove default fieldset styles.
 */
fieldset {
  border: 0;
  margin: 0;
  padding: 0;
}

/**
 * Allow only vertical resizing of textareas.
 */
textarea {
  resize: vertical;
}

/**
 * Default styling for code tags
 */
code {
  background: @lighter-gray;
  border: 1px solid @light-gray;
  border-radius: 4px;
  color: @blue;
  display: block;
  padding: @spacing-sm;
}


/* ==========================================================================
   Spacing
   ========================================================================== */

code,
p,
pre,
.spaced {
  margin: @spacing 0;
}

section {
  margin: @spacing-l 0;
}

section:first-child {
  margin-top: 0;
}

section:last-child {
  margin-bottom: 0;
}

code pre {
  margin: 0;
}

section,
.max-width-content {
  margin-left: auto;
  margin-right: auto;
  max-width: @max-content-width;
}

.padded {
  padding: @spacing;
}

/* ==========================================================================
   Links
   ========================================================================== */

a[href] {
  color: @blue;
  text-decoration: none;
  transition: color 150ms linear;

  &:hover {
    color: @light-blue;
    text-decoration: underline;
  }

  &:active {
    color: @dark-blue;
  }

  &:focus,
  &:active {
    outline: none;
  }
}

a[href],
.clickable,
.btn {
  cursor: pointer;
}

/* ==========================================================================
   Header
   ========================================================================== */

header {
  background: @dark-blue;
  border-top: 2px solid @yellow;

  &,
  h1,
  h2,
  h3,
  h4,
  h5,
  h6 {
    color: @white;
  }
}

.header-title-text {
  font-size: @font-size-xsm;
  margin: 0 @spacing-xsm 0;
  text-transform: uppercase;
}

/* ==========================================================================
   Hero
   ========================================================================== */

.hero {
  background: @black;
  color: @white;
  padding: @spacing 0;

  [class*="icon-"] {
    color: @yellow;
    font-size: @font-size * 7.5;
  }
}

/* ==========================================================================
   Footer
   ========================================================================== */

footer {
  border-top: 1px solid @lighter-gray;
  color: darken(@light-gray, 8%);
  font-weight: 300;

  a[href] {
    color: darken(@light-gray, 8%);
    text-decoration: underline;
  }
}


/* ==========================================================================
   Messages
   ========================================================================== */

.msg {
  padding: @spacing @spacing @spacing @spacing + (2 * @spacing-sm);
  position: relative;

  &:before {
    background-size: contain;
    content: '';
    height: @spacing;
    left: @spacing;
    position: absolute;
    top: @spacing;
    width: @spacing;
  }
}

.msg-success,
.msg-error {
  color: @white;
}

.msg-success {
  background: @green;

  &:before {
    background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2ZXJzaW9uPSIxLjAiIGlkPSJMYXllcl8xIiB4PSIwcHgiIHk9IjBweCIgd2lkdGg9IjI1Ljc3MnB4IiBoZWlnaHQ9IjI1LjU5OHB4IiB2aWV3Qm94PSIwIDAgMjUuNzcyIDI1LjU5OCIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMjUuNzcyIDI1LjU5ODsiIHhtbDpzcGFjZT0icHJlc2VydmUiPgo8cGF0aCBmaWxsPSIjZmZmIiBkPSJNMjUuNjQ2LDEzLjY1M2wtMS41MTktMi4zOTZsMC45MDEtMi42ODljMC4xMjItMC4zNjctMC4wMy0wLjc3LTAuMzY1LTAuOTYybC0yLjQ1OC0xLjQxN2wtMC40NTItMi44ICBjLTAuMDYzLTAuMzgyLTAuMzg1LTAuNjY3LTAuNzcxLTAuNjgzbC0yLjgzNS0wLjExMWwtMS43MDEtMi4yN2MtMC4yMzItMC4zMS0wLj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TAuNzYsMC0xLjA1bDEuMDMxLTEuMDVjMC4yODUtMC4yODYsMC43NDgtMC4yODYsMS4wMzEsMGwyLjcxOSwyLjc2Mmw0LjQ4NC02LjcxOCAgYzAuMjI1LTAuMzM5LDAuNjgyLTAuNDI1LDEuMDE0LTAuMTk2bDEuMjA5LDAuODMxQzE4LjkwMiw4Ljk0MiwxOC45ODgsOS40MDUsMTguNzYzLDkuNzQyTDE4Ljc2Myw5Ljc0MnoiLz4KPC9zdmc+);
  }
}

.msg-warning {
  background: lighten(@yellow, 10%);

  &:before {
    background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2ZXJzaW9uPSIxLjEiIGlkPSJhbGVydCIgeD0iMHB4IiB5PSIwcHgiIHdpZHRoPSIxMDBweCIgaGVpZ2h0PSIxMDBweCIgdmlld0JveD0iMCAwIDEwMCAxMDAiIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDEwMCAxMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPgo8cGF0aCBmaWxsPSIjMDAwIiBkPSJNNTAsMUMyMi45MzgsMSwxLDIyLjkzOCwxLDUwYzAsMjcuMDYyLDIxLjkzOCw0OSw0OSw0OWMyNy4wNjIsMCw0OS0yMS45MzgsNDktNDlDOTksMjIuOTM4LDc3LjA2MiwxLDUwLDF6ICAgTTUwLDgzLjcwOWMtNC4xNjQsMC03LjU0LTMuMzc2LTcuNTQtNy41NHMzLjM3Ni03LjU0LDcuNTQtNy41NGM0LjE2NCwwLDcuNTQsMy4zNzYsNy41NCw3LjU0UzU0LjE2NCw4My43MDksNTAsODMuNzA5eiAgIE01Ny41NCw1NS4yOTdjMCw0LjE2NC0zLjM3Niw3LjU0MS03LjU0LDcuNTQxYy00LjE2NCwwLTcuNTQtMy4zNzctNy41NC03LjU0MVYyMy44MzFjMC00LjE2NCwzLjM3Ni03LjU0LDcuNTQtNy41NCAgYzQuMTY0LDAsNy41NCwzLjM3Niw3LjU0LDcuNTRWNTUuMjk3eiIvPgo8L3N2Zz4=);
  }
}

.msg-error {
  background: @red;

  &:before {
    background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2ZXJzaW9uPSIxLjEiIGlkPSJhbGVydCIgeD0iMHB4IiB5PSIwcHgiIHdpZHRoPSIxMDBweCIgaGVpZ2h0PSIxMDBweCIgdmlld0JveD0iMCAwIDEwMCAxMDAiIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDEwMCAxMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPgo8cGF0aCBmaWxsPSIjZmZmIiBkPSJNNTAsMUMyMi45MzgsMSwxLDIyLjkzOCwxLDUwYzAsMjcuMDYyLDIxLjkzOCw0OSw0OSw0OWMyNy4wNjIsMCw0OS0yMS45MzgsNDktNDlDOTksMjIuOTM4LDc3LjA2MiwxLDUwLDF6ICAgTTUwLDgzLjcwOWMtNC4xNjQsMC03LjU0LTMuMzc2LTcuNTQtNy41NHMzLjM3Ni03LjU0LDcuNTQtNy41NGM0LjE2NCwwLDcuNTQsMy4zNzYsNy41NCw3LjU0UzU0LjE2NCw4My43MDksNTAsODMuNzA5eiAgIE01Ny41NCw1NS4yOTdjMCw0LjE2NC0zLjM3Niw3LjU0MS03LjU0LDcuNTQxYy00LjE2NCwwLTcuNTQtMy4zNzctNy41NC03LjU0MVYyMy44MzFjMC00LjE2NCwzLjM3Ni03LjU0LDcuNTQtNy41NCAgYzQuMTY0LDAsNy41NCwzLjM3Niw3LjU0LDcuNTRWNTUuMjk3eiIvPgo8L3N2Zz4=);
  }
}

/* ==========================================================================
   Forms
   ========================================================================== */

input[type="text"],
input[type="number"],
input[type="search"],
input[type="password"],
input[type="submit"],
textarea {
  font-size: @font-size-sm;
  padding: @spacing-xsm;
}

input[type="text"],
input[type="number"],
input[type="search"],
input[type="password"],
textarea {
  border: 1px solid @light-gray;
  box-shadow: inset 1px 1px 4px 0 @light-gray;
  width: 100%;
  &.has-error {
    border-color: @light-red;
    box-shadow: inset 1px 1px 4px 0 @light-red;
  }
}

input:focus.has-error {
  outline: auto 5px @light-red;
}

input[type="checkbox"],
input[type="radio"] {
  margin: @spacing-xsm;
  position: relative;
  top: -2px;
}

input[type="submit"],
button,
a[href].btn,
.btn {
  border: none;
  border-radius: @spacing / 5;
  border-bottom: 1px solid transparent;
  color: @white;
  display: inline-block;
  font-size: @font-size-xsm;
  font-weight: 700;
  line-height: 1;
  padding: @spacing-xsm @spacing;
  text-align: center;
  text-transform: capitalize;
  transition: background 150ms linear;
  .colored-button(@blue);

  &:hover {
    text-decoration: none;
  }

  &[disabled] {
    opacity: 0.4;
  }

  &:focus {
    outline: 0 !important;
  }
}

a[href].btn-sm,
.btn-sm {
  border-radius: @spacing / 5;
  font-size: @font-size-xxsm;
  min-width: 0;
  padding: @spacing / 3 @spacing * .6;
}

a[href].btn-red,
.btn-red {
  .colored-button(@red);
}

a[href].btn-green,
.btn-green {
  .colored-button(@green);
}

a[href].btn-transparent,
.btn-transparent {
  background: transparent;
  color: @blue;
  border-bottom: none;
  text-shadow: none;

  &:hover {
    background: transparent;
  }

  &:active,
  &:focus {
    background: transparent;
    color: #fff;
  }
}

a[href].btn-dark-blue,
.btn-dark-blue {
  .colored-button(@dark-blue);
}

a[href].btn-gray,
.btn-gray {
  .colored-button(@gray);
}

a[href].btn-yellow,
.btn-yellow {
  .colored-button(@yellow, @off-black);
}

a[href].btn-orange,
.btn-orange {
  .colored-button(@orange);
}

a[href].btn-light-gray,
.btn-light-gray {
  .colored-button(@light-gray);
  text-shadow: none;

  &:hover {
    background: lighten(@light-gray, 5%);
  }

  &:active {
    background: darken(@light-gray, 10%);
  }
}

.btn-light-gray {
  color: @dark-blue;

  &:hover {
    color: @blue;
  }
}

.btn-light-gray-red {
  background: @light-gray;
  border-bottom: 1px solid @dark-shadow;
  color: @red;
  text-shadow: 0 0 0 transparent;

  &:hover {
    background: lighten(@red, 10%);
    color: @white;
  }
}

label {
  font-size: @font-size-xxsm;
  font-weight: 300;
  text-transform: uppercase;
  color: @gray;
}

/* ==========================================================================
   Helper classes
   ========================================================================== */

/**
 * Margin / padding related
 */

.no-top-margin {
  margin-top: 0;
}

.no-bottom-margin {
  margin-bottom: 0;
}

/**
 * Hide from both screenreaders and browsers: h5bp.com/u
 */
.hidden {
  display: none !important;
  visibility: hidden;
}

/**
 * Hide only visually, but have it available for screenreaders: h5bp.com/v
 */
.visuallyhidden {
  border: 0;
  clip: rect(0 0 0 0);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
}

/**
 * Extends the .visuallyhidden class to allow the element to be focusable
 * when navigated to via the keyboard: h5bp.com/p
 */
.visuallyhidden.focusable:active,
.visuallyhidden.focusable:focus {
  clip: auto;
  height: auto;
  margin: 0;
  overflow: visible;
  position: static;
  width: auto;
}

/**
 * Hide visually and from screenreaders, but maintain layout
 */
.invisible {
  visibility: hidden;
}

/**
 * Floats
 */
.left {
  float: left;
}

.right {
  float: right;
}

/**
 * Clearfix: contain floats
 *
 * 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 receive the `clearfix` class.
 * 2. The use of `table` rather than `block` is only necessary if using
 *    `:before` to contain the top-margins of child elements.
 */
.clearfix:before,
.clearfix:after {
  content: " "; /* 1 */
  display: table; /* 2 */
}

.clearfix:after {
  clear: both;
}

/**
 * For IE 6/7 only
 * Include this rule to trigger hasLayout and contain floats.
 */
.clearfix {
  *zoom: 1;
}

/**
 * Flex box related utility classes.
 */
.flex-row {
  align-items: center;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: flex-start;
}

.flex-fixed-item-size {
  > * {
    flow-grow: 0;
    flex-shrink: 0;
  }
}

.flex-vcenter {
  display: flex;
  align-items: center;
}

/**
 * Use margin: auto for aligining an item contrary to it's parent's align-items setting.
 * The align-self property seems desireable here but works less consistently across browsers, so for
 * now we'll use this instead.
 */
.flex-align-right {
  margin-left: auto;
}

.flex-align-left {
  margin-right: auto;
}

.flex-align-top {
  margin-bottom: auto;
}

.flex-align-bottom {
  margin-top: auto;
}
