/* Turn the masonry list into an even grid */
.resource-grid {
  display: grid !important;
 grid-template-columns: repeat(auto-fill, minmax(max(240px, calc((100% - 3 * 25px) / 4)), 1fr));
  gap: 25px;
  height: auto !important;            /* undo the height the script sets */
}

/* Put each card back in normal flow */
.resource-grid .resource {
  position: static !important;
  top: auto !important;
  left: auto !important;
  transform: none !important;
  width: auto !important;
  margin: 0;                          /* the gap handles spacing */
  display: flex;
  flex-direction: column;
}

/* Same-height images, cropped to fill */
.resource-grid .resource__thumbnail img {
  display: block;
  width: 100%;
  height: 220px;
  max-height: none;
  object-fit: cover;
  object-position: center top;        /* keeps the tops of documents visible */
}

.resource-grid .resource .description {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;      /* number of lines to show */
  line-clamp: 2;
  overflow: hidden;
  max-height: none;           /* cancels the theme's own fade-out cap */
}
.resource-grid .resource .description::after {
  content: none;              /* removes the theme's fade gradient */
}