/* Community gallery shortcode — scoped under .ih-community-gallery */

.ih-community-gallery {
  width: 100%;
  font-family: Hind, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.ih-community-gallery__media {
  display: block;
  width: 100%;
  overflow: hidden;
  position: relative;
}

.ih-community-gallery__media--54 {
  aspect-ratio: 5 / 4;
}

.ih-community-gallery__media--54 .ih-community-gallery__img,
.ih-community-gallery__media--54 img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ih-community-3d-tour {
    height: 700px;
}

/* Desktop grid */
.ih-community-gallery__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: 1fr 1fr;
  gap: 16px;
  min-height: 540px;
}

.ih-community-gallery__tile {
  position: relative;
  padding: 0;
  border-radius: 0;
  border: none;
  cursor: pointer;
  overflow: hidden;
  text-align: left;
}

.ih-community-gallery__media:before {
    content: '';
    background: rgba(0, 0, 0, 0);
    width: 100%;
    height: 100%;
    position: absolute;
    transition: all .3s;
}

.ih-community-gallery__tile:hover .ih-community-gallery__media:before {
    background: rgba(0, 0, 0, .1);
}

.ih-community-gallery__tile--feature {
  grid-column: 1 / span 2;
  grid-row: 1 / span 2;
}

.ih-community-gallery__tile .ih-community-gallery__media {
  height: 100%;
}

.ih-community-gallery__tile--feature .ih-community-gallery__media--54 {
  aspect-ratio: auto;
  height: 100%;
  min-height: 100%;
}

.ih-community-gallery__tour-cta {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  pointer-events: none;
}

.ih-community-gallery__tour-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  background: rgba(39, 86, 91, 0.85);
  border-radius: 50%;
  color: #fff;
}

.ih-community-gallery__tour-icon svg {
  width: 40px;
  height: 40px;
}

.ih-community-gallery__tour-label {
  background: rgba(39, 86, 91, 0.85);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  text-transform: uppercase;
  padding: 14px 28px;
  border-radius: 999px;
  line-height: 1.2;
}

.ih-community-gallery__see-all {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(76, 76, 76, 0.8);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 4px;
  pointer-events: none;
}

/* Mobile preview — hidden on desktop */
.ih-community-gallery__mobile {
  display: none;
  position: relative;
}

.ih-community-gallery__mobile-swiper {
  width: 100%;
}

.ih-community-gallery__mobile-slide {
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  cursor: pointer;
  background: transparent !important;
}

.ih-community-gallery__mobile-slide:hover, .ih-community-gallery__mobile-slide:focus {
  background: transparent !important;
}

.ih-community-gallery__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 40px;
  height: 40px;
  border: none;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.ih-community-gallery__nav--prev {
  left: 12px;
}

.ih-community-gallery__nav--next {
  right: 12px;
}

.ih-community-gallery__mobile-tour-btn {
    position: absolute;
    left: 16px;
    bottom: 16px;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(101, 188, 70, 1) !important;
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 10px 16px !important;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: unset;
}

.ih-community-gallery__mobile-tour-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.ih-community-gallery__mobile-tour-icon svg {
  width: 20px;
  height: 20px;
}

/* Dialog + Popup */
.ih-community-gallery__dialog {
  border: none;
  padding: 0;
  margin: auto;
  width: 100%;
  max-width: 1140px;
  max-height: 90vh;
  background: transparent;
  border-radius: 2px;
  overflow: hidden;
}

.ih-community-gallery__dialog::backdrop {
  background: rgba(0, 0, 0, 0.75);
}

.ih-community-gallery__popup {
  position: relative;
  width: 100%;
  max-width: 1140px;
  max-height: 90vh;
  margin: 0;
  padding: 0;
  background: #fff;
  border-radius: 2px;
  overflow: hidden;
}

body.ih-community-gallery-open {
  overflow: hidden;
}

.ih-community-gallery[data-has-tour="0"] .ih-community-gallery__tabs {
  display: none !important;
}

.ih-community-gallery__popup-inner {
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  background: #fff;
  overflow: hidden;
}

.ih-community-gallery__popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px;
  flex-shrink: 0;
}

.ih-community-gallery__back {
  background: transparent;
  border: 1px solid rgba(33, 113, 6, 1) !important;
  color: rgba(33, 113, 6, 1) !important;
  font-size: 14px;
  font-weight: 700;
  padding: 8px 40px  !important;
  border-radius: 4px;
  cursor: pointer;
  transition: all .3s;
}

.ih-community-gallery__back:hover, .ih-community-gallery__back:focus {
  background: rgba(33, 113, 6, 1) !important;
  border: 1px solid rgba(33, 113, 6, 1) !important;
  color: #ffffff !important;
}

.ih-community-gallery__tabs {
  display: none;
  gap: 24px;
}

.ih-community-gallery__tab {
    background: none;
    border: none;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    position: relative;
}

.ih-community-gallery__tab.is-active::after {
    content: "";
    position: absolute;
    left: -8px;
    right: 0;
    bottom: -24px;
    width: calc(100% + 16px);
    height: 4px;
    background: rgba(101, 188, 70, 1);
    border-radius: 0;
}

/* Desktop popup body */
.ih-community-gallery__popup-desktop {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0 24px 24px;
  min-height: 0;
  overflow: hidden;
}

