/* ============================================================================
   Image Lightbox - Beautiful Full-Screen Image Viewer
   ============================================================================ */

/* Lightbox Overlay */
.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.image-lightbox[aria-hidden="false"] {
  display: flex;
}

/* Backdrop with blur effect */
.image-lightbox__backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: lightboxFadeIn 0.25s ease-out;
}

@keyframes lightboxFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Lightbox Container */
.image-lightbox__container {
  position: relative;
  z-index: 1;
  max-width: 95vw;
  max-height: 90vh;
  animation: lightboxZoomIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes lightboxZoomIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Image wrapper */
.image-lightbox__image-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  overflow: hidden;
  box-shadow:
    0 25px 50px -12px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.1);
}

/* The image */
.image-lightbox__image {
  display: block;
  max-width: 95vw;
  max-height: 85vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
}

/* Caption */
.image-lightbox__caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 16px 20px;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.8) 0%,
    rgba(0, 0, 0, 0.4) 70%,
    transparent 100%
  );
  color: white;
  font-size: 14px;
  font-style: italic;
  text-align: center;
  font-family: var(--font-serif, Georgia, serif);
  border-radius: 0 0 8px 8px;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s ease;
}

.image-lightbox__container:hover .image-lightbox__caption,
.image-lightbox__caption:focus-within {
  opacity: 1;
  transform: translateY(0);
}

/* Close button */
.image-lightbox__close {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  color: white;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.image-lightbox__close:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
}

.image-lightbox__close:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.4);
}

.image-lightbox__close i {
  font-size: 24px;
}

/* Hint text */
.image-lightbox__hint {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  animation: hintFadeIn 0.3s ease-out 0.5s forwards;
}

@keyframes hintFadeIn {
  to {
    opacity: 1;
  }
}

.image-lightbox__hint kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  font-size: 11px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-weight: 600;
  line-height: 1.3;
}

/* Clickable image trigger styling */
.recipe-hero-image--clickable {
  cursor: zoom-in;
}

.recipe-hero-image--clickable .recipe-hero-image__wrapper {
  position: relative;
}

/* Zoom icon overlay */
.recipe-hero-image__zoom-icon {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 50%;
  color: white;
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.25s ease;
  pointer-events: none;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.recipe-hero-image--clickable:hover .recipe-hero-image__zoom-icon,
.recipe-hero-image--clickable:focus-within .recipe-hero-image__zoom-icon {
  opacity: 1;
  transform: scale(1);
}

.recipe-hero-image__zoom-icon i {
  font-size: 16px;
}

/* Prevent body scroll when lightbox is open */
body.lightbox-open {
  overflow: hidden;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .image-lightbox {
    padding: 10px;
  }

  .image-lightbox__close {
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
  }

  .image-lightbox__close i {
    font-size: 20px;
  }

  .image-lightbox__image {
    max-width: 100vw;
    max-height: 80vh;
    border-radius: 4px;
  }

  .image-lightbox__image-wrapper {
    border-radius: 4px;
  }

  .image-lightbox__caption {
    padding: 12px 16px;
    font-size: 13px;
  }

  .image-lightbox__hint {
    bottom: 10px;
    padding: 6px 12px;
    font-size: 11px;
  }

  .recipe-hero-image__zoom-icon {
    width: 32px;
    height: 32px;
    top: 8px;
    right: 8px;
  }

  .recipe-hero-image__zoom-icon i {
    font-size: 14px;
  }
}

/* Print - hide lightbox elements */
@media print {
  .image-lightbox,
  .recipe-hero-image__zoom-icon {
    display: none !important;
  }
}
