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

/* 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 core body defaults */
body {
  min-height: 100vh;
  line-height: 1.5;
}

/* 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: 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;
}

/* screen leaders only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* defining variables */
:root {
  /* colors */
  --clr-primary-red: hsl(0, 100%, 74%);
  --clr-primary-green: hsl(154, 59%, 51%);
  --clr-accent-blue: hsl(248, 32%, 49%);
  --clr-neutral-dark-blue: hsl(249, 10%, 26%);
  --clr-neutral-grayish-blue: hsl(246, 25%, 77%);

  /* font weights */
  --fw-400: 400;
  --fw-500: 500;
  --fw-600: 600;
  --fw-700: 700;

  /* font sizes */
  --fs-paragraph: clamp(1rem, 0.692rem + 0.481vw, 1.125rem);
  --fs-main-header: clamp(2rem, 1.714rem + 1.429vw, 3rem);
  --fs-banner-bold: clamp(1.125rem, 1.089rem + 0.179vw, 1.25rem);
  --fs-terms-and-services: clamp(0.8rem, 0.743rem + 0.286vw, 1rem);
  --fs-footer: clamp(0.875rem, 0.804rem + 0.357vw, 1.125rem);

  /* paddings */
  --pad-form: clamp(1rem, 0.571rem + 2.143vw, 2.5rem);
  --pad-input-left: clamp(1rem, 0.857rem + 0.714vw, 1.5rem);
}

body {
  background-color: var(--clr-primary-red);
  font-family: "Poppins", sans-serif;
  background-image: url(../images/bg-intro-mobile.png);
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  font-size: var(--fs-paragraph);
}

main {
  width: 100%;
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-grow: 1;
}

.c-card-container {
  width: min(100%, 42rem);
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  text-align: center;
  padding-top: 2rem;
}

.section-one {
  width: 100%;
  color: white;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  .section-one__heading {
    font-size: var(--fs-main-header);
    font-weight: var(--fw-700);
  }
}

.section-two {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.section-two__banner {
  background-color: var(--clr-accent-blue);
  color: white;
  padding: 1rem 2rem;
  border-radius: 12px;
  .banner__bold {
    font-weight: var(--fw-700);
    font-size: var(--fs-banner-bold);
  }
}

.form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background-color: white;
  border-radius: 12px;
  padding: var(--pad-form);
}

.form__input-error-container {
  display: flex;
  flex-direction: column;
  align-items: end;
  gap: 0.2rem;
  .error-text {
    color: var(--clr-primary-red);
  }
}

.input-container {
  width: 100%;
  display: flex;
  align-items: center;
  border: 2px solid var(--clr-neutral-dark-blue);
  border-radius: 8px;
  padding-right: 1rem;
  overflow: hidden;
}

.input-container:has(:focus-within) {
  border-color: var(--clr-primary-green);
}

.input-container:has(input[data-invalid="true"]) {
  border-color: var(--clr-primary-red);
}

input {
  width: 100%;
  height: 100%;
  padding: 1rem;
  padding-left: var(--pad-input-left);
  border: none;
  outline: none;
}

input[type="email"][data-invalid="true"] {
  color: var(--clr-primary-red);
}

.error-icon {
  display: none;
}

input[data-invalid="true"] + .error-icon {
  display: block;
}

button[type="submit"] {
  background-color: var(--clr-primary-green);
  text-transform: uppercase;
  letter-spacing: 0.2ch;
  width: 100%;
  font-weight: var(--fw-600);
  color: white;
  cursor: pointer;
  border: 1px solid;
  outline: none;
  padding: 1rem;
  border-radius: 8px;
  &:focus,
  &:hover {
    border-color: var(--clr-neutral-dark-blue);
  }
}

.terms-service {
  font-size: var(--fs-terms-and-services);
  & a {
    color: red;
    text-decoration: none;
  }
}

footer {
  text-align: center;
  padding: 0.5rem;
  .attribution {
    font-size: var(--fs-footer);
    & a[target="_blank"] {
      color: var(--clr-neutral-dark-blue);
    }
  }
}

@media (min-width: 768px) {
  body {
    background-image: url(../images/bg-intro-desktop.png);
  }
}

@media (min-width: 1024px) {
  .c-card-container {
    width: min(100%, 80rem);
    flex-direction: row;
  }
  .section-one {
    text-align: left;
  }
  .section-one,
  .section-two {
    width: 50%;
  }
}
