.clean-wp-gallery,
.clean-wp-gallery-index {
  --clean-gallery-gap-size: 1rem;
  display: grid;
  gap: var(--clean-gallery-gap-size);
}

.clean-wp-gallery {
  grid-template-columns: repeat(var(--clean-gallery-columns, 3), minmax(0, 1fr));
}

.clean-wp-gallery-index {
  grid-template-columns: repeat(var(--clean-gallery-columns, 3), minmax(0, 1fr));
}

.clean-wp-gallery-gap--none { --clean-gallery-gap-size: 0; }
.clean-wp-gallery-gap--small { --clean-gallery-gap-size: 0.5rem; }
.clean-wp-gallery-gap--medium { --clean-gallery-gap-size: 1rem; }
.clean-wp-gallery-gap--large { --clean-gallery-gap-size: 1.5rem; }

.clean-wp-gallery-item,
.clean-wp-gallery-index-card {
  position: relative;
  margin: 0;
}

.clean-wp-gallery-item a,
.clean-wp-gallery-index-image {
  display: block;
  color: inherit;
  text-decoration: none;
}

.clean-wp-gallery-item img,
.clean-wp-gallery-index-card img,
.clean-wp-gallery-placeholder {
  display: block;
  width: 100%;
  height: auto;
}

.clean-wp-gallery-radius--none img { border-radius: 0; }
.clean-wp-gallery-radius--small img { border-radius: 0.35rem; }
.clean-wp-gallery-radius--medium img { border-radius: 0.65rem; }
.clean-wp-gallery-radius--large img { border-radius: 1rem; }

.clean-wp-gallery-ratio--square .clean-wp-gallery-item img,
.clean-wp-gallery-ratio--square .clean-wp-gallery-index-card img,
.clean-wp-gallery-ratio--square .clean-wp-gallery-placeholder {
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.clean-wp-gallery-ratio--landscape .clean-wp-gallery-item img,
.clean-wp-gallery-ratio--landscape .clean-wp-gallery-index-card img,
.clean-wp-gallery-ratio--landscape .clean-wp-gallery-placeholder {
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.clean-wp-gallery-ratio--wide .clean-wp-gallery-item img,
.clean-wp-gallery-ratio--wide .clean-wp-gallery-index-card img,
.clean-wp-gallery-ratio--wide .clean-wp-gallery-placeholder {
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.clean-wp-gallery-ratio--portrait .clean-wp-gallery-item img,
.clean-wp-gallery-ratio--portrait .clean-wp-gallery-index-card img,
.clean-wp-gallery-ratio--portrait .clean-wp-gallery-placeholder {
  aspect-ratio: 3 / 4;
  object-fit: cover;
}

.clean-wp-gallery-item figcaption {
  margin-top: 0.45rem;
  font-size: 0.875rem;
  line-height: 1.4;
}

.clean-wp-gallery-caption--overlay .clean-wp-gallery-item,
.clean-wp-gallery-caption--overlay-hover .clean-wp-gallery-item {
  overflow: hidden;
}

.clean-wp-gallery-caption--overlay .clean-wp-gallery-item figcaption,
.clean-wp-gallery-caption--overlay-hover .clean-wp-gallery-item figcaption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0;
  padding: 0.75rem;
  color: #fff;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.72), rgba(0, 0, 0, 0));
}

.clean-wp-gallery-caption--overlay-hover .clean-wp-gallery-item figcaption {
  opacity: 0;
  transform: translateY(0.4rem);
  transition: opacity 160ms ease, transform 160ms ease;
}

.clean-wp-gallery-caption--overlay-hover .clean-wp-gallery-item:hover figcaption,
.clean-wp-gallery-caption--overlay-hover .clean-wp-gallery-item:focus-within figcaption {
  opacity: 1;
  transform: translateY(0);
}

.clean-wp-gallery--masonry {
  display: block;
  column-count: var(--clean-gallery-columns, 3);
  column-gap: var(--clean-gallery-gap-size);
}

.clean-wp-gallery--masonry .clean-wp-gallery-item {
  display: inline-block;
  width: 100%;
  margin: 0 0 var(--clean-gallery-gap-size);
  break-inside: avoid;
}

.clean-wp-gallery--featured {
  grid-auto-flow: dense;
}

.clean-wp-gallery--featured .clean-wp-gallery-item.is-featured {
  grid-column: span 2;
  grid-row: span 2;
}

.clean-wp-gallery--slider {
  display: flex;
  gap: var(--clean-gallery-gap-size);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.35rem;
}

.clean-wp-gallery--slider .clean-wp-gallery-item {
  flex: 0 0 min(82vw, 360px);
  scroll-snap-align: start;
}

.clean-wp-gallery-index-card {
  overflow: hidden;
}

.clean-wp-gallery-index--card .clean-wp-gallery-index-card {
  border: 1px solid color-mix(in srgb, currentColor 16%, transparent);
  border-radius: 0.75rem;
  background: color-mix(in srgb, currentColor 2%, transparent);
}

.clean-wp-gallery-index--card .clean-wp-gallery-index-content {
  padding: 1rem;
}

.clean-wp-gallery-index--minimal .clean-wp-gallery-index-card {
  border: 0;
}

.clean-wp-gallery-index--minimal .clean-wp-gallery-index-content {
  padding-top: 0.75rem;
}

.clean-wp-gallery-index--overlay .clean-wp-gallery-index-card {
  border-radius: 0.75rem;
}

.clean-wp-gallery-index--overlay .clean-wp-gallery-index-content {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 1rem;
  color: #fff;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.74), rgba(0, 0, 0, 0));
}

.clean-wp-gallery-index--overlay .clean-wp-gallery-index-content a {
  color: inherit;
}

.clean-wp-gallery-index-card h3 {
  margin: 0 0 0.5rem;
}

.clean-wp-gallery-index-card p {
  margin: 0.35rem 0 0;
}

.clean-wp-gallery-count {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.875rem;
  opacity: 0.75;
}

.clean-wp-gallery-placeholder {
  background: color-mix(in srgb, currentColor 8%, transparent);
}

html.clean-wp-gallery-lightbox-open,
body.clean-wp-gallery-lightbox-open {
  overflow: hidden;
}

.clean-wp-gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: rgba(0, 0, 0, 0.92);
}

.clean-wp-gallery-lightbox.is-open {
  display: flex;
}

.clean-wp-gallery-lightbox-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(1180px, 96vw);
  max-height: 94vh;
}

