/* ==========================================================================
   TEAMFILMER STUDIOS — FULLSCREEN PORTFOLIO LIGHTBOX (/css/portfolio-lightbox.css)
   Architecture:
   LIGHTBOX
   ├── Dark translucent overlay (underlying masonry gallery remains visible)
   ├── Top toolbar (Counter 5 / 24 on left, Zoom / Fullscreen / Admin Delete / Close on right)
   ├── Previous button (← vertically centered left)
   ├── Image viewport (centered active image, object-fit: contain, natural aspect ratio)
   ├── Next button (→ vertically centered right)
   └── Fixed bottom thumbnail strip (horizontally scrollable, natural aspect ratios, active tracking)
   ========================================================================== */

.tf-portfolio-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  /* Keep underlying masonry gallery visible behind darkened translucent overlay (Section 1 & 21) */
  background-color: rgba(8, 8, 11, 0.82);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: none;
  flex-direction: column;
  justify-content: space-between;
  user-select: none;
  overflow: hidden;
}

.tf-portfolio-lightbox.open {
  display: flex;
}

/* ==========================================================================
   TOP TOOLBAR (Counter on Left + Controls on Right)
   ========================================================================== */
.tf-lightbox-topbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  padding: 0 1.25rem;
  background: linear-gradient(to bottom, rgba(8, 8, 11, 0.88), rgba(8, 8, 11, 0.45));
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 10;
}

.tf-lightbox-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.tf-lightbox-counter {
  font-family: var(--font-sans, 'Manrope', sans-serif);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: #F5F3EF;
  font-size: 0.92rem;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.tf-lightbox-meta-sep {
  color: rgba(255, 255, 255, 0.28);
}

.tf-lightbox-category {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #D4AF37;
  white-space: nowrap;
}

.tf-lightbox-caption-inline {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.72);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 42vw;
}

.tf-lightbox-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.tf-lightbox-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-width: 38px;
  height: 36px;
  padding: 0 0.7rem;
  border-radius: 6px;
  background-color: rgba(20, 20, 25, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.tf-lightbox-btn:hover {
  background-color: rgba(212, 175, 55, 0.2);
  border-color: #D4AF37;
  color: #D4AF37;
}

.tf-lightbox-btn:focus-visible {
  outline: 2px solid #D4AF37;
  outline-offset: 2px;
}

.tf-lightbox-btn.close-btn {
  font-size: 1.05rem;
  padding: 0 0.75rem;
  background-color: rgba(255, 255, 255, 0.1);
}

.tf-lightbox-btn.danger {
  background-color: rgba(220, 38, 38, 0.22);
  border-color: rgba(248, 113, 113, 0.45);
  color: #FCA5A5;
}

.tf-lightbox-btn.danger:hover {
  background-color: #DC2626;
  border-color: #DC2626;
  color: #FFFFFF;
}

/* ==========================================================================
   MAIN IMAGE VIEWPORT & PREVIOUS / NEXT ARROWS
   ========================================================================== */
.tf-lightbox-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 1rem 4.75rem;
}

.tf-lightbox-figure {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.tf-lightbox-img {
  pointer-events: auto;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  border-radius: 2px;
  box-shadow: 0 22px 64px rgba(0, 0, 0, 0.75);
  --tf-lb-zoom: 1;
  --tf-lb-enter-scale: 1;
  opacity: 1;
  transform: scale(calc(var(--tf-lb-zoom, 1) * var(--tf-lb-enter-scale, 1)));
  transition:
    opacity 190ms cubic-bezier(0.16, 1, 0.3, 1),
    transform 190ms cubic-bezier(0.16, 1, 0.3, 1);
  cursor: grab;
}

.tf-lightbox-img.is-switching {
  opacity: 0.18;
  --tf-lb-enter-scale: 0.985;
}

/* Left & Right Navigation Arrows (Vertically Centered) */
.tf-lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 999px;
  background-color: rgba(14, 14, 18, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #FFFFFF;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  z-index: 12;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.tf-lightbox-nav:hover {
  background-color: #D4AF37;
  border-color: #D4AF37;
  color: #0B0B0D;
  transform: translateY(-50%) scale(1.05);
}

.tf-lightbox-nav:focus-visible {
  outline: 2px solid #D4AF37;
  outline-offset: 2px;
}

.tf-lightbox-nav.prev {
  left: 1.25rem;
}

.tf-lightbox-nav.next {
  right: 1.25rem;
}

/* ==========================================================================
   BOTTOM THUMBNAIL STRIP (Sections 6, 7, 8, 9, 10, 16)
   Fixed bar at bottom of lightbox with horizontal scrolling & active state
   ========================================================================== */
.tf-lightbox-footer {
  flex-shrink: 0;
  width: 100%;
  background: rgba(10, 10, 13, 0.92);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.6rem 1rem 0.7rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.tf-lightbox-thumbs {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 8px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(212, 175, 55, 0.45) rgba(255, 255, 255, 0.06);
}

.tf-lightbox-thumbs::-webkit-scrollbar {
  height: 4px;
}

.tf-lightbox-thumbs::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}

.tf-lightbox-thumbs::-webkit-scrollbar-thumb {
  background: rgba(212, 175, 55, 0.45);
  border-radius: 4px;
}

/* Individual Thumbnail Button — Preserves Natural Aspect Ratio */
.tf-lb-thumb {
  position: relative;
  height: 54px;
  width: auto;
  min-width: 38px;
  max-width: 108px;
  border-radius: 3px;
  overflow: hidden;
  flex: 0 0 auto;
  opacity: 0.44;
  border: 2px solid rgba(255, 255, 255, 0.12);
  padding: 0;
  margin: 0;
  background-color: #16161B;
  cursor: pointer;
  transition:
    opacity 160ms ease,
    border-color 160ms ease,
    transform 160ms ease,
    box-shadow 160ms ease;
}

.tf-lb-thumb:hover {
  opacity: 0.82;
  border-color: rgba(255, 255, 255, 0.45);
}

.tf-lb-thumb:focus-visible {
  outline: 2px solid #D4AF37;
  outline-offset: 2px;
}

/* Active Thumbnail State (Section 7) */
.tf-lb-thumb.active {
  opacity: 1;
  border-color: #D4AF37;
  transform: scale(1.06);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.28), 0 4px 14px rgba(0, 0, 0, 0.65);
  z-index: 2;
}

.tf-lb-thumb img {
  height: 100%;
  width: auto;
  min-width: 36px;
  max-width: 104px;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

/* ==========================================================================
   MOBILE RESPONSIVE ADJUSTMENTS (Sections 15 & 16)
   ========================================================================== */
@media (max-width: 768px) {
  .tf-lightbox-topbar {
    height: 50px;
    padding: 0 0.75rem;
  }

  .tf-lightbox-caption-inline {
    display: none;
  }

  .tf-lightbox-stage {
    padding: 0.5rem 0.5rem;
  }

  .tf-lightbox-nav {
    width: 40px;
    height: 40px;
    font-size: 1.15rem;
    background-color: rgba(14, 14, 18, 0.72);
  }

  .tf-lightbox-nav.prev {
    left: 0.5rem;
  }

  .tf-lightbox-nav.next {
    right: 0.5rem;
  }

  .tf-lightbox-footer {
    padding: 0.45rem 0.5rem 0.55rem;
  }

  .tf-lightbox-thumbs {
    gap: 5px;
    padding: 3px 4px;
  }

  .tf-lb-thumb {
    height: 44px;
    min-width: 32px;
    max-width: 82px;
  }

  .tf-lb-thumb img {
    min-width: 30px;
    max-width: 78px;
  }
}
