Edit on
<!-- 
/*
Inspired by article from CSS-tricks:
https://css-tricks.com/direction-aware-hover-effects/
*/
-->
<section class="c-gallery js-gallery">
  <!--GALLERY ITEM-->
  <div class="c-gallery__item" tabindex="0">
    
    <!--HOVER PANELS-->
    <div class="o-hover-panel__item o-hover-panel__item--top" aria-hidden="true"></div>
    <div class="o-hover-panel__item o-hover-panel__item--right" aria-hidden="true"></div>
    <div class="o-hover-panel__item o-hover-panel__item--bottom" aria-hidden="true"></div>
    <div class="o-hover-panel__item o-hover-panel__item--left" aria-hidden="true"></div>

    <!--IMAGE-->
    <img src="https://farm5.staticflickr.com/4566/38440710721_5c510dfd77_o.jpg" class="c-gallery__image" width="350" height="350" alt="The-Beatles-Abbey-Road-album-covers-1000x1000" />  
    
    <!--REVEAL OVERLAYS-->
    <div class="c-gallery__reveal-overlay c-gallery__reveal-overlay--swing-top">
           <h3 class="c-gallery__reveal-title">Lorem ipsum</h3>
           <p class="c-gallery__reveal-text">
             Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore eritatis et quasi.
           </p>
      </div>
    <div class="c-gallery__reveal-overlay c-gallery__reveal-overlay--swing-right">
           <h3 class="c-gallery__reveal-title">Lorem ipsum</h3>
           <p class="c-gallery__reveal-text">
             Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore eritatis et quasi.
           </p>
      </div>
    <div class="c-gallery__reveal-overlay c-gallery__reveal-overlay--swing-bottom">
           <h3 class="c-gallery__reveal-title">Lorem ipsum</h3>
           <p class="c-gallery__reveal-text">
             Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore eritatis et quasi.
           </p>
      </div>
    <div class="c-gallery__reveal-overlay c-gallery__reveal-overlay--swing-left">
           <h3 class="c-gallery__reveal-title" tabindex="0">Lorem ipsum</h3>
           <p class="c-gallery__reveal-text" tabindex="0">
             Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore eritatis et quasi.
           </p>
      </div>

  </div>
  
    <!--GALLERY ITEM-->
  <div class="c-gallery__item" tabindex="0">
    
    <!--HOVER PANELS-->
    <div class="o-hover-panel__item o-hover-panel__item--top" aria-hidden="true"></div>
    <div class="o-hover-panel__item o-hover-panel__item--right" aria-hidden="true"></div>
    <div class="o-hover-panel__item o-hover-panel__item--bottom" aria-hidden="true"></div>
    <div class="o-hover-panel__item o-hover-panel__item--left" aria-hidden="true"></div>

    <!--IMAGE-->
    <img src="https://farm5.staticflickr.com/4566/38440710721_5c510dfd77_o.jpg" class="c-gallery__image" width="350" height="350" alt="The-Beatles-Abbey-Road-album-covers-1000x1000" />  
    
    <!--REVEAL OVERLAYS-->
    <div class="c-gallery__reveal-overlay c-gallery__reveal-overlay--swing-top">
           <h3 class="c-gallery__reveal-title">Lorem ipsum</h3>
           <p class="c-gallery__reveal-text">
             Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore eritatis et quasi.
           </p>
      </div>
    <div class="c-gallery__reveal-overlay c-gallery__reveal-overlay--swing-right">
           <h3 class="c-gallery__reveal-title">Lorem ipsum</h3>
           <p class="c-gallery__reveal-text">
             Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore eritatis et quasi.
           </p>
      </div>
    <div class="c-gallery__reveal-overlay c-gallery__reveal-overlay--swing-bottom">
           <h3 class="c-gallery__reveal-title">Lorem ipsum</h3>
           <p class="c-gallery__reveal-text">
             Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore eritatis et quasi.
           </p>
      </div>
    <div class="c-gallery__reveal-overlay c-gallery__reveal-overlay--swing-left">
           <h3 class="c-gallery__reveal-title">Lorem ipsum</h3>
           <p class="c-gallery__reveal-text">
             Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore eritatis et quasi.
           </p>
      </div>

  </div>
  
    <!--GALLERY ITEM-->
  <div class="c-gallery__item" tabindex="0">
    
    <!--HOVER PANELS-->
    <div class="o-hover-panel__item o-hover-panel__item--top" aria-hidden="true"></div>
    <div class="o-hover-panel__item o-hover-panel__item--right" aria-hidden="true"></div>
    <div class="o-hover-panel__item o-hover-panel__item--bottom" aria-hidden="true"></div>
    <div class="o-hover-panel__item o-hover-panel__item--left" aria-hidden="true"></div>

    <!--IMAGE-->
    <img src="https://farm5.staticflickr.com/4566/38440710721_5c510dfd77_o.jpg" class="c-gallery__image" width="350" height="350" alt="The-Beatles-Abbey-Road-album-covers-1000x1000" />  
    
    <!--REVEAL OVERLAYS-->
    <div class="c-gallery__reveal-overlay c-gallery__reveal-overlay--swing-top">
           <h3 class="c-gallery__reveal-title">Lorem ipsum</h3>
           <p class="c-gallery__reveal-text">
             Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore eritatis et quasi.
           </p>
      </div>
    <div class="c-gallery__reveal-overlay c-gallery__reveal-overlay--swing-right">
           <h3 class="c-gallery__reveal-title">Lorem ipsum</h3>
           <p class="c-gallery__reveal-text">
             Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore eritatis et quasi.
           </p>
      </div>
    <div class="c-gallery__reveal-overlay c-gallery__reveal-overlay--swing-bottom">
           <h3 class="c-gallery__reveal-title">Lorem ipsum</h3>
           <p class="c-gallery__reveal-text">
             Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore eritatis et quasi.
           </p>
      </div>
    <div class="c-gallery__reveal-overlay c-gallery__reveal-overlay--swing-left">
           <h3 class="c-gallery__reveal-title">Lorem ipsum</h3>
           <p class="c-gallery__reveal-text">
             Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore eritatis et quasi.
           </p>
      </div>

  </div>
  
    <!--GALLERY ITEM-->
  <div class="c-gallery__item" tabindex="0">
    
    <!--HOVER PANELS-->
    <div class="o-hover-panel__item o-hover-panel__item--top" aria-hidden="true"></div>
    <div class="o-hover-panel__item o-hover-panel__item--right" aria-hidden="true"></div>
    <div class="o-hover-panel__item o-hover-panel__item--bottom" aria-hidden="true"></div>
    <div class="o-hover-panel__item o-hover-panel__item--left" aria-hidden="true"></div>

    <!--IMAGE-->
    <img src="https://farm5.staticflickr.com/4566/38440710721_5c510dfd77_o.jpg" class="c-gallery__image" width="350" height="350" alt="The-Beatles-Abbey-Road-album-covers-1000x1000" />  
    
    <!--REVEAL OVERLAYS-->
    <div class="c-gallery__reveal-overlay c-gallery__reveal-overlay--swing-top">
           <h3 class="c-gallery__reveal-title">Lorem ipsum</h3>
           <p class="c-gallery__reveal-text">
             Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore eritatis et quasi.
           </p>
      </div>
    <div class="c-gallery__reveal-overlay c-gallery__reveal-overlay--swing-right">
           <h3 class="c-gallery__reveal-title">Lorem ipsum</h3>
           <p class="c-gallery__reveal-text">
             Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore eritatis et quasi.
           </p>
      </div>
    <div class="c-gallery__reveal-overlay c-gallery__reveal-overlay--swing-bottom">
           <h3 class="c-gallery__reveal-title">Lorem ipsum</h3>
           <p class="c-gallery__reveal-text">
             Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore eritatis et quasi.
           </p>
      </div>
    <div class="c-gallery__reveal-overlay c-gallery__reveal-overlay--swing-left">
           <h3 class="c-gallery__reveal-title">Lorem ipsum</h3>
           <p class="c-gallery__reveal-text">
             Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore eritatis et quasi.
           </p>
      </div>

  </div>
  
    <!--GALLERY ITEM-->
  <div class="c-gallery__item" tabindex="0">
    
    <!--HOVER PANELS-->
    <div class="o-hover-panel__item o-hover-panel__item--top" aria-hidden="true"></div>
    <div class="o-hover-panel__item o-hover-panel__item--right" aria-hidden="true"></div>
    <div class="o-hover-panel__item o-hover-panel__item--bottom" aria-hidden="true"></div>
    <div class="o-hover-panel__item o-hover-panel__item--left" aria-hidden="true"></div>

    <!--IMAGE-->
    <img src="https://farm5.staticflickr.com/4566/38440710721_5c510dfd77_o.jpg" class="c-gallery__image" width="350" height="350" alt="The-Beatles-Abbey-Road-album-covers-1000x1000" />  
    
    <!--REVEAL OVERLAYS-->
    <div class="c-gallery__reveal-overlay c-gallery__reveal-overlay--swing-top">
           <h3 class="c-gallery__reveal-title">Lorem ipsum</h3>
           <p class="c-gallery__reveal-text">
             Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore eritatis et quasi.
           </p>
      </div>
    <div class="c-gallery__reveal-overlay c-gallery__reveal-overlay--swing-right">
           <h3 class="c-gallery__reveal-title">Lorem ipsum</h3>
           <p class="c-gallery__reveal-text">
             Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore eritatis et quasi.
           </p>
      </div>
    <div class="c-gallery__reveal-overlay c-gallery__reveal-overlay--swing-bottom">
           <h3 class="c-gallery__reveal-title">Lorem ipsum</h3>
           <p class="c-gallery__reveal-text">
             Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore eritatis et quasi.
           </p>
      </div>
    <div class="c-gallery__reveal-overlay c-gallery__reveal-overlay--swing-left">
           <h3 class="c-gallery__reveal-title">Lorem ipsum</h3>
           <p class="c-gallery__reveal-text">
             Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore eritatis et quasi.
           </p>
      </div>

  </div>
  
    <!--GALLERY ITEM-->
  <div class="c-gallery__item" tabindex="0">
    
    <!--HOVER PANELS-->
    <div class="o-hover-panel__item o-hover-panel__item--top" aria-hidden="true"></div>
    <div class="o-hover-panel__item o-hover-panel__item--right" aria-hidden="true"></div>
    <div class="o-hover-panel__item o-hover-panel__item--bottom" aria-hidden="true"></div>
    <div class="o-hover-panel__item o-hover-panel__item--left" aria-hidden="true"></div>

    <!--IMAGE-->
    <img src="https://farm5.staticflickr.com/4566/38440710721_5c510dfd77_o.jpg" class="c-gallery__image" width="350" height="350" alt="The-Beatles-Abbey-Road-album-covers-1000x1000" />  
    
    <!--REVEAL OVERLAYS-->
    <div class="c-gallery__reveal-overlay c-gallery__reveal-overlay--swing-top">
           <h3 class="c-gallery__reveal-title">Lorem ipsum</h3>
           <p class="c-gallery__reveal-text">
             Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore eritatis et quasi.
           </p>
      </div>
    <div class="c-gallery__reveal-overlay c-gallery__reveal-overlay--swing-right">
           <h3 class="c-gallery__reveal-title">Lorem ipsum</h3>
           <p class="c-gallery__reveal-text">
             Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore eritatis et quasi.
           </p>
      </div>
    <div class="c-gallery__reveal-overlay c-gallery__reveal-overlay--swing-bottom">
           <h3 class="c-gallery__reveal-title">Lorem ipsum</h3>
           <p class="c-gallery__reveal-text">
             Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore eritatis et quasi.
           </p>
      </div>
    <div class="c-gallery__reveal-overlay c-gallery__reveal-overlay--swing-left">
           <h3 class="c-gallery__reveal-title">Lorem ipsum</h3>
           <p class="c-gallery__reveal-text">
             Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore eritatis et quasi.
           </p>
      </div>

  </div>
  
    <!--GALLERY ITEM-->
  <div class="c-gallery__item" tabindex="0">
    
    <!--HOVER PANELS-->
    <div class="o-hover-panel__item o-hover-panel__item--top" aria-hidden="true"></div>
    <div class="o-hover-panel__item o-hover-panel__item--right" aria-hidden="true"></div>
    <div class="o-hover-panel__item o-hover-panel__item--bottom" aria-hidden="true"></div>
    <div class="o-hover-panel__item o-hover-panel__item--left" aria-hidden="true"></div>

    <!--IMAGE-->
    <img src="https://farm5.staticflickr.com/4566/38440710721_5c510dfd77_o.jpg" class="c-gallery__image" width="350" height="350" alt="The-Beatles-Abbey-Road-album-covers-1000x1000" />  
    
    <!--REVEAL OVERLAYS-->
    <div class="c-gallery__reveal-overlay c-gallery__reveal-overlay--swing-top">
           <h3 class="c-gallery__reveal-title">Lorem ipsum</h3>
           <p class="c-gallery__reveal-text">
             Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore eritatis et quasi.
           </p>
      </div>
    <div class="c-gallery__reveal-overlay c-gallery__reveal-overlay--swing-right">
           <h3 class="c-gallery__reveal-title">Lorem ipsum</h3>
           <p class="c-gallery__reveal-text">
             Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore eritatis et quasi.
           </p>
      </div>
    <div class="c-gallery__reveal-overlay c-gallery__reveal-overlay--swing-bottom">
           <h3 class="c-gallery__reveal-title">Lorem ipsum</h3>
           <p class="c-gallery__reveal-text">
             Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore eritatis et quasi.
           </p>
      </div>
    <div class="c-gallery__reveal-overlay c-gallery__reveal-overlay--swing-left">
           <h3 class="c-gallery__reveal-title">Lorem ipsum</h3>
           <p class="c-gallery__reveal-text">
             Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore eritatis et quasi.
           </p>
      </div>

  </div>
  
    <!--GALLERY ITEM-->
  <div class="c-gallery__item" tabindex="0">
    
    <!--HOVER PANELS-->
    <div class="o-hover-panel__item o-hover-panel__item--top" aria-hidden="true"></div>
    <div class="o-hover-panel__item o-hover-panel__item--right" aria-hidden="true"></div>
    <div class="o-hover-panel__item o-hover-panel__item--bottom" aria-hidden="true"></div>
    <div class="o-hover-panel__item o-hover-panel__item--left" aria-hidden="true"></div>

    <!--IMAGE-->
    <img src="https://farm5.staticflickr.com/4566/38440710721_5c510dfd77_o.jpg" class="c-gallery__image" width="350" height="350" alt="The-Beatles-Abbey-Road-album-covers-1000x1000" />  
    
    <!--REVEAL OVERLAYS-->
    <div class="c-gallery__reveal-overlay c-gallery__reveal-overlay--swing-top">
           <h3 class="c-gallery__reveal-title">Lorem ipsum</h3>
           <p class="c-gallery__reveal-text">
             Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore eritatis et quasi.
           </p>
      </div>
    <div class="c-gallery__reveal-overlay c-gallery__reveal-overlay--swing-right">
           <h3 class="c-gallery__reveal-title">Lorem ipsum</h3>
           <p class="c-gallery__reveal-text">
             Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore eritatis et quasi.
           </p>
      </div>
    <div class="c-gallery__reveal-overlay c-gallery__reveal-overlay--swing-bottom">
           <h3 class="c-gallery__reveal-title">Lorem ipsum</h3>
           <p class="c-gallery__reveal-text">
             Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore eritatis et quasi.
           </p>
      </div>
    <div class="c-gallery__reveal-overlay c-gallery__reveal-overlay--swing-left">
           <h3 class="c-gallery__reveal-title">Lorem ipsum</h3>
           <p class="c-gallery__reveal-text">
             Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore eritatis et quasi.
           </p>
      </div>

  </div>
  
    <!--GALLERY ITEM-->
  <div class="c-gallery__item" tabindex="0">
    
    <!--HOVER PANELS-->
    <div class="o-hover-panel__item o-hover-panel__item--top" aria-hidden="true"></div>
    <div class="o-hover-panel__item o-hover-panel__item--right" aria-hidden="true"></div>
    <div class="o-hover-panel__item o-hover-panel__item--bottom" aria-hidden="true"></div>
    <div class="o-hover-panel__item o-hover-panel__item--left" aria-hidden="true"></div>

    <!--IMAGE-->
    <img src="https://farm5.staticflickr.com/4566/38440710721_5c510dfd77_o.jpg" class="c-gallery__image" width="350" height="350" alt="The-Beatles-Abbey-Road-album-covers-1000x1000" />  
    
    <!--REVEAL OVERLAYS-->
    <div class="c-gallery__reveal-overlay c-gallery__reveal-overlay--swing-top">
           <h3 class="c-gallery__reveal-title">Lorem ipsum</h3>
           <p class="c-gallery__reveal-text">
             Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore eritatis et quasi.
           </p>
      </div>
    <div class="c-gallery__reveal-overlay c-gallery__reveal-overlay--swing-right">
           <h3 class="c-gallery__reveal-title">Lorem ipsum</h3>
           <p class="c-gallery__reveal-text">
             Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore eritatis et quasi.
           </p>
      </div>
    <div class="c-gallery__reveal-overlay c-gallery__reveal-overlay--swing-bottom">
           <h3 class="c-gallery__reveal-title">Lorem ipsum</h3>
           <p class="c-gallery__reveal-text">
             Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore eritatis et quasi.
           </p>
      </div>
    <div class="c-gallery__reveal-overlay c-gallery__reveal-overlay--swing-left">
           <h3 class="c-gallery__reveal-title">Lorem ipsum</h3>
           <p class="c-gallery__reveal-text">
             Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore eritatis et quasi.
           </p>
      </div>

  </div>
