:root {
  --red: hsl(0, 100%, 74%);
  --green: hsl(154, 59%, 51%);
  --blue: hsl(248, 32%, 49%);
  --dark-blue: hsl(249, 10%, 26%);
  --grayish-blue: hsl(246, 25%, 77%);
  --fw-400: 400;
  --fw-500: 500;
  --fw-600: 600;
  --fw-700: 700;
}

/* RESET */
/* Josh Comeau custom css reset */
/* https://www.joshwcomeau.com/css/custom-css-reset/ */
/* 1. Use a more-intuitive box-sizing model */
*,
*::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;
}

/* BASE STYLES */

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

body {
  font-family: "Poppins", system-ui;
  font-weight: var(--fw-400);
  font-style: normal;
  font-size: clamp(0.875rem, 0.839rem + 0.179vw, 1rem);
  min-height: 100dvh;
  background-image: url(./images/bg-intro-desktop.png);
  background-color: var(--red);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: flex;
  justify-content: center;
  align-items: center;
}

main {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: min(90vw, 90rem);
  margin-inline: auto;
}

.left-container {
  color: white;
  max-width: 35rem;
  text-align: center;
  margin-bottom: 2rem;
}

.right-container {
  width: min(35rem, 90vw);
}

h1 {
  font-size: clamp(2.5rem, 2.214rem + 1.429vw, 3.5rem);
  margin-bottom: 1.5rem;
  line-height: 1.1;
}

h2 {
  font-size: 1rem;
  background-color: var(--blue);
  text-align: center;
  margin-bottom: 1.5rem;
  padding-inline: 2rem;
  padding-block: 1rem;
  border-radius: 0.625rem;
  color: white;
  box-shadow: 0 0.4rem rgba(0, 0, 0, 0.2);
}

h2 > span {
  font-weight: var(--fw-400);
}

form {
  background-color: white;
  padding: clamp(0.5rem, 0.071rem + 2.143vw, 2rem);
  border-radius: 0.625rem;
  box-shadow: 0 0.5rem rgba(0, 0, 0, 0.2);
}

fieldset {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: none;
  gap: 1rem;
}

fieldset div {
  display: flex;
  flex-direction: column;
}

input,
button {
  padding: 1rem;
  border-radius: 0.625rem;
  font-weight: var(--fw-600);
}

input {
  border: 1px solid var(--grayish-blue);
  outline-color: transparent;
  padding-inline: 2rem;
}

input:focus {
  border: 1px solid var(--dark-blue);
}

input:not(:placeholder-shown):valid {
  border: 1px solid var(--green);
  background-image: url(./images/icon-check.png);
  background-position: 95%;
  background-repeat: no-repeat;
}

input:not(:placeholder-shown):invalid {
  border: 1px solid var(--red);
  background-image: url(./images/icon-error.svg);
  background-position: 95%;
  background-repeat: no-repeat;
}

input:not(:placeholder-shown):invalid + p {
  display: block;
  font-weight: var(--fw-600);
}

.hint {
  position: absolute;
  left: -9999px;
}

input:not(:placeholder-shown):invalid + .hint {
  position: static;
  margin-top: 0.5rem;
  margin-left: 2rem;
  color: var(--red);
  font-weight: var(--fw-600);
}

button {
  border-color: transparent;
  background-color: var(--green);
  color: #0a2f0a;
  box-shadow: 0.2rem 0.2rem #45b081;
  text-transform: uppercase;
  transition: background-color 0.5s ease-in-out;
}

button:hover {
  cursor: pointer;
  background-color: hsla(154, 59%, 51%, 0.75);
}

input:focus-within,
button:focus-within {
  outline-color: var(--blue);
  outline-offset: 3px;
}

form p:not(.hint) {
  font-size: 0.7rem;
  text-align: center;
  color: var(--grayish-blue);
  margin-top: 1rem;
  font-weight: var(--fw-400);
}

.tos {
  color: #a91b1b;
  font-weight: var(--fw-600);
}

@media screen and (min-width: 48rem) {
  main {
    flex-direction: row;
  }
  .left-container {
    text-align: center;
  }
  .right-container {
    margin-left: 3rem;
  }
}
