/* ------------------- */
/* Custom properties   */
/* ------------------- */
:root {
  --clr-red-400: 0 78% 62%;
  --clr-cyan-400: 180 62% 55%;
  --clr-orange-400: 34 97% 64%;
  --clr-blue-400: 212 86% 64%;

  --clr-neutral-100: 0 0% 100%;
  --clr-neutral-200: 0 0% 98%;
  --clr-neutral-300: 213 47% 67%;
  --clr-neutral-400: 234 12% 34%;

  --ff-sans: "Poppins", sans-serif;

  --fs-300: 0.8125rem;
  --fs-400: 0.9375rem;
  --fs-500: 1.25rem;
  --fs-600: 1.5rem;

  --ls-600: 0.17px;

  --fw-200: 200;
  --fw-400: 400;
  --fw-600: 600;
}

@media (min-width: 50em) {
  :root {
    --fs-600: 2.25rem;
    --ls-600: 0.25px;
  }
}

/* ------------------- */
/* 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: 1.67;
  font-family: var(--ff-sans);
  font-size: var(--fs-400);
  font-weight: var(--fw-400);
  background-color: hsl(var(--clr-neutral-200));
  color: hsl(var(--clr-neutral-400));
}

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

.block {
  display: block;
}

/* ------------------- */
/* Utility             */
/* ------------------- */
.bg-neutral-100 {
  background-color: hsl(var(--clr-neutral-100));
}

.fs-300 {
  font-size: var(--fs-300);
  line-height: 1.77;
}
.fs-500 {
  font-size: var(--fs-500);
  line-height: 1.5;
}
.fs-600 {
  font-size: var(--fs-600);
  letter-spacing: var(--ls-600);
  line-height: 1.5;
}

.fw-200 {
  font-weight: var(--fw-200);
}
.fw-600 {
  font-weight: var(--fw-600);
}

.opacity-50 {
  opacity: 0.5;
}

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

/* ------------------- */
/* Block               */
/* ------------------- */
.container {
  place-content: center;
  grid-template-rows: 1fr auto 1fr;
  grid-template-areas:
    "header"
    "main"
    "footer";
  min-height: 100vh;
  min-width: fit-content;
  padding: 1rem 2rem;
}

.container > main {
  grid-area: main;
}

.container > footer {
  grid-area: footer;
  align-self: end;
}

.description {
  margin-top: 1rem;
  max-width: 55ch;
  margin-inline: auto;
}

.cards {
  --grid-gap: 1.5rem;
  margin-top: 4.75rem;
  max-width: 19.5rem;
  margin-inline: auto;
}

/* As the divs have identical sizes, longer text in other sibling divs can result in a bigger div than the content.
 * E.g. sibling div text takes up 3 lines but current div text takes up 2 lines.
 * The flex property is added so that we can set the p element to always take up the remaining space of the div,
 * which will push the image to always be at the bottom of the div.
 */
.cards > div {
  --flex-gap: 0;
  flex-direction: column;
  border-radius: 8px;
  overflow: hidden;
  padding: 1.75rem;
  box-shadow: 0px 15px 30px -11px hsl(var(--clr-neutral-300) / 0.5);
  position: relative;
}

.cards > div p {
  margin-bottom: auto;
  /* flex grow 1 works too */
}

.cards > div img {
  margin-top: 2rem;
  margin-left: auto;
  max-width: 3.5rem;
}

.cards > div::before {
  content: "";
  position: absolute;
  inset: 0;
  height: 3.5px;
}

.cards > div:nth-child(1):before {
  background-color: hsl(var(--clr-cyan-400));
}

.cards > div:nth-child(2):before {
  background-color: hsl(var(--clr-red-400));
}

.cards > div:nth-child(3):before {
  background-color: hsl(var(--clr-orange-400));
}

.cards > div:nth-child(4):before {
  background-color: hsl(var(--clr-blue-400));
}

@media (min-width: 50em) {
  .cards {
    --grid-gap: 1.875rem;
    margin-top: 4rem;
    max-width: 69.375rem;
    grid-auto-columns: 1fr;
    grid-auto-rows: 1fr;
    grid-template-areas:
    ". c2 ."
    "c1 c2 c4"
    "c1 c3 c4"
    ". c3 .";
  }

  .cards > div:nth-child(1) {
    grid-area: c1;
  }

  .cards > div:nth-child(2) {
    grid-area: c2;
  }

  .cards > div:nth-child(3) {
    grid-area: c3;
  }

  .cards > div:nth-child(4) {
    grid-area: c4;
  }

  .cards > div {
    padding: 2rem;
  }

  .cards > div p {
    margin-top: 0.375rem;
  }

  .cards > div img {
    margin-top: 2.5rem;
    max-width: 4rem;
  }
}
