"I refuse to believe that it's not possible," he said. "If we don't succeed, it will be because we didn't have enough time."

They are now coming to direct terms with a question familiar to many in retail: How does a brick-and-mortar shop survive in the age of the Internet? Ajaya describes himself as a "stupid optimist" who can't imagine seeing his business fail. He didn't have a magic-bullet solution, but said his team was going to experiment with plenty of ideas.

He and his close-knit cadre of employees at Book Buyers are now making a last stand, working hastily to reinvent and reinvigorate the Castro Street bookstore, which will celebrate its 25th anniversary next month. They are readying a spree of new events, price cuts and promotions all designed to rekindle interest in the printed word.

Costs are rising, sales are sluggish and online competition is undermining the bottom line, he wrote in his newsletter last week. In an earnest confession, he estimated that his used bookstore had three months to turn around or be forced to close down. But Ajaya made a sincere pledge: he would do everything he could to prevent that from happening.

"If you're in the book business, you're not in it for the money," Stallings said. "I have to look at books as widgets in a business, even though they're not like that. In my mind, books are magic."

Meanwhile, she said Book Buyers is doubling down on events and promotions that have been a mainstay for bookstores, such as author readings, open mic gatherings and targeted sales. Hawking second-hand books is never going to be hugely profitable, she said, but it is a line of work that is close to heart of many employees and frequent customers. Her own background is a testament to her passion. Up until recently, she owned and managed Handee Books in Santa Clara, but said she was forced to close last year.

The bookstore had recently upgraded its website and making a concerted effort to plug itself on social media, said Tammie Stallings, the store's in-house marketing guru. On a daily basis, she is writing online posts and blogs listing off the staff's current favorite picks or inviting people to drop by for an afternoon flash sale. Stallings touted a 18 percent bump in Facebook page visits as a sign her efforts were effective.

It was just one area of the book stacks that had been changed, and other upgrades are imminent, he promised. The new focus of his bookstore was on building community and getting people in the doors. To accomplish this, Book Buyers was using a variety of promotions some newfangled and some old-fashioned.

He sat down last week to talk shop in bookstore's new living room, an open area equipped with sofas and tables. It was meant to encourage anyone in the store to relax and flip through a volume, whereas previously the shop put a priority on maximizing its inventory, he said. The room was a personal project for him, and for weeks he arrived early in the morning to build the furniture and clear the space for customers.

"We're not going to ask for handouts," he said. "If we're going to survive, we need people to make the effort to come here and buy here."

For Ajaya, 72, trying to revitalize business remains experimental. The business already sells books online through a sister store in San Jose. For a period, the store also tried to break into international sales, but the shipping costs ended up being too high and it was burdensome to deal with a patchwork of changing tax rules, he said. The main hope was to remind customers to come by and appreciate the bookstore as a local community institution.

"Collectively, independent booksellers are doing very well, but used bookstores are the exception to the rule," Landon said. "This industry is always going to be a challenge as long as Amazon is around, but booksellers are ready to rise to the challenge."

But used bookstores haven't fared quite as well, Landon said. He speculated that this could be because selling used books means tighter profit margins and possibly a customer base that tends to be more frugal. Used booksellers are also competing head-on with the online retail giant Amazon, which has made second-hand books a linchpin of its business, he explained.

Selling books still remains a profitable trade, said Hut Landon, executive director of the Northern California Independent Booksellers Association, which represents about 300 shops. While the market for books experienced a slump during the 2008 recession, Landon said sales have been on a gradual upswing since around 2012. The 2011 bankruptcy and closure of the bookstore chain Borders only helped smaller competitors, he said.

Ajaya said he has already violated a promise he made to himself to leave the business when he turned 72. His goal now is to depart with the assurance that his business is on stable footing.

Used bookshop scrambles to save business

Book Buyers redoubles efforts in face of possible closure