@import url("standard.css");

#gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(275px, 1fr));
  grid-template-rows: auto;
  gap: 1.5rem;
}

.image_container {
  display: flex;
  flex-direction: column;
}

#gallery img {
  height: 300px;
  width: 100%;
  object-fit: cover;
  object-position: top;
  border-radius: 2px;
  margin-bottom: 0.5rem;
  pointer-events: none;
}

#gallery figcaption {
  color: var(--white);
  padding: 0.5rem;
  border-radius: 2px;
  background-color: var(--text-bg);
}

/* DESKTOP MODAL */
#modal {
  position: fixed;
  opacity: 0;
  height: 100vh;
  width: 100vw;
  top: 0;
  left: 0;
  background-color: #000000ee;
  z-index: -1;
  display: grid;
  grid-template-rows: auto 1fr;
  transition: opacity 0.2s ease-in-out;
}

#modal.active {
  opacity: 1;
  z-index: 2;
}

/* Close button */
#modal #button_container {
  display: flex;
  justify-content: flex-end;
}

#modal svg {
  color: var(--white);
  justify-self: end;
  margin: 1rem 1rem 0 0;
  font-size: 2rem;
}

/* Modal image */
#modal figure {
  place-self: center;
}

#modal img {
  max-height: 70vh;
  max-width: 80vw;
}

#modal figure figcaption {
  margin-top: 1rem;
  text-align: center;
  font-size: 1.2rem;
}

/* MEDIA QUERIES */
/* TABLET */
@media screen and (min-width: 600px) {
  main {
    padding: 7rem 1rem;
  }

  .image_container figcaption {
    flex: 1;
  }
}

/* DESKTOP */

@media screen and (min-width: 1024px) {
  body {
    background-size: cover;
  }

  main {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  #gallery {
    max-width: 1040px;
  }

  .image_container {
    display: grid;
  }

  #gallery img {
    pointer-events: all;
    cursor: pointer;
  }

  .image_container picture,
  .image_container figcaption {
    grid-column: 1 / -1;
    grid-row: 1 / -1;
  }

  .image_container img {
    margin-bottom: 0 !important;
  }

  .image_container figcaption {
    align-self: self-end;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
  }

  .image_container:hover figcaption {
    align-self: self-end;
    opacity: 1;
  }
}
