/* =========================
   GALLERY SECTION
========================= */

.gallery-section {
  position: relative;
  padding: 100px 0 100px;
}

.gallery-section::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 15% 20%, rgba(177, 79, 255, 0.08), transparent 20%),
    radial-gradient(circle at 85% 30%, rgba(255, 79, 216, 0.06), transparent 18%),
    radial-gradient(circle at 50% 85%, rgba(134, 22, 228, 0.08), transparent 25%);
}

.gallery-container {
  position: relative;
  z-index: 1;
  width: min(92%, 1320px);
  margin: 0 auto;
}

.gallery-header {
  max-width: 780px;
  margin: 0 auto 42px;
  text-align: center;
}

.gallery-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid rgba(184, 108, 255, 0.28);
  background: rgba(134, 22, 228, 0.09);
  color: #d59aff;
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.2px;
  box-shadow:
    0 0 10px rgba(134, 22, 228, 0.16),
    inset 0 0 10px rgba(255, 255, 255, 0.02);
}

.gallery-header h2 {
  margin: 18px 0 14px;
  font-size: clamp(2.2rem, 4.8vw, 4rem);
  line-height: 1.02;
  color: #fff;
  letter-spacing: -1.4px;
  text-shadow:
    0 0 8px rgba(255, 255, 255, 0.16),
    0 0 22px rgba(184, 108, 255, 0.14);
}

.gallery-header p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.75;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: 220px;
  gap: 18px;
}

.gallery-item {
  min-width: 0;
}

.gallery-item.tall {
  grid-row: span 2;
}

.gallery-item.wide {
  grid-column: span 2;
}

.gallery-card {
  position: relative;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 1px solid rgba(184, 108, 255, 0.16);
  border-radius: 24px;
  overflow: hidden;
  background: linear-gradient(
    180deg,
    rgba(30, 18, 48, 0.9),
    rgba(14, 8, 24, 0.96)
  );
  cursor: pointer;
  box-shadow:
    0 0 14px rgba(134, 22, 228, 0.08),
    inset 0 0 0 1px rgba(255, 255, 255, 0.02);
  transition:
    transform 0.28s ease,
    border-color 0.28s ease,
    box-shadow 0.28s ease;
}

.gallery-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to top, rgba(5, 2, 10, 0.34), transparent 48%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.04), transparent 30%);
  pointer-events: none;
  opacity: 0.85;
  transition: opacity 0.25s ease;
}

.gallery-card img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition:
    transform 0.4s ease,
    filter 0.3s ease;
}

.gallery-card:hover {
  transform: translateY(-6px);
  border-color: rgba(184, 108, 255, 0.36);
  box-shadow:
    0 0 18px rgba(134, 22, 228, 0.16),
    0 0 34px rgba(134, 22, 228, 0.12);
}

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

.gallery-card:hover::after {
  opacity: 0.6;
}

.hidden-item {
  display: none;
}

.gallery-actions {
  display: flex;
  justify-content: center;
  margin-top: 28px;
}

.gallery-more-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 22px;
  border: 1px solid rgba(184, 108, 255, 0.22);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  color: #fff;
  font-size: 0.96rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    transform 0.25s ease,
    border-color 0.25s ease,
    box-shadow 0.25s ease,
    background 0.25s ease;
}

.gallery-more-btn:hover {
  transform: translateY(-2px);
  border-color: rgba(184, 108, 255, 0.45);
  background: rgba(255, 255, 255, 0.045);
  box-shadow: 0 0 14px rgba(134, 22, 228, 0.18);
}

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

.gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
}

.gallery-lightbox.active {
  display: grid;
  place-items: center;
}

.gallery-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at center, rgba(25, 12, 40, 0.22), rgba(3, 2, 8, 0.92)),
    rgba(3, 2, 8, 0.86);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.gallery-lightbox-shell {
  position: relative;
  z-index: 1;
  width: min(94vw, 1180px);
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 56px;
  align-items: center;
  gap: 18px;
  padding: 24px;
}

.gallery-lightbox-content {
  position: relative;
  min-width: 0;
}

