/* Gallery Style Controls */
.gallery-style-controls {
  background: var(--white);
  padding: 2rem 0;
  border-bottom: 1px solid var(--light-gray);
  position: fixed;
  top: 140px; /* Below gallery navigation */
  left: 0;
  right: 0;
  width: 100%;
  z-index: 9000;
}

.style-controls-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  justify-content: center;
  gap: 1rem;
}

.gallery-style-btn {
  background: var(--white);
  border: 2px solid var(--soft-gold);
  color: var(--deep-green);
  padding: 0.75rem 1.5rem;
  border-radius: 25px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
}

.gallery-style-btn:hover {
  background: var(--soft-gold);
  color: var(--white);
  transform: translateY(-2px);
}

.gallery-style-btn.active {
  background: var(--soft-gold);
  color: var(--white);
}

.gallery-style-btn i {
  font-size: 1rem;
}

/* Gallery Specific Styles */
.gallery-page-header {
  background: var(--white);
  padding: 4rem 0 2rem;
  text-align: center;
}

.gallery-page-header h1 {
  color: var(--deep-green);
  font-size: var(--font-header-xl);
  margin-bottom: 1rem;
}

.gallery-page-header p {
  font-size: var(--font-subheader);
  color: var(--light-gray);
  max-width: 600px;
  margin: 0 auto;
}

/* Gallery Breadcrumb (Mobile Only) */
.gallery-breadcrumb-mobile {
  display: none; /* Hidden by default, shown only on mobile */
  background: var(--white);
  padding: 1rem 0;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.1);
  border-bottom: 1px solid var(--light-gray);
  position: fixed;
  top: 80px; /* Position below main nav */
  left: 0;
  right: 0;
  width: 100%;
  z-index: 9400; /* Below gallery nav but above content */
}

.gallery-breadcrumb-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

.gallery-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--font-body-sm);
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
}

.gallery-breadcrumb::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

.gallery-breadcrumb .breadcrumb-link {
  color: var(--soft-gold);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: var(--transition);
  flex-shrink: 0;
}

.gallery-breadcrumb .breadcrumb-link:hover {
  color: var(--deep-green);
}

.gallery-breadcrumb .breadcrumb-separator {
  color: var(--light-gray);
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

.gallery-breadcrumb .breadcrumb-current {
  color: var(--deep-green);
  font-weight: var(--font-medium);
  flex-shrink: 0;
}

.gallery-breadcrumb .breadcrumb-icon {
  width: 14px;
  height: 14px;
}

/* Gallery Navigation in Header - Fixed Position */
.gallery-navigation-header {
  background: var(--white);
  padding: 2rem 0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  border-bottom: 2px solid var(--soft-gold);
  position: fixed;
  top: 80px; /* Position below main nav */
  left: 0;
  right: 0;
  width: 100%;
  z-index: 9500; /* Lower than main nav (10000) but higher than content */
}

.gallery-nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  position: relative;
}

/* Add fade indicators for mobile horizontal scroll - hidden by default */
.gallery-nav-container::before,
.gallery-nav-container::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 20px;
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.gallery-nav-container::before {
  left: 0;
  background: linear-gradient(to right, var(--white), transparent);
  opacity: var(--fade-left, 0);
}

.gallery-nav-container::after {
  right: 0;
  background: linear-gradient(to left, var(--white), transparent);
  opacity: var(--fade-right, 0);
}

.gallery-nav-tabs {
  display: flex;
  justify-content: center;
  gap: 2rem;
  padding: 0.2rem;
  flex-wrap: nowrap; 
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none; 
  -ms-overflow-style: none;
}

.gallery-nav-tabs::-webkit-scrollbar {
  display: none; 
}

.gallery-nav-tab {
  padding: 0.75rem 1.25rem;
  background: transparent;
  border: 2px solid var(--soft-gold);
  color: var(--deep-green);
  font-weight: var(--font-medium);
  font-size: var(--font-body-lg);
  cursor: pointer;
  transition: var(--transition);
  border-radius: 50px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-align: -webkit-center;
  align-content: space-around;
}

.gallery-nav-tab:hover,
.gallery-nav-tab.active {
  background: var(--soft-gold);
  color: var(--white);
  transform: translateY(2px);
}

/* Gallery page styles */
body.gallery-page {
  background: var(--white); /* Clean white background */
  padding-top: 500px; /* Increased padding to clear style controls too */
}

/* Gallery Sections */
.gallery-section {
  padding: 4rem 2rem;
  background: var(--white);
  width: 100%;
}

/* First gallery section - reduce excessive gap */
.gallery-section:first-of-type {
  margin-top: -320px; /* Pull up to reduce the gap, leaving 30px breathing room */
}

/* Add scroll margin to all gallery sections for consistent navigation spacing */
.gallery-section {
  scroll-margin-top: 150px; /* Account for fixed nav (80px) + gallery nav (60px) */
}

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

.gallery-section h2 {
  font-size: var(--font-header-lg);
  color: var(--deep-green);
  margin-bottom: 1rem;
}

.gallery-section p {
  font-size: var(--font-body-lg);
  color: var(--light-gray);
  max-width: 600px;
  margin: 0 auto;
}

/* 3x3 Gallery Grid System with 4:3 Aspect Ratio */
.gallery-style-grid .gallery-grid,
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr); /* 3 columns */
  gap: 1rem;
  margin: 1rem auto 0;
  max-width: 900px;
}

/* Calculate 4:3 aspect ratio for grid items */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin: 1rem auto 0.s;
  max-width: 900px;
}

