Diffusionless phase transitions are at the core of the multifunctionality of (magnetic) shape memory alloys, ferroelectrics and multiferroics. Giant strain effects under external fields are obtained in low symmetric modulated martensitic phases. We outline the origin of modulated phases, their connection with tetragonal martensite and consequences for their functional properties by analysing the martensitic microstructure of epitaxial Ni-Mn-Ga films from the atomic to macroscale. Geometrical constraints at an austenite-martensite phase boundary act down to the atomic scale. Hence a martensitic microstructure of nanotwinned tetragonal martensite can form. Coarsening of twin variants can reduce twin boundary energy, a process we could follow from the atomic to the millimetre scale. Coarsening is a fractal process, proceeding in discrete steps by doubling twin periodicity. The collective defect energy results in a substantial hysteresis, which allows retaining modulated martensite as a metastable phase at room temperature. In this metastable state elastic energy is released by the formation of a twins within twins microstructure which can be observed from the nanometre to millimetre scale. This hierarchical twinning results in mesoscopic twin boundaries which are diffuse, in contrast to the common atomically sharp twin boundaries of tetragonal martensite. We suggest that observed extraordinarily high mobility of such mesoscopic twin boundaries originates from their diffuse nature which renders pinning by atomistic point defects ineffective.