@import "normalize";

// VARIABLES
$color-gray-light: #f0f0f0;
$color-gray-mid:   #999;
$color-gray-dark:  darken(#001F3F, 2%);
$color-primary:    #0074D9;
$color-positive:   #00ffc4;

$width-wrapper:   800px;
$padding-section: 5em;

$radius:  5px;

// HELPERS
@mixin clearfix {
  &:before,
  &:after {
    content: " ";
    display: table;
  }

  &:after {
    clear: both;
  }
}

%section {
  padding: $padding-section 1em;
}

// GENERAL
* {
  box-sizing: border-box;
}

html,
body {
  background: white;
  color: $color-gray-dark;
  font-family: "helvetica neue", helvetica, arial, sans-serif;
  font-size: 18px;
  line-height: 1.3;
}

h1,
h2,
p,
pre {
  margin: 0;
  padding: 0;
}

a {
  color: $color-primary;
  font-weight: bold;
  text-decoration: none;

  &:hover {
    text-decoration: underline;
  }
}

fieldset {
  border: 0;
  padding: 0.5em 1em;
}

label {
  display: block;
  float: left;
  font-size: 0.75em;
  font-weight: bold;
  line-height: 2.5;
  width: 40%;
}

button,
.button {
  appearance: none;
  background-color: transparent;
  background-image: none;
  border-radius: $radius;
  border: 0;
  display: inline-block;
  font-weight: bold;
  padding: 0 1em;
  text-align: center;

  &:hover {
    text-decoration: none;
  }

  &:focus {
    box-shadow: 0 0 0 3px $color-primary;
    outline: none;
  }
}

input {
  appearance: none;
  border-radius: $radius;
  border: 2px solid $color-gray-light;
  float: right;
  line-height: 1;
  padding: 0.25em;
  width: 60%;

  &:focus {
    border-color: $color-primary;
    outline: none;
  }
}

select {
  margin: 0.4em 0 0;
}

// SPECIFIC
.width-wrapper {
  margin: 0 auto;
  max-width: $width-wrapper;
}

.header {
  @extend %section;
  background: $color-gray-dark;
  color: $color-gray-light;
}

.header__title {
  padding-bottom: $padding-section;
  text-align: center;

  h1 {
    color: $color-primary;
    font-size: 6em;
    font-weight: bold;
    letter-spacing: -3px;
  }

  h2 {
    font-weight: 200;
    letter-spacing: 1px;
  }
}

.header__examples {
  padding-bottom: 3em;
  text-align: center;

  .reacticon {
    margin: 0 0.5em;
  }
}

.main {
  @extend %section;
  background-color: $color-gray-light;
}

.example {
  @include clearfix;
  background-color: $color-gray-dark;
  border-radius: $radius;
  overflow: hidden;
  position: relative;
}

.example__result {
  border-radius: $radius 0 0 $radius;
  border-right: 1px solid $color-gray-dark;
  bottom: 0;
  color: $color-gray-light;
  left: 0;
  overflow: hidden;
  position: absolute;
  top: 0;
  width: 50%;
  padding: 3em;

  .reacticon {
    left: 50%;
    position: absolute;
    top: 50%;
    transform: translate3d(-50%, -50%, 0);
  }

  code {
    line-height: 1.5;
  }
}

.example__code__toggle {
  $width: 10em;
  border: 1px solid;
  bottom: 1.25em;
  color: $color-gray-mid;
  font-size: 0.75em;
  left: 50%;
  line-height: 2em;
  margin-left: -($width / 2);
  position: absolute;
  width: $width;
  z-index: 1;

  &:hover {
    background-color: $color-gray-mid;
    border-color: $color-gray-mid;
    color: $color-gray-dark;
  }
}

.toggle {
  $toggleSize: 1em;
  margin-top: 0.25em;

  .toggle__wrapper {
    background-color: $color-gray-dark;
    border-radius: $toggleSize;
    border: 2px solid $color-gray-dark;
    box-sizing: content-box;
    cursor: pointer;
    float: left;
    height: $toggleSize;
    margin-right: 0.5em;
    position: relative;
    width: $toggleSize * 2;

    &:hover {
      box-shadow: 0 0 0 2px $color-positive;
    }
  }

  .toggle__handle {
    background-color: white;
    border-radius: $toggleSize;
    height: $toggleSize;
    left: 0;
    position: absolute;
    top: 0;
    transition: all 0.1s ease-out;
    width: $toggleSize;
  }

  .toggle__label {
    position: relative;
    top: -2px;
    font-size: 0.75em;
    font-weight: bold;
  }

  &.is-on {
    .toggle__wrapper {
      background-color: $color-positive;
      border-color: $color-positive;
    }

    .toggle__handle {
      left: $toggleSize;
    }
  }
}

.example__configure {
  background-color: white;
  color: $color-gray-dark;
  float: right;
  padding: 0.5em 0;
  width: 50%;
}

.instructions {
  @extend %section;
  background-color: white;
  color: $color-gray-dark;

  .width-wrapper {
    max-width: $width-wrapper / 1.5;
  }
}

.instructions__cta {
  background-color: $color-primary;
  color: white;
  line-height: 3em;
  width: 100%;

  &:hover {
    background-color: darken($color-primary, 5%);
  }
}

.instructions__or {
  display: block;
  padding: 1em 0;
  text-align: center;
}

.instructions__code {
  background-color: $color-gray-light;
  border-radius: $radius;
  color: $color-gray-mid;
  display: block;
  line-height: 3em;
  margin-bottom: 3em;
  padding: 0 0.5em;
  text-align: center;
}

.footer {
  @extend %section;
  background-color: $color-gray-light;
  color: $color-gray-mid;
  text-align: center;

  a {
    color: $color-gray-mid;

    &:hover {
      color: $color-primary;
    }
  }
}

