/**
 *
 * CSS file to handle image positioning and processing
 *
 * This file is written by Yaya MNH48 and licensed under MIT
 *
 */

/* Handle image resizing */
img.resize {
  float: left;
  max-width:50%;
  max-height:50%;
}

/* Make it possible to align image to right */
img[alt$='>'] {
  float:right;
  padding: 1em;
}

/* Make it possible to align image to left */
img[alt$='<'] {
  float:left;
  padding: 1em;
}

/* Make it possible to align image to center */
img[alt$='><'] {
  display: block;
  max-width: 100%;
  padding: 1em;
  height: auto;
  margin: auto;
  float: none!important;
}

/* Styling for the image gallery grid */
.imagegallery {
  display: grid;
  grid-gap: 0.5em;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: 6vh auto;
  margin: 1em;
  max-width: 100%;
  width: 800px;
  align-items: start;
  justify-items: center;
  align-content: start;
}

.imagegallery h4 {
  font-size: 30px;
  grid-column: 1/4;
  line-height: 1em;
}

.imagegallery a {
  cursor: zoom-in;
  transition: filter 0.2s ease-in-out;
  text-decoration: none;
}

.imagegallery a:hover {
  filter: brightness(90%);
}

.imagegallery .item strong {
  display: block;
  font-size: 1.5em;
  text-align: center;
}

/* Styling of the thumb image for the gallery */
.imageitem img {
  width: 290px;
  aspect-ratio: 3/2;
  object-fit: cover;
}

/* Styling for the image lightbox for the gallery */
.imagelightbox {
  background: rgba(0, 0, 0, 0.8);
  display: none;
  position: fixed;
  z-index: 1000;
}

.imagelightbox:target {
  align-items: center;
  display: flex;
  justify-content: center;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
}

.imagelightbox img {
  border-radius: 1em;
  display: block;
  margin: auto;
  max-height: 90vh;
  max-width: 90vw;
}

.imagelightbox .close {
  color: #fff;
  font-size: 4em;
  height: 1em;
  position: fixed;
  right: 0;
  top: 0;
  width: 1em;
  z-index: 1001;
}

.imagelightbox p {
  font-size: 1.5em;
  text-align: center;
  margin-block-start: 0.5em;
  margin-block-end: 0.5em;
}

/* Override for Jawi Malay */
.imagelightbox:lang(ms-Arab) .close {
  right: initial;
  left: 0;
}

/* Override for Beringin Malay */
.imagegallery:lang(ms-Brgn) {
  max-width: initial;
  width: initial;
  max-height: 100%;
  height: 800px;
}

.imageitem:lang(ms-Brgn) img {
  width: initial;
  height:  290px;
  aspect-ratio: 2/3;
}
