A giant molecular cloud collapses under gravity to form a protostar. Explain the physical processes that prevent the protostar from collapsing indefinitely, and describe the dynamic balance that allows it to remain stable once it reaches the main sequence.