This planet morphed from one type to another — and formed a second atmosphere