/* Simple Gallery Grid Layout */

/* Gallery Container - Override main styles.css */
body.gallery-page .photo-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)) !important;
  gap: 1.5rem !important;
  padding: 2rem 1rem !important;
  max-width: 1400px !important;
  margin: 0 auto !important;
  justify-items: center !important;
}

/* Override the 4-column grid from styles.css */
body.gallery-page .photo-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)) !important;
}

/* Override responsive styles from main styles.css */
@media (max-width: 900px) {
  body.gallery-page .photo-grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)) !important;
  }
}

@media (max-width: 600px) {
  body.gallery-page .photo-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)) !important;
  }
}

/* Remove photo-sequence container */
.gallery-page .photo-sequence {
  display: contents !important;
}

/* Individual Photo Items - Override main styles.css */
body.gallery-page .photo-item {
  position: relative !important;
  border-radius: 15px !important;
  overflow: hidden !important;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15) !important;
  transition: transform 0.3s ease !important;
  background: white !important;
  width: 100% !important;
  max-width: 320px !important;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  grid-column: unset !important;
  grid-row: unset !important;
}

/* Hover effect - Override main styles.css */
body.gallery-page .photo-item:hover {
  transform: translateY(-5px) !important;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.25) !important;
}

body.gallery-page .photo-item img {
  width: 100% !important;
  height: 220px !important;
  object-fit: cover !important;
  object-position: center !important;
  display: block !important;
}

/* Photo Overlay - Override main styles.css */
body.gallery-page .photo-overlay {
  position: absolute !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(0, 0, 0, 0.7) 100%
  ) !important;
  color: white !important;
  padding: 1.5rem !important;
  transform: translateY(100%) !important;
  transition: transform 0.3s ease !important;
}

body.gallery-page .photo-item:hover .photo-overlay {
  transform: translateY(0) !important;
}

body.gallery-page .photo-overlay h3 {
  margin: 0 0 0.5rem !important;
  font-size: 1.2rem !important;
  font-weight: 600 !important;
}

body.gallery-page .photo-overlay p {
  margin: 0 !important;
  font-size: 0.9rem !important;
  opacity: 0.9 !important;
}

/* Responsive Design - Override main styles.css */
@media (max-width: 1200px) {
  body.gallery-page .photo-grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)) !important;
    gap: 1.2rem !important;
    padding: 1.5rem 1rem !important;
  }
}

@media (max-width: 768px) {
  body.gallery-page .photo-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)) !important;
    gap: 1rem !important;
    padding: 1rem 0.5rem !important;
  }
  
  body.gallery-page .photo-item {
    max-width: 280px !important;
  }
  
  body.gallery-page .photo-item img {
    height: 200px !important;
  }
  
  body.gallery-page .photo-overlay {
    padding: 1rem !important;
  }
  
  body.gallery-page .photo-overlay h3 {
    font-size: 1rem !important;
  }
  
  body.gallery-page .photo-overlay p {
    font-size: 0.8rem !important;
  }
}

@media (max-width: 480px) {
  body.gallery-page .photo-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)) !important;
    gap: 0.8rem !important;
    padding: 1rem 0.5rem !important;
  }
  
  body.gallery-page .photo-item {
    max-width: 250px !important;
  }
  
  body.gallery-page .photo-item img {
    height: 180px !important;
  }
  
  body.gallery-page .photo-overlay {
    padding: 0.8rem !important;
  }
  
  body.gallery-page .photo-overlay h3 {
    font-size: 0.9rem !important;
  }
  
  body.gallery-page .photo-overlay p {
    font-size: 0.75rem !important;
  }
}

/* Enhanced Section Head */
.section-head {
  text-align: center;
  margin-bottom: 3rem;
}