/* Gallery items with 4:3 aspect ratio */
.gallery-item {
  aspect-ratio: 4 / 3; /* 4:3 aspect ratio */
  width: 100%;
  height: auto;
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
  background: var(--off-white);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

/* Hero Image System - Flexible 2x2 or 3x2 with 4:3 ratio */
.gallery-item.hero,
.gallery-item.hero-image {
  aspect-ratio: 4 / 3; /* Maintain 4:3 aspect ratio for heroes too */
  height: auto;
}

/* TOP POSITIONING - Default 3x2 (full width) when no left/right specified */
.gallery-grid.hero-top:not(.hero-left):not(.hero-right) .gallery-item.hero,
.gallery-item.hero.hero-top:not(.hero-left):not(.hero-right) {
  grid-column: 1 / 4; /* Full width (3x2) */
  grid-row: 1 / 3; /* Top rows */
}

/* TOP + LEFT - 2x2 positioned on left */
.gallery-grid.hero-top.hero-left .gallery-item.hero,
.gallery-item.hero.hero-top.hero-left {
  grid-column: 1 / 3; /* Left columns (2x2) */
  grid-row: 1 / 3; /* Top rows */
}

/* TOP + RIGHT - 2x2 positioned on right */
.gallery-grid.hero-top.hero-right .gallery-item.hero,
.gallery-item.hero.hero-top.hero-right {
  grid-column: 2 / 4; /* Right columns (2x2) */
  grid-row: 1 / 3; /* Top rows */
}

/* BOTTOM POSITIONING - Default 3x2 (full width) when no left/right specified */
.gallery-grid.hero-bottom:not(.hero-left):not(.hero-right) .gallery-item.hero,
.gallery-item.hero.hero-bottom:not(.hero-left):not(.hero-right) {
  grid-column: 1 / 4; /* Full width (3x2) */
  grid-row: 2 / 4; /* Bottom rows */
}

/* BOTTOM + LEFT - 2x2 positioned on left */
.gallery-grid.hero-bottom.hero-left .gallery-item.hero,
.gallery-item.hero.hero-bottom.hero-left {
  grid-column: 1 / 3; /* Left columns (2x2) */
  grid-row: 2 / 4; /* Bottom rows */
}

/* BOTTOM + RIGHT - 2x2 positioned on right */
.gallery-grid.hero-bottom.hero-right .gallery-item.hero,
.gallery-item.hero.hero-bottom.hero-right {
  grid-column: 2 / 4; /* Right columns (2x2) */
  grid-row: 2 / 4; /* Bottom rows */
}

/* 6-IMAGE SPECIFIC LAYOUTS */
/* Normal 6-image layout: Hero (A) in middle-left 2x2 */
.gallery-grid.six-images.hero-middle-left .gallery-item.hero {
  grid-column: 1 / 3; /* Left 2 columns */
  grid-row: 2 / 4; /* Middle and bottom rows */
}

/* Reversed 6-image layout: Hero (A) in middle-right 2x2 */
.gallery-grid.six-images.hero-middle-right .gallery-item.hero {
  grid-column: 2 / 4; /* Right 2 columns */
  grid-row: 2 / 4; /* Middle and bottom rows */
}

/* Specific positioning for 6-image normal layout */
.gallery-grid.six-images.hero-middle-left .gallery-item:nth-child(1) {
  /* B */
  grid-column: 1 / 2;
  grid-row: 1 / 2;
}

.gallery-grid.six-images.hero-middle-left .gallery-item:nth-child(2) {
  /* C */
  grid-column: 2 / 3;
  grid-row: 1 / 2;
}

.gallery-grid.six-images.hero-middle-left .gallery-item:nth-child(3) {
  /* D */
  grid-column: 3 / 4;
  grid-row: 1 / 2;
}

.gallery-grid.six-images.hero-middle-left .gallery-item:nth-child(4).hero {
  /* A - Hero */
  grid-column: 1 / 3;
  grid-row: 2 / 4;
}

.gallery-grid.six-images.hero-middle-left .gallery-item:nth-child(5) {
  /* E */
  grid-column: 3 / 4;
  grid-row: 2 / 3;
}

.gallery-grid.six-images.hero-middle-left .gallery-item:nth-child(6) {
  /* F */
  grid-column: 3 / 4;
  grid-row: 3 / 4;
}

/* Specific positioning for 6-image reversed layout */
.gallery-grid.six-images.hero-middle-right .gallery-item:nth-child(1) {
  /* D */
  grid-column: 1 / 2;
  grid-row: 1 / 2;
}

.gallery-grid.six-images.hero-middle-right .gallery-item:nth-child(2) {
  /* E */
  grid-column: 2 / 3;
  grid-row: 1 / 2;
}

.gallery-grid.six-images.hero-middle-right .gallery-item:nth-child(3) {
  /* F */
  grid-column: 3 / 4;
  grid-row: 1 / 2;
}

.gallery-grid.six-images.hero-middle-right .gallery-item:nth-child(4) {
  /* C */
  grid-column: 1 / 2;
  grid-row: 2 / 3;
}

.gallery-grid.six-images.hero-middle-right .gallery-item:nth-child(5) {
  /* B */
  grid-column: 1 / 2;
  grid-row: 3 / 4;
}

.gallery-grid.six-images.hero-middle-right .gallery-item:nth-child(6).hero {
  /* A - Hero */
  grid-column: 2 / 4;
  grid-row: 2 / 4;
}

/* Single item full size (3x3) */
.gallery-grid.single-item-full .gallery-item.hero {
  grid-column: 1 / 4; /* Full width (all 3 columns) */
  grid-row: 1 / 4; /* Full height (all 3 rows) */
}

/* Centered layouts for small item counts without big/little style */
/* Single item centered - middle position in 3x3 grid */
.gallery-grid.centered-single {
  grid-template-columns: 1fr 1fr 1fr !important; /* Force 3x3 grid */
  grid-template-rows: 1fr 1fr 1fr !important;
  display: grid !important;
  gap: 1rem;
}

.gallery-grid.centered-single .gallery-item {
  grid-column: 2 / 3 !important; /* Force center column (col 2 of 3) */
  grid-row: 2 / 3 !important; /* Force center row */
}

/* Ensure no other positioning overrides this */
.gallery-grid.centered-single .gallery-item:not(.hero) {
  grid-column: 2 / 3 !important;
  grid-row: 1 / 3 !important;
}

/* Big/little style with 3x3 for 1-2 items */
.gallery-grid.big-little-single .gallery-item.hero {
  grid-column: 1 / 4; /* Full width (3x3) */
  grid-row: 1 / 4; /* Full height (3x3) */
}

/* DEFAULT - If no positioning specified, default to top full width */
.gallery-item.hero:not(.hero-top):not(.hero-bottom) {
  grid-column: 1 / 4; /* Full width (3x2) */
  grid-row: 1 / 3; /* Top rows */
}

/* Regular items - 1x1 cell with 4:3 aspect ratio */
.gallery-item:not(.hero):not(.hero-image) {
  grid-column: span 1;
  grid-row: span 1;
  aspect-ratio: 4 / 3; /* 4:3 aspect ratio */
}

/* Reversed layout without big-little style - fill from right to left */
.gallery-grid[data-reversed="true"][data-big-little="false"]
  .gallery-item:nth-child(1) {
  grid-column: 3; /* Right column */
  grid-row: 1;
}

.gallery-grid[data-reversed="true"][data-big-little="false"]
  .gallery-item:nth-child(2) {
  grid-column: 2; /* Middle column */
  grid-row: 1;
}

.gallery-grid[data-reversed="true"][data-big-little="false"]
  .gallery-item:nth-child(3) {
  grid-column: 1; /* Left column */
  grid-row: 1;
}

/* For 4+ items, continue filling from right to left, then next row */
.gallery-grid[data-reversed="true"][data-big-little="false"]
  .gallery-item:nth-child(4) {
  grid-column: 3;
  grid-row: 2;
}

.gallery-grid[data-reversed="true"][data-big-little="false"]
  .gallery-item:nth-child(5) {
  grid-column: 2;
  grid-row: 2;
}

.gallery-grid[data-reversed="true"][data-big-little="false"]
  .gallery-item:nth-child(6) {
  grid-column: 1;
  grid-row: 2;
}

.gallery-grid[data-reversed="true"][data-big-little="false"]
  .gallery-item:nth-child(7) {
  grid-column: 3;
  grid-row: 3;
}

.gallery-grid[data-reversed="true"][data-big-little="false"]
  .gallery-item:nth-child(8) {
  grid-column: 2;
  grid-row: 3;
}

.gallery-grid[data-reversed="true"][data-big-little="false"]
  .gallery-item:nth-child(9) {
  grid-column: 1;
  grid-row: 3;
}

/* Horizontal Scroll Style */
.gallery-style-horizontal .gallery-grid {
  display: flex;
  overflow-x: auto;
  gap: 1.5rem;
  padding: 1rem 0;
  margin: 2rem 0;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--soft-gold) var(--light-gray);
}

