/* ------------------- */
/* Custom properties   */
/* ------------------- */
:root {
  --clr-blue-300: 223 100% 88%;
  --clr-blue-400: 223 87% 63%;
  --clr-red-400: 354 100% 66%;
  --clr-neutral-100: 0 0% 100%;
  --clr-neutral-400: 0 0% 59%;
  --clr-neutral-800: 209 33% 12%;

  --ff-sans: "Libre Franklin", sans-serif;

  --fs-300: 0.625rem;
  --fs-400: 0.75rem;
  --fs-500: 0.75rem;
  --fs-800: 1.375rem;

  --lh-300: 1.212;
  --lh-400: 1.333;
  --lh-500: 1.211;
  --lh-800: 1.454;

  --fw-300: 300;
  --fw-400: 400;
  --fw-600: 600;
  --fw-700: 700;
}

@media (min-width: 40em) {
  :root {
    --fs-300: 0.75rem;
    --fs-400: 1rem;
    --fs-500: 1.25rem;
    --fs-800: 3rem;

    --lh-300: 1.211;
    --lh-400: 1.211;
    --lh-500: 1.212;
    --lh-800: 1.25;
  }
}

/* ------------------- */
/* Reset               */
/* ------------------- */

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

/* Remove default margin */
body,
h1,
h2,
h3,
h4,
p,
figure,
blockquote,
dl,
dd {
  margin: 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 root defaults */
html:focus-within {
  scroll-behavior: smooth;
}

/* Set core body defaults */
body {
  min-height: 100vh;
  text-rendering: optimizeSpeed;
  line-height: var(--lh-400);
  font-family: var(--ff-sans);
  font-size: var(--fs-400);
  font-weight: var(--fw-300);
  background-color: hsl(var(--clr-neutral-100));
  color: hsl(var(--clr-neutral-800));
}

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

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

/* Remove all animations, transitions and smooth scroll for people that prefer not to see them */
@media (prefers-reduced-motion: reduce) {
  html:focus-within {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ------------------- */
/* Composition         */
/* ------------------- */
.flex {
  display: flex;
  gap: var(--flex-gap, 1rem);
}

.grid {
  display: grid;
  gap: var(--grid-gap, 1rem);
}

.space-y > * + * {
  margin-top: var(--space, 1rem);
}

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

.text-red-400 {
  color: hsl(var(--clr-red-400));
}
.text-neutral-400 {
  color: hsl(var(--clr-neutral-400));
}
.text-neutral-800 {
  color: hsl(var(--clr-neutral-800));
}

.border-red-400 {
  border-color: hsl(var(--clr-red-400));
}

.fs-300 {
  font-size: var(--fs-300);
  line-height: var(--lh-300);
}
.fs-400 {
  font-size: var(--fs-400);
  line-height: var(--lh-400);
}
.fs-500 {
  font-size: var(--fs-500);
  line-height: var(--lh-500);
}
.fs-800 {
  font-size: var(--fs-800);
  line-height: var(--lh-800);
}

.fw-300 {
  font-weight: var(--fw-300);
}
.fw-400 {
  font-weight: var(--fw-400);
}
.fw-600 {
  font-weight: var(--fw-600);
}
.fw-700 {
  font-weight: var(--fw-700);
}

.mx-auto {
  margin-inline: auto;
}

.text-center {
  text-align: center;
}

/* ------------------- */
/* Block               */
/* ------------------- */
.landing {
  min-height: 100vh;
  padding: 5rem 2.25rem 2.25rem;
  margin-inline: auto;
}

main .intro {
  margin-block: 2rem;
}

main #sign-up-form {
  --grid-gap: 0;
  grid-template-areas:
    "input"
    "error"
    "button";
  margin-inline: 1.125rem;
}

main #sign-up-form #email {
  grid-area: input;
}

main #sign-up-form .error {
  grid-area: error;
}
main #sign-up-form button[type="submit"] {
  grid-area: button;
  margin-top: 0.625rem;
}

main .illustration {
  margin-top: 4.5rem;
}

footer {
  margin-top: 7.5rem;
}

footer ul {
  --flex-gap: 0.75rem;
  justify-content: center;
  list-style: none;
  padding: 0;
  margin: 0;
}

footer ul li::before {
  content: "\200B";
  display: block;
  height: 0;
}

footer p {
  margin-top: 1.6875rem;
}

@media (min-width: 40em) {
  .landing {
    max-width: 44.5rem;
    padding-bottom: 3rem;
  }

  main .intro {
    margin-block: 2.5rem;
  }

  main #sign-up-form {
    column-gap: 1rem;
    grid-template-columns: repeat(3, 1fr);
    grid-template-areas:
      "input input button"
      "error error .";
    margin-inline: unset;
  }

  main #sign-up-form button[type="submit"] {
    margin-top: unset;
  }

  main .illustration {
    margin-top: 4.25rem;
  }

  footer {
    margin-top: 4.5rem;
  }
}

/* ------------------- */
/* Exception           */
/* ------------------- */
.input {
  appearance: none;
  font-size: var(--fs-400);
  line-height: 1.25;
}

.input[data-variant="primary"] {
  border-radius: 1.75rem;
  border: 1px solid hsl(var(--clr-blue-300));
  padding: 0.625rem 2rem;
}

.input[data-variant="primary"]::placeholder {
  color: hsl(var(--clr-blue-300));
}

.input[data-variant="primary"][aria-invalid="true"] {
  border: 1px solid hsl(var(--clr-red-400));
}

.error {
  display: none;
  min-height: 1.25rem;
  font-style: italic;
  text-align: center;
  margin: 0.125rem 0 0.625rem;
}

.error[data-visible="true"] {
  display: block;
}

.button {
  display: block;
  cursor: pointer;
  background-color: transparent;
  border: 0;
  padding: 0;
  font-size: var(--fs-400);
  line-height: var(--lh-400);
  font-weight: var(--fw-600);
  text-align: center;
}

.button[data-variant="primary"] {
  border-radius: 1.75rem;
  background-color: hsl(var(--clr-blue-400));
  color: hsl(var(--clr-neutral-100));
  padding: 0.75rem 1rem;
  box-shadow: 0px 5px 10px 2px hsl(var(--clr-blue-400) / 0.23);
  transition: background-color 200ms ease-in-out;
}

.button[data-variant="primary"]:hover,
.button[data-variant="primary"]:focus {
  background-color: hsl(var(--clr-blue-400) / 0.8);
}

.link[data-variant="social"] {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  aspect-ratio: 1;
  text-decoration: none;
  border-radius: 50%;
  border: 1px solid hsl(var(--clr-blue-400) / 0.15);
  font-size: 1rem;
  color: hsl(var(--clr-blue-400));
  transition: background-color 200ms ease-in-out, color 200ms ease-in-out;
}

.link[data-variant="social"]:hover,
.link[data-variant="social"]:focus {
  background-color: hsl(var(--clr-blue-400));
  color: hsl(var(--clr-neutral-100));
}

@media (min-width: 40em) {
  .input[data-variant="primary"] {
    border: 1px solid hsl(var(--clr-blue-300));
    padding: 1rem 2rem;
  }

  .error {
    display: block;
    margin: 0.375rem 0 0 2rem;
    text-align: start;
  }
}
