Modeling Phase Transitions in the Brain