/**
 * Gallery CSS
 *
 * This file contains the styles for the gallery page, including the layout of galleries,
 * images, and comments.
 * @project LFV Schutterwald e.V.
 * @version 2.0
 * @author Nico Wiedemann
 * @copyright 2025
 */

/* @section Gallery Teaser
 * The newest gallery in the sidebar: its picture above the title.
 */
.teaser.gallery a {
  display: block;
  padding: 10px;
}
.teaser.gallery a img {
  display: block;
  height: 150px;
  margin: 0 auto 0.4em;
  max-width: 100%;
  object-fit: contain;
  width: 100%;
}

/* @section Gallery List
 * One row per gallery: picture | title and details | arrow (on hover, wide screens only).
 */
.galleries {
  --gallery-image-size: 110px;

  display: flex;
  flex-direction: column;
  gap: 0.666em;
  list-style: none !important;
  margin-left: 0 !important;
}
li.gallery {
  border-radius: var(--border-radius-large);
  transition: var(--transition-default-delay);
}
li.gallery a {
  align-items: center;
  column-gap: 1.25rem;
  display: grid;
  grid-template-areas:
    "picture title arrow"
    "picture details arrow";
  grid-template-columns: var(--gallery-image-size) minmax(0, 1fr) 80px;
  grid-template-rows: auto auto;
  padding: 0.75rem 1rem;
  text-decoration: none;
}
li.gallery a img {
  grid-area: picture;
  height: var(--gallery-image-size);
  object-fit: contain;
  width: var(--gallery-image-size);
}
li.gallery a::after {
  align-self: stretch;
  background: url(assets/arrow-right.svg) center / 60% auto no-repeat;
  content: "";
  grid-area: arrow;
  opacity: 0;
  transition: var(--transition-fast-delay);
}
li.gallery:hover,
li.gallery:focus-within,
li.gallery:active {
  background-color: var(--color-yellow-transparent);
  transition: var(--transition-default);
}
li.gallery a:hover::after,
li.gallery a:focus::after,
li.gallery a:active::after {
  background-size: 100% auto;
  opacity: 1;
}
li.gallery .title {
  align-self: end;
  font-size: 1.1em;
  font-weight: bold;
  grid-area: title;
}
li.gallery .details {
  align-self: start;
  font-size: 0.8em;
  grid-area: details;
}

@media (max-width: 990px) {
  .galleries {
    --gallery-image-size: 72px;
  }
  li.gallery a {
    column-gap: 0.9rem;
    grid-template-columns: var(--gallery-image-size) minmax(0, 1fr);
    padding: 0.5rem 0.25rem;
  }
  li.gallery a::after {
    display: none;
  }
}

/* @section Gallery page
 * The pictures of a gallery as a grid of squares; a picture opens the lightbox.
 */
.images {
  --image-size: 150px;
  --image-gap: 0.25em;
  --image-padding: 5px;

  display: flex;
  flex-wrap: wrap;
  gap: var(--image-gap);
  justify-content: center;
}
.images .image {
  border-radius: var(--border-radius);
  height: calc(var(--image-size) + var(--image-padding) * 2);
  position: relative;
  width: calc(var(--image-size) + var(--image-padding) * 2);
}
.images .image a {
  border-radius: inherit;
  display: block;
  height: 100%;
  padding: var(--image-padding);
  box-sizing: border-box;
  position: relative;
}
.images .image a img {
  display: block;
  height: 100%;
  object-fit: contain;
  width: 100%;
}
.images .image a:hover,
.images .image a:focus,
.images .image a:active {
  background-color: var(--color-yellow-transparent);
  transition: var(--transition-default);
}
/* magnifier over the picture while the pointer is on it */
.images .image a::after {
  background: url(assets/zoom.svg) center / calc(var(--image-size) * 0.3) no-repeat;
  content: "";
  inset: var(--image-padding);
  opacity: 0;
  position: absolute;
  transition: var(--transition-fast-delay);
}
.images .image a:hover::after,
.images .image a:focus::after,
.images .image a:active::after {
  background-size: calc(var(--image-size) * 0.4);
  opacity: 1;
}
.images .image .details {
  display: none;
}

