OnCollisionEnter not working when checking for layer

Hello, so I have a Capsule rigidbody with collider working as the PC and im trying to detect collisions with walls and other things on a specific layer. I checked that the test wall has a collider (box collider) set to the right layer (water for now, no reason) and that neither of them are set to isKinematic or isTrigger in the editor. When i was debugging, OnCollisionEnter would send a debug message when I hit the wall, and i even checked the layer mask this way and it returned the correct layer. But when i did this:

OnCollisionEnter(Collision collision)
{
        if(collision.gameObject.layer == mask )
        {
            Debug.Log(collision.gameObject.layer);
         }
}

I no longer get the debug message. Idk why and ive tried just about every other fix i could find so some extra opinions would be much appreciated, thanks. *also i checked the mask variable on my player controller and its set to the right mask **also,also, the function im trying to put in place of the debug message puts the player into isKinematic to move it to a ledge location but the wall stays normal

A single integer layer number is not a multi-layer bit-mask where each bit represents a layer.

Do need to shift a bit something like this:

void OnCollisionEnter(Collision collision)
{
    var hitLayerMask = 1 << collision.gameObject.layer;
    if (hitLayerMask & mask)
    {
        Debug.Log(collision.gameObject.layer);
    }
}

The difference between Layers vs LayerMasks:

https://discussions.unity.com/t/802897/2

“There are 10 types of people in this world: those who understand binary, and those who don’t.”

that was very helpful, i had not found this channel before and i understand whats up now, thank you