article {
    border: 2px solid black;
    margin: 15px;
    width: 300px;
    height: 300px;
    box-sizing: border-box;
    flex: 0 1 auto;
}

* {
    text-align: center;
    background-color: pink;
}

section {
    display: flex;
    position: relative;
    flex-wrap: wrap;
    justify-content: center;
    overflow: auto;
    gap: 5px;
    padding-top: 50px;
}

h2 {
    text-align: center;
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    margin: 0;
}

img {
    width: 50%;
}

article:hover {
    width: 35vh;
    height: 40vh;
    background-color: orangered;
    color: black;
}

/*ChatGPT suggested syntax*/
/* @media screen and (max-width: 500px) {
    article {
        background-color: blue;
        color: white;
        /* overflow-y: scroll; */
/* }
} */

@media screen and (width < 500px) {
    article {
        background-color: blue;
        color: white;
        /* overflow-y: scroll; */
    }
}

@media screen and (width < 300px) {
    section {
        padding-top: 100px;
    }
}

/*ChatGPT suggested syntax*/
/* @media screen and (max-width: 300px) {
    section {
        padding-top: 100px;
    }
} */

p,
h3 {
    background-color: inherit;
}