Drupal has these CSS layers:
- Base
- Layout
- Component
- State
- Theme
Drupal libraries that load CSS define which layer each file is in. This sets the order they are loaded so cascading styles work correctly.
When a page is loaded, Drupal determines the required libraries and creates compressed bundles
https://drupal.stackexchange.com/questions/134621/how-does-css-and-js-aggregration-work-in-drupal