/**
 * 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;
}

/* narrow screens: the grid fills the width (three squares at 375px), the picture fills its square */
@media (max-width: 990px) {
  .images {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  }
  .images .image {
    aspect-ratio: 1;
    height: auto;
    width: auto;
  }
  .images .image a img {
    object-fit: cover;
  }
  .images .image a::after {
    background-size: 30%;
  }
  .images .image a:hover::after,
  .images .image a:focus::after,
  .images .image a:active::after {
    background-size: 40%;
  }
}
