/* Full-screen photo zoom — gallery hero + tour form */
.listing-photo-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  background: rgba(12, 10, 12, 0.97);
}

.listing-photo-lightbox.hidden {
  display: none !important;
}

.listing-photo-lightbox__close {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  right: 12px;
  z-index: 2;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
}

.listing-photo-lightbox__img {
  /* The clicked image is the focus: use the available viewer, not its small
     inline-gallery dimensions.  `contain` keeps every original aspect ratio
     intact without cropping a room or exterior photo. */
  width: min(96vw, 1600px);
  height: min(91vh, 1050px);
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
  border-radius: 4px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.45);
}

body.photo-lightbox-open {
  overflow: hidden;
}

@media (max-width: 768px) {
  .listing-photo-lightbox {
    padding: max(4px, env(safe-area-inset-top)) 4px max(4px, env(safe-area-inset-bottom));
  }

  .listing-photo-lightbox__img {
    width: 100%;
    height: calc(100dvh - max(8px, env(safe-area-inset-top)) - max(8px, env(safe-area-inset-bottom)));
    max-width: 100vw;
    max-height: 100dvh;
    border-radius: 0;
  }

  .listing-photo-lightbox__close {
    top: max(12px, env(safe-area-inset-top));
    right: 12px;
    width: 52px;
    height: 52px;
    background: rgba(12, 10, 12, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.36);
  }
}

/* On a desktop, an opened photo should feel like a real full-screen viewer,
   not a small image floating in a wide dark panel. The image fills the stage;
   only the outer edges are trimmed when an MLS photo's shape differs. */
@media (min-width: 769px) {
  .listing-photo-lightbox__img {
    object-fit: cover;
  }
}

body.listing-modal-open #listing-modal .listing-tour-property__inner {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

body.listing-modal-open #listing-modal .listing-tour-property__photo-btn {
  flex-shrink: 0;
  display: block;
  padding: 0;
  border: none;
  border-radius: 10px;
  overflow: hidden;
  cursor: zoom-in;
  position: relative;
  background: #e8eaed;
  box-shadow: 0 2px 12px rgba(25, 20, 24, 0.12);
}

body.listing-modal-open #listing-modal .listing-tour-property__photo {
  display: block;
  width: 120px;
  height: 90px;
  object-fit: cover;
  object-position: center;
}

body.listing-modal-open #listing-modal .listing-tour-property__zoom {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 4px 6px;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #fff;
  background: linear-gradient(180deg, transparent, rgba(25, 20, 24, 0.75));
}

body.listing-modal-open #listing-modal .listing-tour-property__copy {
  flex: 1;
  min-width: 0;
}

@media (min-width: 480px) {
  body.listing-modal-open #listing-modal .listing-tour-property__photo {
    width: 160px;
    height: 120px;
  }
}