.gallery-style-horizontal .gallery-grid::-webkit-scrollbar {
  height: 8px;
}

.gallery-style-horizontal .gallery-grid::-webkit-scrollbar-track {
  background: var(--light-gray);
  border-radius: 4px;
}

.gallery-style-horizontal .gallery-grid::-webkit-scrollbar-thumb {
  background: var(--soft-gold);
  border-radius: 4px;
}

.gallery-style-horizontal .gallery-item {
  flex: 0 0 300px;
  aspect-ratio: 4 / 3; /* 4:3 aspect ratio for horizontal scroll */
  height: auto;
}

.gallery-style-horizontal .gallery-item img,
.gallery-style-horizontal .gallery-item video {
  height: 100%;
  width: 100%;
  object-fit: cover; /* Fill container completely */
}

/* Styled Image Layout - Horizontal arrangement */
.gallery-style-styled .gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, 300px); /* Regular row height */
  gap: 1rem;
  margin: 2rem auto 0;
  max-width: 1400px;
}

/* Hero image takes up 2x1 space (top row) */
.gallery-style-styled .gallery-item.hero-image {
  grid-column: 1 / 3;
  grid-row: 1 / 2;
  height: 400px; /* Taller height for hero */
}

/* Large images take up 2x1 space */
.gallery-style-styled .gallery-item[data-size="large"] {
  grid-column: span 2;
  grid-row: span 1;
  height: 400px; /* Taller height for large */
}

/* Medium images take up 1x1 space */
.gallery-style-styled .gallery-item[data-size="medium"] {
  grid-column: span 1;
  grid-row: span 1;
  height: 300px; /* Regular height for medium */
}

/* Small images take up 1x1 space */
.gallery-style-styled .gallery-item[data-size="small"] {
  grid-column: span 1;
  grid-row: span 1;
  height: 300px; /* Regular height for small */
}

