/* =========================================================
   GALLERY PAGE
   Relies on the CSS variables defined in style.css (:root) and
   the shared .products-page-header block from products-page.css
   ========================================================= */

/* ---------- Filter chips ---------- */
.gallery-filter-bar {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 40px 24px 0;
  max-width: 1200px;
  margin: 0 auto;
}

.gallery-chip {
  padding: 10px 22px;
  border-radius: 30px;
  border: 1.5px solid #dbe6f2;
  background: #ffffff;
  color: #5b6b82;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}

.gallery-chip:hover {
  border-color: #157dff;
  color: #157dff;
  transform: translateY(-2px);
}

.gallery-chip.is-active {
  background: linear-gradient(135deg, #2f7dff, #0d5ef4);
  border-color: transparent;
  color: #ffffff;
  box-shadow: 0 10px 22px rgba(13, 94, 244, 0.3);
}

/* ---------- Grid ---------- */
.gallery-grid-section {
  padding: 40px 24px 90px;
  max-width: 1200px;
  margin: 0 auto;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 22px;
}

.gallery-item {
  position: relative;
  aspect-ratio: 4 / 3.4;
  background: #f8fcff;
  border: 1px solid #e5edf6;
  border-radius: 18px;
  overflow: hidden;
  cursor: pointer;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.55s ease, transform 0.55s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.gallery-item.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.gallery-item.is-hidden {
  display: none;
}

.gallery-item:hover {
  box-shadow: 0 20px 45px rgba(6, 43, 99, 0.12);
  border-color: transparent;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 20px;
  transition: transform 0.5s cubic-bezier(0.19, 1, 0.22, 1);
}

.gallery-item:hover img {
  transform: scale(1.06);
}

.gallery-item-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 14px 16px;
  background: linear-gradient(0deg, rgba(6, 43, 99, 0.88) 0%, rgba(6, 43, 99, 0) 100%);
  color: #ffffff;
  font-size: 13.5px;
  font-weight: 600;
  transform: translateY(100%);
  transition: transform 0.35s ease;
}

.gallery-item:hover .gallery-item-caption {
  transform: translateY(0);
}

.gallery-item-zoom {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  color: #157dff;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.gallery-item:hover .gallery-item-zoom {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- Lightbox ---------- */
.gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: rgba(3, 15, 35, 0.92);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.gallery-lightbox.is-open {
  opacity: 1;
  visibility: visible;
}

.gallery-lightbox-inner {
  position: relative;
  max-width: 900px;
  max-height: 86vh;
  width: 100%;
  text-align: center;
}

.gallery-lightbox-img {
  max-width: 100%;
  max-height: 72vh;
  object-fit: contain;
  border-radius: 14px;
  background: #ffffff;
  margin: 0 auto;
  transform: scale(0.94);
  transition: transform 0.3s ease;
}

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

.gallery-lightbox-caption {
  margin-top: 18px;
  color: #ffffff;
  font-size: 15px;
  font-weight: 600;
}

.gallery-lightbox-close {
  position: absolute;
  top: -50px;
  right: 0;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.25s ease, transform 0.25s ease;
}

.gallery-lightbox-close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: rotate(90deg);
}

.gallery-lightbox-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  cursor: pointer;
  transition: background 0.25s ease, transform 0.25s ease, opacity 0.2s ease;
}

.gallery-lightbox-prev {
  left: 20px;
}

.gallery-lightbox-next {
  right: 20px;
}

.gallery-lightbox-arrow:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-50%) scale(1.08);
}

.gallery-lightbox-arrow.is-hidden {
  visibility: hidden;
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
  .gallery-item-caption { font-size: 12px; }
  .gallery-lightbox { padding: 20px; }
  .gallery-lightbox-close { top: -46px; width: 36px; height: 36px; }
  .gallery-lightbox-arrow { width: 38px; height: 38px; }
  .gallery-lightbox-prev { left: 6px; }
  .gallery-lightbox-next { right: 6px; }
}
