PHILADELPHIA (AP) — A surprising first half and a surge in early August had the Philadelphia Phillies in prime position to reach the postseason.

Then they fell apart.

Since completing a four-game sweep over the Miami Marlins on Aug. 5, the Phillies (74-71) are 11-23 and 0-10-1 in those series. They went from 1 1/2 games ahead of Atlanta in the NL East to 7 1/2 games behind with only 17 games to play.

Philadelphia was only one game behind the Cubs for best record in the National League before the tailspin began. Now, finishing with a winning mark will be a challenge.

Manager Gabe Kapler's positive approach hasn't wavered, but even he can't find a way to sugarcoat this collapse.

"There's no question that we can play better baseball," Kapler said. "We are more talented and more prepared than the outcomes that we're getting, the losses we've racked up recently."

So, what happened?

"It's not one thing," Kapler said. "It's a collection of many, many things. And to try to boil it down to one thing doesn't appreciate all the variables."

Here's a start. The Phillies can't hit, can't protect leads and play poor defense.

The team has the second-worst batting average (.237) in the majors, is 21st in runs and has third-highest strikeouts.

The bullpen has blown four ninth-inning leads against the Washington Nationals alone, including a three-run lead in the second game of a doubleheader Tuesday night. The defense has committed 105 errors, tied for second most.

Kapler, hitting coach John Mallee and assistant hitting coach Pedro Guerrero have preached patience at the plate.

Based on their reliance on analytics, they've also placed more importance on hitting balls in the air. But most of the hitters are trending downward this season.

Odubel Herrera has a career-high 21 homers, but career-worst average (.257) and on-base percentage (.313). Cesar Hernandez also has a career-high 11 homers, but a career-worst .256 average and his OBP is down to .361 from .371 last season. Nick Williams also has more homers (17) than he did as a rookie but in more at-bats. His average is down from .288 to .256.

Rhys Hoskins (.252, 30 homers and 89 RBIs) has been streaky but overall is the team's best hitter. Maikel Franco (.268, 22 homers, 67 RBIs) is the only player who has better overall numbers under the new coaching staff and he's a player Kapler has tried to bench several times.

Despite the hitting woes, Kapler stands by his coaches.

"Those two are an incredible tandem," he said. "They have done a tremendous job. I understand why a correlation with recent struggles would bring up questions about all sorts of things, but in this particular case, I think you're talking about one of the better hitting coaches in John Mallee and a guy who has supported him in Pedro Guerrero that is off-the-charts good."

General manager Matt Klentak made several moves to try to bolster the offense before the trade deadline and afterward, acquiring All-Star catcher Wilson Ramos, infielder Asdrubal Cabrera, first baseman Justin Bour and veteran slugger Jose Bautista. When healthy, Ramos has been the best hitter. Cabrera was an upgrade over Scott Kingery. Bour and Bautista are bench players.

The Phillies pursued Manny Machado, but the Orioles traded him to the Los Angeles Dodgers because Philadelphia wasn't willing to part with top prospects. Expect the Phillies to go hard after Machado and Bryce Harper in free agency after the season.

Machado wouldn't have made that much of a difference this season. Cabrera has five homers and 17 RBIs in 41 games for the Phillies. Machado has nine homers and 25 RBIs in 49 games for the Dodgers.

Klentak added a couple of relievers who haven't made an impact and passed on acquiring starting pitchers such as Cole Hamels or J.A. Happ to complement NL Cy Young contender Aaron Nola. Hamels has been excellent for the Cubs, going 4-0 with a 1.42 ERA in eight starts.

Chicago is 6-2 in those games. Hamels could've replaced Nick Pivetta or Vince Velasquez in the rotation. The Phillies are 3-5 in each of their starts in that span. So, it wouldn't have made enough of a difference.

Coming off five straight losing seasons, the Phillies weren't expected to contend this season. The goal was to have Kapler instill a positive attitude, change the losing culture, develop young talent and find out which players will be part of the nucleus going forward.

With plenty of money to spend, Klentak gave Carlos Santana a $60-million, three-year contract and former NL Cy Young Award winner Jake Arrieta a $75-million, three-year deal in mid-March when he was still available.

Santana is only batting .229, but he has a .350 on-base percentage with 23 homers and 82 RBIs. Arrieta is 10-9 with a 3.66 ERA and has failed to step up when needed most. His ERA and WHIP have risen each season since 2015 and his strikeout totals are down each year.

The Phillies aren't ready to start looking ahead to the offseason. They were seven games behind the Mets with 17 to play in 2007 and came back to win the first of five straight division titles.

But this team doesn't have Jimmy Rollins, Ryan Howard, Chase Utley, Shane Victorino, Aaron Rowand and Pat Burrell.

"It's not over until we're eliminated," Arrieta said.

___

More AP MLB: https://apnews.com/tag/MLB and https://twitter.com/AP_Sports