As the nation's economy was still reeling from the body blow of the Great Recession, Seattle's was about to take off.

In 2010, Amazon opened a headquarters in the little-known South Lake Union district — and then expanded eight-fold over the next seven years to fill 36 buildings. Everywhere you look, there are signs of a thriving city: Building cranes looming over streets, hotels crammed with business travelers, tony restaurants filled with diners.

Seattle is among a fistful of cities that have flourished in the 10 years since the Great Recession officially began in December 2007, even while most other large cities — and sizable swaths of rural America — have managed only modest recoveries. Some cities are still struggling to shed the scars of recession.

In the decade since the recession began, the nation as a whole has staged a heartening comeback: The unemployment rate is at a 17-year low of 4.1 percent, down from 10 percent in 2009. Employers have added jobs for 86 straight months, a record streak. And last year, income for a typical U.S. household, adjusted for inflation, finally regained its 1999 peak.

Yet the rebound has been uneven. It's failed to narrow the country's deep regional economic disparities and in fact has worsened them, according to data analyzed exclusively for The Associated Press. A few cities have grown much richer, thanks to their grip on an outsize share of lucrative tech jobs and soaring home prices. Others have thrived because of surging oil and gas production.

But many Southern and Midwestern cities — from Greensboro, North Carolina, to Janesville, Wisconsin — have yet to recover from the loss of manufacturing jobs that have been automated out of existence or lost to competition from China, before and during the recession. Like others, they have fewer jobs and lower household incomes than before the downturn.

Those disparities complicate the rosy picture painted by most nationwide economic data. With the nation enduring a widening wealth gap, an overall robust U.S. economy doesn't necessarily translate into widely shared prosperity.

"There's definitely a pattern of the coasts pulling away from the middle of the country on income," said Alan Berube, an expert on metro U.S. economies at the Brookings Institution. "There are a large number of places around the country that haven't gotten back to where they were 15 years ago, never mind ten years ago."

That said, for all the economic might the top-flight cities have gained in the past decade, many city officials and business leaders have become concerned that their success is running up against limits. Surging home prices and rents have made housing unaffordable for many. With cities like Seattle and San Francisco choked with traffic, engulfed by homeless people and requiring ever-larger incomes to live comfortably, quality of life may be at risk.

In the Western United States, inflation reached nearly 3 percent in October compared with a year earlier, according to government data. By contrast, inflation rose just 1.5 percent in the Midwest and New England.

"It's the first time I have noticed a persistent spread between inflation in one area and the rest of the country," says Steve Cochrane, an economist at Moody's Analytics who has studied regional economics for 25 years.

Mindful of the financial burden on employees, some tech companies have decided to set up shop or expand where expenses are more manageable. Snapchat and Hulu have put down roots on the slightly more affordable west side of Los Angeles, joining outposts of Google and Facebook in an area now known as "Silicon Beach."

Last year, nearly as many people moved out of Silicon Valley — defined as Santa Clara and San Mateo counties — as moved in, according to a report by Joint Venture Silicon Valley, a civic group. It was the first time since 2010 that the number of arrivals and departures have been roughly equal.

The trend isn't entirely surprising given that commuting times in San Francisco have lengthened by 40 minutes a week in the past decade, the report said. The price of a typical San Francisco home has reached an eye-watering $1.2 million, according to Trulia, an online real estate data provider.

Housing costs, inflated by local regulations restricting home-building, can act as a barrier to opportunity. They make it harder for people in poorer areas to move for better opportunities. With fewer people able to move to places with more jobs and higher pay, the national economy tends to suffer, economists say.

Among the nation's 100 largest metro areas, San Francisco experienced the biggest gain in median household income in the decade after the recession began. Adjusted for inflation, it jumped 13.2 percent, according to data compiled by Moody's Analytics. San Jose, which is part of Silicon Valley, enjoyed the second-largest increase, at 12.7 percent, followed by Austin, Texas, with 8.8 percent.

By comparison, median household income in the 100 largest metro areas actually fell 2.7 percent, on average. And the income gap between the 10 richest and 10 poorest metro areas has widened in the past decade, Moody's data shows.

Eight of the 10 cities with the largest income gains are "tech hubs," with heavy concentrations of software architects, data analysts and cloud-computing engineers. They include Denver, Portland, Oregon; Provo, Utah; and Raleigh, North Carolina.

Pittsburgh has experienced the ninth-largest income gain, thanks to increased tech and health care jobs. Oklahoma City, where inflation-adjusted incomes are up 5.5 percent, has benefited from the oil and gas boom.

Most Americans haven't received raises anywhere near that large. Data compiled by Brookings shows that 65 percent of Americans who live in urban areas — defined as cities with populations above 65,000 — live in places where the typical household income is still below its 1999 level.

