Pagan gradually grew to absorb its surrounding states until the 1050s–1060s when Anawrahta founded the Pagan Kingdom, the first ever unification of the Irrawaddy valley and its periphery. In the 12th and 13th centuries, the Pagan Empire and the Khmer Empire were two main powers in mainland Southeast Asia. The Burmese language and culture gradually became dominant in the upper Irrawaddy valley, eclipsing the Pyu, Mon and Pali norms by the late 12th century. Theravada Buddhism slowly began to spread to the village level, although Tantric, Mahayana, Hinduism, and folk religion remained heavily entrenched. Pagan's rulers and wealthy built over 10,000 Buddhist temples in the Pagan capital zone alone. Repeated Mongol invasions in the late 13th century toppled the four-century-old kingdom in 1287.