/* ===============================
   Base gallery (page view)
================================ */

.ps-gallery {
  max-width: 1100px;
  margin: 40px auto 0px;
  font-family: Arial, sans-serif;
}

.ps-gallery__hero {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #e9e9e9;
  overflow: hidden;
}

.ps-gallery__hero > img,
.ps-gallery__hero > iframe {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  border: 0;
  display: block;
}

.ps-gallery__hero iframe {
  position: relative;
  z-index: 0;
}

.ps-gallery__open {
  position: absolute;
  right: 24px;
  bottom: 24px;
  z-index: 5;
  padding: 10px 16px;
  background: rgba(45, 45, 45, 0.7);
  border: 1px solid #222;
  cursor: pointer;
}

/* ===============================
   Page filmstrip
================================ */

.ps-gallery__strip {
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  align-items: center;
  gap: 12px;
  padding: 16px 0 0;
}

.ps-gallery__thumbs {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  padding-bottom: 6px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.ps-gallery__thumbs::-webkit-scrollbar {
  display: none;
}

.ps-gallery__thumb {
  width: 140px;
  height: 84px;
  flex: 0 0 auto;
  background: #f1f1f1;
  border: 2px solid transparent;
  scroll-snap-align: start;
  cursor: pointer;
  overflow: hidden;
  padding: 0;
}

.ps-gallery__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ps-gallery__thumb.is-active {
  border-color: #2d2d2d;
}

.ps-gallery__modal .ps-gallery__thumb.is-active {
	border-color: #fff;
}

.ps-gallery__thumbnav,
.ps-gallery__nav {
  width: 48px;
  height: 48px;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
  color: rgba(45, 45, 45, 0.7);
}

.ps-gallery__thumbnav:hover {
  color: rgba(45, 45, 45, 0.5);
}

/* ===============================
   Modal overlay
================================ */

.ps-gallery__modal {
  position: fixed;
  inset: 0;
  background: #2d2d2d;
  z-index: 9999;
  overflow: hidden;
}

.ps-gallery__modal[hidden] {
  display: none !important;
}

/* ===============================
   Modal layout
================================ */

.ps-gallery__modal-inner {
  width: 100%;
  height: 100dvh;
  box-sizing: border-box;
  padding: 24px 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: hidden;
  background: transparent;
}

/* Top bar */

.ps-gallery__modal-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #fff;
  flex: 0 0 auto;
}

.ps-gallery__counter {
  font-size: 14px;
  opacity: 0.85;
}

.ps-gallery__close {
  background: transparent;
  border: 0;
  color: #fff;
  font-size: 34px;
  cursor: pointer;
  line-height: 1;
}

/* ===============================
   Modal hero
================================ */

.ps-gallery__modal-hero {
  width: 100%;
  height: 100%;
  min-height: 0;
  min-width: 0;
  max-width: 1400px;
  justify-self: center;
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: transparent;
}

/* Images: fit fully inside */
.ps-gallery__modal-hero > img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
  border: 0;
  flex: 0 1 auto;
}

/* YouTube iframe: fill available hero area */
.ps-gallery__modal-hero > iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ===============================
   Modal filmstrip
================================ */

.ps-gallery__modal-strip {
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  gap: 16px;
  align-items: center;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  flex: 0 0 auto;
  min-height: 0;
}

.ps-gallery__modal-strip .ps-gallery__thumb {
  background: #1f1f1f;
}

.ps-gallery__modal-strip .ps-gallery__nav {
  border: 1px solid #fff;
  background: transparent;
  color: #fff;
}

.ps-gallery__modal-strip .ps-gallery__thumbs {
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  padding-bottom: 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.ps-gallery__modal-strip .ps-gallery__thumbs::-webkit-scrollbar {
  display: none;
}

/* House & Land Gallery Overrides */

.single-house_land .ps-gallery {
  margin: 20px auto 0px;
}

@media only screen and (max-width: 768px) {
  .ps-gallery__modal-inner {
    height: 100dvh;
    padding: 24px 24px 70px;
  }
}