* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1;
    width: 100%;
}

section {
    /* This can be chabnged. You can play with this and see what layout/visual you like. */
    align-items: stretch;
    margin: 3rem auto 6rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    /* Added this so that there is a gap between the rows */
    grid-row-gap: 1.5rem;
}

img {
    display: block;
    margin: 0 auto;
    height: 100%;
    width: 100%;
    max-width: 800px;
}

figure {
    margin: 0 auto;
    width: 90%;
    max-width: 800px;
    /* added these two lines because wanted to make each image and figcaption equal across the rows. Images appear with different heights but total heights are equal. */
    display: flex;
    flex-direction: column;
}

figure > img {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

figcaption {
    background: pink;
}

figcaption p {
    text-align: left;
    padding: 0.5rem;
}

footer p {
    text-align: center;
}