/* @section Lightbox modification
 * .glightbox-container is the main container for the lightbox.
 * .glightbox-clean is for the desktop version of the lightbox.
 * .glightbox-mobile is for the mobile version of the lightbox.
 */
.glightbox-container {
  --button-padding: 0.5em;
}
.glightbox-container .gbtn {
  background-color: transparent!important;
  transition: opacity 0.3s 0.7s linear;
}
.glightbox-container .gbtn.disabled {
  opacity: 0;
  pointer-events: none;
  transition-delay: 0s;
}
.glightbox-container .gbtn svg {
  display: none;
}
.glightbox-container .gbtn::after {
  content: "";
  display: block;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: calc(100% - var(--button-padding) * 2);
  height: calc(100% - var(--button-padding) * 2);;
  background-image: none;
  background-size: 100%;
  background-position: center;
  background-repeat: no-repeat;
  transition: var(--transition-fast-delay);
}
.glightbox-clean .gbtn::after {
  background-size: 70%;
}
.glightbox-clean .gbtn:hover::after,
.glightbox-clean .gbtn:focus::after,
.glightbox-clean .gbtn:active::after {
  background-size: 100%;
  transition: var(--transition-fast);
}
.glightbox-container .gclose {
  width: 5vw;
  height: 5vw;
  min-width: 50px;
  min-height: 50px;
}
.glightbox-container .gclose::after {
  background-image: url(assets/close.svg);
}
.glightbox-container .gprev,
.glightbox-container .gnext {
  width: 7vw;
  height: 9vw;
  min-width: 50px;
  min-height: 70px;
}
.glightbox-container .gprev::after {
  background-image: url(assets/arrow-left.svg);
}
.glightbox-container .gnext::after {
  background-image: url(assets/arrow-right.svg);
}
.glightbox-clean .gprev:hover::after,
.glightbox-clean .gprev:focus::after,
.glightbox-clean .gprev:active::after,
.glightbox-clean .gnext:hover::after,
.glightbox-clean .gnext:focus::after,
.glightbox-clean .gnext:active::after {
  filter: var(--color-filter-yellow);
}

/* Details */
.glightbox-container .gslide-description {
  background-color: var(--color-darkblue);
  color: var(--color-white);
}
.glightbox-container .gdesc-inner {
  padding-top: 12px;
  padding-bottom: 12px;
}
.glightbox-container .gslide-description a {
  color: inherit;
  font-weight: inherit;
}
.glightbox-container .gslide-desc {
  font-family: inherit;
}
.glightbox-container .gslide-description .info {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 0.5em;
  font-size: 0.9em;
}
.glightbox-container .gslide-description .label {
  font-weight: bold;
  color: var(--color-yellow);
  flex-shrink: 0;
  text-align: right;
  width: 6em;
}
.glightbox-container .gslide-description .value {
  flex-grow: 1;
}
.glightbox-container .gslide-description .original.label {
  opacity: 0;
}
.glightbox-container .gslide-description :first-child > .original.label {
  display: none;
}
.glightbox-container .gslide-description .caption.label {
  display: none;
}
.glightbox-container .gslide-description .caption.value {
  flex-grow: 1;
  font-style: bold;
  font-size: 1.2em;
  text-align: center;
  padding-bottom: 0.5em;
  margin-bottom: 0.5em;
  border-bottom: solid var(--color-yellow) 1px;
}
.glightbox-mobile .glightbox-container .gslide-description {
  padding-bottom: 19px;
  width: calc(100% - 22px);
}
.glightbox-mobile .glightbox-container .gslide-desc a {
  color: inherit;
}
