/*------------------------------------*\
  $FORMS
\*------------------------------------*/

$input-padding: 10px;
$input-border-color: #ddd;
$input-text-color: #323232;
$input-text-size: 16;

form {
  max-width: 460px;
}

fieldset {
  border: 0;
}

legend {
  margin-bottom: 5px;
}

label {
  display: block;
  margin-bottom: 5px;
  cursor: pointer;
}

input {
  display: block;
}

/**
 * 1. Remove the default browser styling from elements
 */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="search"],
input[type="number"],
input[type="date"],
input[type="url"],
input[type="password"],
select,
textarea {
  padding: 0 25px;
  height: 50px;
  line-height: 50px;
  width: 100%;
  font: {
    family: $body-font;
    size: font-size($input-text-size);
  }
  color: $input-text-color;
  background-color: #fff;
  border: 1px solid #fff;
  border-radius: 50px;
  -webkit-appearance: none; /* 1 */
  -moz-appearance: none; /* 1 */
  outline: none;

  &::placeholder {
    color: $input-text-color;
  }

  &:focus {
    border: 1px solid $input-border-color;
  }
}

meter,
progress,
input[type="range"] {
  width: 100%;
}

/**
 * It should be clear that the textarea allows
 * for longer prose, the default is a little too small
 */
textarea {
  height: 150px;
  line-height: 1.3;
  padding: 25px;
  border-radius: 25px;
}

/**
 * Add an arrow to the select menu since we removed
 * the default one with `appearance: none;`
 */
select {
  @include svg-background('select-arrow-down');
  background-repeat: no-repeat;
  background-position: right $input-padding center;
}

/**
 * Give checkboxes and radio buttons
 * some breathing space next to labels
 */
input[type="radio"],
input[type="checkbox"] {
  margin-right: 5px;
  display: inline-block;
}

/**
 * 1. Remove the default browser styling from elements
 * 2. Fixed an issue where [type="submit"] gets an
 *    additional 2px padding in Firefox.
 */
input[type="submit"],
button {
  -webkit-appearance: none; /* 1 */
  -moz-appearance: none; /* 1 */

  &::-moz-focus-inner,
  &::-moz-focus-inner {
    border: 0; /* 2 */
    padding: 0; /* 2 */
  }
}


/**
 * `.field` should wrap a label and input
 */
.field {
  margin-bottom: $base-spacing-unit;

  p { margin-bottom: 0; }
}


/**
 * `.field--choice` contains either
 * radio buttons or checkboxes
 */
.field--choice {
  label:last-child {
    margin-bottom: 0;
  }
}


/**
 * `.field--error` modifies the defaults
 * only when the input errors
 */
.field--error {
  input,
  textarea {
    color: mix($error-color, black, 40%);
    background-color: $error-color;
    border: 1px solid darken($error-color, 50%);
  }
}

.in-page-form {
  margin: 0 auto;

  label {
    display: none;
  }
}