</section>
HTML {
  /*using system font-stack*/
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  font-size: 115%; /*~18px*/
  /*using fluid typography (https://goo.gl/o9sRyq)*/
  font-size: calc(16px + (20 - 16) * (100vw - 300px) / (1300 - 300) );
  line-height: 1.5;
  box-sizing: border-box;
}

BODY {
  color: #3a3d40;
  margin: 0;
}

*, *::before, *::after {
  box-sizing: inherit;
  color: inherit;
}

/*Actual Style*/

/*==================
     Gallery
====================*/
.c-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17.5rem, 1fr));
  grid-row-gap: 0.5rem;
  justify-items: center;
  padding: 1rem;
  border: 1px solid;
}

/*==================
   Gallery Item
====================*/
.c-gallery__item {
  position: relative;
   width: 17.5rem; /*350px*/
   height: 17.5rem;/*350px*/
  overflow: hidden;
  -webkit-perspective: 1200px;
  perspective: 1200px;
/*   border: 5px solid green; */
}

.c-gallery__item:focus {      
  border: 1px solid rgb(166, 200, 255);
}

.c-gallery__item:focus-within {
  border: 1px solid rgb(166, 200, 255);
}

/*==================
  Hover Panel Item
====================*/
.o-hover-panel__item {
  position: absolute;
  width: 70.71%;
  height: 70.71%;
  transform: rotate(45deg);
  z-index: 1;
/*   border: 3px dotted green; */
}

