/**
 * @file
 * Form component's rules.
 *
 * Defines rules for form components : input, label, etc.
 *
 */

form {
  padding: 2rem;
  background-color: var(--color-neutral);
}
@media all and (min-width: 1300px){
  form {
    padding: 3rem 5.75rem;
  }
}
/**
 * Forms bases
 */

input,
textarea {
	max-width: 100%;
}

/**
 * Input Text
 */

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="tel"],
textarea {
  padding: 0.7rem 0.7rem;
  background-color: var(--color-white);
  color: var(--color-neutral--2);
  display: block;
  width: 100%;
  box-sizing: border-box;
  border: none;
}
.form-actions {
  display: flex;
  justify-content: flex-end;
}
.js-form-item label {
  display: block;
  margin-bottom: 8px;
}
.js-form-type-processed-text p {
  font-size: 12px;
}
/**
 * Radio
 */

.form-type-radio {
  line-height: 1.1;
  display: grid;
  grid-template-columns: 1em auto;
  gap: 0.5em;
}
.form-radios .form-type-radio + .form-item.form-type-radio {
  margin-top: 1rem;
}
.form-type-radio:focus-within {
  color: var(--color-neutral--2);
}
.form-type-radio label {
  width: 260px;
  font-weight: 500;
  user-select: none;
  cursor: pointer;
}
input[type="radio"] {
  -webkit-appearance: none;
  appearance: none;
  background-color: var(--color-neutral--4);
  margin: 0;
  font: inherit;
  color: var(--color-neutral--2);
  width: 18px;
  height: 18px;
  border: 1px solid var(--color-neutral--2);
  border-radius: 50%;
  display: grid;
  place-content: center;
  max-width: none;
}
input[type="radio"]::before {
  content: "";
  width: 0.65em;
  height: 0.65em;
  border-radius: 50%;
  transform: scale(0);
  transition: 120ms transform ease-in-out;
  box-shadow: inset 1em 1em var(--color-neutral--2);
  background-color: var(--color-neutral--2);
}
input[type="radio"]:checked::before {
  transform: scale(1);
}
input[type="radio"]:focus {
  outline: max(2px, 0.15em) solid var(--color-neutral--2);
  outline-offset: max(2px, 0.15em);
}


/**
 * Checkbox
 */

.form-type-checkbox {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
}
.form-type-checkbox label {
  width: 260px;
  font-weight: 500;
  user-select: none;
  cursor: pointer;
}
.form-type-checkbox .label-wrapper {
  width: calc(100% - calc(13px + 0.5rem));
  max-width: 500px;
}
input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  background-color: var(--brand-white);
  margin: 5px 0 0;
  font: inherit;
  color: currentColor;
  cursor: pointer;
  width: 15px;
  height: 15px;
  border: 2px solid var(--color-neutral--2);
  border-radius: 2px;
  display: grid;
  place-content: center;
}
input[type="checkbox"]::before {
  content: "";
  width: 8px;
  height: 7px;
  transform: scale(0);
  transform-origin: bottom left;
  transition: 120ms transform ease-in-out;
  background-image: url('../images/form/check.svg');
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
}
input[type="checkbox"]:hover {
  background-color: var(--color-neutral--2);
}
input[type="checkbox"]:checked {
  background-color: var(--color-neutral--2);
}
input[type="checkbox"]:hover::before,
input[type="checkbox"]:checked::before {
  transform: scale(1);
}

/**
 * Select
 */

.form-type-select select {
  -webkit-appearance: none;
     -moz-appearance: none;
          appearance: none;
  background-color: transparent;
  border: none;
  padding: 0.5rem 40px 0.5rem 0.5rem;
  margin: 0;
  width: 100%;
  cursor: inherit;
  line-height: inherit;
  z-index: 1;
  outline: none;
}
.form-type-select select::-ms-expand {
  display: none;
}
.select {
  display: grid;
  grid-template-areas: "select";
  align-items: center;
  position: relative;
  max-width: 350px;
  border: 1px solid var(--color-neutral--2);
  border-radius: 2px;
  cursor: pointer;
  background-color: var(--color-neutral--4);
  margin-top: 0.5rem;
}
.select select, .select::after {
  grid-area: select;
}
.select::after {
  content: "";
  justify-self: end;
  width: 40px;
  height: 100%;
  background-image: url('../images/form/select.svg');
  background-position: calc(50% + 1px) calc(50% + 2px);
  background-repeat: no-repeat;
  background-size: 12px;
  background-color: var(--color-neutral--2);
}
.select:focus-within {
  border: 1px solid var(--color-neutral--2);
}



/**
 * Webform manuscript
 */


.form-type-webform-document-file {
  margin: 1.125rem 0;
  max-width: 500px;
  color: var(--color-secondary--1);
}
.webform-document-file {
  padding: 0.5rem;
  border: 1px solid var(--color-neutral--1);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.form-type-webform-document-file .description {
  margin-top: 10px;
  color: var(--color-neutral--1);
  font-size: 0.8rem;
}
.form-type-webform-document-file input::file-selector-button {
  all: unset;
  padding: 1rem;
  border-radius: 3px;
  background-color: var(--color-neutral--2);
  cursor: pointer;
  color: white;
  text-align: right;
  margin-right: 10px;
  transition: ease 150ms;
  font-size: initial;
}
.form-type-webform-document-file input::file-selector-button:hover {
  background-color: var(--color-neutral--1);
}
.form-type-webform-document-file input[name*="remove_button"]{
  background-color: var(--color-neutral--2);
  color: white;
  margin: 10px 0;
  transition: ease 150ms;
  font-size: initial;
  all: unset;
  padding: 1rem;
  border-radius: 3px;
  background-color: var(--color-neutral--2);
  cursor: pointer;
  color: white;
  text-align: right;
  transition: ease 150ms;
  font-size: initial;
}
.form-type-webform-document-file input[name*="remove_button"]:hover{
  background-color: var(--color-neutral--1);
}
.form-type-webform-document-file span.file a {
  color: var(--color-neutral--1);
}
.form-type-webform-document-file span.file {
  overflow: hidden;
  width: 100%;
  white-space: nowrap;
}


/**
 * Submit
 */

input[type="submit"] {
	padding: 16px;
  background-color: var(--color-primary);
  color: #FCFAF3;
  font-size: var(--content-size);
  font-weight: 400;
  line-height: normal;
  letter-spacing: 1px;
  border: none;
  cursor: pointer;
}
input[type="submit"]:hover {
  background: var(--color-system--3);
  color: var(--color-system--2);
}
