/**
 * HolDent — Lightbox modal styles.
 *
 * Z-index: deve stare sopra navbar (1000), sotto admin-bar (99999).
 */

.holdent-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: grid;
  grid-template-areas:
    'close   close   close'
    'prev    image   next'
    'counter counter counter';
  grid-template-rows: auto 1fr auto;
  grid-template-columns: 64px 1fr 64px;
  background: rgba(0, 0, 0, 0.92);
  align-items: center;
  justify-items: center;
  animation: holdent-lightbox-fade 200ms ease;
}

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

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

body.holdent-lightbox-open {
  overflow: hidden;
}

.holdent-lightbox__backdrop {
  position: absolute;
  inset: 0;
  cursor: zoom-out;
  z-index: 0;
}

.holdent-lightbox__close {
  grid-area: close;
  justify-self: end;
  margin: 16px 16px 0;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 0;
  appearance: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: background 200ms ease;
}

.holdent-lightbox__close:hover,
.holdent-lightbox__close:focus-visible {
  background: rgba(255, 255, 255, 0.24);
  outline: none;
}

.holdent-lightbox__nav {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 0;
  appearance: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: background 200ms ease, transform 200ms ease;
}

.holdent-lightbox__nav:hover,
.holdent-lightbox__nav:focus-visible {
  background: rgba(255, 255, 255, 0.24);
  outline: none;
}

.holdent-lightbox__nav--prev { grid-area: prev; }
.holdent-lightbox__nav--next { grid-area: next; }

.holdent-lightbox__figure {
  grid-area: image;
  margin: 0;
  padding: 0;
  max-width: min(1200px, 92vw);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 1;
}

.holdent-lightbox__image {
  max-width: 100%;
  max-height: 70vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--radius-md, 8px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.holdent-lightbox__caption {
  color: rgba(255, 255, 255, 0.86);
  font-size: 15px;
  line-height: 1.5;
  text-align: center;
  max-width: 56ch;
  margin: 0;
}

.holdent-lightbox__counter {
  grid-area: counter;
  margin: 0 0 16px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
  letter-spacing: 0.1em;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 600px) {
  .holdent-lightbox {
    grid-template-columns: 48px 1fr 48px;
  }
  .holdent-lightbox__nav {
    width: 44px;
    height: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .holdent-lightbox {
    animation: none;
  }
  .holdent-lightbox__close,
  .holdent-lightbox__nav {
    transition: none;
  }
}
