/* =============================================
   ADVT. GALLERY — gallery.css
   Gallery Page + Homepage Preview Section
   ============================================= */

/* =============================================
   HOMEPAGE GALLERY PREVIEW SECTION
   ============================================= */

.gallery-preview {
  padding: 88px 0;
  background: var(--bg-cream);
  border-top: 1px solid var(--border);
}

.gallery-preview .section-header {
  margin-bottom: 48px;
}

.gp-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: auto auto;
  gap: 16px;
  margin-bottom: 40px;
}

.gp-item {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--border);
  aspect-ratio: 4/3;
  cursor: pointer;
}

.gp-item--featured {
  grid-column: span 2;
  aspect-ratio: 16/9;
}

.gp-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.45s ease;
}

.gp-item:hover img {
  transform: scale(1.04);
}

.gp-item-overlay {
  position: absolute;
  inset: 0;
  background: rgba(232,75,26,0.18);
  opacity: 0;
  transition: opacity 0.3s ease;
}

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

/* Placeholder when no image */
.gp-item.img-placeholder {
  background: var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
}

.gp-item.img-placeholder::before {
  content: '\f03e';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  font-size: 2rem;
  color: var(--border);
}

.gp-item.img-placeholder img { display: none; }

.gp-cta {
  text-align: center;
}

/* =============================================
   GALLERY PAGE — HERO
   ============================================= */

.gallery-hero {
  background: var(--bg-cream);
  padding: 140px 0 72px;
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.gh-inner h1 {
  font-family: var(--font-head);
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  font-weight: 900;
  line-height: 1.05;
  color: var(--text);
  margin-bottom: 16px;
  letter-spacing: -0.03em;
}

.gh-desc {
  font-size: 1rem;
  color: var(--text-light);
  max-width: 540px;
  margin: 0 auto;
  line-height: 1.75;
}

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

.gallery-section {
  padding: 60px 0 88px;
  background: #fff;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--bg-cream);
  border: 1px solid var(--border-light);
  aspect-ratio: 4/3;
  cursor: pointer;
}

.gi-img-wrap {
  width: 100%;
  height: 100%;
  position: relative;
}

.gi-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

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

/* Show placeholder icon when image fails to load */
.gi-img-wrap img[src=""],
.gi-img-wrap img:not([src]) {
  display: none;
}

.gallery-item.img-error .gi-img-wrap::before {
  content: '\f03e';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  font-size: 2.5rem;
  color: var(--border);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* Hover overlay with expand icon */
.gi-overlay {
  position: absolute;
  inset: 0;
  background: rgba(26, 10, 5, 0.28);
  opacity: 0;
  transition: opacity 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.gi-zoom {
  width: 48px;
  height: 48px;
  background: #fff;
  border: none;
  border-radius: 50%;
  color: var(--orange);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: scale(0.8);
  transition: transform 0.3s ease, background 0.3s ease, color 0.3s ease;
}

.gallery-item:hover .gi-zoom {
  transform: scale(1);
}

.gi-zoom:hover {
  background: var(--orange);
  color: #fff;
}

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

.lightbox-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 8, 4, 0.92);
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

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

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 2001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

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

.lb-content {
  position: relative;
  max-width: 920px;
  width: 100%;
  background: #fff;
  border-radius: var(--radius-lg);
  overflow: hidden;
  transform: scale(0.94);
  transition: transform 0.3s ease;
}

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

.lb-content img {
  width: 100%;
  max-height: 78vh;
  object-fit: contain;
  display: block;
  background: var(--bg-cream);
}

.lb-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 10;
  width: 38px;
  height: 38px;
  background: rgba(255,255,255,0.92);
  border: none;
  border-radius: 50%;
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.lb-close:hover {
  background: var(--orange);
  color: #fff;
}

.lb-prev,
.lb-next {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2002;
  width: 48px;
  height: 48px;
  background: rgba(255,255,255,0.12);
  border: 1.5px solid rgba(255,255,255,0.25);
  border-radius: 50%;
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.lb-prev { left: 16px; }
.lb-next { right: 16px; }

.lb-prev:hover,
.lb-next:hover {
  background: var(--orange);
  border-color: var(--orange);
}

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

@media (max-width: 1024px) {
  .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
  }
  .gp-grid { grid-template-columns: repeat(2, 1fr); }
  .gp-item--featured { grid-column: span 2; }
}

@media (max-width: 768px) {
  .gallery-hero { padding: 120px 0 56px; }

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

  .gp-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .gp-item--featured { grid-column: span 2; }

  .lb-prev { left: 8px; }
  .lb-next { right: 8px; }
}

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

  .gp-grid { grid-template-columns: 1fr; }
  .gp-item--featured { grid-column: span 1; aspect-ratio: 4/3; }
}