/* Stop Zoho photo gallery from stretching the final row */
*:has(> .hb-grid-item) {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 12px !important;
  justify-content: start !important;
  align-items: start !important;
}

/* Make every photo occupy exactly one grid position */
.hb-grid-item {
  width: 100% !important;
  max-width: 100% !important;
  flex: none !important;
  margin: 0 !important;
}

/* Keep the image contained */
.hb-grid-item figure,
.hb-grid-item figure > a,
.hb-grid-item picture,
.hb-grid-item img {
  width: 100% !important;
  max-width: 100% !important;
}

.hb-grid-item img {
  height: auto !important;
  object-fit: cover !important;
}

/* Tablet */
@media (max-width: 900px) {
  *:has(> .hb-grid-item) {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

/* Mobile */
@media (max-width: 600px) {
  *:has(> .hb-grid-item) {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  /* Make the grid CELL square — it has no height of its own to fight us */
  .hb-grid-item {
    aspect-ratio: 1 / 1 !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
  }
  /* Force every wrapper inside the cell to fill that square */
  .hb-grid-item figure,
  .hb-grid-item figure > a,
  .hb-grid-item picture {
    height: 100% !important;
    min-height: 0 !important;
    max-height: none !important;
    display: block !important;
  }
  .hb-grid-item img {
    height: 100% !important;
    width: 100% !important;
    max-height: none !important;
    object-fit: cover !important;
  }
}