/* ========================================
   GALLERY SYSTEM - Image-Rich Experience
   Compact, responsive galleries for all pages
   ======================================== */

/* === BASE GALLERY CONTAINER === */
.gallery-section {
  padding: clamp(3rem, 8vw, 6rem) 2rem;
  background: var(--light-bg);
  position: relative;
}

.gallery-section.dark {
  background: var(--gradient-abyss);
}

.gallery-header {
  text-align: center;
  margin-bottom: 3rem;
}

.gallery-title {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 900;
  color: var(--brand-primary);
  margin-bottom: 1rem;
  font-family: var(--title-font);
  line-height: 1.2;
}

.gallery-section.dark .gallery-title {
  color: white;
}

.gallery-subtitle {
  font-size: 1.125rem;
  color: #6b7280;
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.6;
}

.gallery-section.dark .gallery-subtitle {
  color: rgba(255, 255, 255, 0.8);
}

/* === GALLERY GRID LAYOUTS === */

/* 3-Column Gallery (Destination, Vessel) */
.gallery-grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 350px));
  gap: 1.25rem;
  justify-content: center;
  margin: 0 auto;
  max-width: 1200px;
}

/* 2-Column Gallery (Disciplines) */
.gallery-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  max-width: 750px;
  margin: 0 auto;
}

/* 4-Column Masonry Gallery (Trophy) */
.gallery-masonry {
  column-count: 4;
  column-gap: 1rem;
  margin: 0 auto;
  max-width: 1400px;
}

/* Team Grid (2-column portraits) */
.gallery-team {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 3rem;
  max-width: 900px;
  margin: 3rem auto;
}

/* === GALLERY ITEM STYLING === */

/* Standard thumbnail */
.gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: #f3f3f3;
}

.gallery-item:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

/* Aspect ratios */
.gallery-item.ratio-4-3 {
  aspect-ratio: 4/3;
}

.gallery-item.ratio-1-1 {
  aspect-ratio: 1/1;
}

.gallery-item.ratio-3-4 {
  aspect-ratio: 3/4;
}

/* Image styling */
.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

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

/* === HOVER OVERLAY EFFECTS === */

/* Dark gradient overlay */
.gallery-item::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(0, 73, 182, 0.4), rgba(15, 169, 232, 0.4));
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 1;
  pointer-events: none;
}

.gallery-item:hover::before {
  opacity: 1;
}

/* Zoom icon indicator */
.gallery-item::after {
  content: '🔍';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  font-size: 2.5rem;
  z-index: 2;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.gallery-item:hover::after {
  transform: translate(-50%, -50%) scale(1);
}

/* === CAPTION OVERLAY === */

.gallery-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.85), transparent);
  color: white;
  padding: 1rem;
  transform: translateY(100%);
  transition: transform 0.3s ease;
  z-index: 2;
}

.gallery-item:hover .gallery-caption {
  transform: translateY(0);
}

.gallery-caption-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.gallery-caption-detail {
  font-size: 0.85rem;
  opacity: 0.9;
  line-height: 1.4;
}

/* === CATEGORY BADGE === */

.gallery-badge {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: rgba(181, 1, 1, 0.95);
  color: white;
  padding: 0.35rem 0.85rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  z-index: 2;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.gallery-badge.blue {
  background: rgba(0, 73, 182, 0.95);
}

.gallery-badge.cyan {
  background: rgba(15, 169, 232, 0.95);
}

.gallery-badge.gold {
  background: rgba(255, 184, 0, 0.95);
  color: #231F20;
}

/* === MASONRY SPECIFIC === */

.gallery-masonry-item {
  break-inside: avoid;
  margin-bottom: 1rem;
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.3s ease;
  display: block;
}

.gallery-masonry-item:hover {
  transform: translateY(-4px);
}

.gallery-masonry-item img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
}

/* === TEAM MEMBER CARDS === */

.team-member-card {
  text-align: center;
  background: white;
  padding: 2rem;
  border-radius: 16px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
}

.team-member-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
}

.team-portrait {
  width: 280px;
  height: 350px;
  border-radius: 12px;
  overflow: hidden;
  margin: 0 auto 1.5rem;
  border: 4px solid var(--brand-cyan);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.team-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.team-member-card:hover .team-portrait img {
  transform: scale(1.08);
}

.team-name {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--brand-primary);
  margin-bottom: 0.5rem;
}

.team-role {
  font-size: 1rem;
  color: #0fa9e8;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 1rem;
  font-weight: 600;
}

.team-bio {
  font-size: 0.95rem;
  line-height: 1.7;
  color: #4b5563;
  max-width: 400px;
  margin: 0 auto;
}

/* === LOADING STATE === */

