@font-face {
  font-family: Roboto;
  src: format("truetype"), url("./assets/fonts/Roboto-Regular.ttf");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: Roboto;
  src: format("truetype"), url("./assets/fonts/Roboto-Bold.ttf");
  font-weight: 700;
  font-display: swap;
}
:root {
  /* Primary */
  --tomato: hsl(4, 100%, 67%);
  --pink: rgb(255, 83, 123);
  --tomato-low-opacity: rgb(255, 232, 230);
  /* Neutral */
  --dark-slate-grey: hsl(234, 29%, 20%);
  --charcoal-grey: hsl(235, 18%, 26%);
  --grey: hsl(231, 7%, 60%);
  --white: hsl(0, 0%, 100%);
}

/* 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 */

body {
  font-family: Roboto, system-ui, sans-serif;
  font-weight: 400;
  min-height: 100dvh;
  background-color: var(--charcoal-grey);
  display: flex;
  justify-content: center;
  align-items: center;
}

.newsletter-sign-up-form,
.success {
  background-color: var(--white);
  max-width: 25rem;
}

.newsletter-sign-up-form__image img {
  height: auto;
  width: 100%;
}

.newsletter-sign-up-form__input-section,
.success {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 2rem 1.5rem;
}

.success__text-section > * {
  margin-top: 1.5rem;
}

h1 {
  font-size: clamp(2.5rem, 2.357rem + 0.714vw, 3rem);
  line-height: 1;
}

.newsletter-sign-up-form__input-section__list {
  list-style-type: none;
  padding-left: 0;
}

.newsletter-sign-up-form__input-section__list li {
  position: relative;
  padding-left: 2rem;
  margin-top: 0.75rem;
}
.newsletter-sign-up-form__input-section__list li::before {
  content: "";
  background-image: url("./assets/images/icon-success.svg");
  background-size: contain;
  background-repeat: no-repeat;
  width: 1.25rem;
  height: 1.25rem;
  position: absolute;
  top: 0;
  left: 0;
}

.newsletter-sign-up-form__input-section__email {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

label {
  font-size: 0.875rem;
  position: relative;
}

.invalid {
  color: var(--tomato);
  position: absolute;
  right: 0;
}

.btn {
  background-color: var(--dark-slate-grey);
  color: var(--white);
  border-color: transparent;
  text-decoration: none;
  text-align: center;
}

input {
  border: 1px solid var(--grey);
}

label,
.btn {
  font-weight: 700;
}
input,
.btn {
  padding-block: 1rem;
  padding-inline: 1.5rem;
  border-radius: 0.5rem;
  cursor: pointer;
}

.btn:hover,
.btn:focus-visible {
  background: linear-gradient(90deg, var(--pink), var(--tomato));
  box-shadow: 5px 10px 18px var(--tomato);
}

input:not(:placeholder-shown):invalid {
  color: var(--tomato);
  border: 1px solid var(--tomato);
  background-color: var(--tomato-low-opacity);
}

.hidden {
  display: none;
}

.success {
  border-radius: 2rem;
  padding-inline: 3rem;
}

.input-error {
  background-color: rgb(255, 232, 230);
  color: var(--tomato);
  border: 1px solid var(--tomato);
}

@media screen and (min-width: 60rem) {
  .newsletter-sign-up-form {
    display: flex;
    flex-direction: row-reverse;
    max-width: none;
    border-radius: 2rem;
    padding: 1.125rem;
  }
  .newsletter-sign-up-form__input-section {
    padding-inline: 3rem;
  }
  .newsletter-sign-up-form__input-section__text {
    font-size: 3.5rem;
    margin-top: 0.5rem;
  }

  .hidden {
    display: none;
  }
}
