/* Core's nested gallery captions are overlays. This named style only moves them
   into normal flow; it does not change columns, crop, gap or image dimensions. */
.wp-element-caption:empty {
  display: none;
}
/* Give lazy images a definite width before their pixels have loaded. */
.wp-block-gallery.has-nested-images figure.wp-block-image > a {
  width: 100%;
}
.wp-block-gallery.has-nested-images.is-style-captions-below figure.wp-block-image figcaption {
  position: static;
  background: none;
  color: inherit;
  text-shadow: none;
  max-height: none;
  overflow: visible;
  box-sizing: border-box;
  padding: 0.5em 0;
  flex-basis: 100%;
}
.wp-block-gallery.has-nested-images.is-style-captions-below figure.wp-block-image {
  align-self: start;
}

:where(.wp-block-image.is-style-project-thumbnail) {
  position: relative;
}
:where(.wp-block-image.is-style-project-thumbnail figcaption) {
  position: absolute;
  inset: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: #0008;
  color: #fff;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}
:where(
  .wp-block-image.is-style-project-thumbnail:hover figcaption,
  .wp-block-image.is-style-project-thumbnail:focus-within figcaption
) {
  opacity: 1;
}
@media (hover: none), (max-width: 47.5rem) {
  :where(.wp-block-image.is-style-project-thumbnail figcaption) {
    position: static;
    opacity: 1;
    background: none;
    color: inherit;
    display: block;
    padding: 0.5rem 0;
    text-align: left;
  }
}
@media (prefers-reduced-motion: reduce) {
  :where(.wp-block-image.is-style-project-thumbnail figcaption) {
    transition: none;
  }
}

/* Proportional rows preserve reading order and avoid gaps beside portrait frames. */
.wp-block-gallery.has-nested-images.portfolio-project-gallery {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--wp--style--unstable-gallery-gap, 20px);
}
.wp-block-gallery.has-nested-images.portfolio-project-gallery
  figure.wp-block-image:not(#individual-image) {
  display: block;
  flex-grow: 0;
  width: calc(
    (100% - var(--portfolio-row-gaps, 2) * var(--wp--style--unstable-gallery-gap, 20px)) *
      var(--portfolio-image-share, 0.333333)
  );
  margin: 0;
  position: relative;
}
.wp-block-gallery.has-nested-images.portfolio-project-gallery figure.wp-block-image img {
  width: 100%;
  height: auto;
}
.wp-block-gallery.has-nested-images.portfolio-project-gallery figure.wp-block-image a {
  display: block;
  width: 100%;
  height: auto;
}
.wp-block-gallery.has-nested-images.portfolio-project-gallery figure.wp-block-image figcaption {
  position: absolute;
  bottom: 0;
  inset-inline: 0;
  padding: 0.75rem;
  margin: 0;
  color: #fff;
  background: #000b;
  font-size: 0.9rem;
  line-height: 1.5;
  opacity: 0;
  max-height: 100%;
  overflow: auto;
}
.wp-block-gallery.has-nested-images.portfolio-project-gallery figure:hover figcaption,
.wp-block-gallery.has-nested-images.portfolio-project-gallery figure:focus-within figcaption {
  opacity: 1;
}
@media (max-width: 600px) {
  .wp-block-gallery.has-nested-images.portfolio-project-gallery
    figure.wp-block-image:not(#individual-image) {
    width: 100%;
  }
  .wp-block-gallery.has-nested-images.portfolio-project-gallery figure.wp-block-image figcaption {
    position: static;
    opacity: 1;
    background: none;
    color: inherit;
    max-height: none;
    padding: 0.6rem 0;
  }
}