.gallery-item.loading,
.gallery-masonry-item.loading {
  background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

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

.gallery-item img[data-src],
.gallery-masonry-item img[data-src] {
  opacity: 0;
  transition: opacity 0.3s ease;
}

.gallery-item img.loaded,
.gallery-masonry-item img.loaded {
  opacity: 1;
}

/* === LIGHTBOX MODAL === */

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(10, 22, 40, 0.97);
  backdrop-filter: blur(10px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.lightbox.active {
  opacity: 1;
  pointer-events: auto;
}

.lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  animation: lightboxZoom 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes lightboxZoom {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.lightbox-image {
  max-width: 100%;
  max-height: 90vh;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  display: block;
}

.lightbox-info {
  position: absolute;
  bottom: -4rem;
  left: 0;
  right: 0;
  text-align: center;
  color: white;
}

.lightbox-caption-title {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.lightbox-caption-detail {
  font-size: 0.95rem;
  opacity: 0.9;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.lightbox-counter {
  position: absolute;
  top: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  color: white;
  padding: 0.5rem 1.25rem;
  border-radius: 50px;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.05em;
}

/* Lightbox controls */
.lightbox-close {
  position: absolute;
  top: 2rem;
  right: 2rem;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  color: white;
  border: none;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  font-size: 1.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  color: white;
  border: none;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  font-size: 1.75rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
}

.lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-50%) scale(1.1);
}

.lightbox-nav:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.lightbox-prev {
  left: 2rem;
}

.lightbox-next {
  right: 2rem;
}

/* === RESPONSIVE DESIGN === */

/* Large Desktop */
@media (min-width: 1400px) {
  .gallery-grid-3 {
    grid-template-columns: repeat(3, 350px);
  }
}

/* Desktop */
@media (min-width: 1024px) and (max-width: 1399px) {
  .gallery-grid-3 {
    grid-template-columns: repeat(3, 1fr);
  }

  .gallery-masonry {
    column-count: 4;
  }
}

/* Tablet */
@media (min-width: 768px) and (max-width: 1023px) {
  .gallery-grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }

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

  .gallery-masonry {
    column-count: 3;
  }

  .gallery-team {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .team-portrait {
    width: 240px;
    height: 300px;
  }
}

/* Mobile */
@media (max-width: 767px) {
  .gallery-section {
    padding: clamp(2rem, 6vw, 3rem) 1.5rem;
  }

  .gallery-header {
    margin-bottom: 2rem;
  }

  .gallery-grid-3,
  .gallery-grid-2 {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .gallery-masonry {
    column-count: 2;
  }

  .gallery-team {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .team-portrait {
    width: 220px;
    height: 280px;
  }

  /* Lightbox adjustments */
  .lightbox-close {
    top: 1rem;
    right: 1rem;
    width: 44px;
    height: 44px;
  }

  .lightbox-nav {
    width: 48px;
    height: 48px;
    font-size: 1.5rem;
  }

  .lightbox-prev {
    left: 1rem;
  }

  .lightbox-next {
    right: 1rem;
  }

  .lightbox-counter {
    top: 1rem;
    font-size: 0.8rem;
    padding: 0.4rem 1rem;
  }

  .lightbox-info {
    bottom: -3rem;
  }

  /* Remove hover effects on mobile */
  .gallery-item::after {
    display: none;
  }

  .gallery-caption {
    transform: translateY(0);
    background: linear-gradient(to top, rgba(0, 0, 0, 0.75), transparent);
  }
}

/* Small Mobile */
@media (max-width: 480px) {
  .gallery-masonry {
    column-count: 1;
  }

  .gallery-badge {
    font-size: 0.7rem;
    padding: 0.3rem 0.7rem;
  }
}

/* === PRINT STYLES === */
@media print {
  .lightbox,
  .gallery-badge {
    display: none;
  }

  .gallery-item {
    page-break-inside: avoid;
  }
}

/* === ACCESSIBILITY === */

/* Focus styles for keyboard navigation */
.gallery-item:focus-visible,
.lightbox-close:focus-visible,
.lightbox-nav:focus-visible {
  outline: 3px solid var(--brand-cyan);
  outline-offset: 4px;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  .gallery-item,
  .gallery-masonry-item,
  .lightbox,
  .lightbox-content {
    animation: none;
    transition: none;
  }

  .gallery-item:hover img {
    transform: none;
  }
}

/* === UTILITY CLASSES === */

.gallery-load-more {
  text-align: center;
  margin-top: 3rem;
}

.gallery-load-more-btn {
  background: var(--gradient-ocean);
  color: white;
  border: none;
  padding: 1rem 2.5rem;
  border-radius: 50px;
  font-weight: 700;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 6px 20px rgba(0, 73, 182, 0.3);
}

.gallery-load-more-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(0, 73, 182, 0.4);
}

.gallery-load-more-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* No images state */
.gallery-empty {
  text-align: center;
  padding: 4rem 2rem;
  color: #9ca3af;
}

.gallery-empty-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.gallery-empty-text {
  font-size: 1.125rem;
  font-weight: 600;
}
