You're shipwrecked in a tropical storm near the coast of Costa Rica and get washed up on the shore. As the dawn breaks, the storm hurries along, the crashing waves recede, and you take stock of your situation as you scoop sand out of your underwear.
Behind you, the Pacific Ocean. In front of you, the edge of a jungle. You look left and right. Both ways the jungle and the beach stretch as far as you can see in the shimmering haze. What was that movement among the trees? Ah, it's a troop of capuchin monkeys starting their foraging for the day. What was that "peew-bip" sound? Must be that pair of toucans up in the foliage.
And you think, "Fuck! I'll have to walk days to get to civilization." Lucky for you, this is not the case. If you were to enter the "jungle", you would soon come across bars, restaurants, hotels, luxury resorts, condo developments, and houses. No high-rises, though.
This is thanks to a 1973 law that designated the first 50 metres above the mean high tide line as public land on which nothing may be built. The next 150 metres is also public land; Costa Rican citizens and residents and Costa Rican companies can lease this land subject to zoning restrictions - hence the lack of high-rises.
The law was intended to guarantee public access to all beaches in Costa Rica, on the Pacific as well as the Caribbean coast. And it works. Especially on weekends and public holidays you see people flocking to the public zone, having picnics and barbeques under the palm trees and enjoying the beach for free.
So, Costa Rica has avoided the situation where luxury hotels and resorts turn a public beach into a "private" one for all practical purposes by making it impossible to access it without crossing over their property. And even if you manage to make it to the beach, they make it very difficult for you to enjoy yourself without having to fork out, because they've built and placed their amenities almost right up to the water's edge.
I don't know whether this was the original intention of the law, but it also means that much of Costa Rica's coastline has escaped the overdevelopment that blights the coasts of so many countries where beach-based tourism is a thing - large parts remain as I described it in the shipwreck scenario above.
Those animals in the scenario aren't made up, either. We live about five minutes' walk from the beach in an area with condo developments, restaurants, hotels, and so on, but in and around our garden we've seen monkeys, toucans, bright red-blue-and-yellow parrots, vultures, eagles, iguanas, bats, and possums.
We've even seen a sloth taking a dump in the undergrowth next to a busy main road. Well, I assume it was taking a dump; when I read up on them it said this was the only reason they ever come down from the trees.