:root {
  /** Colors: **/
  --purple-100: hsl(254, 88%, 90%);
  --purple-500: hsl(256, 67%, 59%);

  --yellow-100: hsl(31, 66%, 93%);
  --yellow-500: hsl(39, 100%, 71%);
  
  --white: hsl(0, 0%, 100%);
  --whitesmoke: hsl(0, 0%, 96%);
  --blue: hsl(228, 45%, 44%);
  --black: hsl(0, 0%, 7%);

  /* Font sizes: */
  --regular: 1.125rem;
  --large: 2rem;
  --larger: 2.375rem;
  --x-large: 3.5rem;
}

@font-face {
  font-family: 'DM Sans';
  src: url('../assets/fonts/DMSans-VariableFont_opsz,wght.ttf');
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  
  font-family: 'DM Sans', Arial, Helvetica, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  display: flex;
  flex-direction: column;
  width: 100%;  
  height: 100vh;
  align-items: center;
  justify-content: center;
  background-color: var(--whitesmoke);
}

.grid {
  display: grid;
  height: 100%;
  padding: 6vh 22vw;
  gap: 2rem;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: 1.2fr .3fr .5fr 1fr;
  grid-template-areas: 
    "cardG cardA cardA cardD"
    "cardG cardB cardC cardD"
    "cardH cardB cardC cardD"
    "cardH cardF cardE cardE";
}

.item {
  display: flex;
  flex-direction: column;
  padding: 1.25rem;
  overflow: hidden;
  border-radius: .5rem;
}

.wrapper {
  display: inherit;
  flex-direction: inherit;
  align-items: inherit;
}

.small-text {
  font-size: var(--regular);
  font-weight: 400;
  line-height: 110%;
}

.large-text {
  font-size: var(--large);
  font-weight: 500;
  line-height: 90%;
}

.yellow {
  color: var(--yellow-500);
}

.purple {
  color: var(--purple-500);
}

.grid .item:nth-child(1) {
  grid-area: cardA;
  justify-content: center;
  align-items: center;
  gap: 1.25rem;
  background-color: var(--purple-500);
  color: var(--white);

  & .large-text {
    font-size: var(--x-large);
    text-align: center;
  }
  & .wrapper {
    gap: .25rem;
  }
  & img {
    width: 45%;
  }
}

.grid .item:nth-child(2) {
  grid-area: cardB;
  justify-content: space-between;
  background-color: var(--white);

  & img {
    width: 150%;
  }
}

.grid .item:nth-child(3) {
  grid-area: cardC;
  padding-block-end: 0;
  gap: 1rem;
  background-color: var(--yellow-500);
}

.grid .item:nth-child(4) {
  grid-area: cardD;
  justify-content: center;
  gap: 1rem;
  background-color: var(--purple-100);
  
  & img {
    width: 180%;
  }
}

.grid .item:nth-child(5) {
  grid-area: cardE;
  flex-direction: row;
  align-items: center;
  gap: 1rem;
  background-color: var(--purple-500);
  color: var(--white);

  & img {
    object-fit: contain;
    width: 45%;
  }
  & .large-text {
    font-size: var(--larger);
  }
}

.grid .item:nth-child(6) {
  grid-area: cardF;
  justify-content: space-between;
  background-color: var(--white);

  & .wrapper {
    gap: 1.75rem;
  }
  & .large-text {
    font-size: var(--x-large);
  }
  & img {
    width: 85%;
  }
}

.grid .item:nth-child(7) {
  grid-area: cardG;
  justify-content: center;
  gap: 1.25rem;
  background-color: var(--yellow-100);

  & .large-text {
    font-size: var(--larger);
  } 
}

.grid .item:nth-child(8) {
  grid-area: cardH;
  justify-content: space-between;
  background-color: var(--yellow-500);

  & .large-text {
    font-size: var(--larger);
  }
  & img {
    width: 105%
  }
}

.attribution {
  display: block;
  padding-block-end: 1rem;
  font-size: .75rem;
  text-align: center; 
}
.attribution a { 
  color: var(--blue); 
}

@media screen and (max-width: 1440px) {
  .grid {
    padding: 8vh 12vw;
  }
}

@media screen and (max-width: 960px) {
  .grid {
    padding: 6vh 6vw;
  }
}