/**
 * @file
 *
 * CSS styles for the Gallery component.
 *
 * This stylesheet defines the grid-based layout for the gallery,
 * along with a vibrant animated outline and scaling hover effect
 * for individual images. It also includes an effect to darken
 * the rest of the screen when an image is hovered.
 */

.gallery__layout--four .photoswipe-gallery.field__items {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--spacing-xl);
}

.gallery__layout--three .photoswipe-gallery.field__items {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--spacing-xl);
}

.photoswipe-gallery .field__item {
  box-sizing: border-box;
  transition: transform 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
  border-radius: var(--border-radius-base);
  overflow: hidden;
  position: relative;
  z-index: 1;
  outline: 4px solid transparent;
  transition: outline-color 0.3s ease, transform 0.3s ease-in-out;
}

.photoswipe-gallery .field__item:hover {
  transform: scale(1.05);
  animation: pastel-glow-anticlockwise 2s linear infinite;
  outline: 4px solid;
  z-index: 100;
}

.photoswipe-gallery .field__item picture,
.photoswipe-gallery .field__item img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--border-radius-base);
  transition: transform 0.3s ease-in-out;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0);
  pointer-events: none;
  transition: background-color 0.3s ease-in-out;
  z-index: 99;
}

body:has(.photoswipe-gallery .field__item:hover)::before {
  background-color: rgba(0, 0, 0, 0.7);
  pointer-events: auto;
}

@media screen and (max-width: 60em) {

  .gallery__layout--four .photoswipe-gallery.field__items,
  .gallery__layout--three .photoswipe-gallery.field__items {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media screen and (max-width: 40em) {

  .gallery__layout--four .photoswipe-gallery.field__items,
  .gallery__layout--three .photoswipe-gallery.field__items {
    grid-template-columns: repeat(1, 1fr);
  }
}

@keyframes pastel-glow-anticlockwise {
  0% {
    outline-color: rgba(var(--rgb-glow-pink), 1);
    box-shadow: 0 0 20px 5px rgba(var(--rgb-glow-pink), 1);
  }

  25% {
    outline-color: rgba(var(--rgb-glow-blue), 1);
    box-shadow: 0 0 20px 5px rgba(var(--rgb-glow-blue), 1);
  }

  50% {
    outline-color: rgba(var(--rgb-glow-yellow), 1);
    box-shadow: 0 0 20px 5px rgba(var(--rgb-glow-yellow), 1);
  }

  75% {
    outline-color: rgba(var(--rgb-glow-green), 1);
    box-shadow: 0 0 20px 5px rgba(var(--rgb-glow-green), 1);
  }

  100% {
    outline-color: rgba(var(--rgb-glow-pink), 1);
    box-shadow: 0 0 20px 5px rgba(var(--rgb-glow-pink), 1);
  }
}
