/* KSP Editorial Wedding Galleries v1.6 — justified copy-width rows, natural ratios */
.ksp-editorial-gallery {
  --ksp-gap: 10px;
  width: 100% !important;
  max-width: none !important;
  margin: 28px 0 40px !important;
  clear: both !important;
}

.ksp-editorial-row {
  display: flex !important;
  flex-wrap: nowrap !important;
  align-items: flex-start !important;
  justify-content: flex-start !important;
  gap: var(--ksp-gap) !important;
  width: 100% !important;
  max-width: none !important;
  margin: 0 0 var(--ksp-gap) !important;
  padding: 0 !important;
}

.ksp-editorial-item {
  flex: 0 0 auto !important;
  min-width: 0 !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  line-height: 0 !important;
  cursor: zoom-in !important;
  overflow: hidden !important;
}

.ksp-editorial-item > figure,
.ksp-editorial-item figure.wp-block-image,
.ksp-editorial-item .wp-block-image {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* JS gives each item the exact width and height required to fill the row while
   preserving its real aspect ratio. No cropping, no squares, no distortion. */
.ksp-editorial-item img,
.ksp-post-content .ksp-editorial-item img,
.et_pb_post_content .ksp-editorial-item img {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  object-fit: contain !important;
  object-position: center center !important;
  aspect-ratio: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  cursor: zoom-in !important;
}

/* Only a true one-photo run is allowed to be narrower than the copy column. */
.ksp-editorial-row[data-count="1"] { justify-content: center !important; }

.ksp-editorial-spacer-hidden { display: none !important; margin: 0 !important; padding: 0 !important; height: 0 !important; }

/* Lightbox */
.ksp-lightbox {
  position: fixed !important;
  inset: 0 !important;
  z-index: 2147483000 !important;
  display: none !important;
  align-items: center !important;
  justify-content: center !important;
  background: rgba(18,17,15,.95) !important;
  padding: 36px 72px !important;
}
.ksp-lightbox.is-open { display: flex !important; }
.ksp-lightbox__image {
  display: block !important;
  width: auto !important;
  height: auto !important;
  max-width: 92vw !important;
  max-height: 90vh !important;
  object-fit: contain !important;
  margin: 0 !important;
  box-shadow: none !important;
}
.ksp-lightbox__close,
.ksp-lightbox__prev,
.ksp-lightbox__next {
  position: absolute !important;
  appearance: none !important;
  border: 0 !important;
  background: transparent !important;
  color: #fff !important;
  cursor: pointer !important;
  font-family: Arial, sans-serif !important;
  line-height: 1 !important;
  box-shadow: none !important;
}
.ksp-lightbox__close { top: 18px !important; right: 24px !important; font-size: 38px !important; }
.ksp-lightbox__prev,
.ksp-lightbox__next { top: 50% !important; transform: translateY(-50%) !important; font-size: 48px !important; padding: 16px !important; }
.ksp-lightbox__prev { left: 12px !important; }
.ksp-lightbox__next { right: 12px !important; }
.ksp-lightbox__count {
  position: absolute !important;
  left: 50% !important;
  bottom: 16px !important;
  transform: translateX(-50%) !important;
  color: rgba(255,255,255,.84) !important;
  font: 500 12px/1.2 Arial,sans-serif !important;
  letter-spacing: .12em !important;
}
body.ksp-lightbox-open { overflow: hidden !important; }

@media (max-width: 980px) {
  .ksp-editorial-gallery { --ksp-gap: 8px; }
}

@media (max-width: 700px) {
  .ksp-editorial-gallery {
    --ksp-gap: 6px;
    width: 100% !important;
    max-width: 100% !important;
    margin: 18px 0 30px !important;
  }
  .ksp-editorial-row {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0,1fr)) !important;
    gap: var(--ksp-gap) !important;
    align-items: start !important;
  }
  .ksp-editorial-row[data-count="1"] { grid-template-columns: 1fr !important; }
  .ksp-editorial-row[data-count="3"] .ksp-editorial-item:nth-child(3) {
    grid-column: 1 / -1 !important;
    width: 50% !important;
    justify-self: center !important;
  }
  .ksp-editorial-item,
  .ksp-editorial-item > figure,
  .ksp-editorial-item figure.wp-block-image,
  .ksp-editorial-item .wp-block-image {
    width: 100% !important;
    height: auto !important;
    max-width: 100% !important;
  }
  .ksp-editorial-item img,
  .ksp-post-content .ksp-editorial-item img,
  .et_pb_post_content .ksp-editorial-item img {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: none !important;
    object-fit: contain !important;
  }
  .ksp-editorial-row[data-count="1"] .ksp-editorial-item { width: 78% !important; justify-self: center !important; }
  .ksp-lightbox { padding: 44px 16px !important; }
  .ksp-lightbox__prev { left: 0 !important; }
  .ksp-lightbox__next { right: 0 !important; }
}
