/* === FONTS ===*/

@font-face {
  font-family: 'Karla';
  src: url('assets/fonts/karla-v33-latin-regular.woff2') format('woff2'); 
  font-weight: 400;
  font-style: normal;
  font-display: swap; 
}

@font-face {
  font-family: 'Karla';
  src: url('assets/fonts/karla-v33-latin-700.woff2') format('woff2'); 
  font-weight: 700;
  font-style: normal;
  font-display: swap; 
}

/* === CSS RESET === */

/* Box sizing rules */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Prevent font size inflation */
html {
  -moz-text-size-adjust: none;
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
}

/* Remove default margin in favour of better control in authored CSS */
body, h1, h2, h3, h4, p,
figure, blockquote, dl, dd {
  margin-block-end: 0;
}

/* Remove list styles on ul, ol elements with a list role, which suggests default styling will be removed */
ul[role='list'],
ol[role='list'] {
  list-style: none;
}

/* Set shorter line heights on headings and interactive elements */
h1, h2, h3, h4,
button, input, label {
  line-height: 1.1;
}

/* Balance text wrapping on headings */
h1, h2,
h3, h4 {
  text-wrap: balance;
}

/* A elements that don't have a class get default styles */
a:not([class]) {
  text-decoration-skip-ink: auto;
  color: currentColor;
}

/* Make images easier to work with */
img,
picture {
  max-width: 100%;
  display: block;
}

/* Inherit fonts for inputs and buttons */
input, button,
textarea, select {
  font-family: inherit;
  font-size: inherit;
}

/* Make sure textareas without a rows attribute are not tiny */
textarea:not([rows]) {
  min-height: 10em;
}

/* Anything that has been anchored to should have extra scroll margin */
:target {
  scroll-margin-block: 5ex;
}

:root {
  /* == COLOR PALLETTE == */

  /* Primary Color */
  --clr-green-200: hsl(148, 38%, 91%);
  --clr-green-600: hsl(169, 51%, 38%);
  --clr-green-700: hsl(169, 63%, 27%);
  --clr-red: hsl(0, 66%, 54%);
  

  /* Neutral Colors */
  --clr-grey-500: hsl(186, 15%, 59%);
  --clr-grey-900: hsl(187, 24%, 22%);
  --clr-white: hsl(0, 0%, 100%);
  
  
  /* == TYPOGRAPHY == */

  /* font family */
  --ff-body: 'Karla', sans-serif;

  /* font size */
  --fs-form-labels: 1rem;

  /* font weights */
  --fw-regular: 400;
  --fw-bold: 700;

  /* Spacing */
  --space-sr:  0.0625rem;
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2rem;
  --space-xlg: 2.5rem;
  --space-xxlg: 3rem;
}

@media (prefers-reduced-motion: reduce) {
  .submit--btn {
    transition: none;
  }
}

@media (hover: hover) {
  .submit--btn:hover {
    background-color: var(--clr-grey-900);
    transform: translateY(-0.15rem);
  }

  input.field:hover {
    border: 0.095rem solid var(--clr-green-600);;
  }

  label.consent--label:hover {
    cursor: pointer;
  }
}

body {
  width: 100%;
  min-height: 100svh;
  background-color: var(--clr-green-200);
  font-family: var(--ff-body);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.5;
}

.form--container {
  width: 90%;
  max-width: 36rem;
  margin-block: 2rem;
}

.sr-only {
  position: absolute;
  width: var(--space-sr);
  height:  var(--space-sr);
  padding: 0;
  margin: - var(--space-sr);
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0
}

.success--popup {
  width: clamp(15rem, 35vw, 30rem);
  background-color: var(--clr-grey-900);
  border: 2px solid var(--clr-grey-900);
  border-radius: 0.6rem;
  color: var(--clr-grey-500);
  margin: 0 auto;
  padding: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.success--popup.hidden {
  display: none;
}

.success--top--block {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-sm);
}

.main__contact--form {
  width: 100%;
  background-color: var(--clr-white);
  border-radius: 0.8rem;
  padding: 3rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.form--heading {
  color: var(--clr-grey-900);
  font-size: 1.8rem;
  font-weight: var(--fw-bold);
  margin-block-end: 0.8rem;
}

.form--control, .query--container {
  display: flex;
  flex-direction: column;
}

.name--surname--container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

fieldset {
  width: 100%;
  border: none;
  padding: 0;
  margin: 0;
}

.field {
  min-width: 100%;
}

.field.invalid {
  border: 0.0625rem solid var(--clr-red);
}

.field:focus {
  outline: none;
}

label, legend {
  color: var(--clr-grey-900);
  font-size:  var(--fs-form-labels);
  font-weight: var(--fw-regular);
  margin-block-end: 0.8rem;
}

legend {
  margin-block-end: 0.5rem;
  padding: 0;
}

.required::after {
  content: "*";
  color: var(--clr-grey-900);
  margin-inline-start: 0.5rem;
}

input {
  padding: 0.8em;
  cursor: pointer;
}

input, textarea, .radio {
  border: 1px solid var(--clr-grey-500);
  border-radius: 0.5em;
}

.radio {
  position: relative;
  padding: 0.8em;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
}

input[type="radio"], input[type="checkbox"] {
  scale: 1.3;
  margin-inline-end: 0.5rem;
}

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

input[type="checkbox"] {
  margin-block-start: -0.55rem;
}

.query--container .radio:has(input[type="radio"]:checked) {
  background-color: var(--clr-green-200);
}

textarea {
  background-color: var(--clr-white);
  font-family: inherit;
  padding: 0.8em;
  resize: none;
  width: 100%;
}

textarea:focus {
  cursor: pointer;
  outline: none;
  border: 0.095rem solid var(--clr-green-600);
}

.error {
  margin-block-start: 0.3rem;
  color: var(--clr-red);
  font-size: 0.89em;
}

.radio--error {
  margin-block-start: -0.2rem;
}

.consent--control {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.consent--error {
  margin-block-start: -1.8rem;
}


.submit--btn {
  all: unset;
  background-color: var(--clr-green-700);
  border-radius: 0.5em;
  color: var(--clr-white);
  font-size: 1.45em;
  padding-block: 0.5em;
  text-align: center;
  cursor: pointer;
  transition: background-color 0.3s ease-in-out, transform 0.3s ease-in-out;
}


@media screen and (min-width: 48rem) {
  .form--container {
    width: 60%;
    max-width: clamp(42rem, 50vw, 60rem);
    padding: 1.5rem;
  }

  .name--surname--container, .query--container {
    flex-direction: row;
    justify-content: space-between;
    gap: 1.2rem;
  }

  .name--surname--container .form--control {
    width: 100%;
  }

  .radio {
    width: 100%;
    gap: 0.5rem;
  }
}


