/* ===================================================================
   NICO MEGA — Lightbox de galería
   Usa los mismos tokens que css/style.css (:root) para sentirse
   nativo del sitio: --ink, --paper-2, --accent, --f-mono, --ease.
   No depende de ninguna librería externa.
   =================================================================== */

/* Bloqueo de scroll sin salto, mientras el lightbox está abierto */
html.lightbox-lock{ overflow: hidden; }
html.lightbox-lock body{ position: fixed; left: 0; right: 0; overflow: hidden; }

.lightbox{
  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(16px, 5vw, 64px);
  background: rgba(10, 10, 11, 0);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity .3s var(--ease),
    background .3s var(--ease),
    visibility 0s linear .3s;
}
.lightbox.is-open{
  opacity: 1;
  visibility: visible;
  background: rgba(10, 10, 11, .92);
  transition:
    opacity .3s var(--ease),
    background .3s var(--ease),
    visibility 0s linear 0s;
}
@supports (backdrop-filter: blur(1px)){
  .lightbox.is-open{ backdrop-filter: blur(7px); }
}

.lightbox__figure{
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: min(1400px, 94vw);
  max-height: 90vh;
  transform: scale(.94);
  opacity: 0;
  transition: transform .32s var(--ease), opacity .32s var(--ease);
}
.lightbox.is-open .lightbox__figure{
  transform: scale(1);
  opacity: 1;
  transition-delay: .04s;
}

.lightbox__img{
  display: block;
  max-width: 100%;
  max-height: 78vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 3px;
  background: var(--ink);
  box-shadow: 0 30px 80px rgba(0,0,0,.5), 0 10px 26px rgba(0,0,0,.35);
  transition: opacity .25s var(--ease);
}

.lightbox__caption{
  margin: 16px 0 0;
  max-width: 60ch;
  text-align: center;
  font-family: var(--f-body);
  font-size: 14px;
  line-height: 1.5;
  color: var(--paper);
  opacity: .82;
}

.lightbox__counter{
  margin: 10px 0 0;
  font-family: var(--f-mono);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: .1em;
  color: var(--accent);
}

/* -------------------------------------------------- controles */
.lightbox__close,
.lightbox__prev,
.lightbox__next{
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(251, 248, 242, .06);
  border: 1px solid rgba(251, 248, 242, .16);
  color: var(--paper);
  cursor: pointer;
  transition: background .25s var(--ease), border-color .25s var(--ease), transform .25s var(--ease);
}
.lightbox__close:hover,
.lightbox__prev:hover,
.lightbox__next:hover{
  background: rgba(251, 248, 242, .14);
  border-color: rgba(251, 248, 242, .32);
}
.lightbox__close:active,
.lightbox__prev:active,
.lightbox__next:active{ transform: scale(.92); }

.lightbox__close{
  top: clamp(14px, 3vw, 28px);
  right: clamp(14px, 3vw, 28px);
  z-index: 2;
  font-family: var(--f-body);
  font-size: 22px;
  line-height: 1;
}

.lightbox__prev,
.lightbox__next{
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
}
.lightbox__prev{ left: clamp(8px, 2.4vw, 28px); }
.lightbox__next{ right: clamp(8px, 2.4vw, 28px); }
.lightbox__prev .mark--arrow{ transform: scaleX(-1); display: block; }
.lightbox__prev:hover .mark--arrow{ transform: scaleX(-1) translateX(-2px); }
.lightbox__next:hover .mark--arrow{ transform: translateX(2px); }

.lightbox__prev[hidden],
.lightbox__next[hidden]{ display: none; }

@media (max-width: 640px){
  .lightbox__prev,
  .lightbox__next{ width: 38px; height: 38px; }
  .lightbox__prev{ left: 8px; }
  .lightbox__next{ right: 8px; }
  .lightbox__close{ top: 12px; right: 12px; width: 38px; height: 38px; }
  .lightbox__img{ max-height: 72vh; }
}

@media (prefers-reduced-motion: reduce){
  .lightbox,
  .lightbox__figure{ transition: opacity .15s linear !important; }
  .lightbox__figure{ transform: none !important; }
}

/* -------------------------------------------------- pistas visuales
   en las imágenes que abren el lightbox (cursor + leve realce) */
.js-lightbox-img{ cursor: zoom-in; }
.project-gallery__item:has(> .js-lightbox-img) img{
  transition: transform .5s var(--ease), filter .5s var(--ease);
}
.project-gallery__item:has(> .js-lightbox-img):hover img{
  transform: scale(1.035);
}
