/**
 * Leather 1X — Gallery Widget
 * Masonry / Uniform / Bento layouts, mobile carousel, lazy blur-up, hover zoom + glow
 */

/* ══════════════════════════════════════════════════════════════
   CONTAINER
   ══════════════════════════════════════════════════════════════ */

.l1x-gallery {
  padding: 60px 0;
}

.l1x-gallery__grid {
  width: min(100% - 32px, var(--container, 1360px));
  margin: 0 auto;
}

/* ══════════════════════════════════════════════════════════════
   UNIFORM GRID
   ══════════════════════════════════════════════════════════════ */

.l1x-gallery__grid--uniform {
  display: grid;
  grid-template-columns: repeat(var(--l1x-gal-cols, 3), 1fr);
  gap: var(--l1x-gal-gap, 12px);
}

.l1x-gallery__grid--uniform .l1x-gallery__item {
  margin: 0;
}

.l1x-gallery__grid--uniform .l1x-gallery__img-wrap {
  aspect-ratio: var(--l1x-gal-ratio, 1/1);
}

/* ══════════════════════════════════════════════════════════════
   MASONRY GRID (CSS columns)
   ══════════════════════════════════════════════════════════════ */

.l1x-gallery__grid--masonry {
  column-count: var(--l1x-gal-cols, 3);
  column-gap: var(--l1x-gal-gap, 12px);
}

.l1x-gallery__grid--masonry .l1x-gallery__item {
  break-inside: avoid;
  margin-bottom: var(--l1x-gal-gap, 12px);
}

/* ══════════════════════════════════════════════════════════════
   BENTO GRID
   ══════════════════════════════════════════════════════════════ */

.l1x-gallery__grid--bento {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 180px;
  gap: var(--l1x-gal-gap, 12px);
}

.l1x-gallery__grid--bento .l1x-gallery__item--hero {
  grid-column: span 2;
  grid-row: span 2;
}

.l1x-gallery__grid--bento .l1x-gallery__img-wrap {
  height: 100%;
}

/* ══════════════════════════════════════════════════════════════
   ITEM / IMAGE
   ══════════════════════════════════════════════════════════════ */

.l1x-gallery__item {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(201, 169, 106, 0.10);
  transition: box-shadow 0.35s ease, transform 0.35s ease;
  cursor: default;
}

.l1x-gallery__item:hover {
  box-shadow: 0 0 0 3px rgba(201, 169, 106, 0.26), 0 8px 32px rgba(201, 169, 106, 0.13);
  transform: translateY(-2px);
}

.l1x-gallery__img-wrap {
  position: relative;
  overflow: hidden;
  width: 100%;
}

.l1x-gallery__placeholder {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: blur(20px);
  transform: scale(1.15);
  z-index: 1;
  transition: opacity 0.5s ease;
}

.l1x-gallery__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: relative;
  z-index: 2;
  opacity: 0;
  transition: opacity 0.5s ease, transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

.l1x-gallery__img.is-loaded {
  opacity: 1;
}

.l1x-gallery__img.is-loaded + .l1x-gallery__placeholder,
.l1x-gallery__item .l1x-gallery__placeholder.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.l1x-gallery__item:hover .l1x-gallery__img {
  transform: scale(1.06);
}

/* ── Caption ─────────────────────────────────────────────── */

.l1x-gallery__caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 3;
  padding: 10px 14px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.75));
  color: rgba(255, 255, 255, 0.92);
  font-size: 13px;
  font-family: 'Georgia', serif;
  letter-spacing: 0.02em;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.l1x-gallery__item:hover .l1x-gallery__caption {
  opacity: 1;
  transform: translateY(0);
}

/* ══════════════════════════════════════════════════════════════
   MOBILE CAROUSEL
   ══════════════════════════════════════════════════════════════ */

.l1x-gallery__carousel-nav {
  display: none;
}

@media (max-width: 767px) {

  .l1x-gallery--mobile-carousel .l1x-gallery__grid {
    display: flex !important;
    column-count: unset !important;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: var(--l1x-gal-gap, 12px);
    padding-bottom: 8px;
  }

  .l1x-gallery--mobile-carousel .l1x-gallery__grid::-webkit-scrollbar {
    display: none;
  }

  .l1x-gallery--mobile-carousel .l1x-gallery__item {
    flex: 0 0 85%;
    scroll-snap-align: center;
    margin-bottom: 0 !important;
    break-inside: unset !important;
  }

  .l1x-gallery--mobile-carousel .l1x-gallery__item--hero {
    grid-column: unset;
    grid-row: unset;
  }

  .l1x-gallery--mobile-carousel .l1x-gallery__img-wrap {
    aspect-ratio: 4/3;
    height: auto;
  }

  .l1x-gallery__carousel-nav {
    display: flex;
    justify-content: center;
    padding: 14px 0 0;
  }

  .l1x-gallery__dots {
    display: flex;
    gap: 8px;
  }

  .l1x-gallery__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.25);
    padding: 0;
    cursor: pointer;
    transition: background 0.25s ease, transform 0.25s ease;
  }

  .l1x-gallery__dot.is-active {
    background: #c9a96a;
    transform: scale(1.3);
  }
}

/* ── Tablet adjustments ──────────────────────────────────── */

@media (max-width: 1023px) and (min-width: 768px) {
  .l1x-gallery__grid--masonry {
    column-count: 2 !important;
  }
  .l1x-gallery__grid--uniform {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .l1x-gallery__grid--bento {
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: 160px;
  }
}

@media (max-width: 767px) {
  .l1x-gallery__grid--masonry:not(.l1x-gallery--mobile-carousel .l1x-gallery__grid) {
    column-count: 2 !important;
  }
  .l1x-gallery__grid--bento:not(.l1x-gallery--mobile-carousel .l1x-gallery__grid) {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: 140px;
  }
  .l1x-gallery__grid--bento:not(.l1x-gallery--mobile-carousel .l1x-gallery__grid) .l1x-gallery__item--hero {
    grid-column: span 2;
    grid-row: span 1;
  }
}
