/* ─── Gallery Grid ──────────────────────────────────────────── */
.gallery__grid {
  columns: 3;
  column-gap: var(--space-2);
}

.gallery__item {
  break-inside: avoid;
  margin-bottom: var(--space-2);
  border-radius: var(--border-radius);
  overflow: hidden;
  position: relative;
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.gallery__item:hover {
  transform: scale(1.02);
}

.gallery__item:hover .gallery__caption {
  opacity: 1;
}

.gallery__item img {
  width: 100%;
  display: block;
  transition: transform var(--transition-base), opacity 0.4s ease;
  background: var(--champagne-light);
  min-height: 120px;
  opacity: 0;
  /* Prevent drag-to-desktop */
  -webkit-user-drag: none;
  user-select: none;
  /* No pointer events on img itself — clicks go to parent item div */
  pointer-events: none;
}

/* Transparent shield over every gallery image — blocks right-click on the img */
.gallery__item::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
}

/* Fade in once the image has loaded */
.gallery__item--loaded img {
  opacity: 1;
}

.gallery__item:hover img {
  transform: scale(1.05);
}

.gallery__caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--space-3) var(--space-2) var(--space-2);
  background: linear-gradient(transparent, rgba(26, 26, 26, 0.8));
  color: var(--white);
  font-size: var(--text-sm);
  font-weight: 400;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.gallery__empty {
  text-align: center;
  font-size: var(--text-lg);
  font-style: italic;
  opacity: 0.6;
  padding: var(--space-8) 0;
}

/* ─── Lightbox ──────────────────────────────────────────────── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.lightbox[hidden] {
  display: none;
}

.lightbox.is-active {
  opacity: 1;
}

.lightbox__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  cursor: pointer;
}

.lightbox__content {
  position: relative;
  z-index: 1;
  max-width: 90vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lightbox__canvas {
  max-width: 90vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: var(--border-radius);
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.5);
  display: block;
  /* Canvas right-click saves a PNG with the watermark baked in */
  -webkit-user-drag: none;
  user-select: none;
}

.lightbox__canvas--loading {
  background: rgba(247, 231, 206, 0.06);
  min-width: 200px;
  min-height: 150px;
  animation: canvasPulse 1.2s ease-in-out infinite;
}

@keyframes canvasPulse {
  0%, 100% { opacity: 0.4; }
  50%       { opacity: 0.8; }
}

.lightbox__caption {
  margin-top: var(--space-2);
  color: var(--champagne);
  font-size: var(--text-base);
  text-align: center;
}

.lightbox__close,
.lightbox__prev,
.lightbox__next {
  position: absolute;
  z-index: 2;
  color: var(--white);
  font-size: 2rem;
  padding: var(--space-2);
  opacity: 0.7;
  transition: opacity var(--transition-fast);
  background: none;
  border: none;
  cursor: pointer;
}

.lightbox__close:hover,
.lightbox__prev:hover,
.lightbox__next:hover {
  opacity: 1;
}

.lightbox__close {
  top: var(--space-3);
  right: var(--space-3);
  font-size: 2.5rem;
}

.lightbox__prev {
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  font-size: 3rem;
}

.lightbox__next {
  right: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  font-size: 3rem;
}
