/* =========================================================
   NVF Lightbox — Premium V4  (Kalium-inspired)
   ========================================================= */

/* lock scroll */
html.nvf-lightbox-open,
html.nvf-lightbox-open body { overflow: hidden; }

/* -------------------------------------------------------
   Root vars
   ------------------------------------------------------- */
:root {
  --nvf-lb-bg:        rgba(8, 8, 10, .96);
  --nvf-lb-pad:       24px;
  --nvf-lb-dur:       0.32s;
  --nvf-lb-ease:      cubic-bezier(.22, .61, .36, 1);
  --nvf-lb-btn:       44px;
  --nvf-lb-radius:    6px;
  --nvf-lb-strip-h:   82px;
  --nvf-lb-font:      system-ui, -apple-system, "Segoe UI", sans-serif;
  --nvf-lb-peek:      80px;
  --nvf-lb-slide-dur: 0.48s;
}

/* -------------------------------------------------------
   Container
   ------------------------------------------------------- */
.nvf-lightbox {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: none;
  font-family: var(--nvf-lb-font);
  -webkit-font-smoothing: antialiased;
}
.nvf-lightbox.is-open { display: block; }

/* -------------------------------------------------------
   Backdrop
   ------------------------------------------------------- */
.nvf-lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: var(--nvf-lb-bg);
  opacity: 0;
  transition: opacity var(--nvf-lb-dur) ease;
  cursor: zoom-out;
}
.nvf-lightbox.is-visible .nvf-lightbox__backdrop { opacity: 1; }

/* -------------------------------------------------------
   Inner
   ------------------------------------------------------- */
.nvf-lightbox__inner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px calc(var(--nvf-lb-pad) + var(--nvf-lb-peek) + 20px) 100px;
  opacity: 0;
  transform: scale(.96);
  transition: opacity var(--nvf-lb-dur) var(--nvf-lb-ease),
              transform var(--nvf-lb-dur) var(--nvf-lb-ease);
  will-change: opacity, transform;
}
.nvf-lightbox.is-visible .nvf-lightbox__inner {
  opacity: 1;
  transform: scale(1);
}

/* -------------------------------------------------------
   Stage
   ------------------------------------------------------- */
.nvf-lb-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.nvf-lightbox__img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--nvf-lb-radius);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .55);
  user-select: none;
  -webkit-user-drag: none;
  transition: transform var(--nvf-lb-slide-dur) var(--nvf-lb-ease),
              opacity var(--nvf-lb-slide-dur) var(--nvf-lb-ease);
  will-change: transform, opacity;
  cursor: zoom-in;
}

.nvf-lb-stage.is-slide-left  .nvf-lightbox__img { transform: translateX(-50px); opacity: 0; }
.nvf-lb-stage.is-slide-right .nvf-lightbox__img { transform: translateX(50px);  opacity: 0; }
.nvf-lb-stage.is-fading      .nvf-lightbox__img { opacity: 0; }

.nvf-lightbox__img.is-zoomed {
  cursor: grab;
  border-radius: 0;
  box-shadow: none;
  transition: none;
  transform-origin: center center;
  will-change: transform;
}
.nvf-lightbox__img.is-zoomed.is-dragging { cursor: grabbing; }

/* -------------------------------------------------------
   Side previews
   ------------------------------------------------------- */
.nvf-lb-peek {
  position: absolute;
  top: 0;
  bottom: 0;
  width: var(--nvf-lb-peek);
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
}
.nvf-lb-peek--prev { left: 0; }
.nvf-lb-peek--next { right: 0; }

.nvf-lb-peek__img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 55%;
  object-fit: cover;
  border-radius: var(--nvf-lb-radius);
  opacity: .22;
  filter: blur(1px) brightness(.65);
  transform: scale(.90);
  transition: opacity 0.3s ease, filter 0.3s ease, transform 0.3s ease;
  user-select: none;
  -webkit-user-drag: none;
}
.nvf-lb-peek--prev .nvf-lb-peek__img {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  margin-left: -18%;
}
.nvf-lb-peek--next .nvf-lb-peek__img {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  margin-right: -18%;
}

.nvf-lb-peek:hover .nvf-lb-peek__img {
  opacity: .38;
  filter: blur(0) brightness(.78);
  transform: scale(.94);
}

.nvf-lightbox[data-count="1"] .nvf-lb-peek,
.nvf-lightbox[data-count="1"] .nvf-lightbox__nav { display: none; }

