/* NFN Dark Lightbox
   Built for Imagely/NextGEN galleries and standard WordPress image galleries. */
:root {
  --nfn-lightbox-bg: rgba(0, 0, 0, 0.92);
  --nfn-lightbox-panel: rgba(6, 6, 8, 0.86);
  --nfn-lightbox-border: rgba(146, 36, 219, 0.34);
  --nfn-lightbox-purple: #8f25db;
  --nfn-lightbox-purple-soft: #b96aff;
  --nfn-lightbox-text: #ffffff;
  --nfn-lightbox-muted: rgba(255, 255, 255, 0.68);
}

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

.nfn-lightbox {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: none;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 18% 15%, rgba(143, 37, 219, 0.09), transparent 30%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.94), var(--nfn-lightbox-bg));
  color: var(--nfn-lightbox-text);
  opacity: 0;
  transition: opacity 180ms ease;
}

.nfn-lightbox.is-open {
  display: flex;
  opacity: 1;
}

.nfn-lightbox::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(143, 37, 219, 0.07), transparent 22%, transparent 78%, rgba(143, 37, 219, 0.05)),
    radial-gradient(circle at 82% 18%, rgba(143, 37, 219, 0.08), transparent 24%);
}

.nfn-lightbox-stage {
  position: relative;
  z-index: 1;
  width: min(94vw, 1500px);
  height: min(88vh, 960px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 14px;
}

.nfn-lightbox-top,
.nfn-lightbox-bottom {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  min-height: 42px;
  padding: 0 4px;
}

.nfn-lightbox-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: "Barlow Condensed", Impact, sans-serif;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--nfn-lightbox-text);
}

.nfn-lightbox-brand::before {
  content: "NFN";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 28px;
  border: 1px solid var(--nfn-lightbox-border);
  color: #fff;
  background: linear-gradient(135deg, rgba(143, 37, 219, 0.34), rgba(255, 255, 255, 0.04));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.nfn-lightbox-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  min-width: 0;
  color: var(--nfn-lightbox-muted);
  font-family: "Inter", system-ui, sans-serif;
  font-size: 13px;
  line-height: 1.35;
}

.nfn-lightbox-caption-small {
  overflow: hidden;
  max-width: min(50vw, 720px);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nfn-lightbox-counter {
  color: var(--nfn-lightbox-purple-soft);
  font-family: "Barlow Condensed", Impact, sans-serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  white-space: nowrap;
}

.nfn-lightbox-frame {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background:
    linear-gradient(135deg, rgba(143, 37, 219, 0.06), transparent 24%),
    rgba(0, 0, 0, 0.34);
  box-shadow: 0 26px 90px rgba(0, 0, 0, 0.56);
  overflow: hidden;
}

.nfn-lightbox-img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  opacity: 0;
  transform: scale(0.985);
  transition: opacity 160ms ease, transform 160ms ease;
  user-select: none;
}

.nfn-lightbox-img.is-loaded {
  opacity: 1;
  transform: scale(1);
}

.nfn-lightbox-loader {
  position: absolute;
  width: 44px;
  height: 44px;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-top-color: var(--nfn-lightbox-purple-soft);
  border-radius: 50%;
  animation: nfn-lightbox-spin 850ms linear infinite;
}

.nfn-lightbox-img.is-loaded + .nfn-lightbox-loader {
  display: none;
}

@keyframes nfn-lightbox-spin {
  to { transform: rotate(360deg); }
}

.nfn-lightbox-btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(12, 10, 16, 0.72);
  color: #fff;
  cursor: pointer;
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease, transform 160ms ease;
}

.nfn-lightbox-btn:hover,
.nfn-lightbox-btn:focus-visible {
  border-color: var(--nfn-lightbox-purple-soft);
  color: var(--nfn-lightbox-purple-soft);
  background: rgba(143, 37, 219, 0.16);
  outline: none;
}

.nfn-lightbox-close {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 28px;
  line-height: 1;
}