.o-hover-panel__item:hover {
  left: 0; top:0;
  width: 100%; height: 100%;
  transform: none;
  z-index: 2;
}

/*Hover Panel TOP*/
/*---------------*/
.o-hover-panel__item--top {
  left: 15%; top: -35%; 
  border-color: blue;
}

/*Hover Panel RIGHT*/
/*---------------*/
.o-hover-panel__item--right {
   right: -35%; top: 15%; 
   border-color: yellow;
}

/*Hover Panel BOTTOM*/
/*---------------*/
.o-hover-panel__item--bottom {
   left: 15%; bottom: -35%; 
   border-color: cyan;
}

/*Hover Panel LEFT*/
/*---------------*/
.o-hover-panel__item--left {
   left: -35%; top: 15%; 
   border-color: red;
}

/*==================
   Gallery Image
====================*/
.c-gallery__image {
  width: 100%;
  height: 100%;
}

/*==================
   Reveal Overlay
====================*/
.c-gallery__reveal-overlay {
  position: absolute;
  left: 0; top: 0;
  width: 100%; height: 100%;
  padding: 1rem;
  background: rgba(0, 0, 0, .8);
  color: #f1f1f1;
/*   border: 1px groove; */
  transition: transform .3s ease-out;
}

.o-hover-panel__item:hover ~ .c-gallery__reveal-overlay,
.c-gallery__reveal-overlay:hover {
  z-index: 3;
}