.section-head h3 {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.section-subtitle {
  font-size: 1.1rem;
  color: #666;
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.6;
}

/* Loading Animation */
.photo-item img {
  opacity: 0;
  animation: imageLoad 0.6s ease-out forwards;
}

@keyframes imageLoad {
  from {
    opacity: 0;
    transform: scale(1.1);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Staggered Loading */
.photo-item:nth-child(1) img { animation-delay: 0.1s; }
.photo-item:nth-child(2) img { animation-delay: 0.2s; }
.photo-item:nth-child(3) img { animation-delay: 0.3s; }
.photo-item:nth-child(4) img { animation-delay: 0.4s; }
.photo-item:nth-child(5) img { animation-delay: 0.5s; }
.photo-item:nth-child(6) img { animation-delay: 0.6s; }
.photo-item:nth-child(7) img { animation-delay: 0.7s; }

/* Special Effects */
.photo-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    135deg,
    rgba(99, 102, 241, 0.1) 0%,
    rgba(8, 145, 178, 0.1) 100%
  );
  opacity: 0;
  transition: opacity 0.8s ease;
  z-index: 1;
}

.photo-grid:hover .photo-item::before {
  opacity: 1;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .photo-grid {
    height: 400px;
  }
  
  .photo-item {
    min-width: 160px;
    max-width: 220px;
  }
  
  .photo-overlay h3 {
    font-size: 1.5rem;
  }
  
  .photo-overlay p {
    font-size: 1rem;
  }
  
  .section-head h2 {
    font-size: 2rem;
  }
}

@media (max-width: 768px) {
  .photo-grid {
    height: 380px;
    border-radius: 20px;
    margin-top: 1.5rem;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.12);
  }
  
  .photo-sequence {
    gap: 1.8rem;
    padding: 0 1rem;
  }
  
  .photo-item {
    border-radius: 16px;
    margin: 0 0.3rem;
    min-width: 160px;
    max-width: 200px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  .photo-item:hover {
    transform: scale(1.08);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  }
  
  .photo-overlay {
    padding: 1.8rem 1.2rem 1.2rem;
    background: linear-gradient(
      180deg,
      transparent 0%,
      rgba(0, 0, 0, 0.2) 20%,
      rgba(0, 0, 0, 0.7) 100%
    );
  }
  
  .photo-overlay h3 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 0.6rem;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
  }
  
  .photo-overlay p {
    font-size: 0.95rem;
    line-height: 1.4;
    opacity: 0.95;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  }
  
  .section-head {
    margin-bottom: 2rem;
  }
  
  .section-head h2 {
    font-size: 2rem;
    margin-bottom: 0.8rem;
  }
  
  .section-subtitle {
    font-size: 1.05rem;
    padding: 0 1rem;
  }
}

@media (max-width: 480px) {
  .photo-grid {
    height: 320px;
    border-radius: 16px;
    margin-top: 1rem;
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.1);
  }
  
  .photo-sequence {
    gap: 1.2rem;
    padding: 0 0.8rem;
  }
  
  .photo-item {
    border-radius: 14px;
    margin: 0 0.2rem;
    min-width: 140px;
    max-width: 170px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  .photo-item:hover {
    transform: scale(1.06);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
  }
  
  .photo-overlay {
    padding: 1.4rem 1rem 1rem;
    background: linear-gradient(
      180deg,
      transparent 0%,
      rgba(0, 0, 0, 0.15) 15%,
      rgba(0, 0, 0, 0.65) 100%
    );
  }
  
  .photo-overlay h3 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.6);
    line-height: 1.3;
  }
  
  .photo-overlay p {
    font-size: 0.85rem;
    line-height: 1.3;
    opacity: 0.9;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  }
  
  .section-head {
    margin-bottom: 1.5rem;
  }
  
  .section-head h2 {
    font-size: 1.7rem;
    margin-bottom: 0.6rem;
  }
  
  .section-subtitle {
    font-size: 0.95rem;
    padding: 0 0.8rem;
    line-height: 1.5;
  }
}

/* Smooth Entrance Animation */
.photo-grid {
  opacity: 0;
  transform: translateY(30px);
  animation: galleryEntrance 1s ease-out 0.5s forwards;
}

@keyframes galleryEntrance {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Performance Optimization */
.photo-sequence {
  will-change: transform;
}

/* Mobile Touch Enhancements */
@media (max-width: 768px) {
  .photo-item {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  
  .photo-item:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
  }
  
  /* Better touch targets */
  .photo-overlay {
    touch-action: manipulation;
  }
  
  /* Improved animation for mobile */
  .photo-sequence {
    animation: slideSequence 45s linear infinite;
  }
  
  /* Pause animation on touch */
  .photo-grid:active .photo-sequence {
    animation-play-state: paused;
  }
}

@media (max-width: 480px) {
  .photo-item:active {
    transform: scale(0.97);
  }
  
  .photo-sequence {
    animation: slideSequence 40s linear infinite;
  }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  .photo-sequence {
    animation: none;
  }
  
  .photo-grid:hover .photo-sequence {
    animation-play-state: running;
  }
  
  .photo-item:hover {
    transform: none;
  }
  
  .photo-item:active {
    transform: none;
  }
}

/* Additional Mobile Improvements */
@media (max-width: 768px) {
  /* Better spacing for mobile */
  .photo-grid {
    margin-left: -1rem;
    margin-right: -1rem;
    width: calc(100% + 2rem);
  }
  
  /* Enhanced visual feedback */
  .photo-item::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
      135deg,
      rgba(99, 102, 241, 0.05) 0%,
      rgba(8, 145, 178, 0.05) 100%
    );
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: inherit;
    pointer-events: none;
  }
  
  .photo-item:hover::after {
    opacity: 1;
  }
}