/* Article image lightbox + legacy WP gallery layout */

.prose-article .gallery,
.guide-content .gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.75rem;
  margin: 2rem 0;
}

.prose-article .gallery-item,
.guide-content .gallery-item {
  margin: 0;
}

.prose-article .gallery-icon,
.guide-content .gallery-icon {
  margin: 0;
}

.prose-article .gallery-icon img,
.guide-content .gallery-icon img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid rgb(var(--border-color));
}

.prose-article .gallery-caption,
.guide-content .gallery-caption {
  margin-top: 0.5rem;
  font-size: 0.8125rem;
  color: rgb(var(--text-secondary));
}

.article-lightbox__trigger {
  cursor: zoom-in;
}

.prose-article img:not(.article-lightbox__image),
.guide-content img:not(.article-lightbox__image) {
  cursor: zoom-in;
}

body.article-lightbox-open {
  overflow: hidden;
}

.article-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10050;
}

.article-lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgb(0 0 0 / 88%);
}

.article-lightbox__dialog {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 1rem 3.5rem;
  pointer-events: none;
}

.article-lightbox__figure,
.article-lightbox__close,
.article-lightbox__nav {
  pointer-events: auto;
}

.article-lightbox__figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: min(100%, 72rem);
  max-height: calc(100vh - 2rem);
  margin: 0;
}

.article-lightbox__image {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 6rem);
  width: auto;
  height: auto;
  object-fit: contain;
  background: rgb(0 0 0 / 35%);
  cursor: default;
}

.article-lightbox__caption {
  margin-top: 0.75rem;
  max-width: 48rem;
  color: rgb(255 255 255 / 88%);
  font-size: 0.9375rem;
  line-height: 1.5;
  text-align: center;
}

/* Close stays circular pill; prev/next shape + states come from ui.css hex nav. */
.article-lightbox__close {
  position: absolute;
  z-index: 2;
  top: 1rem;
  right: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  color: #fff;
  background: rgb(0 0 0 / 45%);
  border: 1px solid rgb(255 255 255 / 18%);
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.article-lightbox__close:hover {
  background: rgb(0 0 0 / 70%);
  border-color: rgb(255 255 255 / 35%);
}

.article-lightbox__close svg,
.article-lightbox__nav svg {
  display: block;
  width: 1.375rem;
  height: 1.375rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Prev / next — shape/states in ui.css; placement here */
.article-lightbox__nav {
  position: absolute;
  z-index: 2;
  top: 50%;
  transform: translateY(-50%);
}

.article-lightbox__nav--prev {
  left: 0.75rem;
}

.article-lightbox__nav--next {
  right: 0.75rem;
}

@media (max-width: 639px) {
  .article-lightbox__dialog {
    padding: 3.5rem 0.75rem 1rem;
  }

  .article-lightbox__nav {
    top: auto;
    bottom: 0.75rem;
    transform: none;
  }

  .article-lightbox__nav--prev {
    left: 0.75rem;
  }

  .article-lightbox__nav--next {
    right: 0.75rem;
  }
}
