/**
 * THE BEAUMONT MANOR: CHRISTMAS COLD CASE - LIGHTBOX STYLES
 * Cinematic Fullscreen Modal with Touch HUD Controls (>= 44x44px Touch Targets)
 * Hardware-accelerated Pinch-to-Zoom (1.0x to 4.5x) and 1-Finger Pan Clamping
 */

/* Lock body scrolling when the lightbox is active */
body.lightbox-locked {
  overflow: hidden !important;
  touch-action: none !important;
}

/* Main Lightbox Modal Container */
.coldcase-lightbox-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  background-color: rgba(6, 10, 16, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
}

.coldcase-lightbox-modal.active {
  opacity: 1;
  pointer-events: auto;
}

/* ---------------------------------------------------------------------------
   UPPER HUD BAR (Inspection Information & Tooling Controls)
   --------------------------------------------------------------------------- */
.lightbox-hud-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.9) 0%, rgba(15, 23, 42, 0.5) 100%);
  border-bottom: 1px solid rgba(245, 158, 11, 0.25);
  user-select: none;
  -webkit-user-select: none;
  z-index: 10;
}

.lightbox-hud-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  max-width: 55%;
}

.lightbox-badge {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: #f59e0b;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.lightbox-badge::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #f59e0b;
  box-shadow: 0 0 6px #f59e0b;
}

.lightbox-title {
  margin: 0;
  font-family: Georgia, 'Playfair Display', serif;
  font-size: clamp(0.95rem, 2.4vw, 1.25rem);
  font-weight: 700;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}

/* HUD Controls Toolbar */
.lightbox-hud-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Zoom Level Pill Indicator */
.lightbox-zoom-pill {
  padding: 0.35rem 0.65rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.8rem;
  font-weight: 700;
  color: #38bdf8;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 9999px;
  min-width: 54px;
  text-align: center;
  letter-spacing: 0.05em;
}

/* Ergonomic Buttons (Minimum 44x44px touch target) */
.lightbox-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0.5rem;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 8px;
  color: #e2e8f0;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
  touch-action: manipulation;
}

.lightbox-btn:hover {
  background: rgba(51, 65, 85, 0.95);
  border-color: #f59e0b;
  color: #f59e0b;
}

.lightbox-btn:active {
  transform: scale(0.94);
}

.lightbox-btn.close-btn {
  background: rgba(220, 38, 38, 0.22);
  border-color: rgba(239, 68, 68, 0.45);
  color: #fca5a5;
  font-size: 1.25rem;
  margin-left: 0.25rem;
}

.lightbox-btn.close-btn:hover {
  background: rgba(220, 38, 38, 0.55);
  color: #ffffff;
  border-color: #ef4444;
}

/* ---------------------------------------------------------------------------
   INTERACTIVE VIEWPORT (Pinch-to-zoom & Pan Surface)
   --------------------------------------------------------------------------- */
.lightbox-viewport {
  position: relative;
  flex: 1;
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  touch-action: none; /* Prevents native mobile browser scrolling and zooming gestures */
  user-select: none;
  -webkit-user-select: none;
}

.lightbox-viewport:active {
  cursor: grabbing;
}

.lightbox-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  max-height: 100%;
  transform-origin: center center;
  will-change: transform;
}

.lightbox-stage.smooth-transition {
  transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

.lightbox-media-img {
  max-width: 90vw;
  max-height: 74vh;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  border-radius: 6px;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.08);
  pointer-events: none;
}

/* ---------------------------------------------------------------------------
   ELEGANT EVIDENCE FALLBACK CARD (Graceful Missing Asset System)
   --------------------------------------------------------------------------- */
.lightbox-fallback-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 2.25rem 2rem;
  max-width: 520px;
  width: 90%;
  background: rgba(15, 23, 42, 0.94);
  border: 1px dashed rgba(245, 158, 11, 0.6);
  border-radius: 14px;
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(245, 158, 11, 0.15);
  position: relative;
  overflow: hidden;
}

.lightbox-fallback-card::before {
  content: "COLD CASE DOSSIER • EVIDENCE SPECIMEN";
  position: absolute;
  top: 0.5rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  color: rgba(245, 158, 11, 0.65);
}

