By 1977, Lisa Lindahl was fed up with running in her regular underwire bra. The University of Vermont employee, then in her late 20s, was frustrated that her male jogging partner could take off his shirt to cool down, while she was stuck in a bra that slipped off her shoulders and dug into her back as she ran.

Why, Lindahl vented to friend and costume designer Polly Smith, wasn’t there something that women could wear to support their breasts without chafing or overheating?

The two set out to create a solution, but didn’t make much progress until Lindahl’s then-husband grabbed his jockstrap and held it over his chest, joking that he’d found it.

Turns out, he was onto something.

“I put it over my chest and it went right over my breast,” Lindahl, now in her late 60s and living in Charleston, SC, tells The Post. “I looked at Polly and said, ‘Oh my word!’”

The two women sewed two jockstraps together, creating what they called the jockbra, which was soon rebranded as the Jogbra. The $16 bra was a revelation: It held breasts in place without metal fixtures or stuffy padding, and the cross-back straps never fell off of shoulders. (Lindahl and her partners sold the company to what would become Champion in 1990.)

This summer marks the 40th anniversary of their invention — and while the sports bra has undoubtedly made technical leaps in the intervening years, its history is a fraught one.

Before the jockbra came into existence, female athletes had been forced to exercise in their regular bras, going so far as to tape the shoulder straps back so they didn’t slip as they ran. Others ran without a bra, leading to uncomfortable catcalls.

Not surprisingly, women embraced the jockbra, which was sold in sporting goods stores and later advertised in women’s magazines.

“It’s amazing how fast sales grew, because there was a pent-up desire for it,” says sports bra science and marketing consultant to Champion LaJean Lawson, Ph.D., who has spent more than 30 years studying and developing sports bras.

‘There is no piece of apparel more difficult to design well than a sports bra.’

At the time, the nation had been in the throes of a jogging obsession, and the passage of Title IX in 1972 had given more female students access to participating in sports.

“[The sports bra] was so important in what it did in sync with Title IX — it would make sports so much more within the reach of all women,” says Lindahl. “It removed a barrier that I had felt.”

The rise of gym culture in the ’80s left women with a plethora of trendy sports-bra options, many made of bright, stretchy Spandex that hugged breasts in close to the chest, in a style now classified as compression bras.

The ’90s saw the invention of the Enell bra — the first encapsulation bra, which cupped breasts individually to support and stabilize them, using what Lawson calls the “divide and conquer” method.

But sports bras largely remained hidden under shirts until the 1999 Women’s World Cup, when American soccer star Brandi Chastain kicked a winning extra point, whipped off her shirt and spun around in her sports bra to celebrate.

Snaps of the moment spread like wildfire and were seen on magazine covers and TV sets around the globe.

“Brandi’s moment at the World Cup … really brought international attention [to the sports bra],” says Lawson. “It increased social acceptance. That it’s OK for us to exercise, exercise hard and show our bras.”

In the 18 years since Chastain’s moment, sports bras have shifted from undergarments to stars of the show themselves, with the emergence of workout crop tops and strappy backs meant to draw eyes.

And yet, even after 40 years of development, sports bras are still plagued with problems and often fail at their sole purpose: keeping breasts from bouncing around during exercise.

“There is no piece of apparel more difficult to design well than a sports bra,” says Lawson.

Thanks to the recent boom in athleisure, customers are demanding options that accommodate a wide range of shapes and sizes.

“The industry tends to have a one-size-fits-all [approach],” says Sarah Carlson, the head of research and development at athletic-wear company Athleta. “[Depending on] if you’re a DD or an A [cup], the problem you have to solve is different.”

Those with larger chests often grapple with spillage — without proper support, they can also risk ligament or tissue damage.

Meanwhile, those with smaller cups frequently struggle with bras that flatten chests, which can decrease confidence.

“The No. 1 thing is for a woman to get measured,” says Lawson.

But sizing remains confusing — and far from standardized.

Small/medium/large sizes are easier for retailers to stock, says Sonja Winther, US president of lingerie company Chantelle, and can “ease the shopping experience for women.” But if your bands feel loose while cups feel tight, or vice versa, she suggests honing in on bras sold by cup and band sizes.

Still, even those can be problematic, according to bra expert Minyoung Suh, Ph.D., who notes that two women who ostensibly wear the same size will still vary “in terms of the volume, the shape and the weight of the breast.”

And then there is the matter of physics.

Most sports bras focus on what’s called vertical displacement — bouncing up and down, as opposed to side to side and forward and back — according to Lululemon innovation product manager Alexandra Plante. The brand just released its first bra meant to quash movement in all directions.

Lindahl, for one, is delighted by the progress — no matter how challenging it’s been.

When she first dreamed up the jockbra, she wrote a list of her requirements: slip-free straps, chafe-free hardware. “The other thing in the back of my head is that I really, really wanted to be able to run without a shirt on,” she says. “I wrote that down and then crossed it out — it seemed too much to ask.”

Forty years later, she says that every time she sees a shirtless woman jog by, it “causes a little spiritual and cosmic giggle.”