.clean-wp-gallery-lightbox-figure {
  margin: 0;
  max-width: min(1100px, 88vw);
  max-height: 94vh;
  text-align: center;
}

.clean-wp-gallery-lightbox img {
  display: block;
  max-width: 100%;
  max-height: 82vh;
  width: auto;
  height: auto;
  margin: 0 auto;
  opacity: 1;
  transition: opacity 120ms ease-in-out;
}

.clean-wp-gallery-lightbox img.is-loading {
  opacity: 0.55;
}

.clean-wp-gallery-lightbox-caption {
  margin-top: 0.75rem;
  color: #fff;
  text-align: center;
  font-size: 0.95rem;
  line-height: 1.45;
}

.clean-wp-gallery-lightbox-caption[hidden],
.clean-wp-gallery-lightbox-counter[hidden],
.clean-wp-gallery-lightbox-nav[hidden] {
  display: none;
}

.clean-wp-gallery-lightbox-counter {
  position: absolute;
  left: 0;
  bottom: -1.75rem;
  color: #fff;
  font-size: 0.875rem;
  opacity: 0.82;
}

.clean-wp-gallery-lightbox-close,
.clean-wp-gallery-lightbox-nav {
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  cursor: pointer;
  line-height: 1;
}

.clean-wp-gallery-lightbox-close:hover,
.clean-wp-gallery-lightbox-close:focus,
.clean-wp-gallery-lightbox-nav:hover,
.clean-wp-gallery-lightbox-nav:focus {
  background: rgba(255, 255, 255, 0.24);
  outline: 2px solid rgba(255, 255, 255, 0.75);
  outline-offset: 2px;
}

.clean-wp-gallery-lightbox-close {
  position: absolute;
  top: -2.75rem;
  right: 0;
  width: 2.25rem;
  height: 2.25rem;
  font-size: 1.9rem;
}

.clean-wp-gallery-lightbox-nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  width: 3rem;
  height: 3rem;
  transform: translateY(-50%);
  font-size: 2.5rem;
}

.clean-wp-gallery-lightbox-prev { left: 0; }
.clean-wp-gallery-lightbox-next { right: 0; }

@media (max-width: 700px) {
  .clean-wp-gallery,
  .clean-wp-gallery-index {
    grid-template-columns: repeat(var(--clean-gallery-mobile-columns, 2), minmax(0, 1fr));
  }

  .clean-wp-gallery--masonry {
    column-count: var(--clean-gallery-mobile-columns, 2);
  }

  .clean-wp-gallery--featured .clean-wp-gallery-item.is-featured {
    grid-column: span var(--clean-gallery-mobile-columns, 2);
    grid-row: span 1;
  }

  .clean-wp-gallery-lightbox {
    padding: 1rem;
  }

  .clean-wp-gallery-lightbox-figure {
    max-width: 94vw;
  }

  .clean-wp-gallery-lightbox-nav {
    width: 2.65rem;
    height: 2.65rem;
    font-size: 2.2rem;
  }
}

@media (max-width: 480px) {
  .clean-wp-gallery,
  .clean-wp-gallery-index {
    grid-template-columns: 1fr;
  }

  .clean-wp-gallery--masonry {
    column-count: 1;
  }

  .clean-wp-gallery-lightbox-prev { left: -0.4rem; }
  .clean-wp-gallery-lightbox-next { right: -0.4rem; }
}
