.galleries {
  margin-top: 4rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

header {
  margin: 2rem;
}

.galleries h3 {
  margin: 2rem 0;
}

/* First Gallery */
.firstGallery {
  width: 100vw;
  height: 90vh;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 0.2rem;
  position: relative;
  margin-bottom: 4rem;
}

.overlay {
  position: absolute;
  z-index: 2;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: hsla(5, 99%, 51%, 0.103);
  pointer-events: none;
}

.image {
  padding: 0;
  margin: 0;
  position: relative;
  background-size: cover;
  background-position: center;
  filter: grayscale(100%);
  transition: var(--transition);
}

.image:hover {
  cursor: pointer;
  filter: grayscale(0);
}

.vertical {
  grid-row: span 2;
}

.horizontal {
  grid-column: span 2;
}

.one {
  background-image: url(./GalleriesImg/First\ Gallery/1.jpg);
}

.two {
  background-image: url(./GalleriesImg/First\ Gallery/2.jpg);
}

.three {
  background-image: url(./GalleriesImg/First\ Gallery/3.jpg);
}

.four {
  background-image: url(./GalleriesImg/First\ Gallery/4.jpg);
}

.five {
  background-image: url(./GalleriesImg/First\ Gallery/5.jpg);
}

.six {
  background-image: url(./GalleriesImg/First\ Gallery/6.jpg);
}

/* First Slider */
.firstSlider {
  overflow: hidden;
  margin-bottom: 4rem;
}

.firstSlider .slider {
  height: 20vh;
  position: relative;
  width: 500%;
  overflow: hidden;
  left: 0;
  animation: firstSlider 25s infinite alternate ease-in-out;
}

@keyframes firstSlider {
  0% {
    left: 0%;
    filter: grayscale(100%) blur(5px);
  }
  10% {
    left: 0%;
    filter: grayscale(0%);
  }
  20% {
    left: -100%;
    filter: grayscale(100%) blur(5px);
  }
  30% {
    left: -100%;
    filter: grayscale(0%);
  }
  45% {
    left: -200%;
    filter: grayscale(100%) blur(5px);
  }
  55% {
    left: -200%;
    filter: grayscale(0%);
  }
  70% {
    left: -300%;
    filter: grayscale(100%) blur(5px);
  }
  80% {
    left: -300%;
    filter: grayscale(0%);
  }
  90% {
    left: -400%;
    filter: grayscale(100%) blur(5px);
  }
  100% {
    left: -400%;
    filter: grayscale(0%);
  }
}

.firstSlider .sliderImg {
  width: 20%;
  float: left;
  height: 100%;
  background-position: 50% 50%;
  background-size: cover;
}

/* Flexbox Gallery */
.flexGallery ul {
  display: flex;
  flex-wrap: wrap;
}

.flexGallery li {
  height: 40vh;
  flex-grow: 1;
}

.flexGallery li:last-child {
  flex-grow: 10;
}

.flexGallery img {
  max-height: 100%;
  max-width: 100%;
  object-fit: cover;
  vertical-align: bottom;
  width: fit-content;
}

@media only screen and (max-width: 900px) {
  /* First Slider */
  .firstSlider .slider {
    height: 50vh;
  }
}

@media only screen and (max-width: 700px) {
  /* First Gallery */
  .firstGallery {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(4, 1fr);
  }

  .horizontal {
    grid-column: auto / span 1;
  }
}

@media only screen and (max-width: 500px) {
  /* First Gallery */
  .firstGallery {
    grid-template-columns: repeat(1, 1fr);
    grid-template-rows: repeat(6, 1fr);
  }

  .vertical {
    grid-row: auto / span 1;
  }
}

/* Flexbox Gallery */
@media (max-aspect-ratio: 1/1) {
  li {
    height: 30vh;
  }
}

@media (max-height: 480px) {
  li {
    height: 80vh;
  }
}

@media (max-aspect-ratio: 1/1) and (max-width: 480px) {
  ul {
    flex-direction: row;
  }

  li {
    height: auto;
    width: 100%;
  }
  img {
    width: 100%;
    max-height: 75vh;
    min-width: 0;
  }
}
