/* ── Photo lightbox ── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 3vw, 1.5rem);
  padding-bottom: calc(clamp(1rem, 3vw, 1.5rem) + env(safe-area-inset-bottom, 0));
}

.lightbox[hidden] {
  display: none;
}

.lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(49, 27, 20, 0.92);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.lightbox__panel {
  position: relative;
  z-index: 1;
  width: min(100%, 56rem);
  max-height: calc(100vh - 2rem);
  animation: lightbox-in 280ms cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes lightbox-in {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(8px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.lightbox__figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--atamer-espresso);
}

.lightbox__img {
  display: block;
  width: 100%;
  max-height: calc(100vh - 8rem);
  object-fit: contain;
  background: var(--atamer-espresso);
}

.lightbox__caption {
  padding: 0.875rem 1rem;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.82);
  background: var(--atamer-espresso);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.lightbox__close {
  position: absolute;
  top: -2.75rem;
  right: 0;
  z-index: 2;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.375rem;
  line-height: 1;
  color: var(--atamer-cream);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}

.lightbox__close:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.32);
}

.lightbox__nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  width: 2.5rem;
  height: 2.5rem;
  margin-top: -1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  color: var(--atamer-cream);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}

.lightbox__nav:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: var(--atamer-warm);
}

.lightbox__nav--prev {
  left: -0.5rem;
}

.lightbox__nav--next {
  right: -0.5rem;
}

@media (max-width: 767px) {
  .lightbox {
    padding: 0.75rem;
    padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0));
  }

  .lightbox__panel {
    width: 100%;
  }

  .lightbox__img {
    max-height: calc(100vh - 10rem);
  }

  .lightbox__nav--prev {
    left: 0.25rem;
  }

  .lightbox__nav--next {
    right: 0.25rem;
  }

  .lightbox__close {
    top: 0.25rem;
    right: 0.25rem;
    background: rgba(49, 27, 20, 0.65);
  }
}

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