.tg-gallery {
  width: 100%;
}

/* Keep the full-width/stretched Elementor section as the background canvas,
   but give the homepage preview its own safe inner breathing room. border-box
   prevents the padding from increasing a JS-stretched 100% width. */
.tg-gallery--preview {
  box-sizing: border-box;
  padding: 16px;
}

.tg-gallery--preview .tg-items {
  width: var(--tg-preview-width-desktop);
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
}

.tg-header {
  margin: 0 0 1.5rem;
}

.tg-title {
  margin: 0;
}

.tg-subtitle {
  margin-top: .5rem;
}

.tg-layout-grid .tg-items {
  display: grid;
  grid-template-columns: repeat(var(--tg-cols-desktop), minmax(0, 1fr));
  gap: var(--tg-gap);
}

.tg-gallery--preview.tg-layout-grid .tg-items {
  grid-template-columns: repeat(var(--tg-effective-cols-desktop), minmax(0, 1fr));
}

.tg-layout-grid .tg-image-link {
  width: 100%;
  aspect-ratio: var(--tg-ratio);
}

.tg-layout-grid .tg-image-link img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tg-layout-masonry .tg-items {
  display: grid;
  grid-template-columns: repeat(var(--tg-cols-desktop), minmax(0, 1fr));
  grid-auto-rows: 1px;
  column-gap: var(--tg-gap);
  row-gap: 0;
  align-items: start;
}

.tg-gallery--preview.tg-layout-masonry .tg-items {
  grid-template-columns: repeat(var(--tg-effective-cols-desktop), minmax(0, 1fr));
}

.tg-gallery--full.tg-layout-masonry .tg-items {
  overflow-anchor: none;
}

.tg-layout-masonry .tg-item {
  min-width: 0;
}

.tg-layout-masonry .tg-image-link img {
  width: 100%;
  height: auto;
}

.tg-item {
  min-width: 0;
}

.tg-image-link {
  display: block;
  overflow: hidden;
  text-decoration: none;
}

.tg-image-link img {
  display: block;
  transition: transform .22s ease, filter .22s ease;
  transform-origin: center center;
}

@media (hover: hover) and (pointer: fine) {
  .tg-image-link:hover img {
    transform: scale(1.025);
    filter: brightness(.96);
  }
}


/* Mobile/coarse-pointer lightbox: horizontal gestures belong to the gallery.
   Pinch zoom is intentionally not enabled inside the modal. */
@media (hover: none) and (pointer: coarse) {
  .tg-lightbox,
  .tg-lightbox-stage,
  .tg-lightbox-image {
    touch-action: pan-y;
  }

  .tg-lightbox-image {
    -webkit-user-select: none;
    user-select: none;
    -webkit-user-drag: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tg-image-link img {
    transition: none;
  }

  .tg-image-link:hover img {
    transform: none;
  }
}

.tg-item-text {
  padding-top: .65rem;
}

.tg-item-title {
  font-weight: 600;
}

.tg-item-caption {
  margin-top: .2rem;
}

.tg-footer {
  margin-top: 1.5rem;
  text-align: center;
}

.tg-gallery-button {
  display: inline-block;
  text-decoration: none;
}

.tg-lightbox[hidden] {
  display: none !important;
}

.tg-lightbox {
  position: fixed;
  z-index: 100000;
  inset: 0;
  background: rgba(0, 0, 0, .92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 4.5rem;
}

.tg-lightbox-stage {
  max-width: min(92vw, 1800px);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.tg-lightbox-image {
  max-width: 100%;
  max-height: calc(92vh - 7rem);
  width: auto;
  height: auto;
  object-fit: contain;
}

.tg-lightbox-text {
  max-width: 900px;
  margin-top: .8rem;
  text-align: center;
  color: #fff;
}

.tg-lightbox-title {
  font-weight: 600;
}

.tg-lightbox-caption {
  margin-top: .2rem;
}

.tg-lightbox-close,
.tg-lightbox-prev,
.tg-lightbox-next {
  position: absolute;
  border: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
  line-height: 1;
  padding: .5rem;
}

.tg-lightbox-close {
  top: 1rem;
  right: 1rem;
  font-size: 2.5rem;
}

.tg-lightbox-prev,
.tg-lightbox-next {
  top: 50%;
  transform: translateY(-50%);
  font-size: 2.5rem;
}

.tg-lightbox-prev {
  left: 1rem;
}

.tg-lightbox-next {
  right: 1rem;
}

body.tg-lightbox-open {
  overflow: hidden;
}

@media (max-width: 991px) {
  .tg-layout-grid .tg-items {
    grid-template-columns: repeat(var(--tg-cols-tablet), minmax(0, 1fr));
  }

  .tg-layout-masonry .tg-items {
    grid-template-columns: repeat(var(--tg-cols-tablet), minmax(0, 1fr));
  }

  .tg-gallery--preview .tg-items {
    width: var(--tg-preview-width-tablet);
  }

  .tg-gallery--preview.tg-layout-grid .tg-items,
  .tg-gallery--preview.tg-layout-masonry .tg-items {
    grid-template-columns: repeat(var(--tg-effective-cols-tablet), minmax(0, 1fr));
  }
}

@media (max-width: 575px) {
  .tg-gallery--preview {
    padding: 12px;
  }

  .tg-layout-grid .tg-items {
    grid-template-columns: repeat(var(--tg-cols-mobile), minmax(0, 1fr));
  }

  .tg-layout-masonry .tg-items {
    grid-template-columns: repeat(var(--tg-cols-mobile), minmax(0, 1fr));
  }

  .tg-gallery--preview .tg-items {
    width: var(--tg-preview-width-mobile);
  }

  .tg-gallery--preview.tg-layout-grid .tg-items,
  .tg-gallery--preview.tg-layout-masonry .tg-items {
    grid-template-columns: repeat(var(--tg-effective-cols-mobile), minmax(0, 1fr));
  }

  .tg-lightbox {
    padding: 3.5rem 1rem 1rem;
  }

  .tg-lightbox-stage {
    max-width: 96vw;
    max-height: calc(100vh - 4.5rem);
  }

  .tg-lightbox-image {
    max-height: calc(100vh - 8rem);
  }

  .tg-lightbox-prev,
  .tg-lightbox-next {
    font-size: 2rem;
  }

  .tg-lightbox-prev {
    left: .25rem;
  }

  .tg-lightbox-next {
    right: .25rem;
  }
}
