/* ===================================================
   lightbox.css — Lightbox overlay styles
   Loaded on: gallery pages only (project.php)
   =================================================== */


/* ===================================================
   LIGHTBOX
   =================================================== */

#lightbox {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

#lightbox.active {
  opacity: 1;
  pointer-events: all;
}

.lb-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 14, 22, 0.95);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.lb-body {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: stretch;
  max-width: min(96vw, 1400px);
  max-height: 92vh;
  width: 100%;
  animation: scaleIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Image area */
.lb-image-wrap {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  position: relative;
  gap: 0;
}

#lightbox-img {
  max-width: 100%;
  max-height: 88vh;
  object-fit: contain;
  display: block;
  border-radius: var(--radius-sm);
  transition: transform 0.25s ease, opacity 0.25s ease;
  cursor: pointer;
}

/* Info panel */
.lb-meta-panel {
  flex: 0 0 280px;
  background: rgba(15, 25, 38, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-left: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  display: flex;
  flex-direction: column;
  padding: 1.75rem 1.5rem 1.5rem;
  color: var(--color-white);
  overflow-y: hidden;
  transition: opacity 0.3s ease;
}

.lb-meta-panel .lb-category {
  font-size: 0.65rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: 0.5rem;
}

.lb-meta-panel h3 {
  font-size: 1.35rem;
  font-weight: 400;
  margin-bottom: 0.35rem;
  line-height: 1.25;
}

.lb-meta-panel .lb-desc {
  font-size: 0.83rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 1rem;
}

.lb-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin-bottom: 1rem;
}

/* EXIF data — compact 2-col grid */
.exif-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem 1rem;
}

.exif-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.85);
}

.exif-label {
  font-size: 0.6rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.35);
}

/* Navigation row — below image */
.lb-nav-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  padding: 0.75rem 0 0;
}

.lb-nav-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.55);
  font-size: 1.4rem;
  font-family: var(--font-body);
  cursor: pointer;
  padding: 0.2rem 0.6rem;
  transition: color 0.2s ease, transform 0.2s ease;
  user-select: none;
  line-height: 1;
}

.lb-nav-btn:hover {
  color: var(--color-accent);
  transform: scale(1.2);
}

.lb-nav-counter {
  font-size: 0.72rem;
  letter-spacing: 2px;
  color: rgba(255, 255, 255, 0.35);
  min-width: 50px;
  text-align: center;
}

/* Close button */
.close-lightbox {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 9200;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 25, 38, 0.6);
    border: 1px solid var(--color-accent-dark);
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.85);
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
    backdrop-filter: blur(6px);
    line-height: 1;
}

.close-lightbox:hover {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-white);
  transform: rotate(90deg);
}

/* ===================================================
   RESPONSIVE LIGHTBOX
   ===================================================
   - Desktop (>900px)            → side-by-side (default rules)
   - Tablet (768–900px)          → side-by-side like desktop
   - Mobile landscape (481–767px)→ side-by-side like desktop
   - Mobile portrait (≤767px)    → stacked: image on top, panel below
   =================================================== */

/* Tablet: keep side-by-side, slightly tighter spacing */
@media (max-width: 900px) and (min-width: 768px) {
  .lb-meta-panel {
    flex: 0 0 240px;
    padding: 1.25rem 1.25rem 1.15rem;
  }

  .lb-meta-panel h3 {
    font-size: 1.2rem;
  }

  .lb-meta-panel .lb-desc {
    font-size: 0.8rem;
  }
}

/* Mobile landscape: keep side-by-side, compact */
@media (max-width: 767px) and (orientation: landscape) {
  .lb-body {
    max-height: 95dvh;
  }

  .lb-meta-panel {
    flex: 0 0 200px;
    padding: 1rem 1rem 0.9rem;
  }

  .lb-meta-panel h3 {
    font-size: 1.1rem;
  }

  .lb-meta-panel .lb-desc {
    font-size: 0.78rem;
    margin-bottom: 0.75rem;
  }

  .lb-meta-panel .lb-category {
    font-size: 0.6rem;
    letter-spacing: 2.5px;
  }

  .exif-info {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.4rem 0.75rem;
  }

  .exif-item {
    font-size: 0.76rem;
  }

  #lightbox-img {
    max-height: 80dvh;
  }

  .close-lightbox {
    width: 38px;
    height: 38px;
    font-size: 1.3rem;
    top: 0.75rem;
    right: 0.75rem;
  }
}

