/* Gallery masonry + lightbox — visual tour grid */

.visual_tour_section.tg-gallery {
  padding-top:2px;
  margin-top: 80px;
  padding-bottom: 110px;
}

.tg-gallery {
  --mg-primary: #049060;
  --mg-accent: #14cc86;
  --mg-white: #ffffff;
  --tg-font-body: 'Open Sans', 'frutigerltarabic-65bold', sans-serif;

  width: 100%;
  float: none;
  clear: both;
}

.tg-gallery * {
  box-sizing: border-box;
}

.visual_tour_container_images.tg-gallery-grid-section {
  width: 1176px;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding: 20px 15px 0;
  float: none;
}

.tg-gallery-grid {
  column-count: 1;
  column-gap: 0.75rem;
}

@media (min-width: 640px) {
  .tg-gallery-grid {
    column-count: 2;
  }
}

@media (min-width: 1024px) {
  .tg-gallery-grid {
    column-count: 3;
  }
}

@media (min-width: 1280px) {
  .tg-gallery-grid {
    column-count: 4;
  }
}

.tg-gallery-item {
  break-inside: avoid;
  margin-bottom: 0.75rem;
  opacity: 0;
  transform: translateY(24px) scale(0.98);
  animation: tg-fade-up 0.35s ease forwards;
}

@keyframes tg-fade-up {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.tg-gallery-card {
  position: relative;
  cursor: pointer;
  overflow: hidden;
  border-radius: 0.5rem;
}

.tg-gallery-media {
  position: relative;
  overflow: hidden;
  width: 100%;
}

.tg-aspect-wide {
  aspect-ratio: 16 / 10;
}

.tg-aspect-standard {
  aspect-ratio: 5 / 4;
}

.tg-aspect-tall {
  aspect-ratio: 4 / 5;
}

.tg-aspect-video {
  aspect-ratio: 16 / 9;
}

.tg-aspect-video-std {
  aspect-ratio: 4 / 3;
}

.tg-gallery-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.7s ease;
  display: block;
}

.tg-gallery-card:hover .tg-gallery-media img {
  transform: scale(1.1);
}

.tg-gallery-overlay {
  position: absolute;
  inset: 0;
  background: transparent;
  transition: background 0.5s ease;
  pointer-events: none;
}

.tg-gallery-card:hover .tg-gallery-overlay {
  background: rgba(4, 80, 50, 0.45);
}

.tg-gallery-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.tg-gallery-play-btn {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  background: rgba(4, 144, 96, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  transition: transform 0.3s ease, background 0.3s ease;
  box-shadow: 0 4px 16px rgba(4, 144, 96, 0.35);
}

.tg-gallery-play-btn svg {
  width: 22px;
  height: 22px;
  color: var(--mg-white);
  margin-left: 2px;
  fill: currentColor;
}

.tg-gallery-card:hover .tg-gallery-play-btn {
  transform: scale(1.1);
  background: var(--mg-accent);
}

.tg-gallery-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.75rem;
  transform: translateY(100%);
  transition: transform 0.5s ease;
  pointer-events: none;
}

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

.tg-gallery-caption p {
  margin: 0;
  font-family: var(--tg-font-body);
  font-size: 0.75rem;
  color: var(--mg-white);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.tg-gallery-type-icon {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  color: var(--mg-accent);
}

html[lang="ar"] .tg-gallery-type-icon {
  right: auto;
  left: 0.5rem;
}

.tg-gallery-card:hover .tg-gallery-type-icon {
  opacity: 1;
}

.tg-gallery-type-icon svg {
  width: 14px;
  height: 14px;
  display: block;
}

.tg-gallery-empty {
  text-align: center;
  padding: 3rem 1rem;
  font-family: var(--tg-font-body);
  color: #6b6b6b;
  font-size: 1rem;
}

@media (max-width: 1199px) {
  .visual_tour_container_images.tg-gallery-grid-section {
    width: 100%;
    padding-left: 20px;
    padding-right: 20px;
  }
}

.tg-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(4, 60, 40, 0.95);
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.tg-lightbox.is-open {
  display: flex;
  opacity: 1;
}

.tg-lightbox-close,
.tg-lightbox-prev,
.tg-lightbox-next {
  position: absolute;
  background: transparent;
  border: 0;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  padding: 0.5rem;
  z-index: 10;
  transition: color 0.2s ease;
  line-height: 0;
}

.tg-lightbox-close:hover,
.tg-lightbox-prev:hover,
.tg-lightbox-next:hover {
  color: var(--mg-accent);
}

.tg-lightbox-close {
  top: 1.5rem;
  right: 1.5rem;
  color: rgba(255, 255, 255, 0.7);
}

html[lang="ar"] .tg-lightbox-close {
  right: auto;
  left: 1.5rem;
}

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

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

html[lang="ar"] .tg-lightbox-prev {
  left: auto;
  right: 1rem;
}

html[lang="ar"] .tg-lightbox-next {
  right: auto;
  left: 1rem;
}

@media (min-width: 768px) {
  .tg-lightbox-prev {
    left: 2rem;
  }
  .tg-lightbox-next {
    right: 2rem;
  }
  html[lang="ar"] .tg-lightbox-prev {
    left: auto;
    right: 2rem;
  }
  html[lang="ar"] .tg-lightbox-next {
    right: auto;
    left: 2rem;
  }
}

.tg-lightbox-close svg,
.tg-lightbox-prev svg,
.tg-lightbox-next svg {
  display: block;
}

.tg-lightbox-body {
  max-width: 95vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tg-lightbox-body img {
  width: auto;
  height: auto;
  max-height: 90vh;
  max-width: 95vw;
  border-radius: 0.25rem;
  display: block;
}

.tg-lightbox-video {
  width: 90vw;
  max-width: 64rem;
  aspect-ratio: 16 / 9;
  border-radius: 0.25rem;
  overflow: hidden;
  background: #000;
}

.tg-lightbox-video iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.tg-lightbox-video video {
  width: 100%;
  height: 100%;
  display: block;
  background: #000;
  object-fit: contain;
}

.tg-lightbox-counter {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--tg-font-body);
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  color: rgba(255, 255, 255, 0.45);
}

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

.tg-gallery.row {
  margin-left: 0;
  margin-right: 0;
}

.tg-gallery::before,
.tg-gallery::after {
  display: none !important;
  content: none !important;
}
