/* Lightbox overlay uses CSS variables; default = dark-style overlay */
:root {
  --lb-bg: rgba(0, 0, 0, 0.95);
  --lb-fg: #fff;
}

/* Light-mode preference: lighter overlay + dark icon */
@media (prefers-color-scheme: light) {
  :root {
    --lb-bg: rgba(255, 255, 255, 0.95);
    --lb-fg: #000;
  }
}

/* Dark-mode preference (explicit for clarity; matches defaults) */
@media (prefers-color-scheme: dark) {
  :root {
    --lb-bg: rgba(0, 0, 0, 0.9);
    --lb-fg: #fff;
  }
}

#lb {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--lb-bg);
  justify-content: center;
  align-items: center;
  z-index: 9999;

  /* Prevent scroll and interactions behind the lightbox */
  overscroll-behavior: contain;
  touch-action: none;
}

#lb img {
  max-width: 100%;
  max-height: 100%;
  height: auto;
  width: auto;

  /* Smooth snap-back if you add swipe later */
  transition: transform 0.2s ease, opacity 0.2s ease;
  will-change: transform, opacity;
}

#lb span {
  position: fixed; /* always in viewport */
  top: 15px;
  right: 25px;
  font-size: 40px;
  color: var(--lb-fg);
  cursor: pointer;

  /* Bigger hit area for touch without enlarging the icon */
  padding: 15px;
  line-height: 1;
  z-index: 10000; /* above image */

  /* Semi-transparent until hover/tap */
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

#lb span:hover,
#lb span:focus {
  opacity: 1;
}

#lb span::before {
  content: '';
  position: absolute;
  inset: 0;
}
