.wdfg {
  --wdfg-forest: var(--ap-forest, #1f3a2c);
  --wdfg-deep: var(--ap-deep, #0e1d17);
  --wdfg-ivory: var(--ap-ivory, #f5f1e6);
  --wdfg-bronze: var(--ap-bronze-l, #d2b48c);
  --wdfg-ink: var(--ap-ink, #17241d);
  --wdfg-serif: var(--ap-serif, "Cormorant Garamond", Georgia, serif);
  --wdfg-sans: var(--ap-sans, "Manrope", system-ui, sans-serif);
  --wdfg-ease: var(--ap-ease-out, cubic-bezier(.16, 1, .3, 1));
  box-sizing: border-box;
  container: wdfg / inline-size;
  margin-block: clamp(1.25rem, 4vw, 3.5rem);
  padding: clamp(1rem, 4vw, 3.5rem);
  background: transparent;
  font: 400 1rem/1.5 var(--wdfg-sans);
}

.wdfg .wdfg-empty {
  margin: 0;
  padding: 1.1rem;
  border: 1px dashed rgb(210 180 140 / 48%);
  border-radius: .8rem;
}

.wdfg-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: clamp(.65rem, 1.6vw, 1.2rem);
}

@media (max-width: 767px) {
  /* More specific than the shared card display rule below, regardless of source order. */
  .wdfg .wdfg-card.wdfg-desktop-only { display: none; }

  /* Elementor's wrapped column can size the sheet before the gallery's rows are resolved. */
  .ap-sheet.e-con-boxed > .e-con-inner:has(> .elementor-widget-shortcode .wdfg) {
    flex-wrap: nowrap;
  }
}

.wdfg .wdfg-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  border-radius: clamp(.6rem, 1.4vw, 1rem);
  background: var(--wdfg-ivory);
  color: var(--wdfg-ink);
  box-shadow: 0 1rem 2rem -1.2rem rgb(0 0 0 / 55%);
}

.wdfg .wdfg-media {
  position: relative;
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--wdfg-forest);
  color: var(--wdfg-ink);
  cursor: zoom-in;
}

.wdfg-thumbnail {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.wdfg .wdfg-thumbnail img {
  --wdfg-thumbnail-size: 100%;
  position: absolute;
  top: calc((100% - var(--wdfg-thumbnail-size)) / 2);
  left: calc((100% - var(--wdfg-thumbnail-size)) / 2);
  display: block;
  width: var(--wdfg-thumbnail-size);
  height: var(--wdfg-thumbnail-size);
  max-width: none;
  max-height: none;
  object-fit: cover;
  filter: saturate(.92) contrast(1.03);
}

.wdfg .wdfg-media::after {
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 14%);
  pointer-events: none;
  content: "";
}

.wdfg .wdfg-zoom {
  position: absolute;
  top: .55rem;
  right: .55rem;
  display: grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  border-radius: 50%;
  background: var(--wdfg-ivory);
  color: var(--wdfg-ink);
  font: 600 1.35rem/1 var(--wdfg-sans);
  box-shadow: 0 .15rem .55rem rgb(0 0 0 / 22%);
}

.wdfg .wdfg-card figcaption {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: .15rem .5rem;
  margin: 0;
  padding: .55rem clamp(.55rem, 1.5vw, 1rem);
  color: var(--wdfg-ink);
}

.wdfg-card strong {
  font: 700 clamp(1.2rem, 2.1vw, 1.6rem)/1.1 var(--wdfg-serif);
}

.wdfg-card time {
  font-size: .76rem;
  font-variant-numeric: tabular-nums;
}

@container wdfg (min-width: 300px) {
  .wdfg-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wdfg-odd .wdfg-card:first-child { grid-column: 1 / -1; }
  .wdfg-single { grid-template-columns: minmax(0, min(100%, 36rem)); }

  @media (max-width: 767px) {
    .wdfg-mobile-odd .wdfg-card:first-child { grid-column: 1 / -1; }
    .wdfg-mobile-even .wdfg-card:first-child { grid-column: auto; }
  }
}

@container wdfg (min-width: 700px) {
  .wdfg-staggered {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding-bottom: clamp(2.5rem, 9cqw, 8.75rem);
  }

  .wdfg-staggered.wdfg-odd .wdfg-card:first-child { grid-column: auto; }
  .wdfg-staggered .wdfg-card { position: relative; top: var(--wdfg-column-a, 0px); }
  .wdfg-staggered .wdfg-card:nth-child(3n+2) {
    top: calc(clamp(2.5rem, 9cqw, 8.75rem) + var(--wdfg-column-b, 0px));
  }
  .wdfg-staggered .wdfg-card:nth-child(3n) { top: var(--wdfg-column-c, 0px); }
}

.wdfg .wdfg-media:focus-visible,
.wdfg .wdfg-dialog button:focus-visible {
  outline: 3px solid var(--wdfg-bronze);
  outline-offset: -4px;
}

.wdfg .wdfg-dialog:not([open]) { display: none; }

.wdfg .wdfg-dialog {
  position: fixed;
  inset: 0;
  box-sizing: border-box;
  width: min(94vw, 52rem);
  max-width: none;
  max-height: min(92vh, 58rem);
  max-height: min(92dvh, 58rem);
  margin: auto;
  padding: 0;
  overflow: auto;
  border: 1px solid var(--wdfg-bronze);
  border-radius: 1rem;
  background: var(--wdfg-deep);
  color: var(--wdfg-ivory);
}

.wdfg-dialog::backdrop { background: rgb(8 15 11 / 86%); }

.wdfg-dialog-panel { padding: clamp(.65rem, 2vw, 1.25rem); }

.wdfg-dialog-top, .wdfg-dialog-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .45rem;
}

.wdfg .wdfg-dialog-caption {
  margin: 0;
  color: var(--wdfg-ivory);
  font: 700 clamp(1.2rem, 4vw, 1.8rem)/1.1 var(--wdfg-serif);
}

.wdfg-dialog-image {
  display: grid;
  min-height: 0;
  margin-block: .55rem;
  place-items: center;
  background: var(--wdfg-deep);
}

.wdfg-dialog-image img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 65vh;
  max-height: 65dvh;
  object-fit: contain;
}

