PHILADELPHIA — Nick Castellanos didn’t share his story publicly until months later. He didn’t even share it with teammates early on, even as his play suffered and the critics in Detroit started to pile on.

The diagnosis. The fear. The exhausting shuttle to Miami from all parts of the baseball map on days off.

When Cubs manager Joe Maddon welcomes his new right fielder as another ‘‘grown-up in the room,’’ that worst — and best — season of Castellanos’ baseball career in 2017 is where it began.

‘‘Death became very real for me,’’ Castellanos said.

This month marks the two-year anniversary of Castellanos learning his father’s brain cancer was in remission after successful surgery. That followed months of anxious conversations with specialists, sobering prognosis statistics and brief visits with his father as he helped lead the process.

‘‘He was the one that would just pitch to me for countless hours and hours and hours and hours [as a kid],’’ Castellanos said of Dr. Jorge Castellanos, a respiratory specialist in Miami and a onetime player himself who maxed out in high school.

‘‘My dad said that he was best-known on the field for two things: for having the tightest pants on the team and for all the girls standing up and cheering every time he struck out. That’s my dad being my dad.’’

The thought of losing him that summer might have been the only thing as powerful emotionally as the news of his recovery.

‘‘I remember as soon as I knew he was healthy and he was going to be good, I took off,’’ Castellanos said, snapping his fingers.

He got the news on Aug. 21. Since then?

After struggling at the plate and even worse in the field — a three-error game at third and a two-error game during the worst of it — he hit two home runs Aug. 22 on the way to a finish that included a .356 average, 10 homers and a 1.040 OPS in the final 37 games of the season.

In 305 games since that day, including an impressive first 11 games with the Cubs, Castellanos is a .300 hitter with a .417 on-base percentage, 48 homers, 103 doubles and a .935 OPS.

It’s not a coincidence.

‘‘That helped form the person that I am today,’’ he said. ‘‘Nothing is permanent; everything is temporary. Not just my life, but my opportunity to be a major-league baseball player. So I’m going to be damned if my career is over, and I look back and say I didn’t give it everything I had every single day.’’

Castellanos, the 44th overall pick out of high school in 2010, was one of the top-ranked players from a Miami-area generation that included Eric Hosmer, Manny Machado and Cubs center fielder Albert Almora Jr., who was drafted sixth overall two years later.

‘‘I remember getting to the big leagues because I was an extremely talented kid, not because I was an educated, hungry baseball player,’’ he said.

Castellanos did what was asked and always played hard.

‘‘But I could have done a lot better, just preparing,’’ he said. ‘‘I could have done a lot better taking care of myself.’’

Castellanos describes the experience of 2017 as an awakening in his life. That includes his relationship with his son, Liam, who turned 6 the day Castellanos joined the Cubs in St. Louis after the trade July 31 from the Tigers.

‘‘I would take Liam’s being 3 years old for granted and where he’s at in a development stage for granted,’’ he said. ‘‘You don’t think about these things when you’re a young kid, especially when your world is so consumed by a sport. For something real to happen like that, it’s just different. It changes you.

‘‘At the time, you think your world’s ending. But as soon as that storm ends and you step out of it and then you sit back and analyze what happened . . . I love how it changed me for the better.’’

For the Cubs, for at least two months, it all seems to add up to getting what might be the best Castellanos of his career, especially as he goes from a years-long rebuilding process in Detroit to a pennant race in Chicago.

An all-fields hitter with an old-school approach who defies modern launch-angle, metrics-based approaches to hitting, Castellanos has been an ideal lineup fit for the Cubs’ young core.

He also will become a free agent at the end of the season. He said any daydreams of what’s to come over the winter were pushed to the back burner as soon as he got to Chicago.

‘‘For me to start thinking beyond [the pennant race] would be an injustice to everybody in this clubhouse,’’ he said. ‘‘There’s a much larger and more important objective than my free agency.’’

Team president Theo Epstein echoed the same thoughts during his weekly radio hit on the Cubs’ flagship station last week.

‘‘We’re not ruling anything out or anything in,’’ Epstein said. ‘‘He certainly has made a great first impression. I can tell you whatever brain cells are being used in the front office and clubhouse right now are on 2019.’’

Castellanos calls his quick and seamless-looking transition into the clubhouse culture, including ‘‘answering’’ Ian Happ’s home-run phone in the dugout, ‘‘a credit to all of my teammates.’’

His hard play and exuberance also have inspired their own organic celebration of big plays in the last week, as he, first baseman Anthony Rizzo and others pantomime ‘‘feeding’’ each other. That’s a direct response to Maddon saying of the new guy, ‘‘He’s reminding us what hunger looks like.’’

‘‘I guess that’s a compliment,’’ Castellanos said.

Some took it as a shot at the holdovers, but Maddon insists that wasn’t the intent. Still, he acknowledged: ‘‘Maybe it serves as a reminder.’’

Said Castellanos: ‘‘I just feel like if I play every game like it’s Game 7 of the World Series, then when it’s Game 7 of the World Series, I’m prepared.’’