/* Specific positioning for styled layout - Horizontal arrangement */
.gallery-style-styled .gallery-item:nth-child(1) {
  grid-column: 1 / 3;
  grid-row: 1 / 2;
}

.gallery-style-styled .gallery-item:nth-child(2) {
  grid-column: 3 / 4;
  grid-row: 1 / 2;
}

.gallery-style-styled .gallery-item:nth-child(3) {
  grid-column: 1 / 2;
  grid-row: 2 / 3;
}

.gallery-style-styled .gallery-item:nth-child(4) {
  grid-column: 2 / 3;
  grid-row: 2 / 3;
}

.gallery-style-styled .gallery-item:nth-child(5) {
  grid-column: 3 / 4;
  grid-row: 2 / 3;
}

.gallery-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.gallery-item img,
.gallery-item video {
  width: 100%;
  height: 100%;
  object-fit: cover; /* Always cover the box fully */
  transition: var(--transition);
  opacity: 0;
  transform: scale(1.1);
  border-radius: 10px; /* Match container border radius */
}

/* Ensure hero images and videos also cover fully */
.gallery-item.hero img,
.gallery-item.hero video,
.gallery-item.hero-image img,
.gallery-item.hero-image video {
  width: 100%;
  height: 100%;
  object-fit: cover; /* Always cover the box fully */
}

.gallery-item img.loaded,
.gallery-item video.loaded {
  opacity: 1;
  transform: scale(1);
}

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

.gallery-item-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to top, rgba(1, 68, 33, 0.7) 0%, transparent 60%);
  display: flex;
  align-items: flex-end;
  padding: 1rem;
  opacity: 0;
  transition: var(--transition);
}

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

/* Hide overlay completely if info is empty */
.gallery-item-overlay:has(.gallery-item-info h3:empty) {
  display: none;
}

.gallery-item-info h3 {
  color: var(--white);
  font-size: var(--font-body-md);
  margin-bottom: 0.25rem;
  line-height: 1.3;
}

/* Hide empty titles */
.gallery-item-info h3:empty {
  display: none;
}

.gallery-item-info p {
  color: rgba(255, 255, 255, 0.9);
  font-size: var(--font-body-sm);
  line-height: 1.4;
}

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

/* Video specific styles - Hide controls in gallery */
.gallery-item video {
  /* Ensure video doesn't show controls in gallery */
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  /* Prevent video from being selected */
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  /* Note: playsinline is an HTML attribute, not a CSS property */
}

/* Hide video controls in gallery items only */
.gallery-item video::-webkit-media-controls {
  display: none !important;
}

.gallery-item video::-webkit-media-controls-panel {
  display: none !important;
}

/* Error states */
.gallery-item.error {
  background: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-item-error {
  text-align: center;
  color: #666;
  padding: 2rem;
}

.gallery-item-error .error-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.gallery-item-error .error-text {
  font-size: 0.9rem;
  opacity: 0.8;
}

/* Ensure lightbox video has controls and proper styling */
#lightbox-video {
  max-width: 100vw !important;
  max-height: 100vh !important;
  width: auto !important;
  height: auto !important;
  object-fit: contain !important;
  outline: none;
  background: #000;
  -webkit-appearance: initial !important;
  -moz-appearance: initial !important;
  appearance: initial !important;
  user-select: initial !important;
  -webkit-user-select: initial !important;
  -moz-user-select: initial !important;
}

/* Force show video controls in lightbox */
#lightbox-video::-webkit-media-controls {
  display: flex !important;
  opacity: 1 !important;
  visibility: visible !important;
}

#lightbox-video::-webkit-media-controls-panel {
  display: flex !important;
  opacity: 1 !important;
  visibility: visible !important;
}

#lightbox-video::-webkit-media-controls-play-button,
#lightbox-video::-webkit-media-controls-timeline,
#lightbox-video::-webkit-media-controls-volume-slider,
#lightbox-video::-webkit-media-controls-mute-button,
#lightbox-video::-webkit-media-controls-fullscreen-button {
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
}

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

/* Responsive Design */
@media (max-width: 1170px) {
  .gallery-nav-tabs {
    gap: 1.5rem; /* Reduce gap slightly */
  }

  .gallery-nav-tab {
    padding: 0.9rem 1.8rem; /* Slightly smaller padding */
    font-size: 0.95rem; /* Slightly smaller font */
  }
}

@media (max-width: 1024px) {
  .gallery-nav-tabs {
    gap: 1.2rem; /* Further reduce gap */
  }

  .gallery-nav-tab {
    padding: 0.8rem 1.5rem; /* Smaller padding */
    font-size: 0.9rem; /* Smaller font */
  }
}

@media (max-width: 920px) {
  .gallery-nav-container {
    padding: 0 1.5rem; /* Reduce container padding */
  }

  .gallery-nav-tabs {
    gap: 1rem; /* Further reduce gap */
    justify-content: center; /* Keep centered */
  }

  .gallery-nav-tab {
    padding: 0.7rem 1.3rem; /* Smaller padding */
    font-size: 0.85rem; /* Smaller font */
  }
}

@media (max-width: 850px) {
  .gallery-nav-container {
    padding: 0 0.5rem; /* Minimal container padding */
    max-width: 100%; /* Use full width */
  }

  .gallery-nav-tabs {
    gap: 0.6rem; /* Smaller gap */
    justify-content: center; /* Keep centered */
  }

  .gallery-nav-tab {
    padding: 0.5rem 1rem; /* Smaller padding */
    font-size: 0.75rem; /* Smaller font */
  }
}

