Buying a home is as much about your state of mind as the state of your bank account—but both need to be in great condition. Here’s how to get in shape.