/* ================================================================
   Elementor Gallery Pro — gallery.css
   ================================================================ */

/* ── Custom Properties ─────────────────────────────────────────── */
.egp-gallery-wrapper {
  --egp-columns: 3;
  --egp-gap: 12px;
  --egp-radius: 8px;
  --egp-transition: 0.38s cubic-bezier(0.4, 0, 0.2, 1);
  --egp-overlay-bg: rgba(10, 10, 20, 0.65);
  --egp-accent: #111;
  font-family: inherit;
}

/* ── Placeholder ───────────────────────────────────────────────── */
.egp-placeholder {
  padding: 48px;
  text-align: center;
  border: 2px dashed #ddd;
  border-radius: 8px;
  color: #999;
}

/* ================================================================
   FILTER BAR
   ================================================================ */
.egp-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 28px;
  justify-content: center;
}

.egp-filter-btn {
  appearance: none;
  background: transparent;
  border: 1.5px solid currentColor;
  border-radius: 999px;
  padding: 7px 20px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: var(--egp-transition);
  color: inherit;
  text-transform: uppercase;
}

.egp-filter-btn:hover,
.egp-filter-btn.active {
  background: var(--egp-accent, #111);
  border-color: var(--egp-accent, #111);
  color: #fff;
}

/* ── Hidden items (filter) ─────────────────────────────────────── */
.egp-item.egp-hidden {
  display: none;
}

/* ================================================================
   SHARED ITEM STYLES
   ================================================================ */
.egp-item-inner {
  position: relative;
  overflow: hidden;
  border-radius: var(--egp-radius);
  background: #f0f0f0;
  display: block;
  width: 100%;
  height: 100%;
}

.egp-item-inner img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--egp-transition);
}

.egp-item-inner:hover img {
  transform: scale(1.05);
}

/* ================================================================
   OVERLAY
   ================================================================ */
.egp-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: var(--egp-overlay-bg);
  pointer-events: none;
}

/* Fade */
.egp-overlay-fade {
  opacity: 0;
  transition: opacity var(--egp-transition);
}
.egp-item-inner:hover .egp-overlay-fade {
  opacity: 1;
  pointer-events: auto;
}

