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

:root {
  --ff-inter: "Inter", sans-serif;
  --ff-lexend: "Lexend Deca", sans-serif;
}

/* General styling */

body,
p,
h1,
h2,
h3,
h4 {
  margin: 0;
  padding: 0;
}

body {
  font-size: 0.938rem;
  font-family: var(--ff-inter);
}

img {
  max-width: 100%;
}

/* Classes */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16.875rem, 20.438rem));
  column-gap: 0.75rem;
  row-gap: 2.75rem;
  justify-content: center;
  align-content: center;
  min-height: 100vh;
  padding: 2rem 1.5rem 2rem 1.5rem;
  background-color: hsl(233, 47%, 7%);
}

.card {
  display: grid;
  grid-template-rows: minmax(35%, 30rem) 65%;
  grid-template-areas:
    "image"
    "content";

  margin: 0 auto;
  text-align: center;
  min-width: 16.875rem;
  width: 90%;
  max-width: 20.438rem; /* 327px */
  height: 48.75rem; /* 780px */
  border-radius: 8px;
  color: white;
  background-color: hsl(244, 38%, 16%);
}

.img-wrapper {
  position: relative;
  grid-area: "image";
}

.img-wrapper::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(164, 88, 212, 0.4);
}

.card__img {
  object-fit: cover;
  width: 100%;
  height: 100%;
  border-radius: 8px 8px 0 0;
}

.card__info {
  grid-area: "content";
  align-self: center;
  width: 80%;
  margin: 0 auto;
}

.card__info h2 {
  font-size: 1.5rem;
  margin-bottom: 0.7em;
}

.accent {
  color: hsl(277, 64%, 61%);
}

.card__info__text p {
  line-height: 1.5;
  word-spacing: 0.03em;
  margin-bottom: 2em;
  color: hsla(0, 0%, 100%, 0.75);
}

.card__metrics {
  display: flex;
  flex-direction: column;
}

.card__metrics__item h4 {
  font-size: 1.1rem;
  margin-bottom: 0.3em;
}

.card__metrics__item p {
  font-size: 0.7rem;
  color: hsla(0, 0%, 100%, 0.6);
}

.card__metrics__item + .card__metrics__item {
  margin-top: 1.6em;
}

/* Switch to "portrait" mode */
@media screen and (min-width: 67.5rem) {
  .cards {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(auto-fit, minmax(25rem, 27.875rem));
    row-gap: 2.75rem;
  }

  .card {
    max-width: 68.75rem;
    height: 27.875rem;
    grid-template-rows: 100%;
    grid-template-columns: 1fr 1fr;
    grid-template-areas: "content-col image-col";
    text-align: left;
  }

  .img-wrapper {
    grid-area: image-col;
  }

  .img-wrapper::after,
  .card__img {
    border-radius: 0 8px 8px 0;
  }

  .card__info {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    height: 80%;
    padding-right: 10%;
    width: 80%;
    grid-area: content-col;
  }

  .card__info h2 {
    font-size: 2.15rem;
  }

  .card__info__text p {
    line-height: 1.8;
  }

  .card__metrics {
    flex-direction: row;
    justify-content: space-between;
  }

  .card__metrics__item h4 {
    font-size: 1.4rem;
  }

  .card__metrics__item.card__metrics__item {
    margin: 0;
  }
}

.attribution {
  font-size: 1.2rem;
  text-align: center;
  color: white;
  background-color: hsl(233, 47%, 7%);
}

.attribution a {
  color: whitesmoke;
}