/*==================
 Revealing Effects
====================*/

/*Default TOP Revealing*/
/*---------------------*/
.c-gallery__reveal-overlay--top {
  transform: translateY(-100%);
}

.o-hover-panel__item--top:hover ~ .c-gallery__reveal-overlay--top,
.c-gallery__reveal-overlay--top:hover {
   transform: translateY(0%);
}

/*Swing TOP Revealing*/
/*---------------------*/
.c-gallery__reveal-overlay--swing-top {
  perspective-origin: center top;
  transform-origin: 50% 0;
  transform: rotate3d(-1, 0, 0, 120deg);
}

.o-hover-panel__item--top:hover ~ .c-gallery__reveal-overlay--swing-top,
.c-gallery__reveal-overlay--swing-top:hover {
   transform: rotate3d(1, 0, 0, 0deg);
}

/*Default RIGHT Revealing*/
/*---------------------*/
.c-gallery__reveal-overlay--right {
  transform: translateX(100%);
}

.o-hover-panel__item--right:hover ~ .c-gallery__reveal-overlay--right,
.c-gallery__reveal-overlay--right:hover {
  transform: translateX(0%);
}

/*Swing RIGHT Revealing*/
/*---------------------*/
.c-gallery__reveal-overlay--swing-right {
  perspective-origin: center top;
  transform-origin: 100% 50%;
  transform: rotate3d(0, 1, 0, -120deg);
}

