/* Gallery Component */

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-sm);
}

.gallery-grid--stretch {
  height: 100%;
  grid-auto-rows: 1fr; /* Automatically stretch all rows equally */
}

.gallery-grid--stretch .gallery-item {
  padding-top: 0;
  height: 100%;
}

@media (min-width: 768px) {
  .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-md);
  }
}

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

.gallery-item {
  position: relative;
  width: 100%;
  padding-top: 100%; /* 1:1 Aspect ratio */
  overflow: hidden;
  border-radius: var(--radius-sm);
  cursor: zoom-in;
}

.gallery-item img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.gallery-item::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(26, 79, 143, 0.4);
  opacity: 0;
  transition: opacity var(--transition);
}

.gallery-item:hover img {
  transform: scale(1.05);
}

.gallery-item:hover::after {
  opacity: 1;
}

/* Lightbox */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.9);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition), visibility var(--transition);
}

.lightbox.is-open {
  opacity: 1;
  visibility: visible;
}

.lightbox__content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
}

.lightbox__image {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
  box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

.lightbox__close {
  position: absolute;
  top: -40px;
  right: -40px;
  background: transparent;
  border: none;
  color: var(--white);
  cursor: pointer;
  padding: 10px;
}

.lightbox__close svg {
  width: 32px;
  height: 32px;
  fill: currentColor;
}

.lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: var(--white);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color var(--transition);
}

.lightbox__nav:hover {
  background: rgba(255, 255, 255, 0.3);
}

.lightbox__nav--prev {
  left: -60px;
}

.lightbox__nav--next {
  right: -60px;
}

.lightbox__nav svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

@media (max-width: 768px) {
  .lightbox__close {
    top: -40px;
    right: 0;
  }
  
  .lightbox__nav--prev {
    left: 10px;
  }
  
  .lightbox__nav--next {
    right: 10px;
  }
}