/* -------------------------------------------------------
   Spinner
   ------------------------------------------------------- */
@keyframes nvf-lb-spin { to { transform: rotate(360deg); } }

.nvf-lb-spinner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 4;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s ease;
}
.nvf-lb-spinner svg { width: 36px; height: 36px; }
.nvf-lb-spinner__arc {
  transform-origin: center;
  animation: nvf-lb-spin 0.75s linear infinite;
}
.nvf-lightbox__inner.is-loading .nvf-lb-spinner { opacity: 1; }

/* -------------------------------------------------------
   Counter (top-left)
   ------------------------------------------------------- */
.nvf-lb-counter {
  position: fixed;
  top: 22px;
  left: 28px;
  z-index: 10;
  color: rgba(255, 255, 255, .5);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .1em;
  pointer-events: none;
  white-space: nowrap;
}

/* -------------------------------------------------------
   Caption (title + subtitle)
   ------------------------------------------------------- */
.nvf-lb-caption {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 6;
  text-align: center;
  padding: 20px 120px 24px;
  pointer-events: none;
  background: linear-gradient(to top, rgba(8,8,10,.55) 0%, transparent 100%);
  transition: transform 0.3s var(--nvf-lb-ease);
}
.nvf-lb-caption[hidden] { display: none; }

.nvf-lightbox:not([data-count="1"]) .nvf-lb-caption {
  bottom: var(--nvf-lb-strip-h);
  background: none;
}
.nvf-lightbox:not([data-count="1"]) .nvf-lb-caption.is-strip-hidden {
  bottom: 0;
  background: linear-gradient(to top, rgba(8,8,10,.55) 0%, transparent 100%);
}

.nvf-lb-caption__title {
  display: block;
  color: rgba(255, 255, 255, .92);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .02em;
  line-height: 1.3;
  margin: 0;
}
.nvf-lb-caption__subtitle {
  display: block;
  color: rgba(255, 255, 255, .48);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: .01em;
  line-height: 1.4;
  margin-top: 3px;
}
.nvf-lb-caption__subtitle:empty { display: none; }

/* -------------------------------------------------------
   Toolbar (top-right)
   ------------------------------------------------------- */
.nvf-lb-toolbar {
  position: fixed;
  top: 16px;
  right: 18px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 6px;
}

.nvf-lb-toolbar__btn {
  width: var(--nvf-lb-btn);
  height: var(--nvf-lb-btn);
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 50%;
  background: rgba(255, 255, 255, .06);
  color: rgba(255, 255, 255, .65);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background 0.2s ease,
              border-color 0.2s ease,
              color 0.2s ease,
              transform 0.2s ease;
  appearance: none;
  -webkit-appearance: none;
}
.nvf-lb-toolbar__btn:hover {
  background: rgba(255, 255, 255, .15);
  border-color: rgba(255, 255, 255, .3);
  color: #fff;
}
.nvf-lb-toolbar__btn:focus-visible {
  outline: 2px solid rgba(255, 255, 255, .6);
  outline-offset: 2px;
}
.nvf-lb-toolbar__btn svg { pointer-events: none; }
.nvf-lb-toolbar__btn--close:hover { transform: rotate(90deg); }

.nvf-lb-toolbar__btn.is-active {
  background: rgba(255, 255, 255, .2);
  border-color: rgba(255, 255, 255, .4);
  color: #fff;
}

/* Download + Share buttons — feedback flash */
.nvf-lb-toolbar__btn--download:active {
  transform: scale(0.9);
}
.nvf-lb-toolbar__btn--share {
  position: relative;
}
.nvf-lb-toolbar__btn--share.is-active {
  background: rgba(80, 200, 120, .25);
  border-color: rgba(80, 200, 120, .6);
  color: #fff;
}

/* "Copied!" tooltip */
.nvf-lb-tooltip {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: rgba(30, 30, 30, .92);
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .04em;
  padding: 5px 10px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s ease, transform .2s ease;
}
.nvf-lb-tooltip::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-bottom-color: rgba(30, 30, 30, .92);
}
.nvf-lb-tooltip.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* -------------------------------------------------------
   Navigation arrows
   ------------------------------------------------------- */
