/* ==========================================================================
   OASIS POOL SERVICES — Gallery Page Stylesheet
   Gallery hero, filter bar, masonry grid, cards, lightbox, CTA
   ========================================================================== */

/* Gallery hero variant */
.page-hero--gallery {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-dark-bg) 60%, #003366 100%);
  padding: 120px 24px 80px;
}

.page-hero--gallery::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 70%, rgba(0, 180, 216, 0.08) 0%, transparent 50%),
              radial-gradient(circle at 70% 30%, rgba(255, 107, 44, 0.05) 0%, transparent 50%);
  animation: heroShimmer 20s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes heroShimmer {
  0% { transform: translate(0, 0) rotate(0deg); }
  100% { transform: translate(-5%, 5%) rotate(3deg); }
}

/* Filter Bar */
.filter-bar {
  background: var(--color-bg);
  border-bottom: 1px solid rgba(12, 35, 64, 0.08);
  padding: 20px 24px;
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  position: sticky;
  top: 72px;
  z-index: 90;
  transition: box-shadow 0.3s ease;
}

.filter-bar.is-stuck {
  box-shadow: 0 4px 20px rgba(12, 35, 64, 0.08);
}

.filter-btn {
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 10px 24px;
  border-radius: 100px;
  border: 1.5px solid rgba(12, 35, 64, 0.15);
  background: transparent;
  color: var(--color-text);
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.filter-btn:hover {
  border-color: var(--color-secondary);
  color: var(--color-secondary);
}

.filter-btn:focus-visible {
  outline: 2px solid var(--color-secondary);
  outline-offset: 2px;
}

.filter-btn.active {
  background: var(--color-secondary);
  border-color: var(--color-secondary);
  color: var(--color-white);
}

/* Gallery Grid (Masonry) */
.gallery-section {
  background: var(--color-bg);
  padding: 60px 24px 100px;
}

.gallery-grid {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  grid-auto-rows: auto;
}

@media (min-width: 640px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: 10px;
  }
}

@media (min-width: 1024px) {
  .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Gallery Card */
.gallery-card {
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1),
              opacity 0.4s ease;
}

.gallery-card[data-visible="false"] {
  opacity: 0;
  transform: scale(0.95);
  position: absolute;
  pointer-events: none;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* Row span variations for masonry */
.gallery-card--tall   { grid-row: span 34; }
.gallery-card--medium { grid-row: span 28; }
.gallery-card--short  { grid-row: span 22; }

.gallery-card__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.gallery-card__placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: flex-end;
  position: relative;
}

.gallery-card:hover .gallery-card__placeholder,
.gallery-card:hover .gallery-card__image {
  transform: scale(1.05);
}

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

/* Gallery Card Overlay */
.gallery-card__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(11, 27, 46, 0.95) 0%, rgba(11, 27, 46, 0.4) 40%, transparent 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 28px 24px;
  transition: background 0.4s ease;
}

.gallery-card:hover .gallery-card__overlay {
  background: linear-gradient(to top, rgba(11, 27, 46, 0.98) 0%, rgba(11, 27, 46, 0.6) 50%, rgba(11, 27, 46, 0.3) 100%);
}

.gallery-card__tag {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-secondary);
  margin-bottom: 8px;
}

.gallery-card__title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-white);
  margin: 0 0 6px;
  line-height: 1.3;
}

.gallery-card__location {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.6);
  margin: 0;
}

.gallery-card__desc {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.5;
  margin: 12px 0 0;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.4s ease, opacity 0.4s ease, margin 0.4s ease;
}

.gallery-card:hover .gallery-card__desc {
  max-height: 100px;
  opacity: 1;
  margin-top: 12px;
}

/* Lightbox Modal */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(11, 27, 46, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
  padding: 40px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

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

.lightbox__inner {
  max-width: 900px;
  width: 100%;
  background: var(--color-dark-bg);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transform: scale(0.92) translateY(20px);
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 40px 80px rgba(0, 0, 0, 0.5);
}

.lightbox.is-open .lightbox__inner {
  transform: scale(1) translateY(0);
}

.lightbox__image {
  width: 100%;
  height: 400px;
  display: block;
}

.lightbox__content {
  padding: 32px;
}

.lightbox__tag {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-secondary);
  margin-bottom: 8px;
}

.lightbox__title {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--color-white);
  margin: 0 0 8px;
}

.lightbox__location {
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.5);
  margin: 0 0 16px;
}

.lightbox__desc {
  font-family: var(--font-body);
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.7;
  margin: 0;
}

.lightbox__close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 48px;
  height: 48px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  color: var(--color-white);
  font-size: 1.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s ease, transform 0.3s ease;
  z-index: 10;
}

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

.lightbox__close:focus-visible {
  outline: 2px solid var(--color-secondary);
  outline-offset: 2px;
}

/* Gallery CTA */
.gallery-cta {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-dark-bg) 100%);
  padding: 100px 24px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.gallery-cta::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0, 180, 216, 0.3), transparent);
}

.gallery-cta__heading {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 700;
  color: var(--color-white);
  margin: 0 0 16px;
}

.gallery-cta__sub {
  font-family: var(--font-body);
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.6);
  margin: 0 0 40px;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

.gallery-cta__btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 600;
  padding: 18px 40px;
  background: var(--color-cta);
  color: var(--color-white);
  border: none;
  border-radius: var(--radius);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 4px 20px rgba(255, 107, 44, 0.3);
}

.gallery-cta__btn:hover {
  background: var(--color-cta-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(255, 107, 44, 0.4);
}

.gallery-cta__btn:focus-visible {
  outline: 2px solid var(--color-cta);
  outline-offset: 4px;
}

/* Gallery Responsive */
@media (max-width: 1024px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .filter-bar {
    top: 72px;
    gap: 8px;
    padding: 16px;
  }

  .filter-btn {
    font-size: 0.82rem;
    padding: 8px 18px;
  }

  .gallery-grid {
    grid-template-columns: 1fr;
    grid-auto-rows: auto;
  }

  .gallery-card--tall,
  .gallery-card--medium,
  .gallery-card--short {
    grid-row: span 1;
    height: 320px;
  }

  .lightbox {
    padding: 16px;
  }

  .lightbox__image {
    height: 240px;
  }

  .lightbox__title {
    font-size: 1.3rem;
  }
}

/* Gallery Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .gallery-card:hover {
    transform: none;
  }

  .gallery-card:hover .gallery-card__placeholder,
  .gallery-card:hover .gallery-card__image {
    transform: none;
  }

  .lightbox__inner {
    transform: none;
  }

  .lightbox.is-open .lightbox__inner {
    transform: none;
  }
}
