.ngal-section {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.ngal-grid {
  display: grid;
  grid-template-columns: repeat(var(--ngal-cols, 4), 1fr);
  gap: var(--ngal-gap, 2px);
  grid-auto-flow: dense;
  width: 100%;
  max-width: var(--ngal-max-width, 100%);
  margin: 0 auto;
}

.ngal-item {
  position: relative;
  display: block;
  overflow: hidden;
  background: #e8e8e8;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  aspect-ratio: var(--ngal-ratio, 1 / 1);
}

.ngal-item--portrait {
  --ngal-ratio: 3 / 4;
  grid-row: span 2;
}

.ngal-item--landscape {
  --ngal-ratio: 4 / 3;
  grid-column: span 2;
}

.ngal-item--tall {
  --ngal-ratio: 2 / 3;
  grid-row: span 2;
}

.ngal-item--wide {
  --ngal-ratio: 16 / 9;
  grid-column: span 2;
}

.ngal-item--small {
  --ngal-ratio: 1 / 1;
}

.ngal-stack {
  grid-row: span 2;
  display: flex;
  flex-direction: column;
  gap: var(--ngal-gap, 2px);
  aspect-ratio: 2 / 3;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.ngal-stack .ngal-item.ngal-stack-item {
  flex: 1 1 50%;
  aspect-ratio: auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
}

.ngal-stack .ngal-media {
  position: relative;
  inset: auto;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ngal-stack .ngal-img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
}

.ngal-stack .ngal-item:hover .ngal-img {
  transform: none;
  filter: brightness(0.96);
}

.ngal-media {
  position: absolute;
  inset: 0;
}

.ngal-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: transform 0.45s ease, filter 0.35s ease;
}

.ngal-item:hover .ngal-img {
  transform: scale(1.04);
  filter: brightness(0.92);
}

.ngal-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(0, 0, 0, 0.45) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.ngal-item:hover .ngal-overlay {
  opacity: 1;
}

.ngal-badge {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 2;
  background: rgba(80, 80, 80, 0.72);
  color: #ffffff;
  font-family: Montserrat, sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 5px 9px;
  line-height: 1.2;
  pointer-events: none;
}

.ngal-item:hover .ngal-badge {
  background: rgba(40, 40, 40, 0.88);
}

.ngal-badge.is-hidden {
  display: none;
}

.ngal-lightbox {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(0, 0, 0, 0.92);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
}

.ngal-lightbox.is-open {
  display: flex;
}

.ngal-lightbox img {
  max-width: min(1100px, 96vw);
  max-height: 90vh;
  width: auto;
  height: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.ngal-lightbox-close {
  position: absolute;
  top: 18px;
  right: 22px;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

@media (max-width: 1024px) {
  .ngal-item--landscape,
  .ngal-item--wide {
    grid-column: span 1;
  }
}

@media (max-width: 767px) {
  .ngal-item--portrait,
  .ngal-item--tall,
  .ngal-stack {
    grid-row: span 1;
  }

  .ngal-stack {
    aspect-ratio: 3 / 4;
  }
}
