Near-edge x-ray absorption fine structure (NEXAFS) and resonant inelastic x-ray scattering (RIXS) measurements at the oxygen K edge were combined with theoretical spectrum simulations, based on periodic density functional theory and nuclear quantum dynamics, to investigate the electronic structure and chemical bonding in kaolinite Al2Si2O5(OH)4. We simulated NEXAFS spectra of all crystallographically inequivalent oxygen atoms in the crystal and RIXS spectra of the hydroxyl groups. Detailed insight into the ground-state potential energy surface of the electronic states involved in the RIXS process were accessed by analyzing the vibrational excitations, induced by the core excitation, in quasielastic scattering back to the electronic ground s...