Buddhism began to spread throughout Japan during the Heian period, primarily through two major esoteric sects, Tendai and Shingon. Tendai originated in China and is based on the Lotus Sutra, one of the most important sutras of Mahayana Buddhism; Saichō was key to its transmission to Japan. Shingon is the Japanese transmission of the Chinese Chen Yen school. Shingon, brought to Japan by the monk Kūkai, emphasizes Esoteric Buddhism. Both Kūkai and Saichō aimed to connect state and religion and establish support from the aristocracy, leading to the notion of 'aristocratic Buddhism'. An important element of Tendai doctrine was the suggestion that enlightenment was accessible to "every creature". Saichō also sought independent ordination for Tendai monks. A close relationship developed between the Tendai monastery complex on Mount Hiei and the imperial court in its new capital at the foot of the mountain. As a result, Tendai emphasized great reverence for the emperor and the nation. Kammu himself was a notable patron of the otherworldly Tendai sect, which rose to great power over the ensuing centuries. Kūkai greatly impressed the emperors who succeeded Emperor Kammu, and also generations of Japanese, not only with his holiness but also with his poetry, calligraphy, painting, and sculpture. Shingon, through its use of "rich symbols, rituals and mandalas" held a wide-ranging appeal.
What court did Shingon develop a close relationship with?