/* Only project photo galleries; homepage hero and card carousels are unaffected. */
.project-gallery .carousel-inner {
  aspect-ratio: var(--gallery-ratio);
}
.project-gallery .carousel-inner > .item {
  height: 100%;
}
.project-gallery .carousel-inner > .item > img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background-color: #000;
}
/* Works and Student Projects share the existing 3:2 landscape photo pattern. */
#works + .g-works .project-gallery .carousel-inner,
#student-projects .project-gallery .carousel-inner {
  aspect-ratio: 3 / 2;
}
#works + .g-works .project-gallery .carousel-inner > .item,
#student-projects .project-gallery .carousel-inner > .item {
  /* Keep intrinsic image height out of stage sizing; retain Bootstrap's slide offsets. */
  position: absolute;
  top: 0;
  width: 100%;
}
.gallery-expand,
.gallery-lightbox button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 2px;
  background: rgba(0, 0, 0, .6);
  color: #fff;
  line-height: 1;
  font-size: 18px;
  cursor: pointer;
}
.gallery-expand {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 2;
}
.gallery-expand:hover,
.gallery-lightbox button:hover { background: rgba(0, 0, 0, .85); }
.gallery-expand:focus-visible,
.gallery-lightbox button:focus-visible { outline: 2px solid #fff; outline-offset: -4px; }
.gallery-lightbox {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: #131313;
  color: #fff;
  overflow: hidden;
  overscroll-behavior: contain;
}
.gallery-lightbox::backdrop { background: #000; }
.gallery-lightbox-image {
  display: block;
  width: 100%;
  height: 100%;
  padding: calc(56px + env(safe-area-inset-top, 0px)) env(safe-area-inset-right, 0px) calc(48px + env(safe-area-inset-bottom, 0px)) env(safe-area-inset-left, 0px);
  object-fit: contain;
}
.gallery-lightbox button { position: absolute; }
.gallery-lightbox button.gallery-lightbox-slideshow {
  top: calc(8px + env(safe-area-inset-top, 0px));
  left: calc(8px + env(safe-area-inset-left, 0px));
  width: auto;
  min-width: 44px;
  max-width: calc(100% - 76px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px));
  padding: 0 12px;
  gap: 8px;
  font-size: 14px;
}
.gallery-lightbox-close {
  top: calc(8px + env(safe-area-inset-top, 0px));
  right: calc(8px + env(safe-area-inset-right, 0px));
}
.gallery-lightbox-previous,
.gallery-lightbox-next { top: 50%; transform: translateY(-50%); }
.gallery-lightbox-previous { left: calc(8px + env(safe-area-inset-left, 0px)); }
.gallery-lightbox-next { right: calc(8px + env(safe-area-inset-right, 0px)); }
.gallery-lightbox button[hidden] { display: none; }
.gallery-lightbox button:disabled { opacity: .35; cursor: default; }
.gallery-lightbox-counter {
  position: absolute;
  bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  font-size: 16px;
  line-height: 32px;
  font-variant-numeric: tabular-nums;
}
