By the time the Chimú were rising to prominence at the end of the first millennium, the preceding Huari and Moche cultures of the Peruvian seaboard had long faded, but the Chimú inherited – and enhanced – their mastery of irrigation and metalwork. The Chimú capital at Chan Chan was a substantial city, with perhaps 40,000 inhabitants, organized into ten sub-districts, each of which housed a specific caste of craftsmen. The Chimú produced polished blackware ceramics, intricately patterned textiles and jewellery of gold, amber, emeralds and spondylus shells. They constructed sunken farms to exploit the moisture of the subsoil, and built elaborate canal systems, together with walk-in wells and reservoirs. Under the warrior-king Nacen-Pinco, they gained control of much of modern Peru in the late 14th century, with wide trading and tribute networks. However, their expansion brought contact with the warlike Chanca and their eventual conquerors, the Inca.