/* gallery.php — responsive clickable image grid */

.gallery-page-section {
  background: hsl(var(--neutral-400));
}

.gallery-page-intro {
  max-width: 40rem;
  margin-bottom: clamp(2rem, 4vw, 2.75rem);
}

.gallery-page-intro__title {
  font-family: var(--heading-font);
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 400;
  color: hsl(var(--black));
  margin-bottom: 0.65rem;
}

.gallery-page-intro__text {
  font-size: 1rem;
  line-height: 1.65;
  color: hsl(var(--body-color));
  margin: 0;
}

.ag-page-gallery {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(0.75rem, 2vw, 1.25rem);
}

@media (min-width: 576px) {
  .ag-page-gallery {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 992px) {
  .ag-page-gallery {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1200px) {
  .ag-page-gallery {
    grid-template-columns: repeat(4, 1fr);
  }
}

.ag-gallery-item {
  position: relative;
  display: block;
  border-radius: clamp(0.65rem, 1.5vw, 1rem);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  background: hsl(var(--neutral-200));
  box-shadow: 0 8px 24px -12px hsla(var(--main-two-h), var(--main-two-s), var(--main-two-l), 0.25);
  outline: none;
  isolation: isolate;
  opacity: 1;
  visibility: visible;
  animation: ag-gallery-tile-in 0.55s ease forwards;
}

.ag-page-gallery .ag-gallery-item:nth-child(1) {
  animation-delay: 0.02s;
}
.ag-page-gallery .ag-gallery-item:nth-child(2) {
  animation-delay: 0.05s;
}
.ag-page-gallery .ag-gallery-item:nth-child(3) {
  animation-delay: 0.08s;
}
.ag-page-gallery .ag-gallery-item:nth-child(4) {
  animation-delay: 0.11s;
}
.ag-page-gallery .ag-gallery-item:nth-child(5) {
  animation-delay: 0.14s;
}
.ag-page-gallery .ag-gallery-item:nth-child(6) {
  animation-delay: 0.17s;
}
.ag-page-gallery .ag-gallery-item:nth-child(7) {
  animation-delay: 0.2s;
}
.ag-page-gallery .ag-gallery-item:nth-child(8) {
  animation-delay: 0.23s;
}
.ag-page-gallery .ag-gallery-item:nth-child(9) {
  animation-delay: 0.26s;
}
.ag-page-gallery .ag-gallery-item:nth-child(10) {
  animation-delay: 0.29s;
}
.ag-page-gallery .ag-gallery-item:nth-child(11) {
  animation-delay: 0.32s;
}
.ag-page-gallery .ag-gallery-item:nth-child(12) {
  animation-delay: 0.35s;
}

@keyframes ag-gallery-tile-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ag-gallery-item {
    animation: none;
  }
}

.ag-gallery-item:focus-visible {
  box-shadow: 0 0 0 3px hsl(var(--white)), 0 0 0 6px var(--main-600);
}

.ag-gallery-item figure {
  margin: 0;
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
}

.ag-gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.45s ease;
}

.ag-gallery-item:hover img,
.ag-gallery-item:focus-visible img {
  transform: scale(1.06);
}

.ag-gallery-item__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(
    to top,
    hsla(var(--main-two-h), var(--main-two-s), var(--main-two-l), 0.55) 0%,
    transparent 55%
  );
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}

.ag-gallery-item:hover .ag-gallery-item__overlay,
.ag-gallery-item:focus-visible .ag-gallery-item__overlay {
  opacity: 1;
}

.ag-gallery-item__zoom {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  color: hsl(var(--black));
  background: hsl(var(--white));
  box-shadow: 0 8px 20px hsla(0, 0%, 0%, 0.2);
  transform: translateY(8px);
  transition: transform 0.35s ease;
}

.ag-gallery-item:hover .ag-gallery-item__zoom,
.ag-gallery-item:focus-visible .ag-gallery-item__zoom {
  transform: translateY(0);
}

.ag-gallery-item__caption {
  display: block;
  padding: 0.65rem 1rem 0.85rem;
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: var(--body-font);
  color: hsl(var(--black));
  background: hsl(var(--white));
  border-top: 1px solid hsl(var(--neutral-200));
}

.ag-gallery-item:hover .ag-gallery-item__caption,
.ag-gallery-item:focus-visible .ag-gallery-item__caption {
  color: var(--main-600);
}
