/* Side-by-side post body: gallery left, content right */
.single-post-body--with-gallery {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-start;
  gap: 2rem;
  margin: 0 0 2rem;
}

.single-post-body__gallery {
  flex: 0 0 35%;
  max-width: 35%;
  min-width: 0;
}

.single-post-body__content {
  flex: 1 1 auto;
  min-width: 0;
}

/* Compact grid in the left column */
.single-post-body__gallery .zipgallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  margin: 0;
}

.zipgallery__item {
  margin: 0;
}

.zipgallery__link {
  display: block;
  cursor: zoom-in;
  line-height: 0;
  border-radius: 3px;
  overflow: hidden;
}

.zipgallery__link:hover .zipgallery__img,
.zipgallery__link:focus-visible .zipgallery__img {
  opacity: 0.88;
}

.zipgallery__link:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

.zipgallery__img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 3px;
  transition: opacity 0.15s ease;
}

/* Lightbox */
html.zipgallery-lightbox-open {
  overflow: hidden;
}

.zipgallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  box-sizing: border-box;
}

.zipgallery-lightbox[hidden] {
  display: none;
}

.zipgallery-lightbox__backdrop {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.55);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  cursor: pointer;
}

.zipgallery-lightbox__inner {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: min(96vw, 1400px);
  max-height: 92vh;
  width: 100%;
  pointer-events: none;
}

.zipgallery-lightbox__inner > * {
  pointer-events: auto;
}

.zipgallery-lightbox__figure {
  margin: 0;
  max-width: 100%;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.zipgallery-lightbox__img {
  display: block;
  max-width: 100%;
  max-height: calc(92vh - 3rem);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

.zipgallery-lightbox__caption {
  margin: 0.75rem 0 0;
  max-width: 100%;
  font-size: 0.95rem;
  line-height: 1.4;
  color: #fff;
  text-align: center;
}

.zipgallery-lightbox__caption[hidden] {
  display: none;
}

.zipgallery-lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  margin: 0;
  padding: 0.5rem 0.75rem;
  border: 0;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 4px;
}

.zipgallery-lightbox__nav:hover,
.zipgallery-lightbox__nav:focus-visible {
  background: rgba(255, 255, 255, 0.22);
}

.zipgallery-lightbox__nav--prev {
  left: -3rem;
}

.zipgallery-lightbox__nav--next {
  right: -3rem;
}

.zipgallery-lightbox__nav[hidden] {
  display: none;
}

@media (max-width: 768px) {
  .zipgallery-lightbox__nav--prev {
    left: 0.25rem;
  }

  .zipgallery-lightbox__nav--next {
    right: 0.25rem;
  }
}

.single-post-body__gallery .zipgallery__caption {
  margin-top: 0.25rem;
  font-size: 0.7rem;
  line-height: 1.3;
  color: inherit;
  opacity: 0.85;
}

/* Shortcode-only placement (no side-by-side wrapper) */
.entry-content > .zipgallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

@media (max-width: 768px) {
  .single-post-body--with-gallery {
    flex-direction: column;
    gap: 1.5rem;
  }

  .single-post-body__gallery {
    flex: 1 1 auto;
    max-width: 100%;
    width: 100%;
  }

  .single-post-body__gallery .zipgallery {
    grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
    gap: 0.5rem;
  }
}
