/* APSAIDAL Project gallery interaction core.
 * Goals: never distort source imagery; reliable close; sequential browsing;
 * swipe/pointer navigation; optional zoom without cropping.
 */

/* Preserve source proportions in the gallery overview. */
:is(body.single-aps_project,body.single-aps_product) .aps-project-media-index__card img,
:is(body.single-aps_project,body.single-aps_product) .aps-project-media-index__thumb img,
:is(body.single-aps_project,body.single-aps_product) .aps-project-media-index img {
  width: 100% !important;
  height: auto !important;
  max-width: 100% !important;
  max-height: none !important;
  aspect-ratio: auto !important;
  object-fit: contain !important;
  object-position: center center !important;
}

/* A forced close is used only as a fallback when the historical modal's
 * native X does not actually hide the gallery. The Images trigger clears it. */
:is(body.single-aps_project,body.single-aps_product) .aps-project-media-index--forced-closed {
  display: none !important;
}

/* Keep the historical close button clickable above gallery content. */
:is(body.single-aps_project,body.single-aps_product) .aps-project-media-index__close {
  z-index: 1000005 !important;
  pointer-events: auto !important;
  cursor: pointer !important;
}

:is(body.single-aps_project,body.single-aps_product).aps-project-lightbox-open {
  overflow: hidden !important;
}

:is(body.single-aps_project,body.single-aps_product) .aps-project-lightbox {
  position: fixed;
  z-index: 1000010;
  inset: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: rgba(20, 20, 20, .96);
  color: #fff;
  opacity: 0;
  transition: opacity .14s ease;
}

:is(body.single-aps_project,body.single-aps_product) .aps-project-lightbox[hidden] {
  display: none !important;
}

:is(body.single-aps_project,body.single-aps_product) .aps-project-lightbox.is-open {
  opacity: 1;
}

:is(body.single-aps_project,body.single-aps_product) .aps-project-lightbox__bar {
  position: relative;
  z-index: 3;
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 12px 22px;
  background: rgba(20, 20, 20, .96);
}

:is(body.single-aps_project,body.single-aps_product) .aps-project-lightbox__count {
  font-family: "Source Sans Pro", Arial, sans-serif;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: .02em;
  color: rgba(255,255,255,.72);
}

:is(body.single-aps_project,body.single-aps_product) .aps-project-lightbox__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

:is(body.single-aps_project,body.single-aps_product) .aps-project-lightbox__close,
:is(body.single-aps_project,body.single-aps_product) .aps-project-lightbox__zoom-step,
:is(body.single-aps_project,body.single-aps_product) .aps-project-lightbox__nav {
  appearance: none;
  -webkit-appearance: none;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
  color: #fff !important;
  cursor: pointer;
}

:is(body.single-aps_project,body.single-aps_product) .aps-project-lightbox__close {
  width: 42px;
  height: 42px;
  padding: 0 0 4px !important;
  font: 300 32px/1 Arial, sans-serif !important;
}

:is(body.single-aps_project,body.single-aps_product) .aps-project-lightbox__zoom-controls {
  height: 34px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.035);
}

:is(body.single-aps_project,body.single-aps_product) .aps-project-lightbox__zoom-step {
  width: 31px;
  height: 32px;
  padding: 0 !important;
  display: grid;
  place-items: center;
  font: 300 18px/1 "Source Sans Pro", Arial, sans-serif !important;
  color: rgba(255,255,255,.86) !important;
}

:is(body.single-aps_project,body.single-aps_product) .aps-project-lightbox__zoom-step:disabled {
  opacity: .28;
  cursor: default;
}

:is(body.single-aps_project,body.single-aps_product) .aps-project-lightbox__zoom-value {
  min-width: 48px;
  padding: 0 6px;
  text-align: center;
  font-family: "Source Sans Pro", Arial, sans-serif;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: .015em;
  color: rgba(255,255,255,.66);
  user-select: none;
}

:is(body.single-aps_project,body.single-aps_product) .aps-project-lightbox__stage {
  position: relative;
  min-height: 0;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 72px;
  align-items: stretch;
}

:is(body.single-aps_project,body.single-aps_product) .aps-project-lightbox__canvas {
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 10px 16px 18px;
  touch-action: pan-y;
}

