/* ===================================
   GALLERY PAGE STYLES
   =================================== */

/* Prevent horizontal scroll globally */
html, body {
  overflow-x: hidden;
  max-width: 100%;
}

/* === PAGE CONTAINER === */
#gallery-page-container {
  padding-top: 120px; /* Account for fixed navbar */
  min-height: 100vh;
  background: #ffffff;
  overflow-x: hidden; /* Prevent horizontal scroll */
  max-width: 100vw; /* Don't exceed viewport width */
}

/* === HEADER SECTION === */

/* ===================================
   NAVBAR LINK STYLES
   (Copied from tours-page.css for consistency)
   =================================== */
.navbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.navbar-logo {
  width: 40px;
  height: auto;
}

.navbar-title {
  font-family: Inter, sans-serif;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
  margin: 0;
  color: inherit;
}

.navbar-links {
  display: flex;
  gap: 2em;
}

.nav-link-exclusion {
  /* Inherit global styles */
  font-family: Inter, sans-serif;
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  color: inherit;
  position: relative;
  transition: color 0.3s ease;
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 1em;
}

/* Hide contact button and show hamburger on mobile */
.header-contact-btn {
  display: inline-flex;
}

.menu-toggle-exclusion {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}

/* ===================================
   LANGUAGE DROPDOWN STYLES
   =================================== */
.lang-dropdown {
  position: relative;
}

.lang-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: Inter, sans-serif;
  font-size: 13px;
}

.lang-flag {
  width: 16px;
  height: auto;
  border-radius: 2px;
}

.lang-options {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: #ffffff;
  border: 1px solid #e6e6e6;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  z-index: 1000;
  min-width: 100px;
}

.lang-options.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Force close override to beat hover state */
.lang-options.force-close {
  opacity: 0 !important;
  visibility: hidden !important;
  display: none !important;
  pointer-events: none !important;
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.lang-option:hover {
  background: #f7f7f3;
}

.lang-option:first-child {
  border-radius: 8px 8px 0 0;
}

.lang-option:last-child {
  border-radius: 0 0 8px 8px;
}

/* ===================================
   RESPONSIVE
   =================================== */
@media screen and (max-width: 991px) {
  /* Tablet Styles */
  
  /* Navbar adjustments */
  .navbar-links {
    display: none;
  }
  .header-contact-btn {
    display: none;
  }
  .menu-toggle-exclusion {
    display: block;
  }

  /* Page Margins */
  .gallery-page-header {
    padding: 3em 2.5em 1em 2.5em;
  }
}

@media screen and (max-width: 767px) {
  /* Mobile Styles */

  /* Page Margins */
  .gallery-page-header {
    padding: 0em 16px 1em 16px;
    text-align: left; /* Match ToursPage mobile alignment */
  }
  
  .gallery-page-header .page-title {
    margin-bottom: 0.5em; 
  }
}

/* ===========================================
   MOBILE MENU STYLES (Copied from ToursPage)
   =========================================== */
.mobile-menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 50vh;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 999990; /* Below Navbar */
  display: flex;
  flex-direction: column;
  align-items: center; /* Center horizontally */
  justify-content: flex-start; /* Start from top */
  padding-top: 2rem;
  gap: 0; /* Gap handled by separators/padding */
  transform: translateY(-100%);
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  border-bottom-left-radius: 32px;
  border-bottom-right-radius: 32px;
}

.mobile-menu-overlay.active {
  transform: translateY(0);
}

/* Header within Menu */
.mobile-menu-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 2rem 2rem;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  margin-bottom: 1rem;
}

.mobile-menu-title {
  font-family: 'Tasa Orbiter Display', sans-serif;
  font-size: 1.2rem;
  color: #042e4d;
  opacity: 0.7;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.mobile-menu-close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #042e4d;
  cursor: pointer;
  padding: 0.5rem;
  transition: transform 0.3s ease;
}
.mobile-menu-close-btn:hover { transform: rotate(90deg); }

/* Links Container */
.mobile-menu-links {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.mobile-nav-link {
  width: 80%;
  display: flex;
  align-items: center;
  justify-content: flex-start; /* Icon then text */
  gap: 1rem;
  font-family: Inter, sans-serif;
  font-size: 1.4rem;
  font-weight: 500;
  color: #042e4d;
  text-decoration: none;
  padding: 1.2rem 1rem;
  transition: all 0.2s ease;
  letter-spacing: -0.01em;
  border-radius: 16px;
}

.mobile-nav-link:hover {
  background: rgba(37, 99, 235, 0.05);
  transform: translateX(10px);
}

.nav-icon {
  font-size: 1.2rem;
  opacity: 0.8;
}

.nav-separator {
  width: 80%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(4, 46, 77, 0.1), transparent);
}