.nvf-lightbox__nav {
  position: fixed;
  z-index: 8;
  top: 50%;
  margin-top: -24px;
  width: 48px;
  height: 48px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: rgba(255, 255, 255, .55);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease, transform 0.2s ease, background 0.2s ease;
  appearance: none;
  -webkit-appearance: none;
}
.nvf-lightbox__nav:hover {
  color: #fff;
  background: rgba(255, 255, 255, .08);
}
.nvf-lightbox__nav:focus-visible {
  outline: 2px solid rgba(255, 255, 255, .6);
  outline-offset: 2px;
}
.nvf-lightbox__prev { left: calc(var(--nvf-lb-peek) + 8px); }
.nvf-lightbox__next { right: calc(var(--nvf-lb-peek) + 8px); }
.nvf-lightbox__prev:hover { transform: translateX(-3px); }
.nvf-lightbox__next:hover { transform: translateX(3px); }
.nvf-lightbox__nav svg { pointer-events: none; }

/* -------------------------------------------------------
   Thumbnail strip
   ------------------------------------------------------- */
.nvf-lb-strip {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 7;
  display: flex;
  gap: 6px;
  padding: 12px 24px 14px;
  justify-content: center;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  box-sizing: border-box;
  background: linear-gradient(to top, rgba(8, 8, 10, .65) 0%, transparent 100%);
  transform: translateY(0);
  transition: transform 0.3s var(--nvf-lb-ease), opacity 0.3s ease;
}
.nvf-lb-strip::-webkit-scrollbar { display: none; }
.nvf-lb-strip[hidden] { display: none; }

.nvf-lb-strip.is-hidden {
  transform: translateY(100%);
  opacity: 0;
  pointer-events: none;
}

.nvf-lb-strip__thumb {
  flex-shrink: 0;
  width: 56px;
  height: 42px;
  border-radius: 4px;
  border: 2px solid transparent;
  background-color: rgba(255, 255, 255, .1);
  background-size: cover;
  background-position: center;
  cursor: pointer;
  padding: 0;
  opacity: .42;
  transition: opacity .22s ease,
              border-color .22s ease,
              transform .22s ease,
              box-shadow .22s ease;
  appearance: none;
  -webkit-appearance: none;
}
.nvf-lb-strip__thumb:hover {
  opacity: .78;
  transform: translateY(-2px);
}
.nvf-lb-strip__thumb.is-active {
  border-color: #fff;
  opacity: 1;
  transform: translateY(-3px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .45);
}

.nvf-lightbox:not([data-count="1"]) .nvf-lightbox__inner {
  padding-bottom: calc(var(--nvf-lb-strip-h) + 10px);
}

/* -------------------------------------------------------
   Mobile
   ------------------------------------------------------- */
@media (max-width: 768px) {
  :root {
    --nvf-lb-peek: 0px;
    --nvf-lb-pad:  12px;
    --nvf-lb-btn:  38px;
    --nvf-lb-strip-h: 66px;
  }
  .nvf-lb-peek { display: none; }
  .nvf-lightbox__inner { padding: 54px 12px 80px; }
  .nvf-lightbox__prev { left: 8px; }
  .nvf-lightbox__next { right: 8px; }
  .nvf-lb-counter { top: 16px; left: 16px; font-size: 12px; }
  .nvf-lb-toolbar { top: 10px; right: 10px; gap: 4px; }
  .nvf-lb-toolbar__btn { width: 38px; height: 38px; }
  .nvf-lb-toolbar__btn--zoom,
  .nvf-lb-toolbar__btn--fullscreen { display: none; }
  .nvf-lb-caption { padding: 12px 60px 16px; }
  .nvf-lb-caption__title { font-size: 14px; }
  .nvf-lb-caption__subtitle { font-size: 12px; }
  .nvf-lb-strip__thumb { width: 44px; height: 33px; }
  .nvf-lightbox__nav { width: 42px; height: 42px; }
}

@media (max-width: 480px) {
  .nvf-lightbox__inner { padding-top: 48px; }
  .nvf-lb-toolbar__btn--grid { display: none; }
  .nvf-lb-strip__thumb { width: 38px; height: 28px; }
}

/* -------------------------------------------------------
   Reduced motion
   ------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .nvf-lightbox__backdrop,
  .nvf-lightbox__inner,
  .nvf-lightbox__img,
  .nvf-lightbox__nav,
  .nvf-lb-toolbar__btn,
  .nvf-lb-stage,
  .nvf-lb-strip,
  .nvf-lb-peek__img {
    transition: none !important;
    animation: none !important;
  }
}