/* Slide Up */
.egp-overlay-slide {
  opacity: 0;
  transform: translateY(100%);
  transition: opacity var(--egp-transition), transform var(--egp-transition);
}
.egp-item-inner:hover .egp-overlay-slide {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* Zoom */
.egp-overlay-zoom {
  opacity: 0;
  transform: scale(0.85);
  transition: opacity var(--egp-transition), transform var(--egp-transition);
}
.egp-item-inner:hover .egp-overlay-zoom {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

/* Blur & Reveal */
.egp-overlay-blur {
  opacity: 0;
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
  transition: opacity var(--egp-transition), backdrop-filter var(--egp-transition);
  background: rgba(10,10,20,0.4);
}
.egp-item-inner:hover .egp-overlay-blur {
  opacity: 1;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  pointer-events: auto;
}

/* Icon */
.egp-overlay-icon {
  width: 44px;
  height: 44px;
  border: 1.5px solid #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  transition: background var(--egp-transition), transform var(--egp-transition);
  text-decoration: none;
}
.egp-overlay-icon:hover {
  background: rgba(255,255,255,0.15);
  transform: scale(1.1);
}
.egp-overlay-icon svg {
  width: 18px;
  height: 18px;
}

/* Caption */
.egp-caption {
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  padding: 0 16px;
  max-width: 100%;
  line-height: 1.5;
}

/* ================================================================
   LAYOUT 1: GRID
   ================================================================ */
.egp-gallery-grid {
  display: grid;
  grid-template-columns: repeat(var(--egp-columns, 3), 1fr);
  gap: var(--egp-gap, 12px);
}

.egp-gallery-grid .egp-item {
  min-width: 0;
}

/* ================================================================
   LAYOUT 2: MASONRY
   ================================================================ */
.egp-gallery-masonry {
  column-count: var(--egp-columns, 3);
  column-gap: var(--egp-gap, 12px);
}

.egp-gallery-masonry .egp-item {
  break-inside: avoid;
  margin-bottom: var(--egp-gap, 12px);
}

.egp-gallery-masonry .egp-item-inner {
  aspect-ratio: unset;
}

.egp-gallery-masonry .egp-item-inner img {
  height: auto;
  object-fit: unset;
}

/* ================================================================
   LAYOUT 3: JUSTIFIED
   ================================================================ */
.egp-gallery-justified {
  display: flex;
  flex-wrap: wrap;
  gap: var(--egp-gap, 12px);
}

.egp-gallery-justified .egp-item {
  flex-grow: 1;
  min-width: 80px;
}

.egp-gallery-justified .egp-item-inner {
  height: var(--egp-row-height, 220px);
  aspect-ratio: unset;
}

.egp-gallery-justified .egp-item-inner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  min-width: 100%;
}

/* Last row stretching fix */
.egp-gallery-justified::after {
  content: '';
  flex-grow: 999;
  min-width: 0;
  height: 0;
}

/* ================================================================
   LAYOUT 4: HORIZONTAL SCROLL
   ================================================================ */
.egp-gallery-horizontal {
  display: flex;
  flex-wrap: nowrap;
  gap: var(--egp-gap, 12px);
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 8px;
  cursor: grab;
}

.egp-gallery-horizontal:active {
  cursor: grabbing;
}

.egp-gallery-horizontal::-webkit-scrollbar {
  height: 4px;
}
.egp-gallery-horizontal::-webkit-scrollbar-track {
  background: rgba(0,0,0,0.06);
  border-radius: 2px;
}
.egp-gallery-horizontal::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.25);
  border-radius: 2px;
}

.egp-gallery-horizontal .egp-item {
  flex: 0 0 auto;
  width: auto;
  scroll-snap-align: start;
}

.egp-gallery-horizontal .egp-item-inner {
  height: var(--egp-horizontal-height, 320px);
  aspect-ratio: unset;
  width: auto;
}

.egp-gallery-horizontal .egp-item-inner img {
  height: 100%;
  width: auto;
  max-width: 600px;
}

/* ================================================================
   LAYOUT 5: SPOTLIGHT
   a 12-col "bento" style with first item large, rest small
   ================================================================ */
.egp-gallery-spotlight {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--egp-gap, 12px);
  grid-auto-rows: 220px;
}

/* First item — large spotlight */
.egp-gallery-spotlight .egp-item:nth-child(1) {
  grid-column: span 8;
  grid-row: span 2;
}

/* 2nd, 3rd — right column top */
.egp-gallery-spotlight .egp-item:nth-child(2) {
  grid-column: span 4;
  grid-row: span 1;
}
.egp-gallery-spotlight .egp-item:nth-child(3) {
  grid-column: span 4;
  grid-row: span 1;
}

/* 4th onward: 3 per row */
.egp-gallery-spotlight .egp-item:nth-child(n+4) {
  grid-column: span 4;
  grid-row: span 1;
}

.egp-gallery-spotlight .egp-item {
  min-width: 0;
  min-height: 0;
}

.egp-gallery-spotlight .egp-item-inner {
  aspect-ratio: unset !important;
  height: 100%;
}

/* ================================================================
   ANIMATIONS — staggered entrance
   ================================================================ */
@keyframes egpFadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.egp-item {
  animation: egpFadeUp 0.5s ease both;
}

.egp-item:nth-child(1)  { animation-delay: 0.00s; }
.egp-item:nth-child(2)  { animation-delay: 0.05s; }
.egp-item:nth-child(3)  { animation-delay: 0.10s; }
.egp-item:nth-child(4)  { animation-delay: 0.15s; }
.egp-item:nth-child(5)  { animation-delay: 0.20s; }
.egp-item:nth-child(6)  { animation-delay: 0.25s; }
.egp-item:nth-child(7)  { animation-delay: 0.30s; }
.egp-item:nth-child(8)  { animation-delay: 0.35s; }
.egp-item:nth-child(n+9){ animation-delay: 0.40s; }