.o-hover-panel__item--right:hover ~ .c-gallery__reveal-overlay--swing-right,
.c-gallery__reveal-overlay--swing-right:hover {
  transform: rotate3d(0, -1, 0, 0deg);
}

/*Default BOTTOM Revealing*/
/*---------------------*/
.c-gallery__reveal-overlay--bottom {
  transform: translateY(100%);
}

.o-hover-panel__item--bottom:hover ~ .c-gallery__reveal-overlay--bottom,
.c-gallery__reveal-overlay--bottom:hover {
  transform: translateY(0%);
}

/*Swing BOTTOM Revealing*/
/*---------------------*/
.c-gallery__reveal-overlay--swing-bottom {
  perspective-origin: center top;
  transform-origin: 50% 100%;
  transform: rotate3d(-1, 0, 0, -120deg);
}

.o-hover-panel__item--bottom:hover ~ .c-gallery__reveal-overlay--swing-bottom,
.c-gallery__reveal-overlay--swing-bottom:hover {
  transform: rotate3d(1, 0, 0, 0deg);
}

/*Default LEFT Revealing*/
/*---------------------*/
.c-gallery__reveal-overlay--left {
  transform: translateX(-100%);
}

.o-hover-panel__item--left:hover ~ .c-gallery__reveal-overlay--left,
.c-gallery__reveal-overlay--left:hover {
  transform: translateX(0%);
}