@media (max-width: 830px) {
  .gallery-nav-container {
    padding: 0 0.25rem; /* Very minimal container padding */
  }

  .gallery-nav-tabs {
    gap: 0.5rem; /* Very small gap */
    justify-content: center; /* Keep centered */
  }

  .gallery-nav-tab {
    padding: 0.4rem 0.8rem; /* Very small padding */
    font-size: 0.7rem; /* Very small font */
  }
}

@media (max-width: 770px) {
  .gallery-nav-container {
    padding: 0 1rem; /* Further reduce container padding */
  }

  .gallery-nav-tabs {
    gap: 0.8rem; /* Even smaller gap */
    justify-content: flex-start; /* Start from left for horizontal scroll */
  }

  .gallery-nav-tab {
    padding: 0.6rem 1.2rem; /* Smaller padding */
    font-size: 0.8rem; /* Smaller font */
  }
}

@media (max-width: 768px) {
  body.gallery-page {
    padding-top: 420px; /* Increased for mobile with style controls */
  }

  /* Show breadcrumb on mobile */
  .gallery-breadcrumb-mobile {
    display: block;
    top: 60px; /* Position below main nav on mobile */
  }

  .gallery-style-controls {
    top: 100px; /* Adjust for smaller main nav on mobile */
    padding: 1rem 0;
  }

  .style-controls-container {
    padding: 0 1rem;
    gap: 0.5rem;
  }

  .gallery-style-btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
  }

  .gallery-style-btn span {
    display: none; /* Hide text on mobile, show only icons */
  }

  .gallery-navigation-header {
    padding: 1.5rem 0; /* Increase top padding to clear main nav */
    top: 60px; /* Position directly below main nav */
    border-top: none; /* Remove top border */
    box-shadow: none; /* Remove shadow to connect seamlessly */
  }

  .gallery-nav-container {
    padding: 0 1rem; /* Horizontal padding only */
  }

  /* Enable fade indicators on mobile - opacity controlled by JavaScript */
  .gallery-nav-container::before,
  .gallery-nav-container::after {
    transition: opacity 0.3s ease;
  }

  .gallery-page-header {
    padding: 2rem 0;
  }

  .gallery-page-header h1 {
    font-size: 2.5rem;
  }

  .gallery-section:first-of-type {
    margin-top: -250px; /* Adjusted for increased mobile padding with 30px gap */
  }

  /* Mobile: Adjust scroll margin for fixed navs */
  .gallery-section {
    scroll-margin-top: 120px; /* Account for mobile fixed navs */
  }

  /* Mobile: Compact horizontal scroll to prevent blocking content */
  .gallery-style-grid .gallery-grid,
  .gallery-grid {
    display: flex;
    overflow-x: auto;
    gap: 0.75rem;
    padding: 0.5rem 1rem; /* Add horizontal padding for centering */
    margin: 0.5rem 0;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: var(--soft-gold) var(--light-gray);
    /* Remove grid layout */
    grid-template-columns: none;
    max-height: 200px; /* Limit height to prevent blocking */
    align-items: center; /* Center items vertically */
    justify-content: flex-start; /* Start from left but allow centering */
  }

  /* Webkit scrollbar styling - wider for mobile */
  .gallery-style-grid .gallery-grid::-webkit-scrollbar,
  .gallery-grid::-webkit-scrollbar {
    height: 12px; /* Wider scrollbar for better mobile usability */
  }

  .gallery-style-grid .gallery-grid::-webkit-scrollbar-track,
  .gallery-grid::-webkit-scrollbar-track {
    background: var(--light-gray);
    border-radius: 6px;
  }

  .gallery-style-grid .gallery-grid::-webkit-scrollbar-thumb,
  .gallery-grid::-webkit-scrollbar-thumb {
    background: var(--soft-gold);
    border-radius: 6px;
  }

  .gallery-style-grid .gallery-grid::-webkit-scrollbar-thumb:hover,
  .gallery-grid::-webkit-scrollbar-thumb:hover {
    background: var(--deep-green); /* Darker on hover */
  }

  /* Compact horizontal scroll items */
  .gallery-item.hero,
  .gallery-item.hero-image,
  .gallery-item.hero.hero-top,
  .gallery-item.hero.hero-bottom,
  .gallery-item.hero.hero-top.hero-left,
  .gallery-item.hero.hero-top.hero-right,
  .gallery-item.hero.hero-bottom.hero-left,
  .gallery-item.hero.hero-bottom.hero-right,
  .gallery-item.hero:not(.hero-top):not(.hero-bottom),
  .gallery-item:not(.hero):not(.hero-image) {
    flex: 0 0 200px; /* Compact width */
    aspect-ratio: 4 / 3; /* Maintain 4:3 aspect ratio */
    height: auto;
    max-height: 150px; /* Limit height */
    /* Remove grid positioning */
    grid-column: unset;
    grid-row: unset;
  }

  /* Responsive styled layout - also use compact horizontal scroll */
  .gallery-style-styled .gallery-grid {
    display: flex;
    overflow-x: auto;
    gap: 0.75rem;
    padding: 0.5rem 1rem; /* Add horizontal padding for centering */
    margin: 0.5rem 0;
    scroll-behavior: smooth;
    max-height: 200px; /* Limit height */
    align-items: center; /* Center items vertically */
    justify-content: flex-start; /* Start from left but allow centering */
    /* Remove grid layout */
    grid-template-columns: none;
    grid-template-rows: none;
  }

  .gallery-style-styled .gallery-item {
    flex: 0 0 200px; /* Compact width */
    aspect-ratio: 4 / 3; /* Maintain aspect ratio */
    height: auto;
    max-height: 150px; /* Limit height */
    /* Remove all grid positioning */
    grid-column: unset;
    grid-row: unset;
  }

  .gallery-nav-tabs {
    display: flex;
    overflow-x: auto;
    gap: 1rem;
    padding-bottom: 1rem;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: var(--soft-gold) var(--light-gray);
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    justify-content: flex-start; /* Start from left on mobile */
    flex-wrap: nowrap; /* Ensure single line */
  }

  /* Show scrollbar on mobile */
  .gallery-nav-tabs::-webkit-scrollbar {
    display: block;
    height: 8px;
  }

  .gallery-nav-tabs::-webkit-scrollbar-track {
    background: var(--light-gray);
    border-radius: 4px;
  }

  .gallery-nav-tabs::-webkit-scrollbar-thumb {
    background: var(--soft-gold);
    border-radius: 4px;
  }

  .gallery-nav-tabs::-webkit-scrollbar-thumb:hover {
    background: var(--deep-green);
  }

  .gallery-nav-tab {
    padding: 0.8rem 1.5rem;
    font-size: var(--font-body-md);
    white-space: nowrap;
    flex-shrink: 0; /* Prevent tabs from shrinking */
    min-width: fit-content; /* Ensure tabs don't get compressed */
  }
}

