/* ── Gallery Section ── */

#gallery {
  background: rgb(2, 18, 17);
  padding: 5rem 0;
  position: relative;
  overflow: hidden;
}

#gallery::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 600px 400px at 20% 30%, rgba(0,245,196,0.04), transparent),
    radial-gradient(ellipse 500px 350px at 80% 70%, rgba(0,245,196,0.03), transparent);
  pointer-events: none;
}

/* ── Gallery Header ── */

.gallery-header {
  text-align: center;
  max-width: 660px;
  margin: 0 auto 3rem;
  position: relative;
  z-index: 1;
}

.gallery-eyebrow {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
}

.gallery-heading {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 800;
  line-height: 1.15;
  background: linear-gradient(135deg, #F8F8F4 30%, #00F5C4 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
  margin-top: 0.5rem;
}

.gallery-sub {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.7;
  margin-top: 0.75rem;
}

/* ── Gallery Grid ── */

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  position: relative;
  z-index: 1;
}

/* ── Gallery Card (wrapper for image + caption) ── */

.gallery-card {
  display: flex;
  flex-direction: column;
  cursor: pointer;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(248,248,244,0.03);
  border: 1px solid rgba(0,245,196,0.08);
  transition: transform 0.4s cubic-bezier(0.22,1,0.36,1),
              box-shadow 0.4s cubic-bezier(0.22,1,0.36,1),
              border-color 0.4s ease;
}

.gallery-card:hover {
  transform: translateY(-6px) scale(1.015);
  box-shadow: 0 12px 40px rgba(0,245,196,0.12), 0 4px 20px rgba(0,0,0,0.3);
  border-color: rgba(0,245,196,0.25);
  z-index: 2;
}

/* ── Gallery Item (image area) ── */

.gallery-item {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: transform 0.6s cubic-bezier(0.22,1,0.36,1), filter 0.4s ease;
}

.gallery-card:hover .gallery-item img {
  transform: scale(1.08);
  filter: brightness(1.08);
}

/* ── Hover Overlay ── */

.gallery-item-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    transparent 40%,
    rgba(2,27,26,0.7) 100%
  );
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 1.25rem;
  opacity: 0;
  transition: opacity 0.4s cubic-bezier(0.22,1,0.36,1);
}

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

.gallery-item-overlay svg {
  width: 36px;
  height: 36px;
  padding: 8px;
  background: rgba(0,245,196,0.15);
  border: 1px solid rgba(0,245,196,0.25);
  border-radius: 50%;
  color: var(--gold);
  backdrop-filter: blur(8px);
  margin-bottom: 0.5rem;
  transition: transform 0.3s var(--ease-out), background 0.3s ease;
}

.gallery-card:hover .gallery-item-overlay svg {
  transform: scale(1.1);
  background: rgba(0,245,196,0.25);
}

/* ── Gallery Caption ── */

.gallery-caption {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1rem 0.85rem 1.1rem;
  background: linear-gradient(180deg, rgba(2,27,26,0.95) 0%, rgba(2,18,17,1) 100%);
  border-top: 1px solid rgba(0,245,196,0.08);
  gap: 0.3rem;
  transition: background 0.3s ease;
}

.gallery-card:hover .gallery-caption {
  background: linear-gradient(180deg, rgba(0,245,196,0.06) 0%, rgba(2,18,17,1) 100%);
}

.gallery-caption-name {
  font-family: 'Poppins', sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  color: #F8F8F4;
  letter-spacing: 0.01em;
  line-height: 1.3;
  transition: color 0.3s ease;
}

.gallery-card:hover .gallery-caption-name {
  color: #00F5C4;
}

.gallery-caption-title {
  font-family: 'Inter', sans-serif;
  font-size: 0.68rem;
  font-weight: 400;
  color: rgba(248,248,244,0.5);
  letter-spacing: 0.02em;
  line-height: 1.45;
  transition: color 0.3s ease;
}

.gallery-card:hover .gallery-caption-title {
  color: rgba(248,248,244,0.7);
}

/* ── Lightbox ── */

.gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(2,18,17,0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.gallery-lightbox.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.gallery-lightbox-img {
  max-width: 90vw;
  max-height: 75vh;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  transform: scale(0.92);
  transition: transform 0.4s var(--ease-out);
}

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

/* ── Lightbox Caption ── */

.gallery-lightbox-caption {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-top: 1.25rem;
  padding: 0 1rem;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.4s ease 0.1s, transform 0.4s ease 0.1s;
}

.gallery-lightbox.active .gallery-lightbox-caption {
  opacity: 1;
  transform: translateY(0);
}

.gallery-lightbox-caption-name {
  font-family: 'Poppins', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: #00F5C4;
  letter-spacing: 0.01em;
  line-height: 1.3;
}

.gallery-lightbox-caption-title {
  font-family: 'Inter', sans-serif;
  font-size: 0.82rem;
  font-weight: 400;
  color: rgba(248,248,244,0.6);
  letter-spacing: 0.02em;
  line-height: 1.5;
  margin-top: 0.25rem;
  max-width: 500px;
}

.gallery-lightbox-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(0,245,196,0.2);
  border-radius: 50%;
  background: rgba(0,245,196,0.08);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
  z-index: 10001;
}

.gallery-lightbox-close:hover {
  background: rgba(0,245,196,0.2);
  border-color: rgba(0,245,196,0.4);
}

.gallery-lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border: 1px solid rgba(0,245,196,0.2);
  border-radius: 50%;
  background: rgba(0,245,196,0.08);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
  z-index: 10001;
}

.gallery-lightbox-nav:hover {
  background: rgba(0,245,196,0.2);
  border-color: rgba(0,245,196,0.4);
}

.gallery-lightbox-prev { left: 1.5rem; }
.gallery-lightbox-next { right: 1.5rem; }

.gallery-lightbox-counter {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  color: rgba(248,248,244,0.5);
  letter-spacing: 0.1em;
}

/* ── Responsive ── */

/* Tablet */
@media (max-width: 1024px) {
  #gallery { padding: 3.5rem 0; }
  .gallery-grid { grid-template-columns: repeat(3, 1fr); gap: 1rem; }
  .gallery-header { margin-bottom: 2.5rem; }
  .gallery-caption { padding: 0.85rem 0.75rem 1rem; }
  .gallery-caption-name { font-size: 0.78rem; }
  .gallery-caption-title { font-size: 0.65rem; }
}

/* Mobile */
@media (max-width: 768px) {
  #gallery { padding: 3rem 0; }
  .gallery-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
    max-width: 420px;
    margin-left: auto;
    margin-right: auto;
  }
  .gallery-header { margin-bottom: 2rem; }
  .gallery-card {
    border-radius: 12px;
  }
  .gallery-item {
    aspect-ratio: 4 / 3;
  }
  .gallery-item-overlay { display: none; }
  .gallery-caption {
    padding: 0.9rem 1rem 1rem;
    gap: 0.25rem;
    border-top: 1px solid rgba(0,245,196,0.1);
  }
  .gallery-caption-name {
    font-size: 0.82rem;
  }
  .gallery-caption-title {
    font-size: 0.68rem;
  }
  
  .gallery-lightbox-img {
    max-width: 95vw;
    max-height: 65vh;
    border-radius: 8px;
  }
  .gallery-lightbox-prev { left: 0.75rem; }
  .gallery-lightbox-next { right: 0.75rem; }
  .gallery-lightbox-close { top: 1rem; right: 1rem; width: 38px; height: 38px; }
  .gallery-lightbox-nav { width: 38px; height: 38px; }
  .gallery-lightbox-caption { margin-top: 1rem; }
  .gallery-lightbox-caption-name { font-size: 0.92rem; }
  .gallery-lightbox-caption-title { font-size: 0.75rem; }
}

/* Small phones */
@media (max-width: 480px) {
  #gallery { padding: 2.5rem 0; }
  .gallery-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
    max-width: 100%;
    padding: 0 0.25rem;
  }
  .gallery-card {
    border-radius: 10px;
  }
  .gallery-item {
    aspect-ratio: 4 / 3;
  }
  .gallery-caption {
    padding: 0.75rem 0.75rem 0.85rem;
    gap: 0.2rem;
  }
  .gallery-caption-name {
    font-size: 0.78rem;
  }
  .gallery-caption-title {
    font-size: 0.64rem;
  }
  .gallery-lightbox-counter { bottom: 1rem; font-size: 0.72rem; }
  .gallery-lightbox-caption-name { font-size: 0.85rem; }
  .gallery-lightbox-caption-title { font-size: 0.7rem; max-width: 280px; }
}

/* Very narrow */
@media (max-width: 374px) {
  .gallery-grid { gap: 0.85rem; }
  .gallery-card { border-radius: 8px; }
  .gallery-caption { padding: 0.65rem 0.6rem 0.75rem; }
  .gallery-caption-name { font-size: 0.72rem; }
  .gallery-caption-title { font-size: 0.6rem; }
}
