This is an interesting question. Here are my 0.02. I think the Bible uses figurative language to tell how things took place, but deciding upon the scientific equivocation of HOW God could have done this is the fun part. So here goes.
1:1 "In the beginning God created the Heavens and Earth." So we know right now that the earth and the sun and the stars were already there. All that is left now is to move things around and thus I think what happens after this is just selecting the earth and moving it and the sun perhaps into an isolated area where just the light of the sun reached the earth with no other stars nearby.
Thus speaking of creating light and darkness and dividing the light and dark had to do with isolating the earth close enough to the sun for it's current illumination and yet isolated enough from other stars so that one half the earth was lit up and the other half in darkness.
Now think about that. If the earth was far far away then it wouldn't be all that bright. So with reference to the earth, creating "light" meant moving the earth into the Sun's light, then perhaps moving the earth and sun into an isolated place so that there was darkness elsewhere.
So what we see is God creating the solar system and assembling the planets and moons in their orbits so that it became a means of timekeeping, etc. Obviously the Sun didn't generate all the perfectly round planets circling it. So that would explain this.
Now, of note, the "firmament" that separated the waters from the waters has been confirmed Biblically to be clear ICE. That is, the "water canopy" that encircled the earth was a clear ice sheet creating a hothouse effect on the planet; not the seasons we have now which didn't begin until after the flood. That's how those waters stayed up there because it was frozen.
At the time of the flood, the darkness for seven days prior to the floor may have been the de-iciing of the water canopy which created dense clouds and thus the darkness. Then when the ice canopy had been vaporized, while there was total darkness on the earth, God caused it to rain down on the earth for 40 days and 40 nights until the entire planet was flooded (I know you didn't ask for all this, BUT....).
After that, God used "winds" to funnel most of the water back into outer space. The water may have remained generally in the vicinity of the earth and thus we see ice accumulations around comets, etc. So we know there is H20 in outer space. Maybe the majority of it we have in the solar system were part of the original flood waters. As we know most planets have no atmosphere.
Anyway, my main point here was that we should think of the water canopy above the earth before the flood as being a solid outer globe of clear ice.
Spectacular!
But it's true, persons without spiritual imagination find much in the Bible boggling; those with spiritual insight find it a fascinating revelation of God's secrets.
LG