The expected result should be that the .item ( green color ) is followed by any element like p without any empty space like below:

I was trying to do this by translateY, but it just move the div .item going up and left an empty white space like the below:
.main {
background-color: gray;
display: flex;
flex-direction: column;
justify-content: center;
margin-top: 150px; /* For illustratoin purpose only to see the result */
padding: 30px;
}
.item {
background-color: green;
height: 200px;
transform: translateY(calc(-50% - 30px)); /* Here is my try */
width: 100%;
}
<div class="main">
<div class="item"></div>
<p>Helloooooooooooooooooooooooooo</p>
</div>
I have also tried margin-top: -50%;, I thought it should work but it just going up which I think is not "50%", going so much more than -50% although I don't know why like below.
Edited: negative margin will only work if I know exactly what's its height, say its height is 200px, then I can do margin-top: -100px;. But now the height of .item is unknown/flexible where the height: 200px; in the code is just for illustration purposes.
.main {
background-color: gray;
display: flex;
flex-direction: column;
justify-content: center;
margin-top: 150px; /* For illustratoin purpose only to see the result */
padding: 30px;
}
.item {
background-color: green;
height: 200px;
margin-top: calc(-50% - 30px); /* Here is my try */
width: 100%;
}
<div class="main">
<div class="item"></div>
<p>Helloooooooooooooooooooooooooo</p>
</div>