/*
 * Dr. Panturu Luxury v1.15.9 - responsive media in imported blog posts.
 * Scoped to single-post article content; does not alter service pages, galleries,
 * the homepage or featured/hero media.
 *
 * The old WPBakery / Classic Editor content can contain images, captions and
 * wrappers with pixel widths. Limiting <img> alone cannot limit those wrappers.
 */
.drp-article-page .drp-longform-grid--article,
.drp-article-page .drp-longform-grid--article > .drp-longform-aside,
.drp-article-page .drp-longform-grid--article > .drp-entry-content {
  min-width: 0;
}

.drp-article-page .drp-longform-grid--article > .drp-entry-content {
  width: 100%;
  max-width: 100%;
  overflow-wrap: anywhere;
}

/* Constrain the imported containers, including their inline width values. */
.drp-article-page .drp-entry-content :is(
  figure,
  picture,
  .wp-caption,
  .wp-block-image,
  .wp-block-gallery,
  .wp-block-columns,
  .wp-block-column,
  .wp-block-group,
  .wp-block-media-text,
  .gallery,
  .gallery-item,
  .wpb_single_image,
  .wpb_wrapper,
  .vc_figure,
  .vc_single_image-wrapper,
  .vc_column-inner,
  .vc_row,
  .wp-block-embed,
  .wp-block-embed__wrapper
) {
  box-sizing: border-box;
  min-width: 0 !important;
  max-width: 100% !important;
}

/* Catch arbitrary imported builder wrappers with pixel dimensions in style=. */
.drp-article-page .drp-entry-content [style*="width" i] {
  min-width: 0 !important;
  max-width: 100% !important;
}

/* Images keep their natural aspect ratio and never grow past the article column. */
.drp-article-page .drp-entry-content img,
.drp-article-page .drp-entry-content picture img {
  box-sizing: border-box;
  min-width: 0 !important;
  max-width: 100% !important;
  height: auto !important;
}

.drp-article-page .drp-entry-content picture {
  display: block;
  max-width: 100% !important;
}

/* Classic Editor captions often carry a fixed inline style="width: ...px". */
.drp-article-page .drp-entry-content .wp-caption {
  width: fit-content !important;
  max-width: 100% !important;
}

/* Gutenberg align-wide/full rules must remain inside the text column. */
.drp-article-page .drp-entry-content :is(
  .wp-block-image.alignwide,
  .wp-block-image.alignfull,
  figure.alignwide,
  figure.alignfull,
  .wp-block-gallery.alignwide,
  .wp-block-gallery.alignfull
) {
  width: 100% !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

/* Media embedded inside figures should adapt to the actual figure width. */
.drp-article-page .drp-entry-content :is(figure, .wp-caption, .vc_figure) img {
  max-width: 100% !important;
}

/* Preserve the intentional crop in Gutenberg cover blocks. */
.drp-article-page .drp-entry-content .wp-block-cover img.wp-block-cover__image-background {
  width: 100%;
  height: 100% !important;
  object-fit: cover;
}

/* Embeds and legacy tables should scroll locally rather than widen the page. */
.drp-article-page .drp-entry-content :is(iframe, object, embed, video, svg) {
  box-sizing: border-box;
  min-width: 0 !important;
  max-width: 100% !important;
}

.drp-article-page .drp-entry-content :is(table, .wp-block-table) {
  max-width: 100% !important;
}

.drp-article-page .drp-entry-content table {
  display: block;
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 820px) {
  /* A 1fr track has an automatic minimum; minmax(0,1fr) cannot be forced
     wider by the intrinsic dimensions of imported image elements. */
  .drp-article-page .drp-longform-grid--article {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  /* Old floated images and captions are easier to read as full-width rows. */
  .drp-article-page .drp-entry-content :is(
    img.alignleft, img.alignright,
    figure.alignleft, figure.alignright,
    .wp-caption.alignleft, .wp-caption.alignright
  ) {
    float: none !important;
    display: block;
    margin-left: auto !important;
    margin-right: auto !important;
    max-width: 100% !important;
  }
}
