/* === Gallery === */
.gallery__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(1rem, 1.8vw, 1.75rem);
}

.gallery__item {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--color-bg-alt);
  cursor: zoom-in;
  border: none;
  padding: 0;
}

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

.gallery__item:hover img {
  transform: scale(1.05);
}

.gallery__item::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(43, 42, 40, 0);
  transition: background var(--transition);
}

.gallery__item:hover::after {
  background: rgba(43, 42, 40, 0.08);
}

.gallery__empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem 1rem;
  color: var(--color-text-secondary);
}

/* === Pagination === */
.gallery__pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: clamp(2rem, 4vw, 3.5rem);
}

.gallery__page {
  min-width: 44px;
  height: 44px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
}

.gallery__page:hover:not(:disabled):not(.is-active) {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.gallery__page.is-active {
  background: var(--color-btn-bg);
  color: var(--color-btn-text);
  border-color: var(--color-btn-bg);
  cursor: default;
}

.gallery__page:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.gallery__page--dots {
  border: none;
  cursor: default;
  min-width: auto;
  padding: 0 4px;
  color: var(--color-text-secondary);
}

/* === Lightbox === */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 19, 18, 0.92);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition), visibility var(--transition);
  padding: clamp(1rem, 4vw, 3rem);
}

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

.lightbox__img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--radius);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  user-select: none;
}

.lightbox__btn {
  position: absolute;
  background: rgba(246, 243, 238, 0.1);
  border: 1px solid rgba(246, 243, 238, 0.25);
  color: var(--color-white);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition);
  z-index: 2;
}

.lightbox__btn:hover {
  background: rgba(246, 243, 238, 0.22);
}

.lightbox__btn svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.lightbox__close {
  top: clamp(1rem, 3vw, 2rem);
  right: clamp(1rem, 3vw, 2rem);
}

.lightbox__prev {
  left: clamp(0.5rem, 2vw, 2rem);
  top: 50%;
  transform: translateY(-50%);
}

.lightbox__next {
  right: clamp(0.5rem, 2vw, 2rem);
  top: 50%;
  transform: translateY(-50%);
}

.lightbox__counter {
  position: absolute;
  bottom: clamp(1rem, 3vw, 2rem);
  left: 50%;
  transform: translateX(-50%);
  color: rgba(246, 243, 238, 0.8);
  font-size: var(--text-sm);
  letter-spacing: 0.05em;
}

/* === Responsive === */
@media (max-width: 768px) {
  .gallery__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .gallery__grid {
    grid-template-columns: 1fr;
  }
  .lightbox__prev {
    left: 0.5rem;
  }
  .lightbox__next {
    right: 0.5rem;
  }
}