.gallery-lightbox-image-wrap {
  width: 100%;
  max-height: 82vh;
  border-radius: 28px;
  overflow: hidden;
  border: 1px solid rgba(184, 108, 255, 0.18);
  background:
    linear-gradient(180deg, rgba(16, 10, 28, 0.98), rgba(7, 4, 14, 0.99));
  box-shadow:
    0 0 20px rgba(134, 22, 228, 0.18),
    0 0 46px rgba(134, 22, 228, 0.12),
    inset 0 0 0 1px rgba(255, 255, 255, 0.02);
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-lightbox-image-wrap img {
  display: block;
  max-width: 100%;
  max-height: 82vh;
  width: auto;
  height: auto;
  object-fit: contain;
  background: transparent;
}

.gallery-lightbox-caption {
  margin-top: 14px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
  min-height: 24px;
}

.gallery-lightbox-close,
.gallery-lightbox-nav {
  border: 1px solid rgba(184, 108, 255, 0.18);
  background: rgba(14, 8, 24, 0.84);
  color: #fff;
  cursor: pointer;
  transition:
    transform 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.gallery-lightbox-close:hover,
.gallery-lightbox-nav:hover {
  border-color: rgba(184, 108, 255, 0.42);
  background: rgba(22, 12, 36, 0.94);
  box-shadow:
    0 0 16px rgba(134, 22, 228, 0.18),
    0 0 28px rgba(134, 22, 228, 0.12);
}

.gallery-lightbox-close {
  position: absolute;
  top: -8px;
  right: 8px;
  width: 48px;
  height: 48px;
  border-radius: 16px;
  font-size: 1.2rem;
  font-weight: 700;
  z-index: 3;
}

.gallery-lightbox-close:hover {
  transform: translateY(-2px);
}

.gallery-lightbox-nav {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  font-size: 2rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.gallery-lightbox-nav:hover {
  transform: scale(1.05);
}

.gallery-lightbox-nav.prev {
  justify-self: end;
}

.gallery-lightbox-nav.next {
  justify-self: start;
}

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

@media (max-width: 1100px) {
  .gallery-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .gallery-item.wide {
    grid-column: span 1;
  }
}

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

  .gallery-header {
    margin-bottom: 30px;
  }

  .gallery-header h2 {
    font-size: clamp(2rem, 8vw, 3rem);
    line-height: 1.04;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: 190px;
    gap: 14px;
  }

  .gallery-item.tall,
  .gallery-item.wide {
    grid-column: span 1;
    grid-row: span 1;
  }

  .gallery-card {
    border-radius: 18px;
  }

  .gallery-lightbox-content {
    width: min(94vw, 1100px);
    height: min(72vh, 620px);
    margin-top: 9vh;
  }

  .gallery-lightbox-close {
    top: -54px;
    right: 0;
  }

  .gallery-lightbox-nav {
    bottom: -66px;
    top: auto;
    transform: none;
    width: 48px;
    height: 48px;
  }

  .gallery-lightbox-nav:hover {
    transform: translateY(-2px);
  }

  .gallery-lightbox-nav.prev {
    left: calc(50% - 60px);
  }

  .gallery-lightbox-nav.next {
    right: calc(50% - 60px);
  }
  .gallery-lightbox-shell {
    width: min(96vw, 1180px);
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 18px 14px 90px;
  }

  .gallery-lightbox-content {
    order: 1;
  }

  .gallery-lightbox-close {
    top: 4px;
    right: 4px;
    width: 44px;
    height: 44px;
    border-radius: 14px;
  }

  .gallery-lightbox-nav {
    position: absolute;
    bottom: 22px;
    width: 48px;
    height: 48px;
  }

  .gallery-lightbox-nav.prev {
    left: calc(50% - 58px);
  }

  .gallery-lightbox-nav.next {
    right: calc(50% - 58px);
  }

  .gallery-lightbox-image-wrap,
  .gallery-lightbox-image-wrap img {
    max-height: 68vh;
  }

  .gallery-lightbox-caption {
    font-size: 0.9rem;
    margin-top: 12px;
  }
}

@media (max-width: 520px) {
  .gallery-grid {
    grid-template-columns: 1fr;
    grid-auto-rows: 240px;
  }

  .gallery-more-btn {
    width: 100%;
  }

  .gallery-lightbox-content {
    height: min(60vh, 500px);
  }
}