@keyframes rotate {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.form {
  margin: em(50px) 0;
  opacity: 1;
  transition: opacity 0.2s ease-in-out;
  position: relative;
  z-index: 1;
  .section__text {
    margin: 0;
  }
  & + .section__title {
    margin-top: em(-75px);
  }
}

*.loading {
  pointer-events: none;
  opacity: 0.4;
  transition: opacity 0.2s ease-in-out;
  &:before {
    content: '';
    position: absolute;
    top: 40%;
    left: 50%;
    width: em(70px);
    height: em(70px);
    margin-top: em(-35px);
    margin-left: em(-35px);
    border: em(3px) solid;
    border-color: $green transparent transparent transparent;
    border-radius: 50%;
    animation: rotate 1s infinite;
    z-index: 100;
  }
}

.form__submit {
  text-align: right;
  .button {
    vertical-align: top;
    margin-left: em(10px);
  }
}

.button {
  display: inline-block;
  height: em(45px);
  line-height: em(44px);
  border: none;
  -webkit-appearance: none;
  text-align: center;
  font-size: em(16px);
  text-transform: uppercase;
  text-decoration: none;
  background: $green;
  border-radius: 0;
  color: $white;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.02em;
  position: relative;
  overflow: hidden;
  span {
    transition: transform 0.4s $easeOutQuart;
  }
  &:hover {
    .button__icon {
      transform: none;
    }
    .button__text {
      transform: translateX(100%);
    }
  }
}

.button--small {
  height: em(35px);
  line-height: em(35px);
  font-size: em(14px);
}

.button--white {
  background: $white;
  color: $green;
  .button__icon {
    svg {
      fill: $green;
    }
  }
}

.button--ghost {
  background: none;
  color: $green;
  svg {
    fill: $green !important;
  }
  &:after {
    content: '';
    position: absolute;
    z-index: -1;
    display: block;
    top: 0;
    right: 0;
    left: 0;
    bottom: 0;
    border: 2px solid $green;
  }
}

.button--ghost-white {
  color: $white;
  svg {
    fill: $white !important;
  }
  &:after {
    border: 2px solid $white;
  }
}

.button__icon {
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform: translateX(-100%);
  svg {
    display: inline-block;
    height: em(21px);
    width: em(36px);
    fill: $white;
    margin: em(12px) 0;
    .button--small & {
      margin: em(7px) 0;
    }
  }
}

.button__text {
  display: inline-block;
  transform: none;
  padding: 0 em(30px);
  min-width: em(200px);
}

.button--icon {
  white-space: nowrap;
  transform: none;
  transition: transform 0.4s $easeOutQuart;
  .button__icon {
    display: inline-block;
    vertical-align: top;
    position: relative;
    transform: none !important;
    width: auto;
    padding-left: em(15px);
  }
  .button__text {
    vertical-align: top;
    transform: none !important;
    padding-left: 0;
    min-width: auto;
  }
  &:hover {
    transform: scale(1.05);
  }
}

.form__field {
  width: 100%;
  display: block;
  margin-bottom: em(25px);
  position: relative;
}

.form__field--label {
  padding-left: 30%;
  @media screen and (max-width: $small_breakpoint) {
    padding: 0;
  }
}

.form__field__label {
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  width: 30%;
  line-height: em(36px);
  font-weight: 400;
  padding-right: em(20px);
  font-size: em(12px);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  span {
    line-height: 1.3;
    display: inline-block;
    vertical-align: middle;
  }
  @media screen and (max-width: $small_breakpoint) {
    position: relative;
    width: 100%;
    padding: 0;
    margin-bottom: em(2px);
  }
}

.form__field--icon {
  input[type="text"], input[type="email"], input[type="number"], input[type="password"] {
    height: em(70px);
    padding: 0 em(90px) 0 em(15px);
  }
  button, a {
    display: block;
    -webkit-appearance: none;
    position: absolute;
    top: 0;
    right: 0;
    width: em(70px);
    height: em(70px);
    line-height: em(65px);
    border: none;
    font-size: 0;
    text-align: center;
    padding: em(3px);
    border-top-right-radius: em(5px);
    border-bottom-right-radius: em(5px);
    background: transparent;
    color: inherit;
    cursor: pointer;
    svg {
      vertical-align: middle;
      width: em(36px);
      height: em(36px);
      display: inline-block;
      transform: none;
      fill: $green;
      transition: transform 0.3s $easeOutQuart;
    }
    &:hover {
      svg {
        transform: scale(1.1);
      }
    }
  }
}

input[type="checkbox"], input[type="radio"] {
  display: none;
}

input[type="text"], input[type="email"], input[type="number"], input[type="password"],
input[type="checkbox"] + label, input[type="radio"] + label,
textarea {
  display: block;
  width: 100%;
  height: em(45px);
  font-size: em(16px);
  font-weight: 900;
  font-family: $default_font_family;
  color: darken($dark_gray, 20);
  background: lighten($light_gray, 2);
  text-indent: em(14px);
  border: none;
  transition: background 0.2s ease-in-out;
  -webkit-appearance: none;
  border-radius: 0;
  padding-right: em(5px);
  position: relative;
  &::placeholder {
    color: $gray;
  }
  &::-webkit-input-placeholder {
    color: $gray;
  }
  &::-moz-placeholder {
    color: $gray;
  }
  &:-ms-input-placeholder {
    color: $gray;
  }
  &:-moz-placeholder {
    color: $gray;
  }
  &:focus {
    background: $light_gray;
    outline: none;
  }
}

.form__field__choice__icon {
  display: inline-block;
  position: absolute;
  top: 50%;
  left: em(14px);
  width: em(24px);
  height: em(24px);
  margin-top: em(-12px);
  border: 2px solid $gray;
  background: $white;
  will-change: transform;
  svg {
    display: none;
    position: absolute;
    top: -20%;
    left: 15%;
    width: 120%;
    height: 120%;
    fill: $green;
  }
  &:before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: em(10px);
    height: em(10px);
    margin-top: em(-5px);
    margin-left: em(-5px);
    border-radius: 50%;
    background: $green;
    display: none;
  }
}

input[type="checkbox"] + label, input[type="radio"] + label {
  padding: em(14px) em(14px) em(14px) em(52px);
  margin-bottom: em(10px);
  text-indent: 0;
}

input[type="checkbox"]:checked + label, input[type="radio"]:checked + label {
  .form__field__choice__icon {
    svg {
      display: block;
    }
  }
}

input[type="radio"] + label {
  .form__field__choice__icon {
    border-radius: 50%;
  }
}

input[type="radio"]:checked + label {
  .form__field__choice__icon {
    svg {
      display: none;
    }
    &:before {
      display: block;
    }
  }
}

textarea {
  height: em(150px);
  text-indent: 0;
  padding: em(12px) em(14px);
  resize: vertical;
  min-height: em(100px);
  line-height: 1.3;
}

.form__field__help_text {
  margin-top: em(5px);
  display: block;
  width: 100%;
  font-size: em(16px);
  font-weight: 300;
  color: $dark_gray;
}

.form__success, .form__errors, .form__field__errors {
  display: block;
  width: 100%;
  font-size: em(14px);
  font-weight: 700;
  line-height: 1.5;
}

.form__errors, .form__field__errors {
  color: $red;
}

.form__errors {
  margin-bottom: em(30px);
}

.form__field__errors {
  margin-top: em(7px);
}

input[name="honeypot"] {
  display: none !important;
}