html {
  scrollbar-gutter: stable;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  background: rgba(var(--navy-deep-rgb), 0.88);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  animation: lightbox-auf 0.2s ease-out;
}

.lightbox.active {
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
  align-items: center;
  justify-content: center;
  padding: 5rem 5rem 2.5rem;
}

.lightbox-content {
  width: auto;
  max-width: min(90vw, 1100px);
  height: auto;
  max-height: 74vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 24px 60px -20px rgba(var(--black-rgb), 0.8);
  animation: lightbox-bild 0.22s ease-out;
}

.lightbox-caption {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  align-items: center;
  max-width: min(90vw, 620px);
  font-family: 'Montserrat', Helvetica, Arial, sans-serif;
  text-align: center;
}

.lightbox-name {
  font-size: var(--font-lg);
  font-weight: bold;
  line-height: 1.3;
  color: var(--white);
}

.lightbox-role {
  font-size: var(--font-sm);
  line-height: 1.4;
  color: var(--cream);
}

.lightbox-counter {
  margin-top: 0.5rem;
  font-size: var(--font-xs);
  color: rgba(var(--grey-light-rgb), 0.55);
  letter-spacing: 0.12em;
}

.lightbox-btn {
  position: absolute;
  z-index: 1001;
  gap: 0;
  width: 3rem;
  height: 3rem;
  padding: 0;
  color: var(--grey-light);
  background: rgba(var(--navy-deep-rgb), 0.55);
  box-shadow: inset 0 0 0 1px rgba(var(--grey-light-rgb), 0.35);
}

.lightbox-btn i {
  font-size: 1.15rem;
  line-height: 1;
}

.lightbox-btn:not(:disabled):hover {
  color: var(--white);
  background: var(--copper);
  box-shadow: inset 0 0 0 1px rgba(var(--white-rgb), 0.6);
}

.lightbox-btn:not(:disabled):active {
  background: var(--copper-dark);
}

.lightbox-btn:not(:disabled):focus-visible {
  outline: 2px solid transparent;
  box-shadow:
    inset 0 0 0 1px rgba(var(--white-rgb), 0.6),
    0 0 0 2px var(--cream),
    0 0 0 6px rgba(var(--cream-rgb), 0.22);
}

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

.lightbox-close {
  top: 1.25rem;
  right: 1.25rem;
}

.lightbox-prev {
  top: 50%;
  left: 1.25rem;
  transform: translateY(-50%);
}

.lightbox-next {
  top: 50%;
  right: 1.25rem;
  transform: translateY(-50%);
}

@keyframes lightbox-auf {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes lightbox-bild {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (max-height: 500px) {
  .lightbox.active {
    gap: 0.6rem;
    padding: 1rem 4.5rem;
  }

  .lightbox-content {
    max-height: calc(100dvh - 7rem);
  }

  .lightbox-close {
    top: 0.75rem;
    right: 0.75rem;
  }
}

@media (max-width: 768px) {
  .lightbox.active {
    gap: 1.1rem;
    padding: 4.5rem 1rem 6rem;
  }

  .lightbox-content {
    max-width: 92vw;
    max-height: 62vh;
  }

  .lightbox-prev,
  .lightbox-next {
    top: auto;
    bottom: 1.25rem;
    transform: none;
  }

  .lightbox-prev {
    left: calc(50% - 3.35rem);
  }

  .lightbox-next {
    right: calc(50% - 3.35rem);
  }

  .lightbox-close {
    top: 1rem;
    right: 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lightbox,
  .lightbox-content {
    animation: none;
  }
}
