/* Full-size viewer for the gallery photos, and the compact gallery variant.
 *
 * Paired with assets/js/lightbox.js, which adds .is-zoomable to every photo tile
 * it binds. The cursor and hover treatment key off that class rather than off
 * .is-photo, so a page that loads the CSS without the JS never shows an
 * affordance for something that will not respond.
 */

/* ---- the affordance on the tile ---------------------------------------- */

.sos-gallery .sos-gl-tile.is-zoomable {
  cursor: zoom-in;
}

.sos-gallery .sos-gl-tile.is-zoomable img {
  transition: transform 220ms ease;
}

.sos-gallery .sos-gl-tile.is-zoomable:hover img,
.sos-gallery .sos-gl-tile.is-zoomable:focus-visible img {
  transform: scale(1.05);
}

.sos-gallery .sos-gl-tile.is-zoomable:focus-visible {
  outline: 3px solid #dd5c26;
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .sos-gallery .sos-gl-tile.is-zoomable img {
    transition: none;
  }
  .sos-gallery .sos-gl-tile.is-zoomable:hover img,
  .sos-gallery .sos-gl-tile.is-zoomable:focus-visible img {
    transform: none;
  }
}

/* ---- the overlay -------------------------------------------------------- */

/* Locks the page behind the dialog. Without it the body scrolls under the
   overlay on a wheel gesture, which reads as the photo drifting. */
.sos-lb-open,
.sos-lb-open body {
  overflow: hidden;
}

.sos-lb {
  position: fixed;
  inset: 0;
  /* Above Divi's fixed header (z-index 99999 in the mirror's own CSS). */
  z-index: 200000;
  background: rgba(12, 12, 12, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
}

.sos-lb[hidden] {
  display: none;
}

.sos-lb-stage {
  margin: 0;
  max-width: min(1100px, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.sos-lb-img {
  display: block;
  max-width: 100%;
  /* Room for the caption under it without the photo pushing past the viewport. */
  max-height: calc(100vh - 140px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  background: #1a1a1a;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}

.sos-lb-cap {
  color: #e8e8e8;
  font-size: 0.95rem;
  line-height: 1.5;
  text-align: center;
  max-width: 720px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sos-lb-count {
  color: #9a9a9a;
  font-size: 0.85rem;
}

/* ---- controls ----------------------------------------------------------- */

.sos-lb-close,
.sos-lb-nav {
  appearance: none;
  border: 0;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  border-radius: 999px;
  line-height: 1;
  transition: background 160ms ease;
}

.sos-lb-close:hover,
.sos-lb-nav:hover,
.sos-lb-close:focus-visible,
.sos-lb-nav:focus-visible {
  background: #dd5c26;
}

.sos-lb-close:focus-visible,
.sos-lb-nav:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
}

.sos-lb-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 44px;
  height: 44px;
  font-size: 30px;
}

.sos-lb-nav {
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  font-size: 34px;
}

.sos-lb-nav[hidden] {
  display: none;
}

@media all and (max-width: 620px) {
  .sos-lb {
    padding: 12px;
    gap: 4px;
  }
  .sos-lb-nav {
    width: 42px;
    height: 42px;
    font-size: 28px;
  }
  .sos-lb-img {
    max-height: calc(100vh - 170px);
  }
}

/* ---- compact gallery ----------------------------------------------------
   The About page is a story page, not a service page: the gallery supports the
   copy above it rather than being the point of the page, and at the service-page
   size it was taking most of a screen on its own. Narrower grid, tighter band.
   Scoped to .is-compact so the 136 service galleries are untouched. */

.sos-gallery.is-compact {
  padding: 40px 0;
}

.sos-gallery.is-compact .sos-gl-head {
  margin-bottom: 24px;
}

.sos-gallery.is-compact .sos-gl-grid {
  max-width: 880px;
  margin-inline: auto;
  gap: 12px;
}

.sos-gallery.is-compact .sos-gl-cta {
  margin-top: 24px;
}