:is(body.single-aps_project,body.single-aps_product) .aps-project-lightbox__image {
  display: block;
  width: auto !important;
  height: auto !important;
  max-width: 100% !important;
  max-height: calc(100vh - 136px) !important;
  aspect-ratio: auto !important;
  object-fit: contain !important;
  object-position: center center !important;
  transform-origin: center center;
  transition: transform .18s ease;
  user-select: none;
  -webkit-user-drag: none;
}

:is(body.single-aps_project,body.single-aps_product) .aps-project-lightbox--zoomed .aps-project-lightbox__canvas {
  display: block;
  overflow: auto;
  cursor: grab;
  touch-action: pan-x pan-y;
}

:is(body.single-aps_project,body.single-aps_product) .aps-project-lightbox--zoomed .aps-project-lightbox__canvas:active {
  cursor: grabbing;
}

:is(body.single-aps_project,body.single-aps_product) .aps-project-lightbox--zoomed .aps-project-lightbox__image {
  max-width: none !important;
  max-height: none !important;
  margin: 24px auto;
}

:is(body.single-aps_project,body.single-aps_product) .aps-project-lightbox__nav {
  position: relative;
  z-index: 2;
  width: 72px;
  min-width: 72px;
  padding: 0 0 9px !important;
  display: grid;
  place-items: center;
  font: 200 58px/1 Arial, sans-serif !important;
  color: rgba(255,255,255,.78) !important;
}

:is(body.single-aps_project,body.single-aps_product) .aps-project-lightbox__nav:hover,
:is(body.single-aps_project,body.single-aps_product) .aps-project-lightbox__close:hover,
:is(body.single-aps_project,body.single-aps_product) .aps-project-lightbox__zoom-step:hover,
:is(body.single-aps_project,body.single-aps_product) .aps-project-lightbox__nav:focus-visible,
:is(body.single-aps_project,body.single-aps_product) .aps-project-lightbox__close:focus-visible,
:is(body.single-aps_project,body.single-aps_product) .aps-project-lightbox__zoom-step:focus-visible {
  color: #fff !important;
  background: rgba(255,255,255,.08) !important;
}

:is(body.single-aps_project,body.single-aps_product) .aps-project-lightbox__caption {
  min-height: 44px;
  padding: 9px 24px 13px;
  text-align: center;
  font-family: "Source Sans Pro", Arial, sans-serif;
  font-size: 12px;
  font-weight: 300;
  line-height: 1.4;
  color: rgba(255,255,255,.66);
}

@media (max-width: 767px) {
  :is(body.single-aps_project,body.single-aps_product) .aps-project-lightbox__bar {
    min-height: 56px;
    padding: 7px 8px 7px 14px;
  }

  :is(body.single-aps_project,body.single-aps_product) .aps-project-lightbox__stage {
    grid-template-columns: 44px minmax(0, 1fr) 44px;
  }

  :is(body.single-aps_project,body.single-aps_product) .aps-project-lightbox__nav {
    width: 44px;
    min-width: 44px;
    font-size: 46px !important;
  }

  :is(body.single-aps_project,body.single-aps_product) .aps-project-lightbox__canvas {
    padding: 6px 2px 12px;
  }

  :is(body.single-aps_project,body.single-aps_product) .aps-project-lightbox__image {
    max-height: calc(100vh - 116px) !important;
  }

  :is(body.single-aps_project,body.single-aps_product) .aps-project-lightbox__caption {
    min-height: 36px;
    padding: 7px 12px 10px;
    font-size: 11px;
  }
}

@media (max-width: 767px) {
  :is(body.single-aps_project,body.single-aps_product) .aps-project-lightbox__zoom-controls {
    height: 32px;
  }

  :is(body.single-aps_project,body.single-aps_product) .aps-project-lightbox__zoom-step {
    width: 29px;
    height: 30px;
    font-size: 17px !important;
  }

  :is(body.single-aps_project,body.single-aps_product) .aps-project-lightbox__zoom-value {
    min-width: 44px;
    font-size: 10.5px;
  }
}

/* Real zoom/pan behavior: when enlarged, the image exceeds the viewport and
 * the canvas becomes the navigation surface. */
:is(body.single-aps_project,body.single-aps_product) .aps-project-lightbox--zoomed .aps-project-lightbox__canvas {
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  cursor: grab;
}

