/**
 * ACF Gallery — Frontend CSS
 */

/* ── Wrapper ──────────────────────────────────────────────────────── */
.dnxte-acf-gallery-wrapper {
  width: 100%;
  position: relative;
  border-radius: inherit;
  overflow: hidden;
}

/* ── Grid Layout ──────────────────────────────────────────────────── */
.dnxte-acf-gallery-grid {
  display: grid;
  grid-template-columns: repeat(var(--acf-columns, 4), 1fr);
  gap: var(--acf-gap, 0px);
  border-radius: inherit;
}

/* ── Masonry Layout ───────────────────────────────────────────────── */
.dnxte-acf-layout-masonry {
  display: block !important;
}

.dnxte-acf-layout-masonry::after {
  content: "";
  display: block;
  clear: both;
}

.dnxte-acf-layout-masonry .dnxte-acf-grid-sizer {
  width: calc((100% - (var(--acf-columns, 4) - 1) * var(--acf-gap, 0px)) / var(--acf-columns, 4));
}

.dnxte-acf-layout-masonry .dnxte-acf-gutter-sizer {
  width: var(--acf-gap, 0px);
}

.dnxte-acf-layout-masonry .dnxte-acf-gallery-item {
  float: left;
  width: calc((100% - (var(--acf-columns, 4) - 1) * var(--acf-gap, 0px)) / var(--acf-columns, 4));
  margin-bottom: var(--acf-gap, 0px);
}

/* ── Justified Layout ─────────────────────────────────────────────── */
.dnxte-acf-layout-justified {
  display: flex !important;
  flex-wrap: wrap;
  gap: var(--acf-gap, 0px);
}

.dnxte-acf-layout-justified .dnxte-acf-gallery-item {
  flex: 1 1 calc((100% - (var(--acf-columns, 4) - 1) * var(--acf-gap, 0px)) / var(--acf-columns, 4));
  aspect-ratio: var(--acf-aspect-ratio, 4/3);
  min-width: 0;
  overflow: hidden;
}

.dnxte-acf-layout-justified .dnxte-acf-gallery-item a {
  display: block;
  height: 100%;
  line-height: 0;
}

.dnxte-acf-layout-justified .dnxte-acf-gallery-item img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
}

.dnxte-acf-layout-justified .dnxte-acf-justified-spacer {
  flex: 1 1 calc((100% - (var(--acf-columns, 4) - 1) * var(--acf-gap, 0px)) / var(--acf-columns, 4));
  height: 0;
  overflow: hidden;
}

/* ── Gallery Item ─────────────────────────────────────────────────── */
.dnxte-acf-gallery-item {
  position: relative;
  overflow: hidden;
  line-height: 0;
  border-radius: inherit;
}

.dnxte-acf-gallery-item img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform 0.4s ease, opacity 0.4s ease, filter 0.4s ease;
  border-radius: inherit;
}

.dnxte-acf-gallery-item a {
  display: block;
  line-height: 0;
  height: 100%;
  width: 100%;
}

/* ── Equal Height ────────────────────────────────────────────────── */
.dnxte-acf-equal-height .dnxte-acf-gallery-item a {
  display: block;
  height: 100%;
}

.dnxte-acf-equal-height .dnxte-acf-gallery-item img {
  height: 100%;
  object-fit: cover;
}

/* ── Aspect Ratios ────────────────────────────────────────────────── */
.dnxte-acf-gallery-grid:not(.dnxte-acf-layout-masonry):not(.dnxte-acf-layout-justified) .dnxte-acf-gallery-item img {
  aspect-ratio: var(--acf-aspect-ratio, auto);
}

.dnxte-acf-gallery-grid[style*="--acf-custom-height"]:not([style*="--acf-custom-height:auto"]) .dnxte-acf-gallery-item img {
  height: var(--acf-custom-height);
  object-fit: cover;
}

