responsive image with mouse parallax

i have coded in, 3 layers of image with a mouse parallax effect, on full screen the image seems fine, but if i resize the window everything would crumble appart.

`


<!DOCTYPE html>

<html>
  <head>
    <link rel="stylesheet" href="css.css"/>
    <title>Document</title>
  </head>
  <body>
    <section id="main">
      <img src="canyon 3.png"  class="layer" id="c3" value="5" />
      <img src="canyon 2.png" class="layer" id="c2" value="10" />
      <h1 class="text" >bla bla bla bla bla bla bla</h1>
      <img src="canyon 1.png" class="layer" id="c1" value="20" />
    </section>
    <script src="js.js"></script>
  </body>
</html>

section{
  width: 100%;
  height:100vh;
  position: relative;
  justify-content: center;
  align-items: center;
  display: flex;
}

section img{
  position: absolute;
  width:100%;
  height:100%;
  object-fit:cover;
}


#c1{
  position: absolute;
  width:140%;
  height:max-content;
  z-index:4;
}

#c2{
  position: absolute;
  left:100px;
  width:100%;
  height:max-content;

  z-index: 2;
}

#c3{
  position: absolute;
  height:max-content;
  z-index: 1;
}

`
i dont really know anything that i ca do to make it responsive.