Max Versace, CEO of artificial intelligence startup Neurala, who arrived in Boston in 2001 from Italy, has watched the city transform itself into a boomtown, filled with innovative companies working on robotics, AI and self-driving cars. Boston enjoyed the 11th-best income gain in the past decade, Moody's data shows.

"I have never experienced a slowdown in Boston," said Versace, whose company is based in Boston's Seaport neighborhood, a formerly rundown industrial area now crowded with startups and high-end restaurants. "Boston is one of those bubbles — good bubbles — that have been saved by the two locomotives of computer sciences and biotechnology."

Versace launched Neurala in 2013, and it now has 36 employees, including eight with PhDs. While most workers across the country have endured scant pay gains, Versace estimates that salaries for AI researchers with Ph.D.'s have doubled since 2008.

Neurala is working to incorporate AI in drones, including one aimed at energy firms that will use its technology to spot cracks in pipelines or wind turbines without needing humans to monitor video feeds.

One other change Versace is happy to observe: "I no longer have to spit out espressos or pasta," because the quality of each has improved so much since he arrived.

The divergence between the richest and poorest U.S. cities predates the Great Recession. But it is historically unusual. For a period of 100 years ending in the 1980s, income gaps between richer and poorer cities narrowed steadily.

Economists cite three reasons why such convergence ended. The nature of high-tech work, for one thing, makes it productive for higher-skilled workers to cluster in the same cities.

Elisa Giannone, an economist at the University of Chicago, notes that in past decades, highly paid professionals — doctors, say — might have congregated in cities with fewer physicians to capitalize on the lack of competition and earn more. Likewise, many companies that employed high-skilled workers would move to lower-cost cities to take advantage of cheaper labor.

But her research has found that both trends have been upended by the rise of highly skilled information technology work. People with such skills prefer to work in cities with their peers. And the companies that employ them seem to care just as much about the right skills as they do about lower costs. What's more, higher educated employees typically become more efficient when they cluster together and exchange ideas.

"It's more beneficial and more productive to go where there are more people like me," Giannone says, referring to how such workers think. "I don't want to be left out."

Jed Kolko, chief economist at Indeed, the job listings website, calculates that one quarter of tech job openings in the first half of this year were located in just eight tech hubs: Baltimore, Washington, Boston, San Jose, San Francisco, Seattle, Austin and Raleigh, North Carolina.

A second factor is swelling home prices and rents, particularly where regulations make it harder to build more. People in poorer areas often used move to wealthier cities to find better opportunities. Now, that option is increasingly available only to those with advanced skills or education.

Two public policy experts, Peter Ganong and Daniel Shoag, concluded in a paper last year that both janitors and lawyers used to fare better financially in New York City than in poorer cities, even accounting for the higher cost of living.

Now, because of rocketing home prices in richer areas, that's no longer true. Lawyers can still come out ahead. But janitors and other lower-skilled workers don't.

In the 10 cities with the fastest income growth, housing prices have soared by an average of 31.1 percent in the past decade, Trulia found. That compares with a national average increase of just 5.1 percent.

One result has been huge wealth gains for a fortunate few. A resident of San Francisco who bought a typical home, paying nearly $816,000 in the spring of 2007 — just as the housing market nationwide was collapsing — has gained $365,000 in the past decade.

In Cincinnati, a homeowner who bought at the same time would have paid just $143,000 but would have gained only $6,500.

"Geography plays a critical role in wealth building," said Ralph McLaughlin, chief economist at Trulia.

A final factor behind the diversion is that the industries and occupations in slower-growing regions were leveled by the recession. Manufacturing and mining are disproportionately located in red states. So are retail jobs. All those sectors have endured weak growth since the recession.

Robin Brooks, an economist at the Institute of International Finance, a trade group, says those job losses have opened a gap between so-called "red" states, which voted for Donald Trump in 2016, and "blue" states.

About 61 percent of blue state residents have jobs, compared with roughly 59 percent in red states, Brooks found. That cuts against recent historical patterns: From the 1990s through the mild recession of 2001, there was no gap at all.

Despite the persistence of regional inequality, some positive trends have emerged: More tech jobs are moving out of the tech hubs and spreading around the country. Software programming jobs have migrated to Dallas, Detroit, and Charlotte, among other cities, according to Brookings data. Software increasingly plays a vital role in banking and finance, auto manufacturing, and retail.

But many of those tech jobs are lower- or mid-level positions, such as technical support and help desk jobs, rather than higher-paying, cutting-edge positions. Kolko notes that the most highly-skilled tech jobs — in such areas as machine learning, a form of artificial intelligence; computer vision; and database engineering — are even more concentrated in tech hubs than are tech jobs overall.

"There's a spreading out of the tech economy, but it remains a different tech economy in the middle of the country than what you find in the Bay Area, Boston, New York and Austin," Berube said.

Software may be more widely used, but when it comes to actually inventing new software, "that is still a phenomenon you find in only four of five places in the United States."