Chapter one creates the sun (and moon) on the fourth day, after the Earth and after "the waters". How can you have a "day" with no sun?
There is no way this can make any sense if taken literally. The whole thing has to be seen allegorically.
And verse 1 creates the "heavens" before the "first day"
even starts.
And the Hebrew "heavens" was the sun, moon and stars.
There's two ways of looking at the text. Take your pick.
When NASA went to Titan with their Huygens probe
they wanted to see a "precursor earth" and expected
to find a dark, cold, sterile, ocean world. As it was
the oceans were merely seas and lakes.
But it's what the early earth was like. Genesis 1
gives us this image of an earth already formed, and
in the "heavens" - BEFORE THE "DAYS" BEGAN.
It was dark, sterile, oceanic and without any "form"
(landmarks of any sort.)
Yes the text is confusing. It ought to be, it comes from
Sumer or even earlier. Word of mouth and translation
by translation for four, five or more thousand years.
But you can still see something of interest, like trying
to decipher those faded and broken clay tablets.