

main {
  width: 90vw;
  /* display the anchor links in a grid */
  display: grid;
  grid-template-columns: repeat(auto-fit, 185px);
  grid-auto-rows: 185px;
  /* center the content horizontally & vertically */
  justify-content: center;
  align-content: center;
  grid-auto-flow: dense;

}
/* remove overflow to give the impression of a zoom when scaling the image up */
main a {
  overflow: hidden;
}
/* update the size of a few selected cells */
main a:nth-of-type(2) {
  grid-column: span 2;
}
main a:nth-of-type(5) {
  grid-column: span 2;
  grid-row: span 2;
}
main a:nth-of-type(7) {
  grid-row: span 2;
}
/* the default overflow is substituted by the scale/brightness of the nested images */
main a:focus {
  outline: none;
}
main img {
  object-fit: cover;
  display: block;
  width: 100%;
  height: 100%;
  /* transition the scale and brightness of the image when hover/focus-ing on the anchor link */
  filter: brightness(0.6);
  transition: all 0.3s cubic-bezier(0.445, 0.05, 0.55, 0.95);
  transform: scale(1);
}
main a:focus img,
main a:hover img {
  transform: scale(1.1);
  filter: brightness(1);
}

/* stretch the overlay to cover the available viewport */
#divc {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  /* center te image horizontally & vertically */
  display: flex;
  justify-content: center;
  align-items: center;
  background: hsla(0, 0%, 0%, 0.6);
  backdrop-filter: blur(5px);
  /* transition the opacity and visibility when the class of .overlay is added on the #divc container */
  transition: all 0.5s ease-in-out;
  opacity: 0;
  visibility: hidden;
}
/* slight delay as the class is added and the overlay is meant to be shown */
#divc.overlay {
  transition-delay: 0.2s;
  opacity: 1;
  visibility: visible;
}
/* size the image according to both the width and height of the viewport */
#divc img {
  height: 90vh;
  width: 85vw;
  max-width: 700px;
  object-fit: contain;
}
/* absolute position the button in the top right corner of the overlay */
#divc button {
  color: #fff;
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 3rem;
  height: 3rem;
  background: none;
  border: none;
  padding: 0.25rem;
  outline-color: currentColor;
  /* transition the opacity on hover/focus */
  opacity: 0.5;
  transition: all 0.3s cubic-bezier(0.445, 0.05, 0.55, 0.95);
}
#divc button:hover,
#divc button:focus {
  opacity: 1;
}
#divc button svg {
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}