body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  background-color: #1b1b1f;
  color: white;
}

.gallery {
  --size: 100px;
  display: grid;
  grid-template-columns: repeat(8, var(--size));
  grid-auto-rows: var(--size);
  margin-bottom: var(--size);
  place-items: start center;
  gap: 5px;
  
  &:has(:hover) img:not(:hover),
  &:has(:focus) img:not(:focus){
    filter: brightness(0.5) contrast(0.5);
  }

  & img {
    object-fit: cover;
    width: calc(var(--size) * 2);
    height: calc(var(--size) * 2);
    clip-path: path("M90,10 C100,0 100,0 110,10 190,90 190,90 190,90 200,100 200,100 190,110 190,110 110,190 110,190 100,200 100,200 90,190 90,190 10,110 10,110 0,100 0,100 10,90Z");
    transition: clip-path 0.25s, filter 0.75s;
    grid-column: auto / span 2;
    border-radius: 5px;

    &:nth-child(7n - 2) { 
      grid-column: 2 / span 2 
    }

    &:hover,
    &:focus {
      clip-path: path("M0,0 C0,0 200,0 200,0 200,0 200,100 200,100 200,100 200,200 200,200 200,200 100,200 100,200 100,200 100,200 0,200 0,200 0,100 0,100 0,100 0,100 0,100Z");
      z-index: 1;
      transition: clip-path 0.25s, filter 0.25s;
    }
    
    &:focus {
      outline: 1px dashed black;
      outline-offset: -5px;
    }
  }
}

/* Pagination controls styling */

#pagination-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 10px 0;
  gap: 10px;
}

#pagination-controls button {
  padding: 5px 10px;
  font-size: 1em;
  cursor: pointer;
}

#page-info {
  padding-left: 15px;
  padding-right: 15px;
  font-size: 1em;
}

/* Fullscreen overlay */

#fullscreen-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease;
}

#fullscreen-overlay.show {
  opacity: 1;
  visibility: visible;
}

#fullscreen-img {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
}

/* Navigation buttons */

#close-btn {
  position: absolute;
  top: 20px;
  right: 30px;
  font-size: 2em;
  color: white;
  cursor: pointer;
}

.nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: white;
  font-size: 2em;
  cursor: pointer;
  padding: 0 10px;
  z-index: 10000;
}

#prev-btn {
  left: 20px;
}

#next-btn {
  right: 20px;
}

