Conwy castle in north Wales has been portrayed by more artists than even the most swaggering eighteenth-century aristocrat. As you enter the castle today, some of these watercolours and paintings are blown up on the staircase to the ticket office and shop. Even without the cue of JMW Turner's romantic view, and even with modern traffic hurtling over the road bridge beneath the castle, no eye can fail to see the picturesque qualities of this punchy assembly of high walls and round turrets squatting giant-like on its high rock above a walled town. The fishing boats bob in the green water, while vistas of Welsh mountains recede in the distance. Nor can any heart fail to leap.

Inside, the picturesque first impressions grow into awe at the power and intelligence of the 13th-century king and masons who created this medieval architectural glory.Conwy is the military and secular equivalent of the great cathedrals – a triumph of the gothic mind. Looking up from inside one of its hollowed-out towers, you are stunned to see the sky above framed by a perfect circle of stone, with the crowning top turret a second, equally accurate, circle set on its parent like a cog wheel. How did medieval builders create such precise geometries? My guess is with nothing more complex than a pegged string, mapping the circle on the ground then building straight up. When you look at the base of the walls from outside, you discover that they grow out of the rock: crude but effective.

Other details are anything but crude. The stone vault beams of the great hall, of which only one survives, and the remains of its stained glass window match the sinuous decoration of the chapel tower's interior. This was a royal castle, and behind its formidable defences boasted the finery of a palace or abbey. Luckily, it fell into disrepair soon enough that it avoided becoming a manor house in Renaissance times or being converted into a Georgian gothic hideaway.

It was never modernised, in other words, and yet its stones, so massively gathered, survived remarkably well. This makes Conwy a truly stirring place: a medieval time capsule, with not a hint of fakery or false restoration about it.

This building is both practical and lovely. So here's a question. Why did castles stop being beautiful? Because of gunpowder, which blasted great holes in Conwy's near neighbour Rhuddlan castle. Fortifications could no longer afford to be picturesque in the era of cannon. Instead they became angular earthworks with sloping gun towers. The bunker-like forms of Renaissance bastions, which resisted artillery fire, evolved into the actual bunkers and trenches of the first and second world wars. Fortifications are still raised: what else is the green zone in Iraq if not a castle? But it is not beautiful.