/* ══════════════════════════════════════════
   QURTÈN — Gallery & Lightbox
   ══════════════════════════════════════════ */

/* ─── Section ─────────────────────────────── */
.gallery-section {
  background: var(--clr-bg);
}

/* ─── Grid ─────────────────────────────────── */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.625rem;
}

@media (min-width: 640px) {
  .gallery-grid { gap: 0.75rem; }
}

@media (min-width: 768px) {
  .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
  }
}

/* ─── Item ──────────────────────────────────── */
.gallery-item {
  aspect-ratio: 4 / 5;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  border: none;
  padding: 0;
  background: var(--clr-surface, #f0ede8);
  display: block;
  outline: none;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
  transition: box-shadow var(--dur-base) var(--ease-smooth),
              transform var(--dur-base) var(--ease-smooth);

  /* staggered appear animation set via JS */
  opacity: 0;
  animation: galleryFadeIn 0.5s var(--ease-smooth) both;
}

@keyframes galleryFadeIn {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.55s var(--ease-smooth),
              filter 0.55s var(--ease-smooth);
}

/* Zoom icon overlay */
.gallery-item__zoom {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0);
  color: #fff;
  opacity: 0;
  transition: background var(--dur-base) var(--ease-smooth),
              opacity var(--dur-base) var(--ease-smooth);
  pointer-events: none;
}

.gallery-item:hover img,
.gallery-item:focus-visible img {
  transform: scale(1.06);
  filter: brightness(0.72);
}

.gallery-item:hover .gallery-item__zoom,
.gallery-item:focus-visible .gallery-item__zoom {
  opacity: 1;
  background: rgba(0, 0, 0, 0.26);
}

.gallery-item:hover,
.gallery-item:focus-visible {
  box-shadow: 0 0 0 2px var(--clr-accent, #a08060),
              0 8px 32px rgba(0, 0, 0, 0.14);
  outline: none;
}

/* ═══════════════════════════════════════════════
   LIGHTBOX
   ═══════════════════════════════════════════════ */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.lightbox[aria-hidden="false"] {
  opacity: 1;
  pointer-events: all;
}

/* Backdrop */
.lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 8, 6, 0.92);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  cursor: pointer;
}

/* Image wrapper */
.lightbox__img-wrap {
  position: relative;
  z-index: 2;
  max-width: min(90vw, 1000px);
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox__img {
  display: block;
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 2px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.lightbox__img.lightbox__img--loading {
  opacity: 0;
  transform: scale(0.97);
}

/* Close button */
.lightbox__close {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 3;
  width: 44px;
  height: 44px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.lightbox__close:hover {
  background: rgba(255, 255, 255, 0.22);
}

/* Prev / Next arrows */
.lightbox__prev,
.lightbox__next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 52px;
  height: 52px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.lightbox__prev { left: 1.25rem; }
.lightbox__next { right: 1.25rem; }

.lightbox__prev:hover,
.lightbox__next:hover {
  background: rgba(255, 255, 255, 0.22);
}

@media (max-width: 640px) {
  .lightbox__prev { left: 0.5rem; }
  .lightbox__next { right: 0.5rem; }
  .lightbox__prev,
  .lightbox__next { width: 40px; height: 40px; }
}