/* ===================================
   GALLERY GRID STYLES (Masonry)
   =================================== */

.gallery-grid-section {
  padding: 2em 5em 0 5em; /* No bottom padding, handled by footer spacer */
  min-height: 60vh;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  grid-auto-rows: 250px; /* Base row height */
  grid-auto-flow: dense; /* Fill gaps efficiently */
  gap: 1.5rem;
  max-width: 1600px;
  margin: 0 auto;
}

/* === GRID ITEM VARIANTS === */
.gallery-item {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background-color: #f0f0f0; /* Skeleton bg */
  opacity: 0;
  transform: translateY(20px);
  transition: transform 0.4s ease, opacity 0.4s ease, box-shadow 0.3s ease;
  cursor: pointer;
}

/* Base item matches 1x1 */

/* Wide: Spans 2 columns */
.gallery-item.wide {
  grid-column: span 2;
}

/* Tall: Spans 2 rows */
.gallery-item.tall {
  grid-row: span 2;
}

/* Big: Spans 2 columns & 2 rows */
.gallery-item.big {
  grid-column: span 2;
  grid-row: span 2;
}

/* === IMAGE STYLES === */
.gallery-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
  display: block;
  opacity: 0; /* Hidden until loaded */
}

/* Hover Effect: Zoom */
.gallery-item:hover .gallery-img {
  transform: scale(1.05);
}

.gallery-item:hover {
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  transform: translateY(-4px) !important; /* Override reveal transform */
  z-index: 2;
}

/* Overlay (Optional - for caption/icon) */
.gallery-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.2);
  opacity: 0;
  transition: opacity 0.3s ease;
}

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

/* === SKELETON LOADING === */
.skeleton {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #f0f0f0;
  z-index: 1;
}

.skeleton::after {
  content: "";
  display: block;
  width: 100%;
  height: 100%;
  transform: translateX(-100%);
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.4) 50%,
    transparent 100%
  );
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  100% {
    transform: translateX(100%);
  }
}

/* State: Loaded */
.gallery-item.loaded {
  opacity: 1;
  transform: translateY(0);
}

.gallery-item.loaded .gallery-img {
  opacity: 1;
  animation: growIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes growIn {
  0% {
    transform: scale(0.8);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.gallery-item.loaded .skeleton {
  display: none;
}

/* === RESPONSIVE === */
@media screen and (max-width: 991px) {
  .gallery-grid-section {
    padding: 2em 2.5em;
  }
  
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
    grid-auto-rows: 200px;
  }
}

@media screen and (max-width: 767px) {
  .gallery-grid-section {
    padding: 1em 16px;
  }

  .gallery-grid {
    /* Mobile: 2 columns for a better gallery feel than just 1 */
    display: grid;
    grid-template-columns: repeat(2, 1fr); 
    gap: 8px;
    grid-auto-rows: 150px; /* Smaller rows on mobile */
  }
  
  /* On mobile, limit 'big' items to not break flow too much, 
     but keeping variation is nice. */
  
  .gallery-item.big {
    grid-column: span 2;
    grid-row: span 2;
  }
  
  .gallery-item.wide {
    grid-column: span 2; 
  }
  
  /* Tall items might take too much vertical space; keep normally */
}

/* ===================================
   LIGHTBOX MODAL (Fullscreen Viewer)
   =================================== */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.95);
  z-index: 9999999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.lightbox.active {
  opacity: 1;
  visibility: visible;
}

.lightbox-img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  z-index: 1;
}

.lightbox.active .lightbox-img {
  transform: scale(1);
}

.lightbox-close {
  position: absolute;
  top: 2rem;
  right: 2rem;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  color: #ffffff;
  font-size: 24px;
  font-weight: 300;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: rotate(90deg);
}

/* Navigation Arrows */
.lightbox-prev,
.lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  outline: none;
  border-radius: 50%;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  color: #ffffff;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.lightbox-prev {
  left: 2rem;
}

.lightbox-next {
  right: 2rem;
}

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

.lightbox-prev:active,
.lightbox-next:active {
  transform: translateY(-50%) scale(0.95);
}

/* Mobile Lightbox Adjustments */
@media screen and (max-width: 767px) {
  .lightbox-img {
    max-width: 95vw;
    max-height: 80vh;
  }
  
  .lightbox-close {
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    font-size: 20px;
  }
}