@media (max-width: 480px) {
  body.gallery-page {
    padding-top: 350px; /* Increased for small mobile with style controls */
  }

  /* Adjust breadcrumb for small mobile */
  .gallery-breadcrumb-mobile {
    top: 50px; /* Position below main nav on small mobile */
    padding: 0.75rem 0;
  }

  .gallery-breadcrumb-container {
    padding: 0 0.75rem;
  }

  .gallery-breadcrumb {
    font-size: 0.8rem;
    gap: 6px;
  }

  .gallery-breadcrumb .breadcrumb-icon {
    width: 12px;
    height: 12px;
  }

  .gallery-breadcrumb .breadcrumb-separator {
    width: 10px;
    height: 10px;
  }

  .gallery-style-controls {
    top: 80px; /* Adjust for even smaller main nav */
    padding: 0.5rem 0;
  }

  .gallery-style-btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
  }

  .gallery-navigation-header {
    padding: 1.25rem 0; /* Increase top padding to clear main nav */
    top: 50px; /* Position directly below main nav */
    border-top: none; /* Remove top border */
    box-shadow: none; /* Remove shadow to connect seamlessly */
  }

  .gallery-nav-container {
    padding: 0 0.75rem; /* Horizontal padding only */
  }

  .gallery-page-header {
    padding: 1.5rem 0;
  }

  .gallery-section {
    padding: 3rem 1rem;
  }

  .gallery-section:first-of-type {
    margin-top: -210px; /* Adjusted for increased small mobile padding with 30px gap */
  }

  /* Small mobile: Adjust scroll margin */
  .gallery-section {
    scroll-margin-top: 100px; /* Account for small mobile fixed navs */
  }

  .gallery-nav-container {
    padding: 0 1rem;
  }

  .gallery-nav-tabs {
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    padding-top: 0.5rem;
    gap: 0.75rem; /* Smaller gap for small mobile */
    flex-wrap: nowrap; /* Ensure single line */
  }

  .gallery-nav-tab {
    white-space: nowrap;
    flex-shrink: 0;
    padding: 0.7rem 1.2rem; /* Slightly smaller padding */
    font-size: 0.9rem; /* Slightly smaller font */
    min-width: fit-content; /* Ensure tabs don't get compressed */
  }

  /* Small Mobile: Even more compact horizontal scroll */
  .gallery-style-grid .gallery-grid,
  .gallery-grid {
    display: flex;
    overflow-x: auto;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem; /* Add horizontal padding for centering */
    margin: 0.25rem 0;
    scroll-behavior: smooth;
    max-height: 160px; /* Even more compact height */
    align-items: center; /* Center items vertically */
    justify-content: flex-start; /* Start from left but allow centering */
    /* Remove grid layout */
    grid-template-columns: none;
  }

  /* Extra wide scrollbar for small mobile */
  .gallery-style-grid .gallery-grid::-webkit-scrollbar,
  .gallery-grid::-webkit-scrollbar {
    height: 14px; /* Even wider scrollbar for small mobile */
  }

  .gallery-style-grid .gallery-grid::-webkit-scrollbar-track,
  .gallery-grid::-webkit-scrollbar-track {
    background: var(--light-gray);
    border-radius: 7px;
  }

  .gallery-style-grid .gallery-grid::-webkit-scrollbar-thumb,
  .gallery-grid::-webkit-scrollbar-thumb {
    background: var(--soft-gold);
    border-radius: 7px;
  }

  .gallery-style-grid .gallery-grid::-webkit-scrollbar-thumb:hover,
  .gallery-grid::-webkit-scrollbar-thumb:hover {
    background: var(--deep-green); /* Darker on hover */
  }

  /* Extra compact items for very small mobile */
  .gallery-item.hero,
  .gallery-item.hero-image,
  .gallery-item.hero.hero-top,
  .gallery-item.hero.hero-bottom,
  .gallery-item.hero.hero-top.hero-left,
  .gallery-item.hero.hero-top.hero-right,
  .gallery-item.hero.hero-bottom.hero-left,
  .gallery-item.hero.hero-bottom.hero-right,
  .gallery-item.hero:not(.hero-top):not(.hero-bottom),
  .gallery-item:not(.hero):not(.hero-image) {
    flex: 0 0 160px; /* Extra compact width */
    aspect-ratio: 4 / 3; /* Maintain 4:3 aspect ratio */
    height: auto;
    max-height: 120px; /* Extra compact height */
    /* Remove grid positioning */
    grid-column: unset;
    grid-row: unset;
  }
}

