/* ==========================================================================
   Transport Pastor Philippe — Gallery Stylesheet
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Gallery Grid
   -------------------------------------------------------------------------- */
.gallery {
  padding: var(--spacing-xl) 0 var(--spacing-xxl);
}

.gallery__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--spacing-sm);
}

.gallery__item {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-md);
  cursor: pointer;
  aspect-ratio: 4 / 3;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  animation: galleryFadeIn 0.6s var(--ease-out) both;
}

@keyframes galleryFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.gallery__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease-out);
}

.gallery__item:hover img {
  transform: scale(1.08);
}

/* Hover overlay with zoom icon + caption */
.gallery__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.7) 0%,
    rgba(0, 0, 0, 0.15) 40%,
    transparent 100%
  );
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: var(--spacing-md);
  opacity: 0;
  transition: opacity 0.35s var(--ease-out);
}

.gallery__item:hover .gallery__overlay {
  opacity: 1;
}

.gallery__icon {
  color: white;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  opacity: 0;
  transition: opacity 0.35s var(--ease-out), transform 0.35s var(--ease-out);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.gallery__item:hover .gallery__icon {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.gallery__caption {
  color: white;
  font-size: 13px;
  font-family: var(--font-body);
  text-align: center;
  line-height: 1.4;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  transform: translateY(8px);
  transition: transform 0.35s var(--ease-out);
}

.gallery__item:hover .gallery__caption {
  transform: translateY(0);
}

/* --------------------------------------------------------------------------
   2. Lightbox
   -------------------------------------------------------------------------- */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  animation: lightboxFadeIn 0.25s ease-out;
}

@keyframes lightboxFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.lightbox.is-open {
  display: flex;
}

.lightbox__image-wrapper {
  position: relative;
  max-width: 90vw;
  max-height: 78vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox__image {
  max-width: 90vw;
  max-height: 78vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
  opacity: 0;
  transition: opacity 0.3s ease-out;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}

.lightbox__image.is-loaded {
  opacity: 1;
}

/* Close button */
.lightbox__close {
  position: absolute;
  top: 16px;
  right: 20px;
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  color: white;
  font-size: 26px;
  cursor: pointer;
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease, transform 0.2s ease;
  line-height: 1;
}

.lightbox__close:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: scale(1.1);
}

/* Navigation arrows */
.lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  color: white;
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease, transform 0.2s ease;
  z-index: 10001;
}

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

.lightbox__prev {
  left: 20px;
}

.lightbox__prev:hover {
  transform: translateY(-50%) translateX(-3px);
}

.lightbox__next {
  right: 20px;
}

.lightbox__next:hover {
  transform: translateY(-50%) translateX(3px);
}

/* Info bar: caption + counter */
.lightbox__info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 90vw;
  margin-top: var(--spacing-md);
  padding: 0 var(--spacing-sm);
}

.lightbox__caption {
  color: rgba(255, 255, 255, 0.85);
  font-size: 14px;
  font-family: var(--font-body);
  letter-spacing: 0.01em;
}

.lightbox__counter {
  color: rgba(255, 255, 255, 0.5);
  font-size: 13px;
  font-family: var(--font-body);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

/* Loading spinner */
.lightbox__spinner {
  position: absolute;
  width: 36px;
  height: 36px;
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-top-color: rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  animation: lightbox-spin 0.7s linear infinite;
}

@keyframes lightbox-spin {
  to { transform: rotate(360deg); }
}

/* --------------------------------------------------------------------------
   3. Responsive — Tablet (>= 600px)
   -------------------------------------------------------------------------- */
@media (min-width: 600px) {
  .gallery__grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-sm);
  }
}

/* --------------------------------------------------------------------------
   4. Responsive — Small Desktop (>= 900px)
   -------------------------------------------------------------------------- */
@media (min-width: 900px) {
  .gallery__grid {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-md);
  }

  .lightbox__nav {
    width: 56px;
    height: 56px;
    font-size: 26px;
  }

  .lightbox__prev { left: 28px; }
  .lightbox__next { right: 28px; }
}

/* --------------------------------------------------------------------------
   5. Responsive — Large Desktop (>= 1200px)
   -------------------------------------------------------------------------- */
@media (min-width: 1200px) {
  .gallery__grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .lightbox__image {
    max-width: 85vw;
    max-height: 85vh;
  }
}
