/* =====================================================================
   Eralux lightbox — shared by the projects and news-and-events modals
   =====================================================================
   Clicking a gallery image expands it over the modal it belongs to. The
   overlay is fixed and positioned onto the host panel's box by JS rather
   than nested inside it: both panels scroll and clip their overflow, so an
   absolutely positioned child would scroll away with the gallery and be
   cut off at the panel edge.
   ===================================================================== */

/* Gallery images advertise themselves as zoomable. */
[data-ews-lightbox] img {
  cursor: zoom-in;
}

.ews-lightbox {
  /* JS sets width/height from the host panel's rect, so the padding has
	   to sit inside that box. Without this the overlay came out one
	   padding wider and taller than the panel it is meant to cover. */
  box-sizing: border-box;
  position: fixed;
  /* Above the modal it covers. Both modals sit at 999999, so anything
	   lower renders behind them and the expanded image is invisible and
	   unclickable — which is exactly what happened at 100000. */
  z-index: 1000000;
  display: flex;
  align-items: center;
  justify-content: center;
  /* the "reasonable padding" around the expanded image */
  padding: clamp(16px, 3vw, 44px);
  background: rgba(var(--ews-ink-rgb, 13, 13, 12), 0.93);
  cursor: zoom-out;
  opacity: 0;
  transition: opacity 0.22s ease;
}

.ews-lightbox.is-open {
  opacity: 1;
}

/* Fill the padded box and let object-fit keep the aspect ratio. With
   width/height auto the image only ever shrank to fit — a source smaller
   than the panel stayed at its intrinsic size and barely looked expanded at
   all, which is exactly what it did on a 500px product shot. */
.ews-lightbox img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform: scale(0.97);
  transition: transform 0.22s ease;
}

.ews-lightbox.is-open img {
  transform: scale(1);
}

/* Hint, not a control: the whole overlay is the close target. */
.ews-lightbox-hint {
  position: absolute;
  right: clamp(12px, 2vw, 22px);
  top: clamp(12px, 2vw, 22px);
  color: rgba(var(--ews-paper-rgb, 247, 245, 241), 0.62);
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .ews-lightbox,
  .ews-lightbox img {
    transition: none;
  }

  .ews-lightbox img {
    transform: none;
  }
}
