/* ============================
   Gallery Page Overrides
   ============================ */
.hero {
  background:
    linear-gradient(rgba(15, 17, 23, 0.72), rgba(15, 17, 23, 0.72)),
    var(--hero-image, url("../../images/banner(1920).jpg")) center/cover no-repeat;
}

.gallery-section {
  padding: 90px 5% 120px;
  background: var(--dark-bg);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  margin-top: 40px;
}

.gallery-card {
  background: var(--dark-card);
  border: 1px solid var(--dark-border);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition: transform var(--transition), box-shadow var(--transition);
}

.gallery-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.3);
}

.gallery-photo {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-bottom: 1px solid var(--dark-border);
  padding: 0;
  width: 100%;
  background: none;
  border-top: 0;
  border-left: 0;
  border-right: 0;
  cursor: zoom-in;
}

.gallery-photo img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform var(--transition);
}

.gallery-card:hover .gallery-photo img {
  transform: scale(1.04);
}

.gallery-photo:focus-visible {
  outline: 3px solid rgba(255, 153, 51, 0.9);
  outline-offset: -3px;
}

.gallery-caption {
  padding: 20px 22px 26px;
}

.gallery-caption h4 {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  margin-bottom: 8px;
}

.gallery-caption p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Light mode tuning */
.light-mode .gallery-section {
  background: var(--dark-bg);
}

.light-mode .gallery-card {
  background: #fff;
  border-color: #eceff4;
}

.light-mode .gallery-photo {
  border-color: #eceff4;
}

.gallery-lightbox {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.24s ease, visibility 0s linear 0.24s;
  z-index: 4000;
}

.gallery-lightbox.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition-delay: 0s;
}

.gallery-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(7, 10, 18, 0.84);
  backdrop-filter: blur(8px);
}

.gallery-lightbox-dialog {
  position: relative;
  width: min(1100px, 100%);
  max-height: min(92vh, 940px);
  background: rgba(18, 23, 35, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
}

.gallery-lightbox-media {
  background: #05070d;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px 18px 0;
  overflow: hidden;
}

.gallery-lightbox-media img {
  width: auto;
  max-width: 100%;
  max-height: calc(92vh - 185px);
  height: auto;
  display: block;
  object-fit: contain;
}

.gallery-lightbox-caption {
  padding: 18px 24px 24px;
}

.gallery-lightbox-caption h3 {
  margin: 0 0 8px;
  font-family: var(--font-heading);
  font-size: 1.5rem;
}

.gallery-lightbox-caption p {
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
}

.gallery-lightbox-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(9, 12, 20, 0.75);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  z-index: 1;
}

.gallery-lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border: none;
  border-radius: 50%;
  background: rgba(9, 12, 20, 0.72);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  z-index: 1;
}

.gallery-lightbox-nav.prev {
  left: 16px;
}

.gallery-lightbox-nav.next {
  right: 16px;
}

.gallery-lightbox-nav:hover,
.gallery-lightbox-nav:focus-visible,
.gallery-lightbox-close:hover,
.gallery-lightbox-close:focus-visible {
  background: rgba(228, 77, 46, 0.95);
}

.light-mode .gallery-lightbox-dialog {
  background: rgba(255, 255, 255, 0.97);
  border-color: rgba(18, 23, 35, 0.08);
}

.light-mode .gallery-lightbox-media {
  background: #f3f5f9;
}

.light-mode .gallery-lightbox-caption p {
  color: #3e4a5f;
}

body.lightbox-open {
  overflow: hidden;
}

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

@media (max-width: 720px) {
  .gallery-grid {
    grid-template-columns: 1fr;
  }

  .gallery-lightbox {
    padding: 14px;
  }

  .gallery-lightbox-dialog {
    border-radius: 18px;
    max-height: 88vh;
  }

  .gallery-lightbox-media {
    padding: 14px 14px 0;
  }

  .gallery-lightbox-media img {
    max-height: calc(88vh - 165px);
  }

  .gallery-lightbox-caption {
    padding: 16px 18px 20px;
  }

  .gallery-lightbox-caption h3 {
    font-size: 1.2rem;
  }

  .gallery-lightbox-nav {
    width: 44px;
    height: 44px;
    font-size: 1.7rem;
  }

  .gallery-lightbox-nav.prev {
    left: 10px;
  }

  .gallery-lightbox-nav.next {
    right: 10px;
  }
}
