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

:root {
  /* colors */
  --clr-desaturated-red: hsl(0, 36%, 70%);
  --clr-soft-red: hsl(0, 93%, 68%);
  --clr-dark-grayish-red: hsl(0, 6%, 24%);

  /* linear gradients */
  --lg-white-linear: linear-gradient(
    135deg,
    hsl(0, 0%, 100%),
    hsl(0, 100%, 98%)
  );
  --lg-red-linear: linear-gradient(135deg, hsl(0, 80%, 86%), hsl(0, 74%, 74%));

  /* font size */
  --fs-p: clamp(1rem, 0.929rem + 0.357vw, 1.25rem);
  --fs-head: clamp(2.5rem, 2.071rem + 2.143vw, 4rem);
  --fs-footer: clamp(0.875rem, 0.804rem + 0.357vw, 1.125rem);

  /* font family */
  --ff-josefin: "Josefin Sans", sans-serif;

  /* padding */
  --space-padding: clamp(10rem, 2.615rem + 11.538vw, 13rem);
}

body {
  font-family: var(--ff-josefin);
  min-height: 100dvh;
  font-size: var(--fs-p);
  display: grid;
  background: var(--lg-white-linear);
  color: var(--clr-desaturated-red);
  font-weight: 600;
}
header {
  padding-block: 1rem;
  padding-inline: 1.5rem;
  max-width: 37.5rem;
  margin-inline: auto;
  width: 100%;
}
aside {
  grid-row: 2;
  max-width: 37.5rem;
  margin-inline: auto;
  width: 100%;
}
.hero-picture,
.hero-image {
  width: 100%;
  height: 100%;
}
.main {
  width: 100%;
  padding-block: 1rem;
  margin-inline: auto;
  padding-inline: 1.5rem;
  display: grid;
  place-items: center;
  max-width: 37.5rem;
}
.main_content {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  text-align: center;
}
.secondary_heading {
  text-transform: uppercase;
  letter-spacing: 0.5ch;
  font-size: var(--fs-head);
  span {
    color: var(--clr-dark-grayish-red);
  }
}
.form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.form_container {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--clr-dark-grayish-red);
  border-radius: 100px;
  overflow: hidden;
}
.form_container:has(:focus-within) {
  border: 1px solid var(--clr-desaturated-red);
}
.form_container:has(.email-input[data-invalid="true"]) {
  border: 1px solid var(--clr-soft-red);
}
.email-input {
  width: 100%;
  padding-inline: 1rem;
  padding-block: 0.5rem;
  border: none;
  outline: none;
  color: var(--clr-dark-grayish-red);
  background-color: transparent;
  caret-color: var(--clr-desaturated-red);
}
.email-input .email-input::placeholder {
  color: var(--clr-desaturated-red);
}
.error-icon {
  display: none;
}
.email-input[data-invalid="true"] + .error-icon {
  display: block;
}
.error-message {
  text-align: left;
  padding-inline-start: 1rem;
  color: var(--clr-soft-red);
}
.success-message {
  color: green;
}
.submit-button {
  background: var(--lg-red-linear);
  display: grid;
  place-items: center;
  border: none;
  outline: none;
  padding-block: 1rem;
  padding-inline: 2.5rem;
  border-radius: 50px;
  &:hover,
  &:focus {
    background: var(--clr-desaturated-red);
    box-shadow: 0 1px 10px 0 var(--clr-dark-grayish-red);
    background: var(--clr-desaturated-red);
  }
  cursor: pointer;
  .button-icon {
    width: 1.5rem;
    height: 1.5rem;
  }
}

footer {
  /* padding: 1rem; */
  padding-top: 0;
  text-align: center;
  font-size: var(--fs-footer);
  color: var(--clr-dark-grayish-red);
}

.attribution a {
  color: var(--clr-desaturated-red);
  text-decoration: none;
  &:hover {
    text-decoration: underline;
  }
}

@media (min-width: 64rem) {
  body {
    grid-template-columns: 4fr 3fr;
    grid-template-rows: auto 1fr auto;
    gap: 2rem;
    background: var(--lg-white-linear),
      url(./images/bg-pattern-desktop.svg) no-repeat center;
  }
  header {
    grid-column: 1 / span 1;
    grid-row: 1 / span 1;
    padding-block: 3rem;
    padding-inline: var(--space-padding);
    max-width: 100%;
  }
  .main {
    grid-column: 1 / span 1;
    grid-row: 2 / span 1;
    padding-inline: var(--space-padding);
    margin-top: 5rem;
    place-items: start;
    max-width: 100%;
  }
  .main_content {
    text-align: left;
  }
  aside {
    grid-column: 2 / span 1;
    grid-row: 1 / span 2;
    max-width: 100%;
  }
  footer {
    grid-column: 1 / span 2;
    grid-row: 3 / span 1;
  }
  .hero-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
  }
}