.wdfg .wdfg-dialog button {
  min-width: 44px;
  min-height: 44px;
  margin: 0;
  padding: .4rem .65rem;
  border: 1px solid rgb(210 180 140 / 50%);
  border-radius: .65rem;
  background: var(--wdfg-forest);
  color: var(--wdfg-ivory);
  font: 700 .83rem/1.1 var(--wdfg-sans);
  cursor: pointer;
}

.wdfg .wdfg-dialog [data-wdfg-close] { font-size: 1.5rem; }
.wdfg .wdfg-dialog button:disabled { opacity: .45; cursor: default; }
.wdfg-dialog-controls [data-wdfg-counter] { font-size: .8rem; white-space: nowrap; }

@media (hover: hover) {
  .wdfg .wdfg-media:hover img { filter: saturate(1.05); }
  .wdfg .wdfg-media:hover .wdfg-zoom { background: var(--wdfg-bronze); }
}

@media (prefers-reduced-motion: no-preference) {
  .wdfg .wdfg-reveal {
    clip-path: inset(0 round 0);
    transition: clip-path 1.6s cubic-bezier(.87, 0, .13, 1);
  }

  .wdfg .wdfg-pending:not(:focus-within) {
    clip-path: inset(12% 8% round 14px);
    transition: none;
  }

  .wdfg .wdfg-reveal:focus-within { transition: none; }

  .wdfg-thumbnail {
    transform: translateY(var(--wdfg-image-y, 0%)) scale(var(--wdfg-image-scale, 1));
    transition: scale 1.2s var(--wdfg-ease);
  }

  .wdfg .wdfg-thumbnail img { transition: filter .8s ease; }
}

@media (prefers-reduced-motion: no-preference) and (hover: hover) {
  .wdfg .wdfg-media:hover .wdfg-thumbnail { scale: 1.04; }
}
