# Formatting each part/section/subsection

Are there some magic lines to be placed in the preamble that would, like in CSS, specify how each generic section or subsection in the whole document should be formatted?

You can use the titlesec package for this.

A short example would be \titleformat*{\section}{\itshape} to change the style of \section to \itshape. See the package manual for more details.