/*
NOTE: this will be applied only when parent (e.g. body/html)
has class that indicates that user is currently using keyboard
to tab over items without using mouse
*/
.is-using-keyboard .c-gallery__item:focus:not(:hover) .c-gallery__reveal-overlay--left {
  transform: translateX(0%);
}

/*
NOTE: here we are using new feature that has limited support
as of 02.2018 this pseudo class is supported in
	Chrome	Edge	Firefox	IE	Opera	Safari
  	60	   No	     52	  No  	47	 10.1
more info about :focus-within can be found in MDN:
https://developer.mozilla.org/en-US/docs/Web/CSS/:focus-within

In a nutshell, it represents an element that matched by the :focus pseudo-class 
or has a descendant that is matched by :focus.
*/
.is-using-keyboard .c-gallery__item:focus-within:not(:hover) .c-gallery__reveal-overlay--left {
  transform: translateX(0%);
}

/*Rotate LEFT Revealing*/
/*---------------------*/
.c-gallery__reveal-overlay--rotate-left {
  transform-origin: 0 0;
  transform: rotate(90deg);
}

.o-hover-panel__item--left:hover ~ .c-gallery__reveal-overlay--rotate-left,
.c-gallery__reveal-overlay--rotate-left:hover {
  transform: rotate(0deg);
}