/* ── Border Animation (only when enabled) ─────────────────────────── */
.dnxte-acf-border-animation::after {
  content: "";
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  bottom: 10px;
  border: 2px solid #fff;
  border-radius: inherit;
  opacity: 0;
  transition: all 0.4s ease;
  transform: scale(1.1);
  pointer-events: none;
  z-index: 2;
}

.dnxte-acf-border-animation:hover::after {
  opacity: 1;
  transform: scale(1);
}

/* ── Overlay ──────────────────────────────────────────────────────── */
.dnxte-acf-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  background: rgba(0, 0, 0, 0.5);
  pointer-events: none;
  z-index: 1;
}

.dnxte-acf-gallery-item:not(.dnxte-acf-overlay-disabled):hover .dnxte-acf-overlay {
  opacity: 1;
}

/* ── Content Positions (flex-direction: column) ───────────────────── */
/* align-items = horizontal (cross-axis), justify-content = vertical (main-axis) */
.dnxte-acf-content-top-left {
  align-items: flex-start;
  justify-content: flex-start;
  text-align: left;
}
.dnxte-acf-content-top-left .dnxte-acf-overlay-content {
  text-align: left;
}

.dnxte-acf-content-top-right {
  align-items: flex-end;
  justify-content: flex-start;
  text-align: right;
}
.dnxte-acf-content-top-right .dnxte-acf-overlay-content {
  text-align: right;
}

.dnxte-acf-content-center {
  align-items: center;
  justify-content: center;
  text-align: center;
}

.dnxte-acf-content-bottom-left {
  align-items: flex-start;
  justify-content: flex-end;
  text-align: left;
}
.dnxte-acf-content-bottom-left .dnxte-acf-overlay-content {
  text-align: left;
}

.dnxte-acf-content-bottom-right {
  align-items: flex-end;
  justify-content: flex-end;
  text-align: right;
}
.dnxte-acf-content-bottom-right .dnxte-acf-overlay-content {
  text-align: right;
}

/* ── Overlay Icon ─────────────────────────────────────────────────── */
.dnxte-acf-overlay-icon {
  margin-bottom: 10px;
  line-height: 1;
  pointer-events: none;
  display: inline-block;
}

/* ── Overlay Content ──────────────────────────────────────────────── */
.dnxte-acf-overlay-content {
  padding: 10px;
  text-align: center;
  color: #fff;
  line-height: 1.4;
}

.dnxte-acf-overlay-content p {
  margin: 0;
  line-height: 1.4;
}

.dnxte-acf-gallery-caption {
  font-weight: bold;
  font-size: 16px;
  margin-bottom: 5px;
}

.dnxte-acf-gallery-description {
  font-size: 14px;
  opacity: 0.9;
}

/* ── Hover Effects ────────────────────────────────────────────────── */
.dnxte-acf-hover-effect-zoom:hover img {
  transform: scale(1.1);
}

.dnxte-acf-hover-effect-fade:hover img {
  opacity: 0.7;
}

.dnxte-acf-hover-effect-rotate:hover img {
  transform: rotate(5deg) scale(1.1);
}

.dnxte-acf-hover-effect-blur:hover img {
  filter: blur(2px);
}

.dnxte-acf-hover-effect-directional {
  overflow: hidden;
}
.dnxte-acf-hover-effect-directional .dnxte-acf-overlay {
  transform: translateY(100%);
  transition: transform 0.4s ease, opacity 0.3s ease;
}
.dnxte-acf-hover-effect-directional:hover .dnxte-acf-overlay {
  transform: translateY(0);
  opacity: 1;
}

/* ── Notice / Loading ─────────────────────────────────────────────── */
.dnxte-acf-gallery-notice {
  padding: 40px;
  text-align: center;
  color: #666;
  background: #f9f9f9;
  border: 1px dashed #ccc;
  border-radius: 4px;
  line-height: 1.5;
  width: 100%;
}

.dnxte-acf-gallery-loading {
  padding: 40px;
  text-align: center;
  color: #999;
  line-height: 1.5;
}

