/* Category Gallery */
.page-template-gallery-page {
  background-color: #bea058;
}

.gallery-heading {
  text-align: center;
  font-size: 2.5rem;
  margin: 60px auto 20px;
  font-weight: 700;
  color: #fff;
}

.category-gallery {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    max-width: 1200px;
    margin: 60px auto 60px;
    padding: 0 15px;
}

.category-item {
  position: relative;
  flex: 1 1 calc(33% - 20px);
  cursor: pointer;
  min-width: 250px;
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease;
  border-radius: 10px;
  z-index: 1;
}

.category-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
  transition: transform 0.3s ease;
  position: relative;
  z-index: 3;
}

.category-item::before,
.category-item::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: var(--bg-img);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border-radius: 10px;
  z-index: 1;
  opacity: 0.6;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.category-item::before {
  transform: rotate(-4deg) scale(0.96);
  z-index: 1;
}

.category-item::after {
  transform: rotate(4deg) scale(0.96);
  z-index: 2;
}

.category-item:hover::before,
.category-item:hover::after {
  opacity: 0;
}

.category-item:hover img {
  transform: scale(1.02);
  z-index: 4;
}

.overlay-text {
  position: absolute;
  bottom: 20px;
  left: 20px;
  color: white;
  font-size: 1.5rem;
  font-weight: bold;
  z-index: 5;
  text-shadow: 1px 1px 5px rgba(0, 0, 0, 0.8);
}

.back-btn {
  margin: 40px auto 20px;
  display: block;
  padding: 10px 20px;
  background: #333;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  position: relative;
  z-index: 10;
}

/* Masonry Gallery */
.main-preview img {
  max-height: 50vh;
  max-width: 100%;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 0 10px rgba(0,0,0,0.2);
}

.horizontal-gallery {
  max-width: 1000px;
  margin: 40px auto;
  padding: 0 1rem;
}

.main-preview {
  width: 100%;
  height: auto;
  text-align: center;
  margin-bottom: 1rem;
}

.main-preview img {
  max-width: 100%;
  border-radius: 10px;
  box-shadow: 0 0 10px rgba(0,0,0,0.2);
}

.thumb-strip {
  display: flex;
  overflow-x: auto;
  gap: 10px;
  padding: 10px 0;
  scrollbar-width: thin;
}

.thumb-strip::-webkit-scrollbar {
  height: 6px;
}

.thumb-strip::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}

.thumb-strip img {
  height: 150px;
  cursor: pointer;
  border-radius: 5px;
  transition: transform 0.2s, opacity 0.2s;
  opacity: 0.7;
  flex-shrink: 0;
}

.thumb-strip img.active,
.thumb-strip img:hover {
  opacity: 1;
  transform: scale(1.05);
  border: 2px solid #f90;
}

.lightbox-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.9);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  flex-direction: column;
  padding: 2rem;
}

.lightbox-content img {
  max-width: 100%;
  max-height: 60vh;
  border-radius: 10px;
}

.lightbox-thumbnails {
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.lightbox-thumbnails img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border: 2px solid white;
  border-radius: 5px;
  cursor: pointer;
  opacity: 0.6;
}

.lightbox-thumbnails img.active,
.lightbox-thumbnails img:hover {
  opacity: 1;
  border-color: #f90;
}

.lightbox-close {
  position: absolute;
  top: 30px;
  right: 50px;
  font-size: 40px;
  color: white;
  cursor: pointer;
}

@media (max-width: 768px) {
  .category-item {
    flex: 1 1 calc(50% - 20px);
  }
  .thumb-strip img {
    height: 80px;
  }
  .gallery-heading {
    margin-top: 7rem;
  }
}

/* Responsive */
@media (max-width: 768px) {
    .category-item {
        flex: 1 1 calc(50% - 20px);
    }
}

@media (max-width: 480px) {
    .category-item {
        flex: 1 1 100%;
    }

    .overlay-text {
        font-size: 1.2rem;
    }
}

.thumb-nav {
  position: absolute;
  bottom: calc((160px / 2) - 18px);
  background: white;
  color: #333;
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 18px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s;
}

@media (max-width: 768px) {
  .thumb-nav {
    bottom: calc((95px / 2) - 18px);
  }
}

.thumb-nav:hover {
  background: #eee;
}

.thumb-nav.left {
  left: 10px;
}

.thumb-nav.right {
  right: 10px;
}

.horizontal-gallery {
  position: relative;
}

.image-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.6);
  color: white;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 18px;
  z-index: 5;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-nav.left {
  left: 10px;
}

.image-nav.right {
  right: 10px;
}

.main-preview {
  position: relative;
  text-align: center;
  margin-bottom: 1rem;
}
