It’s what happens when you believe they don’t need bleeding after hose shortening. You have air sitting harmlessly in the master cylinder reservoir until the bike’s inverted, at which point it can find it’s way into the pressurised part of the system and cause spongeyness. Buy a Shimano bleed bucket and fluid, fit the bleed block into the caliper to prevent over-filling (new pads will perform a similar function), and tease the air out of the reservoir into the half filled bucket by flicking the lever whilst tilting the bike side to side, and making sure the hose always has an upward slope towards the lever.