Genesis 1:1 IN the beginning God created the heaven and the earth.
2. And the earth was (should be "became") without form, and void; and darkness was upon the face of the deep.
And the Spirit of God moved upon the face of the waters.
We are not told when the earth became without form.
Many times the alternate meanings have more impact than the literal. Start with earth = mind.