@font-face {
  font-family: Karla;
  src: local("Karla"), url("./assets/fonts/Karla-VariableFont_wght.ttf");
  font-weight: 400;
  font-display: swap;
}
:root {
  /* Primary */
  --green-200: hsl(148, 38%, 91%);
  --green-600: hsl(169, 82%, 27%);
  --red: hsl(0, 66%, 54%);

  /* Neutral */
  --grey-500: hsl(186, 15%, 59%);
  --grey-900: hsl(187, 24%, 22%);
  --white: hsl(0, 0%, 100%);
  --fs-p: 1.5rem;
  --fw-700: 700;
}

/* RESET */
/* Josh Comeau custom css reset */
/* https://www.joshwcomeau.com/css/custom-css-reset/ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* 2. Remove default margin */
*:not(dialog) {
  margin: 0;
}

/* 3. Enable keyword animations */
@media (prefers-reduced-motion: no-preference) {
  html {
    interpolate-size: allow-keywords;
  }
}

body {
  /* 4. Increase line-height */
  line-height: 1.5;
  /* 5. Improve text rendering */
  -webkit-font-smoothing: antialiased;
}

/* 6. Improve media defaults */
img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

/* 7. Inherit fonts for form controls */
input,
button,
textarea,
select {
  font: inherit;
}

/* 8. Avoid text overflows */
p,
h1,
h2,
h3,
h4,
h5,
h6 {
  overflow-wrap: break-word;
}

/* 9. Improve line wrapping */
p {
  text-wrap: pretty;
}
h1,
h2,
h3,
h4,
h5,
h6 {
  text-wrap: balance;
}

/*
  10. Create a root stacking context
*/
#root,
#__next {
  isolation: isolate;
}

.sr-only {
  border: 0 !important;
  clip: rect(1px, 1px, 1px, 1px) !important;
  -webkit-clip-path: inset(50%) !important;
  clip-path: inset(50%) !important;
  height: 1px !important;
  overflow: hidden !important;
  margin: -1px !important;
  padding: 0 !important;
  position: absolute !important;
  width: 1px !important;
  white-space: nowrap !important;
}

/* BASE STYLES */

.flex-col {
  display: flex;
  flex-direction: column;
}

.flex-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.error-message {
  display: none;
}

.error-message {
  color: var(--red);
  font-size: 0.875rem;
  font-weight: var(--fw-700);
}

.error-message.show {
  display: block;
}

.invalid {
  border: 1px solid hsl(0, 66%, 54%);
}

body {
  font-family: Karla;
  font-size: var(--fs-p);
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: var(--green-200);
  color: var(--grey-900);
}

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

fieldset {
  border: none;
  padding: 0;
}

legend {
  margin-bottom: 0.5rem;
  font-weight: var(--fw-700);
  font-size: 1rem;
}

label {
  font-size: 1rem;
  font-weight: var(--fw-700);
  margin-bottom: 0.5rem;
  cursor: pointer;
  width: 100%;
}

input,
textarea {
  padding: 0.25rem 1rem;
}

input,
textarea,
label:has(input[type="radio"]) {
  border: 1px solid var(--grey-500);
  border-radius: 0.375rem;
}

label:has(input[type="radio"]) {
  display: flex;
  align-items: center;
  gap: 1ch;
  padding: 0.75rem 1.5rem;
}

textarea {
  box-sizing: content-box;
  resize: none;
  min-height: 10lh;
  font-size: 1rem;
  padding-block: 0.5rem;
  padding-inline: 1.5rem;
}

.submit-btn {
  width: 100%;
  border: none;
  background-color: var(--green-600);
  color: var(--white);
  border-radius: 0.25rem;
  padding-block: 0.5rem;
}

.star {
  color: var(--green-600);
}

.gap {
  margin-block: 0.5rem;
}

.consent {
  margin: 0;
}

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

input:hover {
  border: 1px solid var(--green-600);
}

input[type="checkbox"]:focus {
  outline: 1px solid var(--green-600);
}

input[type="radio"]:checked,
input[type="checkbox"]:checked {
  accent-color: var(--green-600);
}

label:has(input[type="radio"]):focus-within {
  background-color: var(--green-200);
}
textarea:hover {
  border: 1px solid var(--green-600);
}

.submit-btn {
  cursor: pointer;
  transition: all 0.3s;
}

.submit-btn:hover {
  filter: brightness(70%);
}

/* Modal */

.success {
  border: none;
  background-color: var(--grey-900);
  color: var(--white);
  border-radius: 0.5rem;
  padding: 1rem 1.5rem;
  font-size: 1rem;
  margin: 0;
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
}

.success::backdrop {
  background: rgba(0, 0, 0, 0.5);
}

/* Progress bar container */
.progress-bar {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
  margin-top: 0.5rem;
  overflow: hidden;
}

/* Progress fill (animated) */
.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--green-200);
  transition: width 3s linear;
}

.success h1 {
  margin-bottom: 0.5rem;
}

.success h1::before {
  content: "";
  display: inline-block;
  background-image: url(./assets/images/icon-success-check.svg);
  background-size: contain;
  background-repeat: no-repeat;
  width: 20px;
  height: 21px;
  margin-right: 0.5rem;
  vertical-align: middle;
}

.success > p {
  color: var(--grey-500);
}

@media screen and (min-width: 55rem) {
  .flex-pc-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
  }
  .consent {
    margin-right: auto;
  }

  textarea {
    min-height: 5lh;
  }
}
