/* Gallery Section */
/* Dark section wrapper; seam spacing is global */
.gallery-section.dark-section {
  width: 100%;
  background-color: var(--secondary-color);
  overflow: visible; /* safe for adjacent tear overlap */
  /* no padding-top or padding-bottom here */
}

.gallery-header {
  max-width: 1152px;
  margin: auto;
  margin-top: 40px;
  margin-bottom: 50px;
}


.gallery-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-template-rows: 200px 200px 300px 200px 200px 300px;
  gap: 1rem;
  max-width: 1152px;
  margin: 0 auto;
  padding-inline: 20px; /* ensure internal gutter inside the gallery */
  box-sizing: border-box;

}

/* Mobile Gallery - Hidden by default */
.mobile-gallery {
  display: none;
  position: relative;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0;
  height: 70vh;
  min-height: 400px;
  max-height: 600px;
  overflow: hidden;
}

.mobile-gallery-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  transition: transform 0.3s ease-in-out;
  -webkit-user-select: none;
  user-select: none;
  touch-action: pan-y pinch-zoom;
}

.mobile-gallery img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  flex-shrink: 0;
}

/* Specific styles for gallery-grid images to differentiate from card gallery images */
.gallery-grid > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0px;
  transition: transform 0.3s ease;
}

/* Row 1: Square (5 cols) + Wide (7 cols) */
.gallery-grid > img:nth-child(1) {
  grid-column: 1 / 6;
  grid-row: 1 / 3;
}

.gallery-grid > img:nth-child(2) {
  grid-column: 6 / 13;
  grid-row: 1 / 3;
}

/* Row 2: Small images offset to create stagger effect */
.gallery-grid > img:nth-child(3) {
  grid-column: 1 / 5;
  grid-row: 3;
}

.gallery-grid > img:nth-child(4) {
  grid-column: 5 / 9;
  grid-row: 3;
}

.gallery-grid > img:nth-child(5) {
  grid-column: 9 / 13;
  grid-row: 3;
}

/* Row 3: Square (5 cols) + Wide (7 cols) - offset to create stagger */
.gallery-grid > img:nth-child(6) {
  grid-column: 1 / 8;
  grid-row: 4 / 6;
}

.gallery-grid > img:nth-child(7) {
  grid-column: 8 / 13;
  grid-row: 4 / 6;
}

/* Row 4: Small images offset differently to stagger with row 3 */
.gallery-grid > img:nth-child(8) {
  grid-column: 1 / 5;
  grid-row: 6;
}

.gallery-grid > img:nth-child(9) {
  grid-column: 5 / 9;
  grid-row: 6;
}

.gallery-grid > img:nth-child(10) {
  grid-column: 9 / 13;
  grid-row: 6;
}

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

@media (max-width: 1200px) and (min-width: 1025px) {
  .gallery-grid {
    grid-template-columns: repeat(12, 1fr);
    grid-auto-rows: 100px;
  }
  
  /* Simplified layout for medium screens */
  .gallery-grid > img:nth-child(1) {
    grid-column: 1 / 6;
    grid-row: 1 / 3;
  }
  
  .gallery-grid > img:nth-child(2) {
    grid-column: 6 / 13;
    grid-row: 1 / 3;
  }
  
  .gallery-grid > img:nth-child(3) {
    grid-column: 1 / 5;
    grid-row: 3;
  }
  
  .gallery-grid > img:nth-child(4) {
    grid-column: 5 / 9;
    grid-row: 3;
  }
  
  .gallery-grid > img:nth-child(5) {
    grid-column: 9 / 13;
    grid-row: 3;
  }
  
  .gallery-grid > img:nth-child(6) {
    grid-column: 1 / 8;
    grid-row: 4 / 6;
  }
  
  .gallery-grid > img:nth-child(7) {
    grid-column: 8 / 13;
    grid-row: 4 / 6;
  }
  
  .gallery-grid > img:nth-child(8) {
    grid-column: 1 / 6;
    grid-row: 6;
  }
  
  .gallery-grid > img:nth-child(9) {
    grid-column: 6 / 10;
    grid-row: 6;
  }
  
  .gallery-grid > img:nth-child(10) {
    grid-column: 10 / 13;
    grid-row: 6;
  }
}

/* Ensure gallery navigation is visible on mobile gallery */
.mobile-gallery .gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.5);
  color: white;
  padding: 0.75rem;
  cursor: pointer;
  border: none;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: all 0.3s ease;
  z-index: 2;
  font-size: 1.2rem;
  border-radius: 4px;
}

.mobile-gallery .gallery-nav:hover {
  background: rgba(0, 0, 0, 0.7);
  transform: translateY(-50%) scale(1.1);
}

.mobile-gallery .gallery-nav:active {
  transform: translateY(-50%) scale(0.95);
}

.mobile-gallery .gallery-nav:focus {
  outline: none;
  transform: translateY(-50%);
}

/* Disable scaling on touch devices to prevent stuck hover states */
@media (hover: none) {
  .mobile-gallery .gallery-nav:hover {
    background: rgba(0, 0, 0, 0.7);
    transform: translateY(-50%);
  }
}

.mobile-gallery .gallery-nav.prev {
  left: 15px;
}

.mobile-gallery .gallery-nav.next {
  right: 15px;
}



/* Responsive Gallery Grid */
/* Switch to mobile gallery at 1024px */
@media (max-width: 1024px) {
  .gallery-grid {
    display: none;
  }
  
  .mobile-gallery {
    display: block;
  }
}

/* Mobile Gallery Responsive Adjustments */
@media (max-width: 768px) {
  .gallery-header {
    margin-top: 20px;
    margin-bottom: 25px;
  }

  .mobile-gallery {
    height: 60vh;
    min-height: 300px;
    max-height: 500px;
    padding: 0;
  }
}

@media (max-width: 480px) {
  .gallery-header {
    margin-top: 15px;
    margin-bottom: 20px;
  }

  .mobile-gallery {
    height: 50vh;
    min-height: 250px;
    max-height: 400px;
    padding: 0;
  }
}

/* Gallery image cursor indication */
.gallery-grid > img {
  cursor: pointer;
}

.mobile-gallery img {
  cursor: pointer;
}