/*
NOTE: this will be applied only when parent (e.g. body/html)
has class that indicates that user is currently using keyboard
to tab over items without using mouse
*/
.is-using-keyboard .c-gallery__item:focus:not(:hover) .c-gallery__reveal-overlay--rotate-left {
  transform: translateX(0%);
}

/*
NOTE: here we are using new feature that has limited support
as of 02.2018 this pseudo class is supported in
	Chrome	Edge	Firefox	IE	Opera	Safari
  	60	   No	     52	  No  	47	 10.1
more info about :focus-within can be found in MDN:
https://developer.mozilla.org/en-US/docs/Web/CSS/:focus-within

In a nutshell, it represents an element that matched by the :focus pseudo-class 
or has a descendant that is matched by :focus.
*/
.is-using-keyboard .c-gallery__item:focus-within:not(:hover) .c-gallery__reveal-overlay--rotate-left {
  transform: translateX(0%);
}

/*Swing LEFT Revealing*/
/*---------------------*/
.c-gallery__reveal-overlay--swing-left {
  perspective-origin: center top;
  transform-origin: 0% 50%;
  transform: rotate3d(0, -1, 0, -120deg);
}

.o-hover-panel__item--left:hover ~ .c-gallery__reveal-overlay--swing-left,
.c-gallery__reveal-overlay--swing-left:hover {
  transform: rotate3d(0, 1, 0, 0deg);
}

/*
NOTE: this will be applied only when parent (e.g. body/html)
has class that indicates that user is currently using keyboard
to tab over items without using mouse
*/
.is-using-keyboard .c-gallery__item:focus:not(:hover) .c-gallery__reveal-overlay--swing-left {
  transform: translateX(0%);
}

/*
NOTE: here we are using new feature that has limited support
as of 02.2018 this pseudo class is supported in
	Chrome	Edge	Firefox	IE	Opera	Safari
  	60	   No	     52	  No  	47	 10.1
more info about :focus-within can be found in MDN:
https://developer.mozilla.org/en-US/docs/Web/CSS/:focus-within

In a nutshell, it represents an element that matched by the :focus pseudo-class 
or has a descendant that is matched by :focus.
*/
.is-using-keyboard .c-gallery__item:focus-within:not(:hover) .c-gallery__reveal-overlay--swing-left {
  transform: translateX(0%);
}

