/* =========================================================
   GALLERY PAGE — Modern Responsive Grid & Mobile Optimization
   ========================================================= */

/* ---------- Hero Stats Ribbon ---------- */
.gallery-hero-stats {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 28px;
  flex-wrap: wrap;
  margin-top: 28px;
}

.gallery-stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.gallery-stat-pill svg {
  color: #38BDF8;
  flex-shrink: 0;
}

/* ---------- Category Filter Bar (Mobile-Scrollable) ---------- */
.gallery-filters-wrapper {
  position: relative;
  margin-bottom: 40px;
}

.gallery-filters {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE 10+ */
}

.gallery-filters::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

.gallery-filters .btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  font-size: 0.88rem;
  font-weight: 600;
  min-height: 44px;
  white-space: nowrap;
  border-radius: var(--radius-pill);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  box-shadow: var(--shadow-soft);
}

.gallery-filters .btn .filter-count {
  background: rgba(11, 29, 58, 0.08);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  transition: background 0.3s ease, color 0.3s ease;
}

.gallery-filters .btn.active {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #ffffff !important;
  border-color: transparent;
  box-shadow: 0 8px 24px -6px rgba(14, 165, 233, 0.4);
  transform: translateY(-2px);
}

.gallery-filters .btn.active .filter-count {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

/* Quick Search / Location Input */
.gallery-search-box {
  max-width: 420px;
  margin: 0 auto 32px;
  position: relative;
}

.gallery-search-box input {
  width: 100%;
  padding: 12px 18px 12px 46px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--border);
  background: #fff;
  font-family: var(--body);
  font-size: 0.92rem;
  color: var(--text);
  box-shadow: var(--shadow-soft);
  outline: none;
  transition: all 0.3s ease;
}

.gallery-search-box input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--hover-glow);
}

.gallery-search-box svg {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-soft);
  pointer-events: none;
}

/* ---------- Responsive CSS Grid ---------- */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 22px;
  align-items: stretch;
}

/* Base Gallery Card */
.gallery-item {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  background: #0B1D3A;
  box-shadow: 0 10px 30px -10px rgba(11, 29, 58, 0.18);
  border: 1px solid var(--border);
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.4s ease, border-color 0.3s ease;
  aspect-ratio: 4 / 3;
}

.gallery-item:hover {
  transform: translateY(-8px) scale(1.01);
  box-shadow: 0 20px 40px -10px rgba(14, 165, 233, 0.3);
  border-color: rgba(14, 165, 233, 0.4);
}

/* Filter animation states */
.gallery-item.hiding {
  opacity: 0;
  transform: scale(0.85);
  pointer-events: none;
  position: absolute;
  visibility: hidden;
  width: 0;
  height: 0;
  overflow: hidden;
  margin: 0;
  padding: 0;
  border: none;
}

.gallery-item.showing {
  animation: galleryFadeIn 0.45s ease forwards;
}

@keyframes galleryFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.94);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Thumbnail Container */
.gallery-thumb {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1), filter 0.5s ease;
}

.gallery-item:hover .gallery-thumb img {
  transform: scale(1.1);
  filter: brightness(1.05);
}

/* Category Badge (Top Right) */
.gallery-cat-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 3;
  background: rgba(11, 29, 58, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #38BDF8;
  border: 1px solid rgba(56, 189, 248, 0.3);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Overlay & Card Text */
.gallery-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(7, 18, 38, 0.94) 0%,
    rgba(7, 18, 38, 0.4) 55%,
    rgba(7, 18, 38, 0.05) 100%
  );
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 20px 18px;
  opacity: 0.92;
  transition: opacity 0.35s ease, background 0.35s ease;
}

.gallery-item:hover .gallery-overlay {
  opacity: 1;
  background: linear-gradient(
    to top,
    rgba(7, 18, 38, 0.96) 0%,
    rgba(7, 18, 38, 0.5) 60%,
    rgba(7, 18, 38, 0.15) 100%
  );
}

.gallery-location {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #38BDF8;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.gallery-location svg {
  flex-shrink: 0;
}

.gallery-label {
  color: #ffffff;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
  margin: 0;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

.gallery-desc {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.8rem;
  margin-top: 4px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Zoom / Action Icon */
.gallery-zoom-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -60%) scale(0.8);
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.9) 0%, rgba(2, 132, 199, 0.9) 100%);
  backdrop-filter: blur(8px);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 10px 25px rgba(14, 165, 233, 0.5);
  border: 1.5px solid rgba(255, 255, 255, 0.4);
}

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

