#Linux
At the bottom is Linux the kernel: a small part of the system. It provides access to hardware, and implements security.

#Gnu
Then Gnu (Libraries; bash; tools:ls, etc; C compiler, etc). Most of the operating system.

#X11
Then X11 (Or Wayland, or ...), the base GUI subsystem. This runs in user-land (outside of the kernel): it is just another process, with some privileges.
The kernel dose not get involved, except to give access to the hardware. And providing inter-process communication, so that other processes can talk with the X11 server.

#X11 library
A simple abstraction to allow you to write code for X11.

#GUI libraries
Libraries such as qt, gtk, sdl, are next they make it easier to use X11, and work on other systems such as wayland, Microsoft's Windows, or MacOS.

#Applications
Applications sit on top of the libraries.

#Summary
It looks something like this

```
┌─────┬─────┬─────┬──────────────────────────┐
│ SDL │ GTK │ SDL │ ... │
├─────┴─────┴─────┴──────────────────────────┤
│ xLib │
├────────────────────────────────────────────┤
│ X11 │
├─────────────┬────┬─────────────────────────┤
│ Gnu tools │ │ │
├─────────────┘ │ │
│ Libraries │ │
├──────────────────┤ │
│ Linux │ │
├──────────────────┘ │
│ Hardware │
└────────────────────────────────────────────┘
```

#xlib
Using xlib, is a good way to learn to learn about X11. However do some reading about X11 first.

#SDL
SDL will give you low level access, direct to bit-planes for you to directly draw to.

#Going lower
If you want to go lower, then I am not sure what good current options are, but here are some ideas.

 - Get an old Amiga, or simulator. And some good documentation. e.g. https://archive.org/details/Amiga_System_Programmers_Guide_1988_Abacus/mode/2up (I had 2 books, this one and similar).
 - Look at what can be done on a raspberry pi. I have not looked into this.