GeoNodes UV Counterscaling for Recursive Subdivided faces

Good insert time of the day everyone.

I have no idea what im doing. Please bare with me.

I have, for the past few weeks, been trying to figure out a way to make my UVs detect the length of both horizontal and vertical edges of a quad face and use this as a counterscale, and as a scale ratio for the UV of said faces.

Here is the look with annotations for better understanding

This is “result” i would like to get:
Texture is consistently 1:1 using the side lengths as source for scaling (as in uniform) for both a and b, as to avoid distortion on either direction from the same face being resized (basicaly a counter scale depending on what size is being distorted)

Main objective would be so that each face resizes the UV so that the accordion is both 1:1 in aspect ratio, but also uniformly scaled to the size of the face as to avoid it being too big and getting out of the face itself.

Extra information:
The whole base for the GeoNode setup is based on this video (the guy is awesome)
“Procedural Nodes (part 1) - Using simple math to create shapes in Blender”
Everything different from the vide is me quite literally fooling arround trying to figure out this very issue.

Any clarifications will be answered promptly. Can’t share the proyect (new user) but here are a few screenshots of the geonode setup