/* Video Items */
.gallery-video-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
  color: #ffffff;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.5);
}

.gallery-play-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  opacity: 0.9;
  transition: opacity 0.35s ease, transform 0.35s ease;
  filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.5));
}

.gallery-item:hover .gallery-play-icon {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.1);
}

/* ---------- Enhanced Lightbox & Swipe Modal ---------- */
.gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(4, 9, 20, 0.96);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
  padding: 20px;
  user-select: none;
  touch-action: pan-y;
}

.gallery-lightbox.open {
  opacity: 1;
  pointer-events: all;
}

/* Lightbox Header / Control Bar */
.lightbox-topbar {
  position: absolute;
  top: 16px;
  left: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 10002;
}

.lightbox-counter {
  color: #fff;
  font-size: 0.88rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(8px);
  padding: 6px 16px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255, 255, 255, 0.2);
  letter-spacing: 0.5px;
}

.lightbox-close {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.3s ease, transform 0.3s ease;
  color: #fff;
}

.lightbox-close:hover {
  background: rgba(239, 68, 68, 0.85);
  transform: rotate(90deg);
}

.lightbox-content {
  max-width: 92vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  transform: scale(0.94);
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.gallery-lightbox.open .lightbox-content {
  transform: scale(1);
}

.lightbox-content img {
  max-width: 88vw;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 16px;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.15);
  transition: transform 0.2s ease;
}

/* Lightbox Caption Box */
.lightbox-details {
  margin-top: 16px;
  text-align: center;
  max-width: 600px;
}

.lightbox-caption {
  color: #ffffff;
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 4px;
}

.lightbox-location {
  color: #38BDF8;
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* Lightbox Nav Buttons */
.lightbox-prev,
.lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10001;
  color: #fff;
  transition: background 0.3s ease, transform 0.3s ease;
}

.lightbox-prev {
  left: 20px;
}

.lightbox-next {
  right: 20px;
}

.lightbox-prev:hover,
.lightbox-next:hover {
  background: rgba(14, 165, 233, 0.75);
  transform: translateY(-50%) scale(1.1);
}

/* Mobile Swipe Hint */
.lightbox-swipe-hint {
  display: none;
  position: absolute;
  bottom: 20px;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.5px;
}

/* Video Player Modal Container */
.lightbox-video-container {
  width: 88vw;
  max-width: 850px;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: none;
}

.lightbox-video-container video,
.lightbox-video-container iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* ---------- Responsive Breakpoints for Mobile ---------- */

@media (max-width: 992px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
  }
}

@media (max-width: 768px) {
  .gallery-page {
    padding-top: 40px;
  }

  .gallery-hero-stats {
    gap: 12px;
  }

  .gallery-stat-pill {
    padding: 6px 14px;
    font-size: 0.78rem;
  }

  /* 2 Column Mobile Grid Layout */
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .gallery-item {
    border-radius: 14px;
    aspect-ratio: 1 / 1; /* Clean square cards on mobile */
  }

  /* Permanent elegant overlay for mobile accessibility */
  .gallery-overlay {
    opacity: 1;
    padding: 14px 10px 10px;
    background: linear-gradient(
      to top,
      rgba(7, 18, 38, 0.95) 0%,
      rgba(7, 18, 38, 0.45) 60%,
      transparent 100%
    );
  }

  .gallery-location {
    font-size: 0.68rem;
    gap: 4px;
    margin-bottom: 2px;
  }

  .gallery-label {
    font-size: 0.84rem;
    line-height: 1.25;
  }

  .gallery-desc {
    display: none; /* Hide detailed desc on tight mobile cards */
  }

  .gallery-cat-badge {
    top: 10px;
    right: 10px;
    font-size: 0.6rem;
    padding: 3px 8px;
  }

  .gallery-video-badge {
    top: 10px;
    left: 10px;
    font-size: 0.62rem;
    padding: 4px 9px;
  }

  .gallery-zoom-icon {
    display: none; /* Hide hover zoom icon on touch screens */
  }

  /* Mobile Filters: Horizontal Scrollable Pills */
  .gallery-filters {
    justify-content: flex-start;
    padding-left: 16px;
    padding-right: 16px;
    margin-bottom: 24px;
  }

  .gallery-filters .btn {
    padding: 8px 16px;
    font-size: 0.8rem;
    min-height: 38px;
  }

  /* Mobile Lightbox Controls */
  .lightbox-prev,
  .lightbox-next {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.2);
  }

  .lightbox-prev {
    left: 10px;
  }

  .lightbox-next {
    right: 10px;
  }

  .lightbox-content img {
    max-width: 95vw;
    max-height: 65vh;
    border-radius: 12px;
  }

  .lightbox-caption {
    font-size: 0.98rem;
  }

  .lightbox-swipe-hint {
    display: block;
  }
}