/* Lightbox Base Container */
.lightbox {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  z-index: 15000;
  flex-direction: column;
  padding: 0;
}

.lightbox.active {
  display: flex;
}

/* ======== HEADER - Navbar Kategori ======== */
.lightbox-header {
  background: rgba(0, 0, 0, 0.85);
  padding: 0.5rem 2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  position: relative;
  z-index: 15001;
  flex-shrink: 0;
}

.lightbox-navbar {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: var(--soft-gold) transparent;
  padding: 0.5rem 0;
  scroll-behavior: smooth;
  justify-content: center; /* CENTER NAVBAR */
  align-items: center;
}

.lightbox-navbar::-webkit-scrollbar {
  height: 6px;
}

.lightbox-navbar::-webkit-scrollbar-track {
  background: transparent;
}

.lightbox-navbar::-webkit-scrollbar-thumb {
  background: var(--soft-gold);
  border-radius: 3px;
}

.lightbox-navbar::-webkit-scrollbar-thumb:hover {
  background: #c9a961;
}

.lightbox-nav-tab {
  padding: 0.75rem 1.5rem;
  background: transparent;
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: rgba(255, 255, 255, 0.7);
  font-weight: 500;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s ease;
  border-radius: 25px;
  white-space: nowrap;
  flex-shrink: 0;
  text-decoration: none;
}

.lightbox-nav-tab:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border-color: rgba(255, 255, 255, 0.5);
}

.lightbox-nav-tab.active {
  background: var(--soft-gold);
  color: white;
  border-color: var(--soft-gold);
}

.lightbox-header-close {
  width: 40px;
  height: 40px;
  background: transparent;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.lightbox-header-close:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.6);
  transform: scale(1.1);
}

.lightbox-header-close svg {
  width: 20px;
  height: 20px;
}

/* ======== CONTENT AREA ======== */
.lightbox-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.lightbox-media-container {
  max-width: 95vw;
  max-height: calc(100vh - 180px);
  width: auto;
  height: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  position: relative;
}

.lightbox-media-container img,
.lightbox-media-container video {
  max-width: 95vw;
  max-height: calc(100vh - 180px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 0;
  display: block;
}

#lightbox-image,
#lightbox-video {
  max-width: 95vw !important;
  max-height: calc(100vh - 180px) !important;
  width: auto !important;
  height: auto !important;
  object-fit: contain !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  display: block;
}

/* Video Controls */
#lightbox-video {
  outline: none;
  background: #000;
  -webkit-appearance: initial !important;
  -moz-appearance: initial !important;
  appearance: initial !important;
  user-select: initial !important;
}

#lightbox-video::-webkit-media-controls {
  display: flex !important;
  opacity: 1 !important;
  visibility: visible !important;
}

#lightbox-video::-webkit-media-controls-panel {
  display: flex !important;
  opacity: 1 !important;
  visibility: visible !important;
}

/* ======== CAPTION TOGGLE & BOX ======== */
.lightbox-caption-toggle {
  position: absolute;
  top: 15px;
  left: 15px;
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 15003;
  transition: all 0.3s ease;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.lightbox-caption-toggle:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.7);
  transform: scale(1.1);
}

.lightbox-caption-toggle.active {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(255, 255, 255, 1);
  color: #000;
}

.lightbox-caption-toggle svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
}

.lightbox-caption-toggle.active svg {
  stroke: #000;
}

.lightbox-caption {
  position: absolute;
  top: 15px;
  left: 75px;
  max-width: 500px;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
  padding: 1.5rem;
  border-radius: 12px;
  z-index: 15002;
  color: white;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  transition: opacity 0.3s ease, transform 0.3s ease;
  opacity: 1;
  transform: translateX(0);
}

.lightbox-caption.hidden {
  opacity: 0;
  transform: translateX(-20px);
  pointer-events: none;
}

.lightbox-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 0.5rem 0;
  color: white;
  line-height: 1.4;
}

.lightbox-description {
  font-size: 0.95rem;
  margin: 0;
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.6;
}

.lightbox-title:empty,
.lightbox-description:empty {
  display: none;
}

/* ======== NAVIGATION ARROWS ======== */
.lightbox-nav-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 60px;
  height: 60px;
  background: rgba(0, 0, 0, 0.7);
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 15002;
  transition: all 0.3s ease;
}

.lightbox-nav-arrow:hover {
  background: rgba(0, 0, 0, 0.9);
  border-color: var(--soft-gold);
  transform: translateY(-50%) scale(1.15);
}

.lightbox-nav-arrow.prev {
  left: 3rem;
}

.lightbox-nav-arrow.next {
  right: 3rem;
}

.lightbox-nav-arrow svg {
  width: 28px;
  height: 28px;
}

/* ======== FOOTER - Counter & Title ======== */
.lightbox-footer {
  background: rgba(0, 0, 0, 0.85);
  padding: 1.5rem 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  position: relative;
  z-index: 15001;
  flex-shrink: 0;
}

/* Counter */
.lightbox-counter {
  color: white;
  font-size: 1rem;
  font-weight: 500;
  white-space: nowrap;
}

.lightbox-counter .current {
  color: var(--soft-gold);
  font-size: 1.25rem;
  font-weight: 600;
}

