/* ============================================
   LIGHTBOX — Antico Frantoio
   4 temi: classica, minimale, vetro, cinematografica
   ============================================ */

/* --- Shared Base Styles --- */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.4s ease;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
}

.lightbox-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 40px;
}

.lightbox-image-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 90vw;
  max-height: 85vh;
  transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              opacity 0.5s ease;
}

.lightbox-image {
  max-width: 100%;
  max-height: 85vh;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.4s ease;
  will-change: transform;
}

.lightbox-caption {
  position: absolute;
  bottom: -48px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 20px;
  border-radius: 8px;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  font-weight: 300;
  letter-spacing: 0.02em;
  white-space: nowrap;
  max-width: 80%;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.lightbox-counter {
  position: absolute;
  top: 24px;
  right: 80px;
  padding: 6px 16px;
  border-radius: 20px;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.05em;
  opacity: 0;
  transition: opacity 0.4s ease;
  user-select: none;
}

/* --- Close Button --- */
.lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: background 0.3s ease, transform 0.2s ease, opacity 0.3s ease;
  -webkit-tap-highlight-color: transparent;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.lightbox-close:hover {
  transform: scale(1.08);
}

.lightbox-close:active {
  transform: scale(0.92);
}

/* --- Navigation Buttons --- */
.lightbox-nav {
  position: absolute;
  top: 50%;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: background 0.3s ease, transform 0.2s ease, opacity 0.3s ease;
  -webkit-tap-highlight-color: transparent;
  opacity: 0;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.lightbox-nav:hover {
  transform: translateY(-50%) scale(1.08);
}

.lightbox-nav:active {
  transform: translateY(-50%) scale(0.92);
}

.lightbox-prev {
  left: 20px;
}

.lightbox-next {
  right: 20px;
}

/* --- Hover reveal for nav --- */
.lightbox-overlay:hover .lightbox-nav {
  opacity: 1;
}

/* ============================================
   THEME: CLASSICA
   Dark overlay, gold accents, rounded image
   ============================================ */
.lightbox-theme-classic .lightbox-overlay {
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  background-color: rgba(0, 0, 0, 0.85);
}

.lightbox-theme-classic .lightbox-image {
  border-radius: 16px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
}

.lightbox-theme-classic .lightbox-close {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  opacity: 0.55;
}

.lightbox-theme-classic .lightbox-close:hover {
  background: rgba(197, 160, 89, 0.35);
  opacity: 1;
}

.lightbox-theme-classic .lightbox-nav {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  opacity: 0.55;
}

.lightbox-theme-classic .lightbox-nav:hover {
  background: rgba(197, 160, 89, 0.35);
  opacity: 1;
}

.lightbox-theme-classic .lightbox-caption {
  color: #fff;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.lightbox-theme-classic .lightbox-counter {
  background: rgba(0, 0, 0, 0.3);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.lightbox-theme-classic .lightbox-image-wrap {
  --transition-in: scale(0.92) translateY(20px);
  --transition-out: scale(0.95);
}

/* ============================================
   THEME: MINIMALE
   Clean, minimal UI, light controls
   ============================================ */
.lightbox-theme-minimal .lightbox-overlay {
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  background-color: rgba(0, 0, 0, 0.7);
}

.lightbox-theme-minimal .lightbox-image {
  border-radius: 4px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);
}

.lightbox-theme-minimal .lightbox-close {
  background: rgba(255, 255, 255, 0.9);
  color: #1d1d1f;
  width: 36px;
  height: 36px;
  top: 24px;
  right: 24px;
}

.lightbox-theme-minimal .lightbox-close:hover {
  background: #fff;
}

.lightbox-theme-minimal .lightbox-nav {
  background: rgba(255, 255, 255, 0.9);
  color: #1d1d1f;
  width: 40px;
  height: 40px;
}

.lightbox-theme-minimal .lightbox-nav:hover {
  background: #fff;
}

.lightbox-theme-minimal .lightbox-caption {
  color: #1d1d1f;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-weight: 400;
  border-radius: 999px;
  padding: 6px 18px;
}

.lightbox-theme-minimal .lightbox-counter {
  background: rgba(255, 255, 255, 0.85);
  color: #1d1d1f;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-weight: 500;
}

.lightbox-theme-minimal .lightbox-image-wrap {
  --transition-in: scale(0.98);
  --transition-out: scale(0.98);
}

/* Hide nav until hover on minimal */
.lightbox-theme-minimal .lightbox-nav {
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.2s ease, background 0.3s;
}

.lightbox-theme-minimal .lightbox-overlay:hover .lightbox-nav {
  opacity: 0.7;
}

.lightbox-theme-minimal .lightbox-nav:hover {
  opacity: 1 !important;
}

/* ============================================
   THEME: VETRO (MacOS-style)
   Frosted glass, heavy blur, large radius
   ============================================ */
.lightbox-theme-vetro .lightbox-overlay {
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  background-color: rgba(0, 0, 0, 0.6);
}

.lightbox-theme-vetro .lightbox-image {
  border-radius: 20px;
  box-shadow: 0 32px 100px rgba(0, 0, 0, 0.5);
}

.lightbox-theme-vetro .lightbox-close {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  width: 44px;
  height: 44px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.lightbox-theme-vetro .lightbox-close:hover {
  background: rgba(197, 160, 89, 0.35);
  border-color: rgba(197, 160, 89, 0.2);
}

.lightbox-theme-vetro .lightbox-nav {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  width: 44px;
  height: 44px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.lightbox-theme-vetro .lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.12);
}

.lightbox-theme-vetro .lightbox-caption {
  color: #fff;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  padding: 8px 22px;
}

.lightbox-theme-vetro .lightbox-counter {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.lightbox-theme-vetro .lightbox-image-wrap {
  --transition-in: scale(0.9) translateY(30px);
  --transition-out: scale(0.9);
}

/* ============================================
   THEME: CINEMATOGRAFICA
   Cinematic letterbox, slow zoom, gold caption
   ============================================ */
.lightbox-theme-cinematic .lightbox-overlay {
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  background-color: #000;
}

.lightbox-theme-cinematic .lightbox-image {
  border-radius: 0;
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.8);
}

/* Letterbox effect */
.lightbox-theme-cinematic .lightbox-container {
  padding: 0;
}

.lightbox-theme-cinematic .lightbox-image-wrap {
  max-width: 100vw;
  max-height: 100vh;
}

.lightbox-theme-cinematic .lightbox-image {
  max-height: 100vh;
}

.lightbox-theme-cinematic .lightbox-image-wrap::before,
.lightbox-theme-cinematic .lightbox-image-wrap::after {
  content: '';
  position: fixed;
  left: 0;
  right: 0;
  z-index: 5;
  pointer-events: none;
}

.lightbox-theme-cinematic .lightbox-image-wrap::before {
  top: 0;
  height: 10vh;
  background: linear-gradient(to bottom, #000, transparent);
}

.lightbox-theme-cinematic .lightbox-image-wrap::after {
  bottom: 0;
  height: 10vh;
  background: linear-gradient(to top, #000, transparent);
}

.lightbox-theme-cinematic .lightbox-close {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  width: 40px;
  height: 40px;
  top: 30px;
  right: 30px;
}

.lightbox-theme-cinematic .lightbox-close:hover {
  background: rgba(197, 160, 89, 0.3);
}

.lightbox-theme-cinematic .lightbox-nav {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  width: 50px;
  height: 50px;
}

.lightbox-theme-cinematic .lightbox-nav:hover {
  background: rgba(197, 160, 89, 0.25);
}

.lightbox-theme-cinematic .lightbox-caption {
  color: #C5A059;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(197, 160, 89, 0.15);
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 12px;
  border-radius: 4px;
  padding: 10px 28px;
}

.lightbox-theme-cinematic .lightbox-counter {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.6);
  font-weight: 300;
  letter-spacing: 0.1em;
  top: 30px;
  right: 80px;
}

.lightbox-theme-cinematic .lightbox-image-wrap {
  --transition-in: scale(1.1);
  --transition-out: scale(1.05);
}

/* Slow zoom animation for cinematic */
@keyframes cinematicZoomIn {
  from { transform: scale(1.1); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@keyframes cinematicZoomOut {
  from { transform: scale(1); opacity: 1; }
  to { transform: scale(1.05); opacity: 0; }
}

.lightbox-theme-cinematic .lightbox-image-wrap.lightbox-entering {
  animation: cinematicZoomIn 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.lightbox-theme-cinematic .lightbox-image-wrap.lightbox-leaving {
  animation: cinematicZoomOut 0.6s ease forwards;
}

/* ============================================
   Responsive Adjustments
   ============================================ */
@media (max-width: 768px) {
  .lightbox-container {
    padding: 16px;
  }

  .lightbox-image-wrap {
    max-width: 98vw;
    max-height: 75vh;
  }

  .lightbox-image {
    max-height: 75vh;
  }

  .lightbox-caption {
    font-size: 12px;
    white-space: normal;
    max-width: 90%;
    bottom: -40px;
  }

  .lightbox-counter {
    display: none;
  }

  .lightbox-close {
    top: 12px;
    right: 12px;
  }

  .lightbox-nav {
    display: none;
  }

  .lightbox-theme-cinematic .lightbox-image-wrap::before,
  .lightbox-theme-cinematic .lightbox-image-wrap::after {
    height: 6vh;
  }
}

/* --- Loading shimmer --- */
.lightbox-image {
  background: rgba(255, 255, 255, 0.03);
}

.lightbox-image[src=""] {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.03) 25%,
    rgba(255, 255, 255, 0.06) 50%,
    rgba(255, 255, 255, 0.03) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* --- Touch swipe indicator (mobile) --- */
@media (pointer: coarse) {
  .lightbox-overlay .lightbox-nav {
    opacity: 0.6;
    display: flex;
  }
}