.nfn-lightbox-arrow {
  position: absolute;
  top: 50%;
  z-index: 3;
  width: 54px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-family: "Barlow Condensed", Impact, sans-serif;
  font-size: 42px;
  line-height: 1;
  transform: translateY(-50%);
}

.nfn-lightbox-arrow:hover,
.nfn-lightbox-arrow:focus-visible {
  transform: translateY(-50%) scale(1.04);
}

.nfn-lightbox-prev { left: 18px; }
.nfn-lightbox-next { right: 18px; }

.nfn-lightbox-bottom {
  justify-content: center;
  color: var(--nfn-lightbox-muted);
  font-family: "Inter", system-ui, sans-serif;
  font-size: 13px;
  text-align: center;
}

.nfn-lightbox-caption {
  max-width: min(860px, 88vw);
  font-family: "Barlow Condensed", Impact, sans-serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.76);
}

.nfn-lightbox-caption:empty {
  display: none;
}

@media (max-width: 760px) {
  .nfn-lightbox-stage {
    width: 100vw;
    height: 100vh;
    padding: 14px;
    gap: 10px;
  }
  .nfn-lightbox-top {
    align-items: flex-start;
  }
  .nfn-lightbox-brand span {
    display: none;
  }
  .nfn-lightbox-meta {
    margin-left: auto;
    font-size: 12px;
  }
  .nfn-lightbox-caption-small {
    display: none;
  }
  .nfn-lightbox-frame {
    border-left: 0;
    border-right: 0;
  }
  .nfn-lightbox-arrow {
    width: 46px;
    height: 46px;
    font-size: 36px;
    background: rgba(0, 0, 0, 0.56);
  }
  .nfn-lightbox-prev { left: 10px; }
  .nfn-lightbox-next { right: 10px; }
}


/* NFN v7.38 lightbox polish: cleaner brand and centered SVG controls */
.nfn-lightbox-brand {
  gap: 0;
}

.nfn-lightbox-brand::before {
  content: none !important;
  display: none !important;
}

.nfn-lightbox-brand span {
  display: inline-block;
  padding: 0;
  color: #fff;
  line-height: 1;
}

.nfn-lightbox-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 0;
}

.nfn-lightbox-btn svg {
  display: block;
  width: 22px;
  height: 22px;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  pointer-events: none;
}

.nfn-lightbox-close {
  font-size: 0;
}

.nfn-lightbox-close svg {
  width: 20px;
  height: 20px;
}

.nfn-lightbox-arrow {
  font-size: 0;
}

.nfn-lightbox-arrow svg {
  width: 25px;
  height: 25px;
}

@media (max-width: 760px) {
  .nfn-lightbox-brand span {
    display: inline-block;
  }
  .nfn-lightbox-arrow svg {
    width: 23px;
    height: 23px;
  }
}

/* NFN v7.83 Lightbox cleanup: lighter outside edges, dark photo stage, always-visible mobile close */
:root {
  --nfn-lightbox-bg: rgba(10, 8, 13, 0.86);
}
.nfn-lightbox {
  background:
    radial-gradient(circle at 50% 50%, rgba(0,0,0,.92) 0%, rgba(0,0,0,.88) 42%, rgba(20,16,24,.78) 100%),
    radial-gradient(circle at 14% 10%, rgba(143,37,219,.12), transparent 34%);
}
.nfn-lightbox::before {
  content: 'NFN';
  display: block;
  inset: auto -5vw -8vh auto;
  width: auto;
  height: auto;
  font-family: "Barlow Condensed", Impact, sans-serif;
  font-size: min(34vw, 420px);
  font-weight: 900;
  letter-spacing: .06em;
  line-height: .8;
  color: rgba(185,122,232,.055);
  background: none;
  transform: rotate(-3deg);
}
.nfn-lightbox-brand span {
  font-family: "Barlow Condensed", Impact, sans-serif;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: .18em;
  color: rgba(255,255,255,.72);
}
.nfn-lightbox-brand span::after {
  content: '';
  display: block;
  width: 52px;
  height: 2px;
  margin-top: 7px;
  background: rgba(143,37,219,.8);
}
.nfn-lightbox-frame {
  background: rgba(0,0,0,.70);
  border-color: rgba(255,255,255,.12);
  box-shadow: 0 30px 90px rgba(0,0,0,.55), 0 0 0 1px rgba(143,37,219,.08);
}
.nfn-lightbox-top {
  position: relative;
  z-index: 5;
}
.nfn-lightbox-close {
  position: relative;
  z-index: 10;
}

