/**
 * Noir Lens - Lightbox with White Passe-Partout Frame
 * Implements gallery presentation with a museum-grade solid white matting frame (screenshot 2)
 */

/* ==========================================================================
   1. Noir Lens Photographer Lightbox
   ========================================================================== */
.noir-lightbox-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s ease;
  user-select: none;
  -webkit-user-select: none;
}

.noir-lightbox-overlay.is-active {
  opacity: 1;
  visibility: visible;
}

.noir-lightbox-overlay::after {
  position: absolute;
  inset: 0;
  z-index: 99999;
  background: #ffffff;
  content: "";
  opacity: 0;
  pointer-events: none;
}

.noir-lightbox-overlay.is-flashing::after {
  animation: noir-lightbox-flash 0.3s ease-out;
}

@keyframes noir-lightbox-flash {
  0% {
    opacity: 0;
  }
  18% {
    opacity: 0.38;
  }
  100% {
    opacity: 0;
  }
}

/* Lightbox Content Container */
.noir-lightbox-dialog {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: 95vw;
  max-height: 95vh;
  outline: none;
}

/* The Iconic White Passe-Partout Frame (White border around photo) */
.noir-lightbox-mat {
  background-color: #ffffff;
  padding: 38px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.92), 0 0 2px rgba(255, 255, 255, 0.15);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  transform: scale(0.96);
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}

.noir-lightbox-overlay.is-active .noir-lightbox-mat {
  transform: scale(1);
  opacity: 1;
}

/* The Photo inside the white frame */
.noir-lightbox-photo {
  display: block;
  max-width: calc(88vw - 76px);
  max-height: calc(80vh - 76px);
  width: auto;
  height: auto;
  object-fit: contain;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

/* Optional In-Mat Caption (like classic gallery print labeling) */
.noir-lightbox-caption {
  margin-top: 18px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 11px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: #555555;
  text-align: center;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Counter indicator */
.noir-lightbox-counter {
  position: absolute;
  top: -36px;
  left: 0;
  font-family: "SF Mono", Monaco, Inconsolata, monospace;
  font-size: 11px;
  letter-spacing: 1.5px;
  color: rgba(255, 255, 255, 0.7);
}

/* Close Button (×) */
.noir-lightbox-close {
  position: absolute;
  top: 28px;
  right: 32px;
  width: 44px;
  height: 44px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  line-height: 1;
  font-weight: 300;
  opacity: 0.75;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 100000;
}

.noir-lightbox-close:hover {
  opacity: 1;
  transform: scale(1.1);
}

/* Navigation Arrow Buttons */
.noir-lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 54px;
  height: 54px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  opacity: 0.65;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 100000;
  padding: 0;
}

.noir-lightbox-nav:hover {
  opacity: 1;
  transform: translateY(-50%) scale(1.15);
}

.noir-lightbox-prev {
  left: 28px;
}

.noir-lightbox-next {
  right: 28px;
}

.noir-lightbox-zoom-controls {
  position: absolute;
  top: 24px;
  right: 84px;
  display: flex;
  gap: 8px;
  z-index: 100001;
}

.noir-lightbox-zoom {
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: rgba(0, 0, 0, 0.35);
  color: #ffffff;
  font: inherit;
  font-size: 25px;
  line-height: 1;
  cursor: pointer;
  transition: opacity 0.2s ease, background-color 0.2s ease;
}

.noir-lightbox-zoom:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.2);
}

.noir-lightbox-zoom:disabled {
  opacity: 0.4;
  cursor: default;
}

.noir-lightbox-zoom-controls .noir-lightbox-zoom {
  display: flex;
  align-items: center;
  justify-content: center;
}

.noir-lightbox-photo {
  transition: transform 0.2s ease;
}

.noir-lightbox-photo.is-zoomed {
  cursor: grab;
}

.noir-lightbox-photo.is-dragging {
  cursor: grabbing;
  transition: none;
}

.noir-masonry-grid img,
.wp-block-gallery img,
.noir-classic-photo-grid img,
.noir-single-post-area img,
.noir-portfolio-card img,
.wp-block-image:not(.noir-gallery-item) img {
  cursor: pointer;
}

.wp-block-image:not(.noir-gallery-item) img {
  transition: opacity 0.25s ease, transform 0.3s ease;
}

.wp-block-image:not(.noir-gallery-item) img:hover {
  opacity: 0.88;
}

.noir-lightbox-nav svg {
  width: 32px;
  height: 32px;
  stroke: #ffffff;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Loading Spinner */
.noir-lightbox-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 36px;
  height: 36px;
  margin-top: -18px;
  margin-left: -18px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: noir-spin 0.8s linear infinite;
  display: none;
}

.noir-lightbox-overlay.is-loading .noir-lightbox-spinner {
  display: block;
}

.noir-lightbox-overlay.is-loading .noir-lightbox-photo {
  opacity: 0.3;
}

@keyframes noir-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ==========================================================================
   2. Responsive Breakpoints for Lightbox
   ========================================================================== */
@media (max-width: 860px) {
  .noir-lightbox-mat {
    padding: 22px;
  }

  .noir-lightbox-photo {
    max-width: calc(92vw - 44px);
    max-height: calc(76vh - 44px);
  }

  .noir-lightbox-close {
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    font-size: 28px;
  }

  .noir-lightbox-nav {
    width: 44px;
    height: 44px;
  }

  .noir-lightbox-prev {
    left: 8px;
  }

  .noir-lightbox-next {
    right: 8px;
  }

  .noir-lightbox-counter {
    top: -28px;
    font-size: 10px;
  }

  .noir-lightbox-zoom-controls {
    top: 16px;
    right: 64px;
  }

  .noir-lightbox-zoom {
    width: 36px;
    height: 36px;
    font-size: 22px;
  }
}

@media (max-width: 480px) {
  .noir-lightbox-mat {
    padding: 16px;
  }

  .noir-lightbox-photo {
    max-width: calc(94vw - 32px);
    max-height: calc(72vh - 32px);
  }

  .noir-lightbox-caption {
    font-size: 10px;
    margin-top: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .noir-lightbox-overlay.is-flashing::after {
    animation: none;
    opacity: 0;
  }
}