/* ================================================================
   LIGHTBOX
   ================================================================ */
.egp-lightbox {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(0, 0, 0, 0.96);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease;
  overflow: hidden;
}

.egp-lightbox.egp-lb-open {
  opacity: 1;
  pointer-events: auto;
}

.egp-lb-stage {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 64px 80px 16px;
  box-sizing: border-box;
}

.egp-lb-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
  transition: opacity 0.22s ease, transform 0.22s ease;
  user-select: none;
  display: block;
}

.egp-lb-img.egp-lb-loading {
  opacity: 0;
  transform: scale(0.96);
}

/* Controls */
.egp-lb-close,
.egp-lb-prev,
.egp-lb-next {
  position: fixed;
  background: rgba(255,255,255,0.08);
  border: 1.5px solid rgba(255,255,255,0.18);
  color: #fff;
  border-radius: 50%;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
  z-index: 10;
  backdrop-filter: blur(8px);
}
.egp-lb-close { top: 20px; right: 20px; }
.egp-lb-prev  { left: 16px; top: 50%; transform: translateY(-50%); }
.egp-lb-next  { right: 16px; top: 50%; transform: translateY(-50%); }

.egp-lb-close:hover { background: rgba(255,255,255,0.18); }
.egp-lb-prev:hover  { background: rgba(255,255,255,0.18); transform: translateY(-50%) translateX(-2px); }
.egp-lb-next:hover  { background: rgba(255,255,255,0.18); transform: translateY(-50%) translateX(2px); }

.egp-lb-close svg,
.egp-lb-prev svg,
.egp-lb-next svg {
  width: 20px;
  height: 20px;
}

/* Counter */
.egp-lb-counter {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.45);
  font-size: 12px;
  letter-spacing: 0.06em;
}

/* Thumbnails */
.egp-lb-thumbs {
  display: flex;
  gap: 6px;
  padding: 12px 24px 20px;
  overflow-x: auto;
  max-width: 100%;
  scrollbar-width: none;
}
.egp-lb-thumbs::-webkit-scrollbar { display: none; }

.egp-lb-thumb {
  flex: 0 0 auto;
  width: 60px;
  height: 44px;
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.2s, opacity 0.2s;
  opacity: 0.55;
}
.egp-lb-thumb img { width: 100%; height: 100%; object-fit: cover; }
.egp-lb-thumb.active { border-color: #fff; opacity: 1; }

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 1024px) {
  .egp-gallery-spotlight .egp-item:nth-child(1) {
    grid-column: span 12;
    grid-row: span 1;
  }
  .egp-gallery-spotlight .egp-item:nth-child(2),
  .egp-gallery-spotlight .egp-item:nth-child(3) {
    grid-column: span 6;
  }
  .egp-gallery-spotlight .egp-item:nth-child(n+4) {
    grid-column: span 6;
  }
}

@media (max-width: 768px) {
  .egp-gallery-grid,
  .egp-gallery-spotlight {
    --egp-columns: 2;
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .egp-gallery-masonry { column-count: 2; }

  .egp-gallery-spotlight .egp-item:nth-child(1) { grid-column: span 2; }
  .egp-gallery-spotlight .egp-item { grid-column: span 1 !important; }
}

@media (max-width: 480px) {
  .egp-gallery-grid,
  .egp-gallery-spotlight {
    --egp-columns: 1;
    grid-template-columns: 1fr !important;
  }
  .egp-gallery-masonry { column-count: 1; }
  .egp-gallery-spotlight .egp-item { grid-column: span 2 !important; }

  .egp-lb-prev { left: 8px; }
  .egp-lb-next { right: 8px; }
  .egp-lb-stage { padding: 60px 48px 16px; }
}
