/* Post-content galleries (2026-11-03, Matt). WordPress core grows every
   figure to fill its row, so an odd last photo stretched across the full
   width, and a portrait photo set the height for its whole row. Every tile
   is now a fixed 4:3 crop at its column width. Selectors carry the core
   :not(#individual-image) id so they outrank core's own gallery rules. */
.brxe-post-content .wp-block-gallery.has-nested-images figure.wp-block-image:not(#individual-image) {
  flex-grow: 0;
  aspect-ratio: 4 / 3;
}

.brxe-post-content .wp-block-gallery.has-nested-images.is-cropped figure.wp-block-image:not(#individual-image) :is(a, img) {
  width: 100%;
  height: 100%;
}

.brxe-post-content .wp-block-gallery.has-nested-images.is-cropped figure.wp-block-image:not(#individual-image) img {
  object-fit: cover;
}

.brxe-post-content .wp-block-gallery a[data-samye-lightbox] {
  cursor: zoom-in;
}

/* Lightbox. A native <dialog>, so focus trapping and Escape come free. */
.samye-lightbox {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgb(17 17 17 / 0.94);
  color: #fff;
}

.samye-lightbox::backdrop { background: transparent; }

.samye-lightbox[open] {
  display: grid;
  grid-template-columns: 4.8rem minmax(0, 1fr) 4.8rem;
  grid-template-rows: minmax(0, 1fr) auto;
  align-items: center;
  gap: 1.2rem;
  padding: 5.6rem 1.2rem 1.6rem;
}

.samye-lightbox__figure {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  min-height: 0;
  margin: 0;
}

.samye-lightbox__figure img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.samye-lightbox__caption {
  grid-column: 1 / -1;
  grid-row: 2;
  margin: 0 auto;
  max-width: 72rem;
  font-size: 1.4rem;
  line-height: 1.5;
  text-align: center;
}

.samye-lightbox__count {
  display: block;
  margin-top: .4rem;
  color: rgb(255 255 255 / 0.7);
  font-size: 1.2rem;
}

.samye-lightbox button {
  display: grid;
  place-items: center;
  width: 4.4rem;
  height: 4.4rem;
  padding: 0;
  border: 1px solid rgb(255 255 255 / 0.35);
  border-radius: 50%;
  background: rgb(255 255 255 / 0.08);
  color: #fff;
  font-size: 2.2rem;
  line-height: 1;
  cursor: pointer;
}

.samye-lightbox button:hover { background: rgb(255 255 255 / 0.2); }
.samye-lightbox button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.samye-lightbox button[hidden] { display: none; }

.samye-lightbox__prev { grid-column: 1; grid-row: 1; }
.samye-lightbox__next { grid-column: 3; grid-row: 1; }

.samye-lightbox__close {
  position: absolute;
  top: 1.2rem;
  right: 1.2rem;
}

@media (max-width: 767px) {
  .samye-lightbox[open] {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto auto;
  }

  .samye-lightbox__figure { grid-column: 1; }
  .samye-lightbox__caption { grid-row: 3; }

  .samye-lightbox__prev,
  .samye-lightbox__next {
    grid-row: 2;
    grid-column: 1;
  }

  .samye-lightbox__prev { justify-self: start; }
  .samye-lightbox__next { justify-self: end; }
}