.fallback-icon-wrap {
  margin-top: 0.75rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.fallback-title {
  margin: 0 0 0.5rem 0;
  font-family: Georgia, 'Playfair Display', serif;
  font-size: 1.3rem;
  color: #fef08a;
  font-weight: 700;
}

.fallback-desc {
  margin: 0 0 1rem 0;
  font-size: 0.92rem;
  color: #94a3b8;
  line-height: 1.55;
  max-width: 440px;
}

.fallback-meta-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
  margin-bottom: 1rem;
}

.fallback-meta-tag {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.72rem;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  background: rgba(30, 41, 59, 0.8);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.fallback-path-badge {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.82rem;
  color: #38bdf8;
  background: rgba(2, 6, 23, 0.9);
  padding: 0.45rem 0.9rem;
  border-radius: 6px;
  border: 1px solid rgba(56, 189, 248, 0.35);
  word-break: break-all;
  user-select: all;
  -webkit-user-select: all;
}

/* ---------------------------------------------------------------------------
   HUD FOOTER (Contextual Guidance & Quick Ergonomic Actions)
   --------------------------------------------------------------------------- */
.lightbox-hud-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  background: linear-gradient(0deg, rgba(15, 23, 42, 0.92) 0%, rgba(15, 23, 42, 0.5) 100%);
  border-top: 1px solid rgba(245, 158, 11, 0.2);
  font-size: 0.85rem;
  color: #cbd5e1;
  user-select: none;
  -webkit-user-select: none;
  z-index: 10;
}

.hud-mono-tag {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 700;
  color: #f59e0b;
  margin-right: 0.45rem;
}

.lightbox-quick-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: 0.45rem 1.15rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.82rem;
  font-weight: 700;
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.45);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  touch-action: manipulation;
}

.lightbox-quick-btn:hover {
  background: rgba(245, 158, 11, 0.25);
  border-color: #f59e0b;
}

.lightbox-quick-btn:active {
  transform: scale(0.95);
}

/* ---------------------------------------------------------------------------
   MULTI-DEVICE RESPONSIVENESS (Mobile, Tablet & Landscape Modes)
   --------------------------------------------------------------------------- */
@media (max-width: 640px) {
  .lightbox-hud-bar {
    padding: 0.5rem 0.5rem;
    box-sizing: border-box;
    width: 100%;
    max-width: 100vw;
  }
  .lightbox-hud-info {
    flex: 1;
    min-width: 0;
    max-width: none;
    margin-right: 0.5rem;
  }
  .lightbox-badge {
    font-size: 0.55rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .lightbox-title {
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .lightbox-hud-controls {
    gap: 0.25rem;
    flex-shrink: 0;
  }
  .lightbox-zoom-pill,
  #btnLightboxReset {
    display: none;
  }
  .lightbox-btn {
    min-width: 40px;
    min-height: 40px;
    padding: 0.25rem;
    font-size: 1rem;
  }
  .lightbox-btn.close-btn {
    min-width: 44px;
    min-height: 44px;
    margin-left: 0.25rem;
  }
  .lightbox-hud-footer {
    flex-direction: column;
    gap: 0.65rem;
    align-items: stretch;
    text-align: center;
    padding: 0.65rem 0.85rem;
  }
  .lightbox-caption {
    font-size: 0.78rem;
    line-height: 1.4;
  }
  .lightbox-quick-btn {
    width: 100%;
  }
  .lightbox-media-img {
    max-width: 95vw;
    max-height: 70vh;
  }
}

/* Landscape Mode for Compact Mobile Phones */
@media (max-height: 520px) and (orientation: landscape) {
  .lightbox-hud-bar {
    padding: 0.35rem 0.75rem;
  }
  .lightbox-hud-footer {
    padding: 0.35rem 0.75rem;
  }
  .lightbox-title {
    font-size: 0.85rem;
  }
  .lightbox-media-img {
    max-height: 64vh;
  }
  .lightbox-fallback-card {
    padding: 1.25rem 1rem;
  }
  .fallback-icon-wrap {
    width: 48px;
    height: 48px;
    margin-bottom: 0.5rem;
  }
}
