/* Gallery Page Specific Styles */

/* Theme variables - Lavender/Purple pastel palette */
.page-gallery {
  --theme-primary: #9b7bb8;
  --theme-hover: #7d5a9e;
  --theme-light: #c4a8d8;
  --theme-text: #4a3a5a;
  --theme-dark: #5d4777;
  --theme-bg: #f8f4fc;
  --theme-bg-hero: #f5f0fa;
  --theme-surface: #ffffff;
  --theme-border: #e0d4eb;
}

/* Hero palette */
.hero-palette-gallery {
  background: var(--theme-bg-hero, #f5f0fa);
}
.hero-palette-gallery .blob-1,
.hero-palette-gallery .blob-5 {
  --blob-color: #d4c4e8;
}
.hero-palette-gallery .blob-2,
.hero-palette-gallery .blob-6 {
  --blob-color: #b8a0d0;
}
.hero-palette-gallery .blob-3,
.hero-palette-gallery .blob-7 {
  --blob-color: #e8daf0;
}
.hero-palette-gallery .blob-4,
.hero-palette-gallery .blob-8,
.hero-palette-gallery .blob-9 {
  --blob-color: #a888c8;
}

/* Navigation styles */
.page-gallery nav {
  background: var(--theme-bg-hero);
  border-bottom-color: rgba(155, 123, 184, 0.2);
  box-shadow: 0 4px 20px rgba(155, 123, 184, 0.08);
}
.page-gallery .nav-links li > a {
  color: var(--theme-text);
}
.page-gallery .nav-links li > a:hover {
  color: var(--theme-primary);
}
.page-gallery .dropdown-menu {
  background: var(--theme-surface);
  border-color: var(--theme-border);
}
.page-gallery .dropdown-menu a {
  color: var(--theme-text);
}
.page-gallery .dropdown-menu a:hover {
  background: linear-gradient(90deg, rgba(155, 123, 184, 0.15) 0%, rgba(196, 168, 216, 0.1) 100%);
  color: var(--theme-primary);
}
.page-gallery .register-btn {
  background: var(--theme-primary);
}
.page-gallery .register-btn:hover {
  background: var(--theme-hover);
}

/* Year Navigation */
.gallery-year-nav {
  background: var(--theme-surface);
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--theme-border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.year-tabs {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.year-tab {
  padding: 0.75rem 2rem;
  font-size: 1.25rem;
  font-weight: 600;
  background: transparent;
  border: 2px solid var(--theme-border);
  border-radius: 50px;
  color: var(--theme-text);
  cursor: pointer;
  transition: all 0.3s ease;
}

.year-tab:hover {
  border-color: var(--theme-primary);
  color: var(--theme-primary);
}

.year-tab.active {
  background: var(--theme-primary);
  border-color: var(--theme-primary);
  color: white;
}

/* Gallery Year Section */
.gallery-year-section {
  padding: 3rem 0 4rem;
  background: var(--theme-bg);
}

.year-title {
  text-align: center;
  font-size: 2.5rem;
  color: var(--theme-text);
  margin-bottom: 3rem;
  position: relative;
}

.year-title::after {
  content: '';
  display: block;
  width: 80px;
  height: 4px;
  background: linear-gradient(90deg, var(--theme-primary), var(--theme-light));
  margin: 1rem auto 0;
  border-radius: 2px;
}

/* Gallery Category */
.gallery-category {
  margin-bottom: 2rem;
  background: var(--theme-surface);
  border-radius: 16px;
  padding: 1.25rem;
  box-shadow: 0 2px 12px rgba(155, 123, 184, 0.1);
}

.category-header {
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--theme-border);
}

.category-header h3 {
  font-size: 1.25rem;
  color: var(--theme-text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}

.category-header h3 i {
  color: var(--theme-primary);
  font-size: 1.1rem;
}

/* Carousel Container */
.carousel-container {
  position: relative;
  overflow: hidden;
}

.gallery-grid {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 0.5rem 0;
  /* Performance optimizations */
  contain: layout style;
  will-change: scroll-position;
}

.gallery-grid::-webkit-scrollbar {
  display: none;
}

/* Carousel Navigation */
.carousel-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--theme-primary);
  color: white;
  border: none;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  transition: all 0.2s ease;
}

.carousel-nav:hover {
  background: var(--theme-hover);
  transform: translateY(-50%) scale(1.1);
}

.carousel-nav.prev {
  left: 0;
}

.carousel-nav.next {
  right: 0;
}

.carousel-nav:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.gallery-item {
  flex: 0 0 140px;
  height: 105px;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(155, 123, 184, 0.15);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  background: linear-gradient(135deg, #e8daf0 0%, #d4c4e8 100%);
  /* Performance optimizations */
  contain: layout style paint;
  will-change: transform;
  position: relative;
}

/* Skeleton loading animation */
.gallery-item.loading {
  overflow: hidden;
}

.gallery-item.loading::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.4),
    transparent
  );
  animation: skeleton-shimmer 1.5s infinite;
  z-index: 1;
}

