.gallery {
    --n: 1; /* number of rows*/
    --m: 5; /* number of columns */
    --g: 0px;  /* control the gap */
    --f: .8;   /* control the scale factor */
    
    display: grid;
    gap: var(--g);
    width: 84.5vw;
    height: 84.5vh;
    grid-template-columns: repeat(var(--m),auto);
  }
  
  .gallery > img {
    width: 0;
    height: 0;
    min-height: 100%;
    min-width: 100%;
    object-fit: cover;
    cursor: pointer;
    filter: grayscale(80%);
    transition: .35s linear;
  }
  
  .gallery img:hover{
    filter: grayscale(0);
    width:  calc(100vh*var(--f)/var(--n));
    height: calc(100vw*var(--f)/var(--m));
  }