/* Race page lightbox shell.
   Preview strip styles live in preview-controls.css; arrow chrome lives in arrow-controls.css. */

.lightbox {
  --lightbox-nav-offset: clamp(14px, 3vw, 44px);
  display: none;
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-width: 100vw;
  max-height: 100dvh;
  align-items: center;
  justify-content: center;
  z-index: var(--z-lightbox);
  background: rgba(4, 4, 8, 0.96);
  overflow: hidden;
  cursor: zoom-out;
}

.lightbox.is-open {
  display: flex;
}

.lightbox__img-wrap {
  position: relative;
  margin: auto;
  max-width: 95vw;
  max-height: 95vh;
  cursor: default;
}

.lightbox__img-wrap img {
  max-width: 95vw;
  max-height: 95vh;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: block;
  transition: transform 0.3s ease;
  transform-origin: center center;
  cursor: zoom-in;
  user-select: none;
  -webkit-user-drag: none;
  touch-action: none;
}

.lightbox__img-wrap.is-zoomed img {
  cursor: grab;
}

.lightbox__img-wrap.is-panning img {
  cursor: grabbing;
  transition: none;
}

/* Centered X strokes for the lightbox close control. */
.lightbox__close {
  --lightbox-close-size: 30px;
  --lightbox-close-offset: 10px;
  --lightbox-close-stroke-width: 15px;
  --lightbox-close-stroke-height: 2px;
  position: absolute;
  top: var(--lightbox-close-offset);
  right: var(--lightbox-close-offset);
  z-index: var(--z-lightbox-control);
  display: block;
  width: var(--lightbox-close-size);
  height: var(--lightbox-close-size);
  min-width: var(--lightbox-close-size);
  min-height: var(--lightbox-close-size);
  padding: 0;
  border: 1px solid rgba(238, 229, 211, 0.14);
  border-radius: 50%;
  background: rgba(5, 6, 12, 0.22);
  color: rgba(238, 229, 211, 0.58);
  font-size: 0;
  line-height: 0;
  opacity: 0.58;
  text-align: center;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.14);
  cursor: pointer;
  font-family: var(--font-heading);
  transition: opacity 0.18s;
}

.lightbox__close::before,
.lightbox__close::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--lightbox-close-stroke-width);
  height: var(--lightbox-close-stroke-height);
  border-radius: 999px;
  background: currentColor;
  transform-origin: center center;
  pointer-events: none;
}

.lightbox__close::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.lightbox__close::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.lightbox__close:is(:hover, :focus-visible) {
  opacity: 0.92;
  color: rgba(255, 249, 236, 0.90);
  border-color: rgba(238, 229, 211, 0.34);
  background: rgba(5, 6, 12, 0.44);
  outline: none;
}

@media (max-width: 760px) {
  .lightbox__close {
    --lightbox-close-size: 28px;
    --lightbox-close-offset: 8px;
    --lightbox-close-stroke-width: 14px;
  }
}

.lightbox__nav {
  --lightbox-nav-size: 58px;
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: var(--z-lightbox-nav);
  width: var(--lightbox-nav-size);
  height: var(--lightbox-nav-size);
  color: var(--sftl-arrow-color);
  transition: background 0.2s ease, border-color 0.2s ease, opacity 0.2s ease, transform 0.2s ease;
}

.lightbox__nav:disabled {
  display: none;
}

.lightbox__nav--prev {
  left: var(--lightbox-nav-offset);
}

.lightbox__nav--next {
  right: var(--lightbox-nav-offset);
}

@media (max-width: 820px) {
  .lightbox__nav {
    --lightbox-nav-size: 46px;
  }
}
