.image-gallery {
  position: relative;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: repeat(2, minmax(130px, 1fr));
  gap: 8px;
  aspect-ratio: 1.72;
  max-height: 460px;
  margin-bottom: 28px;
}

.image-gallery .main-image {
  grid-column: 1;
  grid-row: 1 / span 2;
  min-height: 0;
  height: 100%;
  margin: 0;
  overflow: hidden;
  border-radius: 14px;
  background: #e9edf2;
}

.image-gallery .main-image > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  cursor: zoom-in;
}

.image-gallery .image-counter {
  right: 12px;
  bottom: 12px;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  background: rgba(17, 27, 44, 0.72);
  color: #fff;
  font-size: 13px;
  line-height: 1;
  backdrop-filter: blur(8px);
}

.image-gallery .nav-arrow {
  display: none !important;
}

.image-gallery .thumbnail-grid {
  grid-column: 2;
  grid-row: 1 / span 2;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.image-gallery .thumbnail {
  position: relative;
  display: block;
  width: 100%;
  height: auto;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 0;
  border-radius: 10px;
  background: #e9edf2;
}

.image-gallery .thumbnail:nth-child(n + 5) {
  display: none;
}

.image-gallery .thumbnail:hover,
.image-gallery .thumbnail.active {
  outline: 3px solid #fff;
  outline-offset: -4px;
}

.image-gallery .thumbnail img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 180ms ease;
}

.image-gallery .thumbnail:hover img {
  transform: scale(1.04);
}

.tour-gallery-view-all {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 3px 14px rgba(17, 27, 44, 0.2);
  color: #172b4d;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.tour-gallery-view-all:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(17, 27, 44, 0.24);
}

.tour-gallery-view-all:focus-visible,
.tour-gallery-viewer button:focus-visible {
  outline: 3px solid #3284f5;
  outline-offset: 3px;
}

.tour-gallery-viewer[hidden] {
  display: none;
}

.tour-gallery-viewer {
  position: fixed;
  inset: 0;
  z-index: 11000;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding: 20px;
  background: rgba(9, 15, 25, 0.96);
  color: #fff;
}

.tour-gallery-viewer__header,
.tour-gallery-viewer__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: min(1100px, 100%);
  margin: 0 auto;
}

.tour-gallery-viewer__header {
  min-height: 44px;
  font-size: 14px;
}

.tour-gallery-viewer__footer {
  justify-content: center;
  min-height: 54px;
}

.tour-gallery-viewer__close,
.tour-gallery-viewer__nav {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font: inherit;
  font-size: 24px;
  cursor: pointer;
}

.tour-gallery-viewer__close:hover,
.tour-gallery-viewer__nav:hover {
  background: rgba(255, 255, 255, 0.2);
}

.tour-gallery-viewer__close {
  margin-left: auto;
}

.tour-gallery-viewer__stage {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 52px;
  align-items: center;
  gap: 18px;
  width: min(1100px, 100%);
  min-height: 0;
  margin: 0 auto;
}

.tour-gallery-viewer__image {
  display: block;
  max-width: 100%;
  max-height: 100%;
  justify-self: center;
  object-fit: contain;
}

@media (max-width: 760px) {
  .activity-content {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .activity-content > .left-content,
  .activity-content > .booking-sidebar {
    width: 100%;
    min-width: 0;
  }

  .image-gallery {
    display: block !important;
    width: 100%;
    aspect-ratio: auto;
    max-height: none;
  }

  .image-gallery .main-image {
    height: clamp(220px, 58vw, 360px);
    margin-bottom: 10px;
  }

  .image-gallery .thumbnail-grid {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 2px 2px 8px;
    scrollbar-width: thin;
    scrollbar-color: #9aa8b9 transparent;
  }

  .image-gallery .thumbnail {
    flex: 0 0 clamp(88px, 24vw, 132px);
    height: clamp(68px, 19vw, 94px);
  }

  .image-gallery .thumbnail:nth-child(n + 5) {
    display: block;
  }

  .tour-gallery-view-all {
    position: static;
    display: flex;
    width: fit-content;
    margin: 2px 0 0 auto;
  }
}

@media (max-width: 420px) {
  .tour-gallery-viewer {
    padding: 12px;
  }

  .tour-gallery-viewer__stage {
    grid-template-columns: 40px minmax(0, 1fr) 40px;
    gap: 6px;
  }

  .tour-gallery-viewer__nav {
    width: 40px;
    height: 40px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .image-gallery .thumbnail img,
  .tour-gallery-view-all {
    transition: none;
  }
}