/* Mobile portrait: stacked layout — image on top, panel below */
@media (max-width: 767px) and (orientation: portrait) {
  .lb-body {
    flex-direction: column;
    max-height: 95dvh;
  }

  .lb-image-wrap {
    flex: 1 1 auto;
  }

  .lb-meta-panel {
    flex: 0 0 auto;
    border-left: none;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    padding: 1rem 1.25rem 1.25rem;
    overflow-y: hidden;
  }

  .lb-meta-panel h3 {
    font-size: 1.1rem;
  }

  #lightbox-img {
    max-height: 52vh;
  }

  .exif-info {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
  }
}


/* ===================================================
   FILMSTRIP LIGHTBOX
   =================================================== */

#lightbox.filmstrip-active {
  cursor: none;
}

#lightbox.filmstrip-active .lb-backdrop {
  background: rgba(0, 0, 0, 0.97);
}

/* Hide the meta panel in filmstrip mode */
#lightbox.filmstrip-active .lb-meta-panel {
  display: none !important;
}

/* Filmstrip main image area */
#lightbox.filmstrip-active .lb-image-wrap {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-top: 0;
  overflow: hidden;
  height: calc(100vh - 110px);
  margin: 0;
}

/* Filmstrip main image */
#lightbox-img-filmstrip {
  max-width: 96vw;
  max-height: calc(100vh - 110px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 0;
  cursor: pointer;
  transition: opacity 0.25s ease, transform 0.25s ease;
  max-inline-size: 96vw;
  max-block-size: 80vh;
}

#lightbox-img.lb-fade,
#lightbox-img-filmstrip.lb-fade {
  opacity: 0.5;
  transform: scale(0.97);
}

/* Filmstrip bar */
.lb-filmstrip {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 110px;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  z-index: 10;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}

.lb-filmstrip-track {
  display: flex;
  gap: 8px;
  padding: 0 20px;
  overflow-x: auto;
  overflow-y: hidden;
  height: 100%;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
  align-items: center;
}

.lb-filmstrip-track::-webkit-scrollbar {
  display: none;
}

.lb-filmstrip-thumb {
  flex: 0 0 auto;
  width: 70px;
  height: 50px;
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
  opacity: 0.5;
  position: relative;
}

.lb-filmstrip-thumb.active {
  border-color: var(--color-accent);
  opacity: 1;
  transform: scale(1.05);
}

.lb-filmstrip-thumb:hover {
  opacity: 0.8;
  transform: scale(1.03);
}

.lb-filmstrip-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb-loader {
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Filmstrip nav arrows */
.lb-filmstrip-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 50px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 5;
  background: rgba(10, 10, 10, 0.4);
  border: 1px solid var(--color-accent-dark);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.85);
  font-size: 1.5rem;
  transition: background 0.2s ease;
}

.lb-filmstrip-nav:hover {
  background: rgba(10, 10, 10, 0.7);
}

.lb-filmstrip-nav.lb-prev {
  left: 10px;
}

.lb-filmstrip-nav.lb-next {
  right: 10px;
}

/* Filmstrip counter */
.lb-filmstrip-counter {
  position: absolute;
  top: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9200;
  font-size: 0.72rem;
  letter-spacing: 2px;
  color: rgba(255, 255, 255, 0.35);
  background: rgba(0, 0, 0, 0.5);
  padding: 4px 12px;
  border-radius: 12px;
}

/* Filmstrip responsive */
@media (max-width: 767px) {
  .lb-filmstrip {
    height: 80px;
  }

  #lightbox.filmstrip-active .lb-image-wrap {
    height: calc(100vh - 80px);
  }

  #lightbox-img-filmstrip {
    max-height: calc(100vh - 80px);
  }

  .lb-filmstrip-thumb {
    width: 55px;
    height: 40px;
  }

  .lb-filmstrip-nav {
    width: 40px;
    height: 60px;
    font-size: 1.2rem;
  }
}