.lightbox-counter .separator {
  color: rgba(255, 255, 255, 0.5);
  margin: 0 0.5rem;
  font-size: 0.9rem;
}

.lightbox-counter .total {
  color: rgba(255, 255, 255, 0.7);
  font-size: 1rem;
}

/* Title - CENTER */
.lightbox-title-footer {
  color: white;
  font-size: 1.1rem;
  font-weight: 500;
  text-align: center;
  line-height: 1.4;
  max-width: 600px;
}

/* ======== RESPONSIVE - TABLET ======== */
@media (max-width: 768px) {
  .lightbox-header {
    padding: 1rem;
    gap: 1rem;
  }

  /* NAVBAR SCROLL - Mobile */
  .lightbox-navbar {
    gap: 0.75rem;
    padding: 0.5rem 0;
    -webkit-overflow-scrolling: touch;
    justify-content: flex-start; /* Start from left on mobile */
  }

  .lightbox-navbar::-webkit-scrollbar {
    height: 8px;
  }

  .lightbox-navbar::-webkit-scrollbar-thumb {
    background: var(--soft-gold);
    border-radius: 4px;
  }

  .lightbox-nav-tab {
    padding: 0.6rem 1.2rem;
    font-size: 0.85rem;
    min-width: fit-content;
  }

  .lightbox-header-close {
    width: 36px;
    height: 36px;
  }

  .lightbox-header-close svg {
    width: 18px;
    height: 18px;
  }

  /* Footer - Mobile Layout */
  .lightbox-footer {
    padding: 1rem;
    flex-direction: column;
    gap: 0.75rem;
    justify-content: center;
  }

  .lightbox-counter {
    position: static; /* Remove absolute positioning */
    font-size: 0.9rem;
    order: 1; /* Show first */
  }

  .lightbox-counter .current {
    font-size: 1.1rem;
  }

  .lightbox-title-footer {
    font-size: 1rem;
    text-align: center;
    order: 2; /* Show second */
    max-width: 100%;
  }

  /* Media Container */
  .lightbox-media-container {
    max-width: 92vw;
    max-height: calc(100vh - 220px);
  }

  .lightbox-media-container img,
  .lightbox-media-container video,
  #lightbox-image,
  #lightbox-video {
    max-width: 92vw !important;
    max-height: calc(100vh - 220px) !important;
  }

  /* Caption */
  .lightbox-caption-toggle {
    top: 10px;
    left: 10px;
    width: 44px;
    height: 44px;
  }

  .lightbox-caption-toggle svg {
    width: 22px;
    height: 22px;
  }

  .lightbox-caption {
    top: 65px;
    left: 10px;
    right: 10px;
    max-width: none;
    padding: 1rem;
  }

  .lightbox-title {
    font-size: 1.1rem;
    margin-bottom: 0.4rem;
  }

  .lightbox-description {
    font-size: 0.85rem;
  }

  /* Navigation Arrows */
  .lightbox-nav-arrow {
    width: 50px;
    height: 50px;
  }

  .lightbox-nav-arrow.prev {
    left: 1.5rem;
  }

  .lightbox-nav-arrow.next {
    right: 1.5rem;
  }

  .lightbox-nav-arrow svg {
    width: 24px;
    height: 24px;
  }
}

/* ======== RESPONSIVE - SMALL MOBILE ======== */
@media (max-width: 480px) {
  .lightbox-header {
    padding: 0.75rem;
    gap: 0.75rem;
  }

  .lightbox-navbar {
    gap: 0.5rem;
  }

  .lightbox-navbar::-webkit-scrollbar {
    height: 10px;
  }

  .lightbox-nav-tab {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
  }

  .lightbox-header-close {
    width: 32px;
    height: 32px;
  }

  .lightbox-header-close svg {
    width: 16px;
    height: 16px;
  }

  .lightbox-footer {
    padding: 0.75rem;
  }

  .lightbox-counter {
    font-size: 0.85rem;
  }

  .lightbox-counter .current {
    font-size: 1rem;
  }

  .lightbox-title-footer {
    font-size: 0.9rem;
  }

  /* Media Container */
  .lightbox-media-container {
    max-width: 90vw;
    max-height: calc(100vh - 240px);
  }

  .lightbox-media-container img,
  .lightbox-media-container video,
  #lightbox-image,
  #lightbox-video {
    max-width: 90vw !important;
    max-height: calc(100vh - 240px) !important;
  }

  /* Navigation Arrows */
  .lightbox-nav-arrow {
    width: 44px;
    height: 44px;
  }

  .lightbox-nav-arrow.prev {
    left: 1rem;
  }

  .lightbox-nav-arrow.next {
    right: 1rem;
  }

  .lightbox-nav-arrow svg {
    width: 20px;
    height: 20px;
  }
}

/* ======== LANDSCAPE MOBILE ======== */
@media (max-width: 768px) and (orientation: landscape) {
  .lightbox-header {
    padding: 0.75rem 1rem;
  }

  .lightbox-footer {
    padding: 0.75rem 1rem;
    flex-direction: row;
    justify-content: space-between;
  }

  .lightbox-counter {
    position: static;
    order: 1;
  }

  .lightbox-title-footer {
    order: 2;
    max-width: 50%;
  }

  .lightbox-media-container {
    max-height: calc(100vh - 140px);
  }

  .lightbox-media-container img,
  .lightbox-media-container video,
  #lightbox-image,
  #lightbox-video {
    max-height: calc(100vh - 140px) !important;
  }
}