@media (max-width: 760px) {
  .nfn-lightbox {
    align-items: center;
    justify-content: center;
    background:
      radial-gradient(circle at 50% 50%, rgba(0,0,0,.90) 0%, rgba(0,0,0,.86) 48%, rgba(27,22,32,.78) 100%);
  }
  .nfn-lightbox-stage {
    width: 100vw;
    height: 100dvh;
    padding: 72px 0 70px;
    gap: 0;
  }
  .nfn-lightbox-top {
    position: fixed;
    top: max(12px, env(safe-area-inset-top));
    left: 14px;
    right: 14px;
    min-height: 46px;
    padding: 0;
    pointer-events: none;
  }
  .nfn-lightbox-brand span {
    display: inline-block !important;
    opacity: .42;
  }
  .nfn-lightbox-meta {
    pointer-events: auto;
  }
  .nfn-lightbox-close {
    position: fixed;
    top: max(14px, env(safe-area-inset-top));
    right: 14px;
    width: 46px;
    height: 46px;
    background: rgba(12,10,16,.86);
    border-color: rgba(255,255,255,.26);
    box-shadow: 0 8px 30px rgba(0,0,0,.35);
  }
  .nfn-lightbox-counter {
    margin-right: 58px;
  }
  .nfn-lightbox-frame {
    height: 100%;
    border: 0;
    background: rgba(0,0,0,.62);
    box-shadow: none;
  }
  .nfn-lightbox-img {
    max-width: 100vw;
    max-height: calc(100dvh - 150px);
  }
  .nfn-lightbox-bottom {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: max(12px, env(safe-area-inset-bottom));
    min-height: 30px;
    pointer-events: none;
  }
}

/* NFN v7.84 Lightbox mobile center polish */
@media (max-width: 760px) {
  .nfn-lightbox {
    background:
      radial-gradient(circle at 50% 48%, rgba(0,0,0,.84) 0%, rgba(0,0,0,.80) 48%, rgba(34,34,38,.72) 100%) !important;
  }
  .nfn-lightbox-stage {
    height: 100dvh !important;
    width: 100vw !important;
    padding: max(64px, env(safe-area-inset-top) + 48px) 0 max(78px, env(safe-area-inset-bottom) + 58px) !important;
    display: grid !important;
    grid-template-rows: 1fr !important;
    align-items: center !important;
    justify-items: center !important;
  }
  .nfn-lightbox-frame {
    width: 100vw !important;
    height: auto !important;
    max-height: calc(100dvh - 170px) !important;
    min-height: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: rgba(0,0,0,.72) !important;
  }
  .nfn-lightbox-img {
    max-width: 100vw !important;
    max-height: calc(100dvh - 170px) !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
  }
  .nfn-lightbox-top {
    z-index: 20 !important;
  }
  .nfn-lightbox-close {
    z-index: 30 !important;
  }
}


/* NFN v7.85 mobile lightbox center fix */
@media (max-width: 760px) {
  .nfn-lightbox {
    align-items: center !important;
    justify-content: center !important;
  }
  .nfn-lightbox-stage {
    position: relative !important;
    width: 100vw !important;
    height: 100dvh !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  .nfn-lightbox-frame {
    position: relative !important;
    width: 100vw !important;
    max-width: 100vw !important;
    height: auto !important;
    max-height: 72dvh !important;
    min-height: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: rgba(0,0,0,.68) !important;
  }
  .nfn-lightbox-img {
    max-width: 100vw !important;
    max-height: 72dvh !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
  }
  .nfn-lightbox-bottom {
    bottom: max(12px, env(safe-area-inset-bottom)) !important;
  }
}