:is(body.single-aps_project,body.single-aps_product) .aps-project-lightbox--zoomed .aps-project-lightbox__image {
  display: block !important;
  margin: 24px auto !important;
  flex: none !important;
}

:is(body.single-aps_project,body.single-aps_product) .aps-project-lightbox--zoomed .aps-project-lightbox__canvas.aps-lightbox-panning,
:is(body.single-aps_project,body.single-aps_product) .aps-project-lightbox--zoomed .aps-project-lightbox__canvas.aps-lightbox-panning * {
  cursor: grabbing !important;
  user-select: none !important;
}


/* Heritage intentionally shares the exact Project detail-viewer contract. */
/* APSAIDAL Project gallery interaction core.
 * Goals: never distort source imagery; reliable close; sequential browsing;
 * swipe/pointer navigation; optional zoom without cropping.
 */

/* Preserve source proportions in the gallery overview. */
body.single-aps_heritage .aps-project-media-index__card img,
body.single-aps_heritage .aps-project-media-index__thumb img,
body.single-aps_heritage .aps-project-media-index img {
  width: 100% !important;
  height: auto !important;
  max-width: 100% !important;
  max-height: none !important;
  aspect-ratio: auto !important;
  object-fit: contain !important;
  object-position: center center !important;
}

/* A forced close is used only as a fallback when the historical modal's
 * native X does not actually hide the gallery. The Images trigger clears it. */
body.single-aps_heritage .aps-project-media-index--forced-closed {
  display: none !important;
}

/* Keep the historical close button clickable above gallery content. */
body.single-aps_heritage .aps-project-media-index__close {
  z-index: 1000005 !important;
  pointer-events: auto !important;
  cursor: pointer !important;
}

body.single-aps_heritage.aps-project-lightbox-open {
  overflow: hidden !important;
}

body.single-aps_heritage .aps-project-lightbox {
  position: fixed;
  z-index: 1000010;
  inset: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: rgba(20, 20, 20, .96);
  color: #fff;
  opacity: 0;
  transition: opacity .14s ease;
}

body.single-aps_heritage .aps-project-lightbox[hidden] {
  display: none !important;
}

body.single-aps_heritage .aps-project-lightbox.is-open {
  opacity: 1;
}

body.single-aps_heritage .aps-project-lightbox__bar {
  position: relative;
  z-index: 3;
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 12px 22px;
  background: rgba(20, 20, 20, .96);
}

body.single-aps_heritage .aps-project-lightbox__count {
  font-family: "Source Sans Pro", Arial, sans-serif;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: .02em;
  color: rgba(255,255,255,.72);
}

body.single-aps_heritage .aps-project-lightbox__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

body.single-aps_heritage .aps-project-lightbox__close,
body.single-aps_heritage .aps-project-lightbox__zoom-step,
body.single-aps_heritage .aps-project-lightbox__nav {
  appearance: none;
  -webkit-appearance: none;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
  color: #fff !important;
  cursor: pointer;
}

body.single-aps_heritage .aps-project-lightbox__close {
  width: 42px;
  height: 42px;
  padding: 0 0 4px !important;
  font: 300 32px/1 Arial, sans-serif !important;
}

body.single-aps_heritage .aps-project-lightbox__zoom-controls {
  height: 34px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.035);
}

body.single-aps_heritage .aps-project-lightbox__zoom-step {
  width: 31px;
  height: 32px;
  padding: 0 !important;
  display: grid;
  place-items: center;
  font: 300 18px/1 "Source Sans Pro", Arial, sans-serif !important;
  color: rgba(255,255,255,.86) !important;
}

body.single-aps_heritage .aps-project-lightbox__zoom-step:disabled {
  opacity: .28;
  cursor: default;
}

body.single-aps_heritage .aps-project-lightbox__zoom-value {
  min-width: 48px;
  padding: 0 6px;
  text-align: center;
  font-family: "Source Sans Pro", Arial, sans-serif;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: .015em;
  color: rgba(255,255,255,.66);
  user-select: none;
}

body.single-aps_heritage .aps-project-lightbox__stage {
  position: relative;
  min-height: 0;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 72px;
  align-items: stretch;
}

body.single-aps_heritage .aps-project-lightbox__canvas {
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 10px 16px 18px;
  touch-action: pan-y;
}

