/* Gallery Page Specific Styles */

/* Gallery Header */
.gallery-header {
  text-align: center;
  padding: 2rem 0 3rem 0;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 3rem;
}

.gallery-header h1 {
  font-family: 'Inter', sans-serif;
  font-size: 2.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.gallery-subtitle {
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 1.2rem;
  color: var(--text-secondary);
  font-style: italic;
}

/* Instagram-style Grid Container */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Individual Gallery Item */
.gallery-item {
  position: relative;
  background: var(--bg-element);
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 12px 12px 24px var(--shadow-dark), 
              -12px -12px 24px var(--shadow-light);
}

.gallery-item:hover {
  transform: translateY(-4px);
  box-shadow: 14px 14px 28px var(--shadow-dark), 
              -14px -14px 28px var(--shadow-light);
}

/* Square Image Container (1:1 Aspect Ratio like Instagram) */
.gallery-item-square {
  position: relative;
  width: 100%;
  padding-bottom: 100%; /* This creates the square aspect ratio */
  overflow: hidden;
  background: var(--bg-main);
}

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

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

/* Multi-image slider inside gallery item */
.multi-image-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
}

.multi-image-container img {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  object-fit: cover;
  scroll-snap-align: center;
  position: relative; /* ensure thumbnail uses first image and not overlay */
}

.multi-image-container::-webkit-scrollbar {
  display: none;
}

/* Dots indicator for multi-image posts */
.multi-image-indicators {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  z-index: 5;
}

.multi-image-indicators span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
}

.multi-image-indicators span.active {
  background: rgba(255, 255, 255, 0.9);
}

/* Photo Details Section */
.gallery-item-details {
  padding: 1.5rem;
  background: var(--bg-element);
}

/* Date Styling */
.gallery-date {
  font-family: 'Inter', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-warm);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.5rem;
}

/* Location Styling */
.gallery-location {
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.location-icon {
  width: 14px;
  height: 14px;
  fill: var(--accent-warm);
  opacity: 0.8;
}

/* Caption Styling */
.gallery-caption {
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-secondary);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3; /* Limit to 3 lines */
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}


/* ============================================
   TABLET RESPONSIVE (iPad, etc.)
   ============================================ */
@media (max-width: 1024px) and (min-width: 769px) {
  .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    padding: 0 15px;
  }
  
  .gallery-header h1 {
    font-size: 2.2rem;
  }
}

/* ============================================
   MOBILE RESPONSIVE - 2 Column Grid
   ============================================ */
@media (max-width: 768px) {
  /* Adjust header for mobile */
  .gallery-header {
    padding: 1.5rem 0 2rem 0;
    margin-bottom: 2rem;
  }
  
  .gallery-header h1 {
    font-size: 2rem;
  }
  
  .gallery-subtitle {
    font-size: 1.1rem;
  }
  
  /* 2 column grid on mobile */
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    padding: 0 12px;
  }
  
  /* Smaller text on mobile */
  .gallery-item-details {
    padding: 1.2rem;
  }
  
  .gallery-date {
    font-size: 0.7rem;
  }
  
  .gallery-location {
    font-size: 0.8rem;
  }
  
  .location-icon {
    width: 12px;
    height: 12px;
  }
  
  .gallery-caption {
    font-size: 0.95rem;
    -webkit-line-clamp: 2; /* Show only 2 lines on mobile */
  }
  
}

/* ============================================
   SMALL MOBILE (iPhone SE, etc.)
   ============================================ */
@media (max-width: 480px) {
  .gallery-header h1 {
    font-size: 1.8rem;
  }
  
  .gallery-subtitle {
    font-size: 1rem;
  }
  
  /* Even smaller gaps on very small screens */
  .gallery-grid {
    gap: 12px;
    padding: 0 8px;
  }
  
  .gallery-item-details {
    padding: 1rem;
  }
  
  .gallery-caption {
    font-size: 0.9rem;
  }
}

/* ============================================
   VERY SMALL SCREENS (Optional: Single Column)
   ============================================ */
@media (max-width: 360px) {
  /* Single column for very small devices */
  .gallery-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .gallery-item-details {
    padding: 1.2rem;
  }
  
  .gallery-caption {
    -webkit-line-clamp: 3; /* Can show more lines in single column */
  }
}

/* ============================================
   HOVER EFFECTS (Desktop Only)
   ============================================ */
@media (hover: hover) {
  /* Only apply hover effects on devices that support hover */
  .gallery-item {
    position: relative;
    overflow: hidden;
  }
  
  /* Optional: Overlay effect on hover */
  .gallery-item-square::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, transparent 0%, rgba(0,0,0,0.1) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
  }
  
  .gallery-item:hover .gallery-item-square::after {
    opacity: 1;
  }
}

/* ============================================
   LOADING STATE (Optional)
   ============================================ */
.gallery-item-square.loading {
  background: linear-gradient(90deg, var(--bg-element) 0%, var(--bg-main) 50%, var(--bg-element) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ============================================
   PRINT STYLES (Optional)
   ============================================ */
@media print {
  .sidebar,
  .menu-toggle {
    display: none !important;
  }
  
  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
  }
  
  .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
