Wettability alteration and spontaneous imbibition in oil-wet carbonate formations