@media (max-width: 420px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .gallery-item {
    border-radius: 12px;
  }

  .gallery-overlay {
    padding: 10px 8px 8px;
  }

  .gallery-label {
    font-size: 0.78rem;
  }

  .gallery-filters .btn {
    padding: 7px 14px;
    font-size: 0.75rem;
  }

  .lightbox-prev,
  .lightbox-next {
    display: none; /* Rely on touch swipe on tiny screens */
  }
}

/* ---------- CTA Banner (High-Contrast Upgrade) ---------- */
.gallery-cta-section {
  padding: 90px 0;
  background: linear-gradient(135deg, #051429 0%, #0A2246 50%, #071933 100%);
  position: relative;
  overflow: hidden;
}

.gallery-cta-section::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 750px;
  height: 400px;
  background: radial-gradient(ellipse at center, rgba(14, 165, 233, 0.22) 0%, rgba(2, 132, 199, 0) 70%);
  pointer-events: none;
}

.gallery-cta-card {
  background: linear-gradient(145deg, #FFFFFF 0%, #F4F9FF 100%);
  border: 2px solid rgba(14, 165, 233, 0.35);
  border-radius: var(--radius);
  padding: 60px 44px;
  text-align: center;
  box-shadow: 0 30px 70px -15px rgba(0, 0, 0, 0.4), 0 0 40px rgba(14, 165, 233, 0.25);
  position: relative;
  z-index: 2;
  transition: transform 0.35s ease, box-shadow 0.35s ease;
}

.gallery-cta-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 35px 80px -15px rgba(0, 0, 0, 0.45), 0 0 50px rgba(14, 165, 233, 0.35);
}

.gallery-cta-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  background: linear-gradient(135deg, #0EA5E9 0%, #0284C7 100%);
  color: #FFFFFF;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  border-radius: var(--radius-pill);
  margin-bottom: 22px;
  box-shadow: 0 6px 18px rgba(14, 165, 233, 0.4);
}

.gallery-cta-card h2 {
  color: #0B1D3A;
  font-size: clamp(2rem, 4vw, 2.8rem);
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 18px;
  letter-spacing: -0.5px;
}

.gallery-cta-card p {
  color: #334155;
  font-size: 1.1rem;
  line-height: 1.75;
  max-width: 660px;
  margin: 0 auto 36px;
  font-weight: 500;
}

.gallery-cta-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.gallery-cta-btn {
  background: linear-gradient(135deg, #0284C7 0%, #0B1D3A 100%);
  color: #FFFFFF !important;
  font-weight: 700;
  font-size: 1rem;
  padding: 16px 38px;
  border-radius: var(--radius-pill);
  box-shadow: 0 10px 30px -6px rgba(2, 132, 199, 0.5);
}

.gallery-cta-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 36px -6px rgba(14, 165, 233, 0.6);
  background: linear-gradient(135deg, #0EA5E9 0%, #1B3A6B 100%);
}

.gallery-cta-call {
  background: transparent;
  border: 2px solid #0B1D3A;
  color: #0B1D3A;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 14px 30px;
  border-radius: var(--radius-pill);
  transition: all 0.3s ease;
}

.gallery-cta-call:hover {
  background: #0B1D3A;
  color: #FFFFFF;
  transform: translateY(-2px);
  box-shadow: 0 10px 24px -6px rgba(11, 29, 58, 0.4);
}

@media (max-width: 768px) {
  .gallery-cta-section {
    padding: 60px 0;
  }

  .gallery-cta-card {
    padding: 36px 20px;
    border-radius: 16px;
  }

  .gallery-cta-badge {
    padding: 6px 14px;
    font-size: 0.72rem;
    margin-bottom: 16px;
  }

  .gallery-cta-card p {
    font-size: 0.95rem;
    margin-bottom: 24px;
  }

  .gallery-cta-actions {
    flex-direction: column;
    width: 100%;
  }

  .gallery-cta-actions .btn {
    width: 100%;
  }
}
