* {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}

:root {
  --light-green: hsl(148, 38%, 91%);
  --green: hsl(169, 82%, 27%);
  --red: hsl(0, 66%, 56%);
  --white: hsl(0, 0%, 100%);
  --medium-grey: hsl(186, 15%, 59%);
  --dark-grey: hsl(187, 24%, 22%);
}

body {
  font-family: "Karla", sans-serif;
  font-optical-sizing: auto;
  font-weight: 500;
  font-style: normal;
  background-color: var(--light-green);
  min-height: 100vh;
  display: grid;
  place-content: center;
}

label {
  color: var(--dark-grey);
}

input[type="text"],
input[type="email"],
textarea {
  width: 100%;
  padding: 0.5rem;
  margin-top: 0.5rem;
  font-family: inherit;
  border: 1px solid var(--medium-grey);
  border-radius: 0.35rem;
}

input:focus,
textarea:focus {
  outline: 1px solid var(--green);
  border: 1px solid var(--green);
}

input[type="text"].form-error,
input[type="email"].form-error
input[type="radio"].form-error,
input[type="checkbox"].form-error
 {
  border: 1px solid var(--red);
}

.required-input {
  color: var(--green);
}

.form-alert {
  display: none;
  color: var(--red);
  margin-top: 0.5rem;
}

.form-alert.form-error {
  display: block;
}

.contact-form {
  background-color: var(--white);
  margin: 1rem;
  padding: 2rem;
  border-radius: 1rem;
}

.contact-form h1 {
  color: var(--dark-grey);
  margin-bottom: 1.25rem;
}

.contact-form .form-item {
  margin-bottom: 1.5rem;
}

.contact-form .form-item:nth-child(1) {
  display: flex;
  gap: 1rem;
}

.contact-form .form-item:nth-child(3) .radio-inputs {
  margin-top: 0.5rem;
  display: flex;
  gap: 1rem;
}

.contact-form .form-item:nth-child(3) .radio-inputs .radio-option {
  cursor: pointer;
  width: 100%;
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  outline: 1px solid var(--medium-grey);
  border-radius: 0.35rem;
}

.contact-form .form-item:nth-child(3) .radio-inputs .radio-option.active {
  background-color: var(--light-green);
}

.contact-form .form-item:nth-child(3) input[type="radio"] {
  appearance: none;
  width: 0.5rem;
  height: 0.5rem;
  outline: 2px solid var(--green);
  outline-offset: 3px;
  border-radius: 50%;
}

.contact-form .form-item:nth-child(3) input[type="radio"]:checked {
  background-color: var(--green);
}

.contact-form .form-item:nth-child(3) .radio-inputs .radio-option label {
  cursor: pointer;
  width: 100%;
}

.contact-form .form-item:nth-child(5) {
  margin-bottom: 2rem;
}

.contact-form .form-item:nth-child(5) div {
  display: flex;
  gap: 1rem;
}

.contact-form .form-item:nth-child(5) input[type="checkbox"] {
  cursor: pointer;
  accent-color: var(--green);
}

.contact-form .form-item:nth-child(5) label {
  cursor: pointer;
}

.contact-form .submit-btn {
  cursor: pointer;
  background-color: var(--green);
  color: var(--white);
  width: 100%;
  padding: 0.75rem;
  border: 0;
  outline: 0;
  border-radius: 0.35rem;
}

.contact-form .submit-btn:hover {
  background-color: var(--dark-grey);
}

.success-message {
  background-color: var(--dark-grey);
  color: var(--light-green);
  width: max-content;
  padding: 1rem;
  pointer-events: none;
  opacity: 0;
  position: fixed;
  top: 10%;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 0.35rem;
}

.success-message.active {
  display: block;
  pointer-events: all;
  animation-name: fadeOut;
  animation-duration: 5s;
  animation-fill-mode: forwards;
}

@keyframes fadeOut {
  0%,
  25%,
  50%,
  75% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

.success-message .message-header {
  color: var(--white);
  margin-bottom: 0.5rem;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

@media (max-width: 380px) {
  .contact-form .form-item:nth-child(1) {
    flex-direction: column;
  }

  .contact-form .form-item:nth-child(3) .radio-inputs {
    flex-direction: column;
  }

  textarea {
    height: 200px;
  }

  .success-message {
    width: 35ch;
    height: 5%;
  }
}
