Fracture spacing in layered rocks: a new explanation based on the stress transition