I don't think I should have been up on the rooftop. The door was locked the next night, blocking access, meaning that evening was a once-only experience. Maybe it was better that way.
I'd decided to explore the old hotel, this rabbit warren of little passageways, its stone staircases leading up and down and around. The place was once a caravanserai, a resting place for wandering explorers of the Persian desert, and still offered plenty of intrigue for those willing to have a poke around.
Downstairs there was a well dug deep below the central atrium; an old cellar had been converted, surprisingly, into a snooker room. To one side of the atrium a narrow staircase lead up past a couple of rooms and then doubled back on itself, twisting further upwards.
I'd wandered up that way, pushed open a door at the top, and then suddenly found myself standing on a roof looking over the city of Yazd, an Iranian outpost deep in the desert in the country's south-east.
There were desolate mountains far out on the horizon; bare earth leading in to the city; and then Yazd itself, its low-rise skyline pierced every now and then by spiky minarets and the tiled domes of the mosques.
This is why you spend your life savings.
The sun was about to set, bathing the city in soft red light. It's the kind of time you might want a gin and tonic in your hand, except that's clearly not going to happen here. So instead I found a little place to sit, to watch the sun dive below the horizon, to see the end of the day.
Just as that happened the first call to prayer rang out from a nearby mosque, the cry rumbling across the city, building in intensity. Soon it was joined by another call, and then another, and another.
And so I sat there on the rooftop being serenaded by a chorus of religious devotion, the light gradually fading, the sounds of the city ebbing and flowing, the feeling of being somewhere so completely alien and exotic and exciting completely overwhelming.
I was having a moment.
You don't get all that many of these when you travel, and it's even more exceptional to realise you're having one at the time. But this is what it's all about.
This is why you sit in airports and aeroplanes for days and days on end. This is why you put up with the odd crappy hotel, or the dodgy cab driver trying to rip you off, or the bad food, or the bus that never shows up. This is why you spend your life savings.
It's for these small moments of perfection, the ones you'll always look back on as highlights of your life. And it's often not the planned experiences that provide them, but the tiny slices of random perfection that the travel universe unexpectedly throws your way.
For me those moments have been when I've felt like I'm in the middle of a true adventure, when home is furthest away.
I had a moment in Uganda, again on a rooftop. Some friends and I had scrambled up onto the top of our truck with a few beers, and sat up there on the roof undisturbed for the afternoon, watching the world go by in Lake Bunyonyi. That's a moment.
I had a moment in India, on a train, lying on a plastic-covered bunk bed staring at the ceiling while the train clickety-clacked through Rajasthan, slowly taking me out towards Pakistan, even further away from everything I knew.
I had a moment in Mexico City, sitting in a little restaurant in a nondescript neighbourhood, eating the only thing on the menu – goat tacos – while a mariachi band played and a Mexican family near me stood up to clap and dance.
And I had a moment on that rooftop in Iran, watching the sunset, listening to five, six, seven calls to prayer ringing out across the city while I pondered my own existence.
That's worth whatever you have to do to get there.
What has been your most memorable "moment" while travelling? Do you enjoy the planned experiences, or the spontaneous events? Share your stories in the comments field below.