An adjective agrees with its own described noun in case, definiteness, gender, and number. It does not automatically copy the nearer noun.
رَسُولُ اللَّهِ الْكَرِيمُ: الْكَرِيمُ agrees with رَسُولُ.
رَسُولُ اللَّهِ الْكَرِيمِ: الْكَرِيمِ agrees with اللَّهِ.