/* ---------------------------------------------------------------
   Mobile image fixes - martynwhite.co (11 Jul 2026)
   1. Single images: figure had an explicit width:860px so it could not
      shrink. min() lets it shrink but keeps the 860px desktop cap.
   2. Kadence galleries: masonry JS not loading; items stuck at a fixed
      width with max-width:none. Forced to stack.
      NB: the gallery <ul> has a -5px negative margin that cancels the
      5px item padding. Do NOT zero it, or gallery images end up 10px
      narrower than the single images.
   --------------------------------------------------------------- */

figure.wp-block-image,
.entry-content figure.wp-block-image,
.wp-block-post-content figure.wp-block-image {
  width: auto !important;
  max-width: min(100%, 860px) !important;
}

figure.wp-block-image img,
.entry-content figure.wp-block-image img {
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
}

@media (max-width: 767px) {
  .kb-gallery-ul,
  ul[class*="kb-gallery"] {
    display: flex !important;
    flex-wrap: wrap !important;
  }
  .kb-gallery-ul .kadence-blocks-gallery-item,
  ul[class*="kb-gallery"] .kadence-blocks-gallery-item {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
    position: relative !important;
    top: auto !important;
    left: auto !important;
    transform: none !important;
  }
  .kb-gallery-type-masonry { height: auto !important; }
  .kb-gallery-ul .kb-gallery-image-contain,
  .kb-gallery-ul .kadence-blocks-gallery-intrinsic,
  .kb-gallery-ul .kb-gal-image-radius,
  .kb-gallery-ul figure,
  .kb-gallery-ul img,
  ul[class*="kb-gallery"] img {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .kb-gallery-ul,
  ul[class*="kb-gallery"] {
    display: flex !important;
    flex-wrap: wrap !important;
  }
  .kb-gallery-ul .kadence-blocks-gallery-item,
  ul[class*="kb-gallery"] .kadence-blocks-gallery-item {
    width: 50% !important;
    max-width: 50% !important;
    flex: 0 0 50% !important;
    position: relative !important;
    top: auto !important;
    left: auto !important;
    transform: none !important;
  }
  .kb-gallery-type-masonry { height: auto !important; }
  .kb-gallery-ul .kb-gallery-image-contain,
  .kb-gallery-ul .kb-gal-image-radius,
  .kb-gallery-ul img {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
  }
}

/* Rebecca Moses homepage/archive thumbnail: keep head in frame on wide cards (21 Jul 2026) */
.post-6382 .wp-block-post-featured-image img {
  object-position: 50% 12%;
}