.parent {
    display: flex;
    flex-direction: row;
    /* or column */
    flex-wrap: nowrap;
    /* ensures no wrapping */
    width: 916px;
    /* makes width auto-fit children */
    gap: 10px;
    padding: 10px;
    margin-left: auto;
    margin-right: auto;
}


/* OUTER FLEXBOX */
.box {
    display: flex;
    flex-wrap: wrap;
    /* Wrap on smaller screens */
    gap: 4px;
    margin-top: 4%;
    padding: 4px;
    background-color: rgb(163, 158, 158);
    max-width: 100%;
    /* Prevent overshooting */
    box-sizing: border-box;
}

/* FLEX ITEMS */
.item {
    background-color: rgb(63, 53, 53);
    width: 300px;
    min-height: 300px;
    height: auto;
    flex-shrink: 0;
    /* Prevents shrinking unexpectedly */
    overflow: hidden;
    color: rgb(182, 149, 149);
}

.text-child {
    display: flex;
    /* make it a flex container */
    justify-content: center;
    /* horizontal center */
    align-items: center;
    /* vertical center */
    text-align: center;
    /* center multiline text horizontally */
    height: 100%;
    /* fill the parent's height */
    width: 100%;
    /* fill the parent's width */
}

/* NESTED FLEXBOX */
.box2 {
    display: flex;
    flex-direction: column;
    gap: 4px;
    height: 100%;
    background-color: rgb(163, 158, 158);
    box-sizing: border-box;
}

/* INNER ITEMS */
.item2 {
    background-color: rgb(63, 53, 53);
    flex: 1;
    /* Fills available vertical space */
    min-height: 0;
    /* Important for flex children */
    overflow: hidden;
}

.item img {
    height: 100%;
    width: 100%;
}