body.single-aps_heritage .aps-project-lightbox__image {
  display: block;
  width: auto !important;
  height: auto !important;
  max-width: 100% !important;
  max-height: calc(100vh - 136px) !important;
  aspect-ratio: auto !important;
  object-fit: contain !important;
  object-position: center center !important;
  transform-origin: center center;
  transition: transform .18s ease;
  user-select: none;
  -webkit-user-drag: none;
}

body.single-aps_heritage .aps-project-lightbox--zoomed .aps-project-lightbox__canvas {
  display: block;
  overflow: auto;
  cursor: grab;
  touch-action: pan-x pan-y;
}

body.single-aps_heritage .aps-project-lightbox--zoomed .aps-project-lightbox__canvas:active {
  cursor: grabbing;
}

body.single-aps_heritage .aps-project-lightbox--zoomed .aps-project-lightbox__image {
  max-width: none !important;
  max-height: none !important;
  margin: 24px auto;
}

body.single-aps_heritage .aps-project-lightbox__nav {
  position: relative;
  z-index: 2;
  width: 72px;
  min-width: 72px;
  padding: 0 0 9px !important;
  display: grid;
  place-items: center;
  font: 200 58px/1 Arial, sans-serif !important;
  color: rgba(255,255,255,.78) !important;
}

body.single-aps_heritage .aps-project-lightbox__nav:hover,
body.single-aps_heritage .aps-project-lightbox__close:hover,
body.single-aps_heritage .aps-project-lightbox__zoom-step:hover,
body.single-aps_heritage .aps-project-lightbox__nav:focus-visible,
body.single-aps_heritage .aps-project-lightbox__close:focus-visible,
body.single-aps_heritage .aps-project-lightbox__zoom-step:focus-visible {
  color: #fff !important;
  background: rgba(255,255,255,.08) !important;
}

body.single-aps_heritage .aps-project-lightbox__caption {
  min-height: 44px;
  padding: 9px 24px 13px;
  text-align: center;
  font-family: "Source Sans Pro", Arial, sans-serif;
  font-size: 12px;
  font-weight: 300;
  line-height: 1.4;
  color: rgba(255,255,255,.66);
}

@media (max-width: 767px) {
  body.single-aps_heritage .aps-project-lightbox__bar {
    min-height: 56px;
    padding: 7px 8px 7px 14px;
  }

  body.single-aps_heritage .aps-project-lightbox__stage {
    grid-template-columns: 44px minmax(0, 1fr) 44px;
  }

  body.single-aps_heritage .aps-project-lightbox__nav {
    width: 44px;
    min-width: 44px;
    font-size: 46px !important;
  }

  body.single-aps_heritage .aps-project-lightbox__canvas {
    padding: 6px 2px 12px;
  }

  body.single-aps_heritage .aps-project-lightbox__image {
    max-height: calc(100vh - 116px) !important;
  }

  body.single-aps_heritage .aps-project-lightbox__caption {
    min-height: 36px;
    padding: 7px 12px 10px;
    font-size: 11px;
  }
}

@media (max-width: 767px) {
  body.single-aps_heritage .aps-project-lightbox__zoom-controls {
    height: 32px;
  }

  body.single-aps_heritage .aps-project-lightbox__zoom-step {
    width: 29px;
    height: 30px;
    font-size: 17px !important;
  }

  body.single-aps_heritage .aps-project-lightbox__zoom-value {
    min-width: 44px;
    font-size: 10.5px;
  }
}

/* Real zoom/pan behavior: when enlarged, the image exceeds the viewport and
 * the canvas becomes the navigation surface. */
body.single-aps_heritage .aps-project-lightbox--zoomed .aps-project-lightbox__canvas {
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  cursor: grab;
}

body.single-aps_heritage .aps-project-lightbox--zoomed .aps-project-lightbox__image {
  display: block !important;
  margin: 24px auto !important;
  flex: none !important;
}

body.single-aps_heritage .aps-project-lightbox--zoomed .aps-project-lightbox__canvas.aps-lightbox-panning,
body.single-aps_heritage .aps-project-lightbox--zoomed .aps-project-lightbox__canvas.aps-lightbox-panning * {
  cursor: grabbing !important;
  user-select: none !important;
}