@keyframes skeleton-shimmer {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

/* Loaded state - fade in the image */
.gallery-item.loaded img {
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.gallery-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 30px rgba(155, 123, 184, 0.25);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
  /* Performance optimizations */
  will-change: transform;
  backface-visibility: hidden;
  transform: translateZ(0);
  image-rendering: -webkit-optimize-contrast;
}

.gallery-item:hover img {
  transform: scale(1.08);
}

.gallery-item::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(74, 58, 90, 0.4) 0%, transparent 50%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.gallery-item:hover::after {
  opacity: 1;
}

/* Lightbox */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.lightbox.active {
  display: flex;
  opacity: 1;
}

.lightbox-content {
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.lightbox-content img {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  transition: opacity 0.3s ease;
}

/* Loading spinner for lightbox */
.lightbox-content::before {
  content: '';
  position: absolute;
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--theme-primary, #9b7bb8);
  border-radius: 50%;
  animation: lightbox-spin 0.8s linear infinite;
  z-index: -1;
}

@keyframes lightbox-spin {
  to {
    transform: rotate(360deg);
  }
}

.lightbox-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  font-size: 2.5rem;
  color: white;
  background: none;
  border: none;
  cursor: pointer;
  transition: transform 0.2s ease;
  z-index: 10001;
}

.lightbox-close:hover {
  transform: scale(1.2);
}

.lightbox-prev,
.lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.5rem;
  color: white;
  background: rgba(155, 123, 184, 0.6);
  border: none;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 10001;
}

.lightbox-prev {
  left: 1.5rem;
}

.lightbox-next {
  right: 1.5rem;
}

.lightbox-prev:hover,
.lightbox-next:hover {
  background: var(--theme-primary);
  transform: translateY(-50%) scale(1.1);
}

/* Container */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* Footer styling for gallery page */
.page-gallery .site-footer {
  background: var(--theme-text);
}

.page-gallery .site-footer h4 {
  color: var(--theme-light);
}

.page-gallery .site-footer a:hover {
  color: var(--theme-light);
}

.page-gallery .social-links a:hover {
  background: var(--theme-primary);
}

/* Responsive Design */
@media (max-width: 992px) {
  .gallery-item {
    flex: 0 0 130px;
    height: 95px;
  }
  
  .year-title {
    font-size: 2rem;
  }
  
  .category-header h3 {
    font-size: 1.1rem;
  }
  
  .carousel-nav {
    width: 32px;
    height: 32px;
  }
}

@media (max-width: 768px) {
  .gallery-item {
    flex: 0 0 110px;
    height: 82px;
    border-radius: 6px;
  }
  
  .year-title {
    font-size: 1.75rem;
  }
  
  .gallery-year-section {
    padding: 1.5rem 0 2rem;
  }
  
  .gallery-category {
    margin-bottom: 1.5rem;
    padding: 1rem;
  }
  
  .lightbox-prev,
  .lightbox-next {
    width: 40px;
    height: 40px;
    font-size: 1.25rem;
  }
  
  .year-tab {
    padding: 0.5rem 1.5rem;
    font-size: 1rem;
  }
  
  .carousel-nav {
    width: 28px;
    height: 28px;
    font-size: 0.85rem;
  }
}

@media (max-width: 480px) {
  .gallery-item {
    flex: 0 0 90px;
    height: 68px;
    border-radius: 4px;
  }
  
  .gallery-category {
    padding: 0.75rem;
    border-radius: 12px;
  }
  
  .category-header h3 {
    font-size: 1rem;
  }
  
  .container {
    padding: 0 1rem;
  }
}

/* Footer styles */
.page-gallery .site-footer {
  background: var(--theme-dark);
}
.page-gallery .footer-section h4 {
  color: var(--theme-light);
}
.page-gallery .footer-section p i {
  color: var(--theme-light);
}
.page-gallery .footer-section ul a:hover {
  color: var(--theme-light);
}
.page-gallery .footer-bottom {
  border-top-color: rgba(196, 168, 216, 0.2);
}
/* Photographer Credit */
.photographer-credit {
  text-align: center;
  padding: 2rem 0;
  background: var(--theme-bg);
}

.photographer-credit p {
  font-size: 0.95rem;
  color: var(--theme-text);
  margin: 0;
}

.photographer-credit a {
  color: var(--theme-primary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.photographer-credit a:hover {
  color: var(--theme-hover);
  text-decoration: underline;
}