Foliated backgrounds for M-theory compactifications (I)