What you’re missing is that absorption of light can’t really be well described by a continuum model of matter.
For any kind of transmitted energy to be absorbed, you need the absorber to respond to the excitation and absorb the energy, which generally means there has to be some internal mode of excitation of the absorber that can suck up the energy. For example, a sound wave is absorbed by exciting some wiggling of the same frequencies in an absorber. The more wiggling motions of the absorber there are, the better chance there is that some of them will match the incoming sound wave, and the better absorption you’ll get. Now, for sound, a continuous description of matter is very reasonable. A continuum generally has many more high-frequency modes of vibration than low, so indeed you would find that high-frequency sound would be absorbed better and faster than low frequency. Hence distant thunder is low, elephants can be heard over miles while parakeets only over feet, et cetera.
This continuous to hold reasonably true for electromagnetic radiation provided you are still talking about big wavelengths, e.g. radio. So longer radio waves do indeed go further and are more penetrating, because there are fewer modes of vibration of matter at that wavelength that they can excite, and transfer their energy to.
But when you get to very small wavelengths – microns and smaller – then it starts to matter a lot that matter is not continuous, but made of atoms and molecules, and the particular atoms and molecules you’ve got determine what kinds of internal excitation your EM radiation can excite.
It turns out that microwaves tend to hit the rotational motion of certain molecules, and a lot of materials have molecules that can rotate. But liquids more than solids, which is why water heats up faster than bread in your microwave (in addition to the fact that the oven is partly tuned to the frequency of water molecule rotation). Go a little shorter, into the far infrared, and you start to get into some vibrational motions of molecules, but only big ones, so far infrared is pretty penetrating. That’s why it’s of interest in astronomy – sees through light years of dust. In the near infrared, you hit vibrational motion in nearly anything, so matter is strongly opaque in the near infrared. You can’t even see through glass very easily. Shorter still, you hit the visible. Now, interestingly, visible light tends to excite very little. It’s too high frequency for vibration, not high enough for anything else. So matter is often surprisingly transparent in the visible – there just aren’t many internal excitations that can absorb the energy. You might say, whoa, amazing then that the Sun puts out most of its radiation in the visible – how very convenient for seeing creatures such as us! Intelligent design! Well, maybe, except that if the Sun put out most of its radiation somewhere else, it’s unlikely life would even be possible, because the energy would be too easily dissipated (if too low wavelength) or blast apart any complex molecules to readily (if too high).
Get a little shorter, and ultraviolet light tends to start exciting electronic transitions, electrons hopping from one part of the molecule to another (roughly speaking). Matter starts to become opaque again in the UV. Also, this hopping of electrons around can easily lead to rearrangements of chemical bonds – i.e. chemical reactions – which is why UV light is destructive of materials – plastics, glues, wood, leather, and flesh itself.
Shorter still, into the soft X-ray, and again matter becomes fairly transparent, because only the heaviest atoms have electrons at such low energies that they can absorb the energy in an X-ray. So X-rays tend to pass unmolested through light atoms, and only get absorbed by the heavier ones.
Keep going far enough, into the hardest of X-rays and early gammas, and you start being able to excite vibrations (so to speak) of atomic nuclei, which are exceedingly fast indeed, and then again matter becomes somewhat more opaque.
In general, the absorption of matter of EM radiation is a very complex function of frequency, and it rises and dips in ways that are not easily described and which depend sensitively on the precise nature of the matter – its chemical and even nuclear constitution. In fact, this is how we learn a great deal about matter: by shining light on it, or through it, recording the spectrum of absorption, and using microscopic modesl to try to explain the spectrum in terms of what kinds of motion is possible at the microscopic level.