.property-gallery__placeholder,
.property-gallery-editor__help {
  margin: 0;
  color: var(--wp--preset--color--custom-deep-grey, #666);
}

.property-gallery-editor__help {
  margin-top: 0.75rem;
}

.property-gallery__grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 0.5rem;
  min-height: 20rem;
}

.property-gallery--count-1 .property-gallery__grid,
.property-gallery--count-2 .property-gallery__grid {
  grid-template-columns: 1fr;
  grid-template-rows: auto;
  min-height: 0;
}

.property-gallery--count-2 .property-gallery__grid {
  grid-template-columns: 1fr 1fr;
}

.property-gallery--count-3 .property-gallery__grid {
  grid-template-columns: 2fr 1fr;
  grid-template-rows: 1fr 1fr;
}

.property-gallery__item {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: var(--wp--preset--color--custom-light-gray, #f4f4f4);
  cursor: pointer;
}

.property-gallery__item:first-child {
  grid-row: 1 / span 2;
}

.property-gallery--count-1 .property-gallery__item:first-child,
.property-gallery--count-2 .property-gallery__item:first-child {
  grid-row: auto;
}

.property-gallery--count-1 .property-gallery__item img {
  height: 30rem;
}

.property-gallery--count-3 .property-gallery__item:first-child {
  grid-row: 1 / span 2;
}

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

.property-gallery__item:focus-visible {
  outline: 2px solid var(--wp--preset--color--custom-off-black, #222);
  outline-offset: 2px;
}

.property-gallery__more {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
  background: rgba(17, 17, 17, 0.45);
  color: #fff;
  font-weight: 600;
}

.property-gallery__lightbox {
  width: min(100%, 72rem);
  max-width: calc(100vw - 2rem);
  height: min(100%, 52rem);
  max-height: calc(100vh - 2rem);
  padding: 0;
  border: 0;
  background: #fff;
  color: var(--wp--preset--color--custom-off-black, #222);
}

.property-gallery__lightbox::backdrop {
  background: rgba(17, 17, 17, 0.72);
}

.property-gallery__lightbox-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
}

.property-gallery__lightbox-back {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
}

.property-gallery__lightbox-count {
  margin: 0;
}

.property-gallery__lightbox-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  height: calc(100% - 9.5rem);
  background: var(--wp--preset--color--custom-light-gray, #f4f4f4);
}

.property-gallery__lightbox-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.property-gallery__lightbox-nav {
  position: absolute;
  top: 50%;
  width: 2.5rem;
  height: 2.5rem;
  transform: translateY(-50%);
  border: 0;
  border-radius: 50%;
  background: rgba(17, 17, 17, 0.55);
  cursor: pointer;
}

.property-gallery__lightbox-nav::before {
  content: "";
  display: block;
  width: 0.6rem;
  height: 0.6rem;
  margin: 0 auto;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
}

.property-gallery__lightbox-nav.is-prev {
  left: 0.75rem;
}

.property-gallery__lightbox-nav.is-prev::before {
  margin-left: 0.7rem;
  transform: rotate(135deg);
}

.property-gallery__lightbox-nav.is-next {
  right: 0.75rem;
}

.property-gallery__lightbox-nav.is-next::before {
  margin-right: 0.7rem;
  transform: rotate(-45deg);
}

.property-gallery--single .property-gallery__lightbox-nav {
  display: none;
}

.property-gallery__lightbox-thumbs {
  display: flex;
  gap: 0.4rem;
  padding: 0.75rem 1rem;
  overflow-x: auto;
}

.property-gallery__lightbox-thumbs button {
  flex: 0 0 4.5rem;
  height: 3.25rem;
  padding: 0;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 6px;
  background: var(--wp--preset--color--custom-light-gray, #f4f4f4);
  cursor: pointer;
}

.property-gallery__lightbox-thumbs button.is-active,
.property-gallery__lightbox-thumbs button:focus-visible {
  border-color: var(--wp--preset--color--custom-off-black, #222);
}

.property-gallery__lightbox-thumbs img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (max-width: 781px) {
  .property-gallery__grid {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto;
    min-height: 0;
  }

  .property-gallery__item:first-child {
    grid-column: 1 / -1;
    grid-row: auto;
    min-height: 16rem;
  }

  .property-gallery__item {
    min-height: 8rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .property-gallery__lightbox-thumbs button {
    scroll-margin: 0;
  }
}
