#all-posts {
  margin: 2.5rem auto 4rem auto;
  width: 90%;
  max-width: var(--container);
}

#all-posts h1 {
  text-align: center;
  font-size: 2rem;
  color: var(--text);
  margin: 3rem 0 1.5rem 0;
}

#all-posts ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
  gap: 1.75rem;
  /* Every row as tall as the tallest, so a card in row two is the same height
     as one in row one and "Read more" sits on the same line down the whole
     page — not just across a single row. */
  grid-auto-rows: 1fr;
}

/* Every card in a row shares that row's height, so short excerpts no longer
   leave a tall gap under the text. */
#all-posts li {
  display: flex;
}

#all-posts .post a {
  box-shadow: 0 2px 8px var(--shadow-card);
  border-radius: 12px;
  background-color: var(--surface);
}

@media (max-width: 48rem) {
  #all-posts {
    /* The header is in the flow on small screens, so the big top gap that made
       room for it is no longer needed. */
    margin: 2rem auto;
    width: calc(100% - 2.5rem);
  }

  #all-posts h1 {
    font-size: 1.6rem;
    margin: 0.5rem 0 1.25rem 0;
  }

  #all-posts ul {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }
}
