.lightbox {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  background: rgba(0,0,0,0.92);
  z-index: 1000;
  padding: 1rem;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition:
    background 320ms cubic-bezier(0.22, 1, 0.36, 1),
    backdrop-filter 320ms cubic-bezier(0.22, 1, 0.36, 1),
    -webkit-backdrop-filter 320ms cubic-bezier(0.22, 1, 0.36, 1);
}

.lightbox.is-open { display: grid; }

.lightbox-image {
  max-width: min(92vw, 1400px);
  max-height: 82vh;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.45);
}

.lightbox-caption {
  color: #fff;
  margin-top: .75rem;
}

.lightbox-close,
.lightbox-nav {
  position: absolute;
  border: 0;
  background: rgba(255,255,255,0.12);
  color: #fff;
  width: 48px;
  height: 48px;
  border-radius: 999px;
  font-size: 1.8rem;
  cursor: pointer;
}

.lightbox-close { top: 20px; right: 20px; }

.lightbox-nav-prev { left: 20px; top: 50%; transform: translateY(-50%); }

.lightbox-nav-next { right: 20px; top: 50%; transform: translateY(-50%); }

/* Change theme for photomode */
body.ultra-dark .section-panel,
body.ultra-dark .collection-card,
body.ultra-dark .gallery-tile,
body.ultra-dark .featured-card,
body.ultra-dark .info-card,
body.ultra-dark .theme-toggle,
body.ultra-dark .button,
body.ultra-dark .contact-form input,
body.ultra-dark .contact-form textarea {
  box-shadow: 0 18px 54px rgba(0, 0, 0, 0.45);
}

body.ultra-dark .collection-card img,
body.ultra-dark .gallery-tile img,
body.ultra-dark .featured-card img,
body.ultra-dark .lightbox-image {
  filter: brightness(0.98) contrast(1.04) saturate(1.02);
}

body.ultra-dark .collection-card-overlay {
  background: linear-gradient(to top, rgba(0,0,0,0.68), transparent 52%);
}

body.ultra-dark .sidebar {
  background: rgba(8, 8, 8, 0.84);
}

body.ultra-dark .lightbox {
  background: rgba(0,0,0,0.96);
}

.js-lightbox-trigger {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  cursor: pointer;
}

.gallery-tile > .js-lightbox-trigger,
.collection-card > .js-lightbox-trigger,
.featured-card > .js-lightbox-trigger {
  width: 100%;
  height: 100%;
}

.js-lightbox-trigger img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Blur background when image opened */
.site-shell::after {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  pointer-events: none;
  transition: background 320ms cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 900;
}

body.lightbox-open .site-shell {
  filter: blur(12px); /* slightly softer, smoother */
  transform: scale(0.985);
  opacity: 0.82;
  pointer-events: none;
  user-select: none;
}

body.lightbox-open .site-shell::after,
body.lightbox-open.ultra-dark .site-shell::after {
  background: rgba(0, 0, 0, 0.28);
}

body.lightbox-open .sidebar,
body.lightbox-open.ultra-dark .sidebar {
  opacity: 0.54;
}

body.lightbox-open .section-panel,
body.lightbox-open .info-card,
body.lightbox-open .theme-toggle,
body.lightbox-open .button,
body.lightbox-open.ultra-dark .section-panel,
body.lightbox-open.ultra-dark .info-card,
body.lightbox-open.ultra-dark .theme-toggle,
body.lightbox-open.ultra-dark .button {
  opacity: 0.68;
}

body.lightbox-open .collection-card,
body.lightbox-open .featured-card,
body.lightbox-open .gallery-tile,
body.lightbox-open.ultra-dark .collection-card,
body.lightbox-open.ultra-dark .featured-card,
body.lightbox-open.ultra-dark .gallery-tile {
  opacity: 0.78;
}