/*
 * image-gallery — converted from src/components/case-studies/ImageGallery.module.css
 * Declarations are unchanged; only class selectors were renamed.
 */
.np-image-gallery__group {
  margin: 12px -40px;
}

/*
 * Keeps a gallery's slot in the article as tall as the gallery.
 *
 * Below 768px Elementor makes every flex container wrap (`--flex-wrap-mobile`
 * defaults to `wrap`), and in a wrapping column the browser measures an item's
 * height before it stretches the item across — at its shrink-to-fit width.
 * Everything in this design sizes itself from its width — the photographs are
 * absolutely positioned inside aspect-ratio frames — so that width is next to
 * nothing and so is the height measured from it. On the live site a 330px
 * photograph got an 84px slot and lay over the heading and paragraph after it,
 * on six of the eight case studies. Text has a width of its own, which is why
 * nothing else in an article is affected.
 *
 * A vertical stack of widgets never actually wraps, so turning wrapping off for
 * the container that holds a gallery changes nothing but the measurement. It is
 * a default, not a rule: one class plus `:has()`, so wrap chosen for that
 * container in Elementor still wins.
 *
 * The width covers a container where someone has chosen wrap: a definite width
 * is measured as itself, which fixes most galleries on its own. `:where()`
 * keeps it at one class, so a width set in Elementor's Advanced tab wins.
 */
.e-con:has(> .elementor-widget-nanoprep-block-image-group),
.e-con:has(> .e-con-inner > .elementor-widget-nanoprep-block-image-group) {
  --flex-wrap-mobile: nowrap;
}

:where(.e-con, .e-con-inner) > .elementor-widget-nanoprep-block-image-group {
  width: 100%;
}

.np-image-gallery__before {
  border-left: 3px solid #c0392b;
  padding-left: 14px;
}

.np-image-gallery__during {
  border-left: 3px solid #f47920;
  padding-left: 14px;
}

.np-image-gallery__after {
  border-left: 3px solid var(--green2);
  padding-left: 14px;
}

.np-image-gallery__header {
  padding: 0 0 8px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.np-image-gallery__header h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.np-image-gallery__badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 100px;
  white-space: nowrap;
  flex-shrink: 0;
}

.np-image-gallery__badge-before {
  background: #fdf0ef;
  color: #c0392b;
  border: 1px solid #f5c6c3;
}

.np-image-gallery__badge-during {
  background: #fff4ec;
  color: #f47920;
  border: 1px solid #ffd4a8;
}

.np-image-gallery__badge-after {
  background: var(--light);
  color: var(--green2);
  border: 1px solid var(--rule);
}

.np-image-gallery__gallery {
  display: grid;
  grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr));
  row-gap: 16px;
  column-gap: 10px;
}

.np-image-gallery__item {
  background: transparent;
}

.np-image-gallery__image-wrap {
  position: relative;
  aspect-ratio: var(--ar, 4 / 3);
  overflow: hidden;
}

.np-image-gallery__image {
  object-fit: contain;
}

.np-image-gallery__placeholder {
  aspect-ratio: var(--ar, 4 / 3);
  background: repeating-linear-gradient(45deg, #f5f5f5, #f5f5f5 8px, #ebebeb 8px, #ebebeb 16px);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed #ccc;
}

.np-image-gallery__placeholder span {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #aaa;
  background: #fff;
  padding: 6px 12px;
  border-radius: 4px;
  border: 1px solid #ddd;
}

.np-image-gallery__caption {
  font-size: 12px;
  color: var(--muted);
  padding: 8px 12px;
  background: var(--rule);
  text-align: center;
  border-top: 1px solid var(--rule);
}

.np-image-gallery__plain-caption {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  margin: 8px 0 0;
}

@media (max-width: 600px) {
  .np-image-gallery__gallery {
    grid-template-columns: 1fr;
  }

  /*
   * The group's -40px margin bleeds the photographs to the edge of the column's
   * 40px inset. On desktop the heading bleeds with them into whitespace; on a
   * phone that inset is the screen edge, and the heading ends up touching it.
   * Put the heading back on the text column; the photographs still bleed.
   */
  .np-image-gallery__header {
    padding-left: 40px;
    padding-right: 40px;
  }
}
