/* ==========================================================================
   gallery.css — filterable photo gallery + lightbox
   ========================================================================== */

.gallery {
  padding-block: var(--sp-10) var(--sp-11);
  background: var(--paper);
}

.gallery__head {
  max-width: 680px;
  margin-bottom: var(--sp-7);
}

.gallery__tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  margin-bottom: var(--sp-7);
}

.gallery__tab {
  padding: 0.6em 1.3em;
  border-radius: var(--radius-pill);
  background: var(--paper);
  border: 1.5px solid var(--steel-200);
  color: var(--ink-700);
  font-weight: 600;
  font-size: 0.87rem;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.gallery__tab:hover {
  border-color: var(--ember-500);
  color: var(--ember-600);
}
.gallery__tab.is-active {
  background: var(--indigo-900);
  border-color: var(--indigo-900);
  color: #fff;
}

.gallery__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-4);
}

.gallery__item {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  background: var(--steel-100);
}
.gallery__item.is-hidden {
  display: none;
}

.gallery__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s var(--ease);
}
.gallery__item:hover img {
  transform: scale(1.08);
}

.gallery__item::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(23, 15, 40, 0.85) 0%, rgba(23, 15, 40, 0) 55%);
  opacity: 0;
  transition: opacity 0.25s var(--ease);
}
.gallery__item:hover::after {
  opacity: 1;
}

.gallery__item-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  padding: var(--sp-3) var(--sp-4);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
}
.gallery__item:hover .gallery__item-caption {
  opacity: 1;
  transform: translateY(0);
}

.gallery__item-zoom {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(23, 15, 40, 0.55);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.25s var(--ease);
}
.gallery__item:hover .gallery__item-zoom {
  opacity: 1;
}
.gallery__item-zoom svg {
  width: 15px;
  height: 15px;
}

@media (max-width: 980px) {
  .gallery__grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 640px) {
  .gallery__grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--sp-3);
  }
  .gallery__tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    margin-inline: calc(var(--container-pad) * -1);
    padding-inline: var(--container-pad);
    padding-bottom: var(--sp-2);
    scrollbar-width: none;
  }
  .gallery__tabs::-webkit-scrollbar {
    display: none;
  }
  .gallery__tab {
    flex: none;
  }
}

/* ---- Lightbox -------------------------------------------------------------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(15, 10, 25, 0.94);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-6);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s var(--ease), visibility 0.25s;
}
.lightbox.is-open {
  opacity: 1;
  visibility: visible;
}

.lightbox__figure {
  max-width: min(1100px, 92vw);
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lightbox__img {
  max-width: 100%;
  max-height: 76vh;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  object-fit: contain;
}

.lightbox__caption {
  color: #ece7f5;
  font-size: 0.9rem;
  margin-top: var(--sp-4);
  text-align: center;
}

.lightbox__close,
.lightbox__nav {
  position: fixed;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s var(--ease);
}
.lightbox__close:hover,
.lightbox__nav:hover {
  background: rgba(255, 255, 255, 0.22);
}

.lightbox__close {
  top: var(--sp-5);
  right: var(--sp-5);
  width: 42px;
  height: 42px;
}
.lightbox__close svg {
  width: 18px;
  height: 18px;
}

.lightbox__nav {
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
}
.lightbox__nav svg {
  width: 20px;
  height: 20px;
}
.lightbox__nav--prev {
  left: var(--sp-5);
}
.lightbox__nav--next {
  right: var(--sp-5);
}

@media (max-width: 640px) {
  .lightbox__nav {
    width: 38px;
    height: 38px;
  }
  .lightbox__nav--prev {
    left: var(--sp-3);
  }
  .lightbox__nav--next {
    right: var(--sp-3);
  }
  .lightbox__close {
    top: var(--sp-3);
    right: var(--sp-3);
    width: 36px;
    height: 36px;
  }
}