/*==================
   Reveal Title
====================*/
.c-gallery__reveal-title {
    
}

/*==================
   Reveal Text
====================*/
.c-gallery__reveal-text {
  
}

.c-gallery__reveal-title:focus,
.c-gallery__reveal-text:focus {
  outline: 1px solid rgb(166, 200, 255);
}


/*=== @MEDIA ===*/

@media (pointer:fine) {
  /*==================
     Gallery Item
  ====================*/
/*   .c-gallery__item:focus:not(:hover) {
    border: 1px solid blue;
  } */
  
  /*==================
   Revealing Effects
  ====================*/
   /*Swing LEFT Revealing*/
  /*---------------------*/
/*   .c-gallery__item:focus:not(:hover) .c-gallery__reveal-overlay--swing-left {
    transform: translateX(0%);
  }
  
  .c-gallery__item:focus:not(:hover) .c-gallery__reveal-overlay--rotate-left {
    transform: translateX(0%);
  }
  
  .c-gallery__item:focus:not(:hover) .c-gallery__reveal-overlay--left {
    transform: translateX(0%);
  } */
  
}
/**
* Script for keyboard use detection,
* when user TABs over gallery, using Tab key, we detect it and add specific class to the body/html tag
* in order to denote it and use this in CSS, 
* once user moves mouse we remove this class
*/
;(function () {
  "use strict";
  
  const galleries = document.querySelectorAll(".js-gallery");
  
  const KEY = {
    "TAB": ["Tab", 9] // we cover 2 properties here (e.key & e.keyCode) for better compatibility
  };
  
  const KEYBOARD_USE_DETECTION_CLASS = "is-using-keyboard";
  
  /*============================
      ADDING EVENT LISTENERS
  ==============================*/  
  galleries.forEach(function (gallery) {
    gallery.addEventListener("keyup", galleryOnKeyUp);
  });
  
  document.addEventListener("mousemove", actThenThrottleEvents(galleryOnMouseMove, 200));
  
  /*============================
        EVENT LISTENERS
  ==============================*/
  /**
  * Fires when user is trying to use keyboard on the image gallery
  */
  function galleryOnKeyUp (e) {
    const pressedKey = e.key || e.keyCode;
    debugger;
    if(isValidKey(KEY.TAB, pressedKey)) {
      // set class on the body in order to denote that user is, currently, using keyboard
      document.body.classList.add(KEYBOARD_USE_DETECTION_CLASS);
    } 
  };
  
  /**
  * Fires when mouse is mover, i.e. user doesn't use keyboard anymore
  */
  function galleryOnMouseMove (e) {
    /// user using mouse, so remove this class from the body
     document.body.classList.remove(KEYBOARD_USE_DETECTION_CLASS);
  };
  
  
   /*======================
      Utility Functions
   ======================*/
  /*
  * Determines whether provided key code is located into key codes array.
  * @param {Array} keyCodes - Array of predefined, valid key codes to check against.
  * @param {String/Number} keyCode - Provided key code to check.
  * @return {Boolean} TRUE if provided key code has been found, otherwise returns FALSE
  */
  function isValidKey(keyCodes, keyCode) {
    let result = false;
    result = keyCodes.some(function(v) {
       return v === keyCode;
    });
    return result;
  };
  
   /**
   * Generates an event listener wrapper function
   * that will prevent the main listener from running
   * if it has previously run within the given delay (in ms).
   */
   function actThenThrottleEvents(listener, delay) {
     var timeout;
     return function(e) {
       if (!timeout) { // no timer running
         listener(e); // run the function
         timeout = setTimeout( function() { timeout = null }, 
           delay); // start a timer that turns itself off when it's done
       }  
       //else, do nothing (we're in a throttling stage)
     }
   };
  
})();
Rerun