.ih-community-gallery__popup-swiper-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
}

.ih-community-gallery__popup-swiper {
  width: 100%;
  height: auto;
  overflow: hidden;
}

.ih-community-gallery__popup-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: #fff;
    box-shadow: unset;
    transition: background 0.2s ease, transform 0.2s ease;
}

.ih-community-gallery__popup-nav:hover {
    background: rgba(255, 255, 255, .9)!important;
    transform: translateY(-50%) scale(1.05);
    color: inherit;
}

.ih-community-gallery__popup-nav:disabled,
.ih-community-gallery__popup-nav.swiper-button-disabled {
  opacity: 0.3;
  cursor: default;
}

.ih-community-gallery__popup-nav--prev {
  left: 24px;
}

.ih-community-gallery__popup-nav--next {
  right: 24px;
}

.ih-community-gallery__popup-image,
.ih-community-gallery__popup-tour {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  height: 100%;
}

.ih-community-gallery__popup-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ih-community-gallery__popup-tour .ih-community-gallery__embed {
  width: 100%;
  height: 100%;
  min-height: 400px;
}

.ih-community-gallery__popup-tour .ih-community-gallery__embed iframe {
  width: 100%;
  height: 100%;
  min-height: 400px;
  border: 0;
}

/* Thumbs Swiper gallery */
.ih-community-gallery__thumbs-swiper {
  width: 100%;
  margin-top: 16px;
  flex-shrink: 0;
}

.ih-community-gallery__thumbs-swiper .swiper-slide {
  width: 120px;
  opacity: 1;
  cursor: pointer;
  transition: opacity 0.2s ease, border-color 0.2s ease;
}

.ih-community-gallery__thumbs-swiper .swiper-slide-thumb-active {
  opacity: 1;
}

.ih-community-gallery__thumbs-swiper .swiper-slide-thumb-active:before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, .3);
    opacity: 1;
    transition: all .3s;
}

.ih-community-gallery__thumb {
  width: 100%;
  padding: 0;
  border: 2px solid transparent;
  background: none;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  border-radius: 0px;
}

.ih-community-gallery__thumb img {
  width: 100%;
  aspect-ratio: 5 / 4;
  object-fit: cover;
  display: block;
}

.ih-community-gallery__thumb-img-wrap {
  display: block;
  position: relative;
  width: 100%;
  aspect-ratio: 5 / 4;
}

.ih-community-gallery__thumb-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ih-community-gallery__thumb-tour-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: rgba(0, 0, 0, .3);
}

.ih-community-gallery__thumb-tour-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: rgba(39, 86, 91, 0.85);
    border-radius: 50%;
    padding: 8px;
}

.ih-community-gallery__thumb-tour-icon svg {
  width: 24px;
  height: 24px;
}

.ih-community-gallery__thumb-tour-badge {
  display: block;
  background: rgba(39, 86, 91, 0.85);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  text-align: center;
  padding: 4px 8px;
  border-radius: 24px;
  line-height: 1.3;
  max-width: 100%;
  word-wrap: break-word;
}

/* Mobile popup panels — hidden on desktop */
.ih-community-gallery__popup-mobile {
  display: none;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.ih-community-gallery__panel {
  visibility: hidden;
  position: absolute;
  pointer-events: none;
  min-height: 100%;
}

.ih-community-gallery__panel.is-active {
  visibility: visible;
  position: relative;
  pointer-events: auto;
}

.ih-community-gallery__photo-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
}

.ih-community-gallery__photo-list-item {
  margin: 0;
}

.ih-community-gallery__photo-list-item img {
  width: 100%;
  height: auto;
  display: block;
}

.ih-community-gallery__embed--mobile {
  min-height: calc(100vh - 64px);
  height: calc(100vh - 64px) !important;
  padding: 0;
}

.ih-community-gallery__embed--mobile iframe {
    width: 100%;
    min-height: calc(100vh - 64px);
    border: 0;
    height: calc(100vh - 64px) !important;
}

@media (max-width: 767px) {
  .ih-community-gallery__grid {
    display: none;
  }

  .ih-community-gallery__mobile {
    display: block !important;
  }

 .ih-community-gallery__dialog {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  max-height: 100vh;
  border-radius: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  box-sizing: border-box;
}

  .ih-community-gallery__dialog::backdrop {
    background: rgba(0, 0, 0, 0.9);
  }

  .ih-community-gallery__popup {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    border-radius: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .ih-community-gallery__popup-inner {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
  }

  .ih-community-gallery__popup-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(42, 87, 91, 1);
    padding: 16px;
    flex-shrink: 0;
  }

  .ih-community-gallery__back {
    border-color: #fff !important;
    color: #fff !important;
  }
  
  .ih-community-gallery__back:hover, .ih-community-gallery__back:focus {
    background: transparent !important;
    border-color: #fff !important;
    color: #fff !important;
  }

  .ih-community-gallery__tabs {
    display: flex;
  }

  .ih-community-gallery__popup-desktop {
    display: none;
  }

  .ih-community-gallery__popup-mobile {
    display: block;
    flex: 1;
    background: #fff;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }
}

@media (min-width: 768px) {
  .ih-community-gallery__popup-mobile {
    display: none !important;
  }
}
