/* ==========================================================================
   ApplyTimes — Image Lightbox
   Uses the theme's own design tokens (--sc-*) so it always matches the
   active color scheme, corner style and dark mode instead of looking like
   a bolted-on third-party widget.
   ========================================================================== */

a.sc-lightbox {
  position: relative;
  display: block;
  cursor: zoom-in;
  isolation: isolate;
}

/* The anchor sits between .image-wrapper (which carries the aspect-ratio
   box) and the <picture>/<img> it wraps — it needs to fill that box
   exactly the way the unwrapped <picture> used to, or the image collapses
   to its content height instead of the reserved aspect-ratio box. */
.image-wrapper > a.sc-lightbox {
  width: 100%;
  height: 100%;
}

.image-wrapper > a.sc-lightbox picture,
.image-wrapper > a.sc-lightbox img {
  display: block;
  width: 100%;
  height: 100%;
}

a.sc-lightbox:focus-visible {
  outline: 2px solid var(--sc-primary);
  outline-offset: 2px;
}

/* Zoom hint — hidden until hover/focus so it never competes with the
   image itself; a quiet affordance rather than a loud badge. */
.sc-lightbox-zoom {
  position: absolute;
  right: var(--sc-space-3, 12px);
  bottom: var(--sc-space-3, 12px);
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  color: #fff;
  font-size: 15px;
  opacity: 0;
  transform: translateY(4px) scale(0.92);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
}

a.sc-lightbox:hover .sc-lightbox-zoom,
a.sc-lightbox:focus-visible .sc-lightbox-zoom {
  opacity: 1;
  transform: translateY(0) scale(1);
}

@media (hover: none) {
  /* Touch devices: always show a faint hint since there's no hover state. */
  .sc-lightbox-zoom {
    opacity: 0.85;
    transform: none;
  }
}

/* ── Modal ────────────────────────────────────────────────────────────── */

.sc-lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sc-space-5, 24px);
  background: rgba(10, 12, 16, 0.92);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s ease;
}

.sc-lightbox-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.sc-lightbox-figure {
  position: relative;
  max-width: min(1400px, 94vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: scale(0.97);
  transition: transform 0.22s ease;
}

.sc-lightbox-overlay.is-open .sc-lightbox-figure {
  transform: scale(1);
}

.sc-lightbox-img {
  max-width: 100%;
  max-height: 78vh;
  width: auto;
  height: auto;
  border-radius: var(--sc-radius, 10px);
  box-shadow: var(--sc-shadow-lg, 0 12px 32px rgba(15, 23, 42, 0.4));
  background: #10141c;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.sc-lightbox-img.is-loaded {
  opacity: 1;
}

.sc-lightbox-caption {
  margin-top: var(--sc-space-3, 12px);
  color: #f1f5f9;
  font-size: 14px;
  text-align: center;
  max-width: 70ch;
  opacity: 0.85;
}

.sc-lightbox-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 34px;
  height: 34px;
  margin: -17px 0 0 -17px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  animation: sc-lightbox-spin 0.8s linear infinite;
}

.sc-lightbox-spinner[hidden] { display: none; }

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

/* ── Controls ─────────────────────────────────────────────────────────── */

.sc-lightbox-btn {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 17px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.sc-lightbox-btn:hover {
  background: rgba(255, 255, 255, 0.22);
}

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

.sc-lightbox-btn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.sc-lightbox-close {
  top: -8px;
  right: -8px;
}

@media (max-width: 640px) {
  .sc-lightbox-close {
    top: var(--sc-space-3, 12px);
    right: var(--sc-space-3, 12px);
  }
}

.sc-lightbox-prev,
.sc-lightbox-next {
  top: 50%;
  transform: translateY(-50%);
}

.sc-lightbox-prev { left: -16px; }
.sc-lightbox-next { right: -16px; }

@media (max-width: 900px) {
  .sc-lightbox-prev { left: var(--sc-space-2, 8px); }
  .sc-lightbox-next { right: var(--sc-space-2, 8px); }
}

.sc-lightbox-counter {
  position: absolute;
  bottom: -34px;
  left: 50%;
  transform: translateX(-50%);
  color: #cbd5e1;
  font-size: 13px;
  letter-spacing: 0.02em;
}

@media (prefers-reduced-motion: reduce) {
  .sc-lightbox-overlay,
  .sc-lightbox-figure,
  .sc-lightbox-img,
  .sc-lightbox-zoom {
    transition: none;
  }
}
