/* ============================================================
   ACF Gallery Grid — Public Stylesheet
   ============================================================ */

/* ----- Grid container ----- */
.agg-grid {
  display: grid;
  grid-template-columns: repeat(var(--agg-cols-desktop, 3), 1fr);
  column-gap: var(--agg-gap-h, 16px);
  row-gap: var(--agg-gap-v, 16px);
}

@media (max-width: 1024px) {
  .agg-grid {
    grid-template-columns: repeat(var(--agg-cols-tablet, 2), 1fr);
  }
}

@media (max-width: 767px) {
  .agg-grid {
    grid-template-columns: repeat(var(--agg-cols-mobile, 1), 1fr);
  }
}

/* ----- Item ----- */
.agg-item {
  position: relative;
  overflow: hidden;
  border-radius: 4px;
}

.agg-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

/* ----- Image wrapper + aspect ratio ----- */
.agg-img-wrap {
  position: relative;
  overflow: hidden;
  aspect-ratio: var(--agg-aspect, 1 / 1);
  background: #f0f0f0;
}

.agg-img-wrap[style*="auto"] {
  aspect-ratio: auto;
}

.agg-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: var(--agg-fit, cover);
  object-position: center;
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ----- Overlay ----- */
.agg-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease, background 0.3s ease;
}

.agg-icon {
  width: 28px;
  height: 28px;
  color: #fff;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.4));
  transform: scale(0.8);
  transition: transform 0.3s ease;
}

/* ----- Caption ----- */
.agg-caption {
  margin: 6px 0 0;
  font-size: .85em;
  color: #666;
  text-align: center;
}

/* ----- Hover: zoom ----- */
.agg-hover-zoom .agg-item:hover .agg-img {
  transform: scale(1.08);
}
.agg-hover-zoom .agg-item:hover .agg-overlay {
  opacity: 1;
  background: rgba(0, 0, 0, .25);
}
.agg-hover-zoom .agg-item:hover .agg-icon {
  transform: scale(1);
}

/* ----- Hover: darken ----- */
.agg-hover-darken .agg-item:hover .agg-overlay {
  opacity: 1;
  background: rgba(0, 0, 0, .45);
}
.agg-hover-darken .agg-item:hover .agg-icon {
  transform: scale(1);
}

/* ----- Hover: slide-up ----- */
.agg-hover-slide-up .agg-overlay {
  top: auto;
  height: 50%;
  background: linear-gradient(to top, rgba(0,0,0,.65) 0%, transparent 100%);
  align-items: flex-end;
  padding-bottom: 12px;
  opacity: 0;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.35s ease;
}
.agg-hover-slide-up .agg-item:hover .agg-overlay {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================================
   Lightbox
   ============================================================ */
.agg-lightbox {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 10, .92);
  backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.agg-lightbox.is-open {
  opacity: 1;
  pointer-events: all;
}

.agg-lb-content {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: min(90vw, 1200px);
  max-height: 90vh;
}

.agg-lb-img {
  display: block;
  max-width: 100%;
  max-height: calc(90vh - 60px);
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 24px 80px rgba(0,0,0,.6);
  transition: opacity 0.25s ease;
}

.agg-lb-img.is-loading {
  opacity: 0;
}

.agg-lb-caption {
  margin: 12px 0 0;
  color: rgba(255,255,255,.75);
  font-size: .9em;
  text-align: center;
  max-width: 600px;
}

/* Buttons */
.agg-lb-close,
.agg-lb-prev,
.agg-lb-next {
  position: fixed;
  border: none;
  cursor: pointer;
  background: rgba(255,255,255,.12);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, transform 0.2s ease;
  line-height: 1;
  font-family: inherit;
}

.agg-lb-close:hover,
.agg-lb-prev:hover,
.agg-lb-next:hover {
  background: rgba(255,255,255,.25);
}

.agg-lb-close {
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  font-size: 24px;
}

.agg-lb-prev,
.agg-lb-next {
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  font-size: 32px;
  font-weight: 300;
}

.agg-lb-prev {
  left: 16px;
}

.agg-lb-next {
  right: 16px;
}

.agg-lb-prev:hover { transform: translateY(-50%) translateX(-2px); }
.agg-lb-next:hover { transform: translateY(-50%) translateX(2px); }

@media (max-width: 767px) {
  .agg-lb-prev { left: 8px; }
  .agg-lb-next { right: 8px; }
}

/* Empty / error */
.agg-empty, .agg-error {
  padding: 1em;
  color: #666;
  font-style: italic;
}
