/* ============================================================
   GALLERY PAGE — STYLES
   Extends the main site design system from ../style.css
   ============================================================ */

/* ----------------------------------------------------
   1. REUSED HERO BANNER OVERRIDES
   ---------------------------------------------------- */
.projects-page-hero {
  position: relative;
  padding: 140px 0 60px;
  background-color: var(--primary-dark);
  overflow: hidden;
  text-align: center;
}

.projects-page-hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: url('../images/tree.webp') center/cover no-repeat fixed;
  opacity: 0.65;
  z-index: 1;
}

.projects-page-hero::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    to bottom,
    rgba(8, 75, 23, 0.3) 0%,
    rgba(8, 75, 23, 0.45) 100%
  );
  z-index: 2;
}

.projects-hero-content {
  position: relative;
  z-index: 3;
}

.projects-hero-content .section-title {
  color: var(--text-light);
  margin-bottom: 12px;
  font-size: 2.6rem;
}

.projects-hero-content .section-subtitle {
  color: rgba(255, 255, 255, 0.75);
  max-width: 600px;
  margin: 0 auto;
}

/* ----------------------------------------------------
   2. GALLERY GRID SECTION
   ---------------------------------------------------- */
.gallery-section {
  background-color: #F4F6F4;
  padding: 60px 0 80px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 30px;
  margin-bottom: 20px;
}

/* Gallery Card Layout */
.gallery-card {
  display: block;
  background-color: #ffffff;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  outline: none;
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94), 
              box-shadow 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  /* Prevent clipping/jittering inside columns on hover transform scale */
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform: translate3d(0, 0, 0);
}

.gallery-card:hover,
.gallery-card:focus-within {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

.gallery-img-wrapper {
  position: relative;
  overflow: hidden;
  background-color: #e2ede5;
  aspect-ratio: 4 / 5;
}

.gallery-img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.gallery-card:hover .gallery-img,
.gallery-card:focus-within .gallery-img {
  transform: scale(1.06);
}

/* Zoom Overlay */
.gallery-card-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(8, 75, 23, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.gallery-card:hover .gallery-card-overlay,
.gallery-card:focus-within .gallery-card-overlay {
  opacity: 1;
}

.gallery-card-zoom-icon {
  width: 48px;
  height: 48px;
  background-color: rgba(255, 255, 255, 0.95);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-dark);
  font-size: 1.4rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transform: scale(0.85);
  transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.gallery-card:hover .gallery-card-zoom-icon,
.gallery-card:focus-within .gallery-card-zoom-icon {
  transform: scale(1);
}

/* Details Under Image */
.gallery-card-details {
  padding: 18px 20px;
  border-top: 1px solid rgba(8, 75, 23, 0.05);
}

.gallery-card-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary-accent);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 5px;
}

.gallery-card-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--primary-dark);
  line-height: 1.35;
}

/* ----------------------------------------------------
   3. PREMIUM LIGHTBOX MODAL
   ---------------------------------------------------- */
.lightbox-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(10, 20, 14, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              visibility 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.lightbox-modal.active {
  opacity: 1;
  visibility: visible;
}

/* Lightbox Content Layout */
.lightbox-content {
  position: relative;
  max-width: 85%;
  max-height: 75vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  outline: none;
}

.lightbox-image-wrapper {
  position: relative;
  max-width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-sm);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}

.lightbox-img {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  display: block;
  opacity: 0;
  transform: scale(0.97);
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94), 
              opacity 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.lightbox-modal.active .lightbox-img.loaded {
  opacity: 1;
  transform: scale(1);
}

/* Loader Animation */
.lightbox-loader {
  position: absolute;
  font-size: 2.5rem;
  color: #ffffff;
  animation: spin 1s linear infinite;
  display: none;
  z-index: 10;
}

.lightbox-loader.visible {
  display: block;
}

@keyframes spin {
  100% {
    transform: rotate(360deg);
  }
}

/* Close Button */
.lightbox-close {
  position: absolute;
  top: 30px;
  right: 30px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.85);
  font-size: 1.6rem;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10010;
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.lightbox-close:hover,
.lightbox-close:focus {
  background-color: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  transform: scale(1.05);
  outline: none;
}

/* Direction Arrows */
.lightbox-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.8);
  font-size: 1.8rem;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10005;
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.lightbox-arrow:hover,
.lightbox-arrow:focus {
  background-color: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  transform: translateY(-50%) scale(1.05);
  outline: none;
}

.lightbox-arrow-left {
  left: 40px;
}

.lightbox-arrow-right {
  right: 40px;
}

/* Caption details */
.lightbox-caption-wrapper {
  text-align: center;
  max-width: 650px;
  padding: 0 10px;
  z-index: 10005;
}

.lightbox-caption {
  font-family: var(--font-main);
  color: rgba(255, 255, 255, 0.88);
  font-size: 1.05rem;
  line-height: 1.5;
  font-weight: 450;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

/* ----------------------------------------------------
   4. RESPONSIVE BREAKPOINTS
   ---------------------------------------------------- */
@media (max-width: 1024px) {
  .lightbox-arrow-left {
    left: 20px;
  }
  
  .lightbox-arrow-right {
    right: 20px;
  }
  
  .lightbox-arrow {
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
  }
}

@media (max-width: 768px) {
  .projects-page-hero {
    padding: 120px 0 50px;
  }

  .projects-hero-content .section-title {
    font-size: 2.1rem;
  }

  .gallery-section {
    padding: 40px 0 60px;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
  }

  .lightbox-close {
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    font-size: 1.4rem;
  }

  .lightbox-content {
    max-width: 90%;
  }

  .lightbox-arrow {
    position: static;
    transform: none;
    margin-top: 10px;
  }

  /* Center the lightbox vertically on mobile */
  .lightbox-modal {
    justify-content: center;
    padding-top: 0;
  }

  .lightbox-content {
    max-height: 60vh;
  }

  .lightbox-img {
    max-height: 50vh;
  }

  /* Overlay navigation controls row at the bottom for mobile */
  .lightbox-mobile-controls {
    display: flex;
    gap: 20px;
    margin-top: 10px;
    z-index: 10005;
  }
}

@media (max-width: 480px) {
  .gallery-grid {
    grid-template-columns: 1fr;
    gap: 20px;
    max-width: 420px;
    margin: 0 auto;
  }
}
