/* ============================================================================
   Swipe lightbox (markup: lightbox.php, script: js/modules/swipe-module.js)
   ============================================================================ */

/* Thumbnail of the photo currently open in the lightbox */
.is-lightbox-source {
  visibility: hidden;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  visibility: hidden;
  touch-action: none; /* Swipes are handled in JS */
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.lightbox.is-open {
  visibility: visible;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background-color: rgb(8, 14, 13);
  opacity: 0;
}

.lightbox-viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
  cursor: grab;
}

.lightbox.is-dragging .lightbox-viewport {
  cursor: grabbing;
}

.lightbox-track {
  position: absolute;
  inset: 0;
}

.lightbox-slide {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding: calc(64px + env(safe-area-inset-top)) 0 calc(64px + env(safe-area-inset-bottom));
}

.lightbox-slide img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  -webkit-user-drag: none;
}

/* Controls are hidden while opening and while swiping down to close */
.lightbox-ui {
  transition: opacity 0.2s ease;
}

.lightbox:not(.is-ready) .lightbox-ui,
.lightbox.is-dragging-y .lightbox-ui {
  opacity: 0;
  pointer-events: none;
}

.lightbox-counter {
  position: absolute;
  z-index: 2;
  top: calc(12px + env(safe-area-inset-top));
  left: 18px;
  line-height: 44px;
  color: rgba(255, 255, 255, 0.85);
  font-family: var(--font-heading-secondary);
  font-size: 19px;
  letter-spacing: 0.12em;
  -webkit-text-stroke: 0.4px currentColor;
}

.lightbox-btn {
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: center;
  padding: 0;
  border: none;
  background: none;
  color: #fff;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.lightbox-close {
  top: calc(12px + env(safe-area-inset-top));
  right: 8px;
  width: 44px;
  height: 44px;
  opacity: 0.85;
}

.lightbox-close:hover,
.lightbox-close:focus-visible {
  opacity: 1;
}

/* Previous & next buttons (desktop only, see media query below) */
.lightbox-arrow {
  display: none;
  top: 50%;
  width: 52px;
  height: 52px;
  margin-top: -26px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background-color: rgba(255, 255, 255, 0.06);
  transition: background-color 0.2s ease;
}

.lightbox-arrow:hover {
  background-color: rgba(255, 255, 255, 0.16);
}

.lightbox-prev {
  left: 24px;
}

.lightbox-next {
  right: 24px;
}

/* A single photo: nothing to browse */
.lightbox.is-single .lightbox-arrow,
.lightbox.is-single .lightbox-counter {
  display: none;
}

/* Swipe hint, shown the first time on touch screens */
.lightbox-hint {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  background-color: rgba(255, 255, 255, 0.14);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: #fff;
  font-size: 14px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 8px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.lightbox-hint.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* Mouse on a wide screen: arrows on the sides, the photo leaves room for them.
   Touch screens (phones and tablets) swipe: no arrows, the photo uses the full width. */
@media (hover: hover) and (pointer: fine) and (min-width: 769px) {
  .lightbox-slide {
    padding: 72px 100px;
  }

  .lightbox-arrow {
    display: grid;
  }
}
