How did new theories and inventions of the Scientific Revolution impact religion and the popularity of democracy?