/* BabyLife 2.9.7 — responsive editorial/page hardening.
 * Presentation only: no content/query/SEO/template data is changed.
 */

/* The standard post/page shell must stay centered and fluid at every viewport. */
body.single-post .blsc-content-shell,
body.page:not(.woocommerce-page) .blsc-content-shell {
  width: min(1180px, calc(100% - 32px));
  max-width: 1180px;
  margin-inline: auto;
  min-width: 0;
}

body.single-post .blsc-article,
body.page:not(.woocommerce-page) .blsc-article {
  width: 100%;
  max-width: 1100px;
  min-width: 0;
  margin-inline: auto;
}

body.single-post .entry-content,
body.page:not(.woocommerce-page) .entry-content {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

/* Old Xtra/Codevz/VC/WordPress content can carry fixed pixel widths. */
body.single-post .entry-content > *,
body.page:not(.woocommerce-page) .entry-content > *,
body.single-post .entry-content figure,
body.page:not(.woocommerce-page) .entry-content figure,
body.single-post .entry-content .wp-caption,
body.page:not(.woocommerce-page) .entry-content .wp-caption,
body.single-post .entry-content .vc_row,
body.page:not(.woocommerce-page) .entry-content .vc_row,
body.single-post .entry-content .vc_column_container,
body.page:not(.woocommerce-page) .entry-content .vc_column_container,
body.single-post .entry-content .wpb_wrapper,
body.page:not(.woocommerce-page) .entry-content .wpb_wrapper,
body.single-post .entry-content [class*="cz_"],
body.page:not(.woocommerce-page) .entry-content [class*="cz_"] {
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

/* Never let editorial media define the viewport width. Keep original aspect ratio. */
body.single-post .entry-content img:not(.emoji):not(.wp-smiley),
body.page:not(.woocommerce-page) .entry-content img:not(.emoji):not(.wp-smiley),
body.single-post .entry-content video,
body.page:not(.woocommerce-page) .entry-content video,
body.single-post .entry-content iframe,
body.page:not(.woocommerce-page) .entry-content iframe,
body.single-post .entry-content embed,
body.page:not(.woocommerce-page) .entry-content embed,
body.single-post .entry-content object,
body.page:not(.woocommerce-page) .entry-content object {
  max-width: 100% !important;
  box-sizing: border-box;
}

body.single-post .entry-content img:not(.emoji):not(.wp-smiley),
body.page:not(.woocommerce-page) .entry-content img:not(.emoji):not(.wp-smiley),
body.single-post .entry-content video,
body.page:not(.woocommerce-page) .entry-content video {
  height: auto !important;
}

body.single-post .entry-content figure,
body.page:not(.woocommerce-page) .entry-content figure,
body.single-post .entry-content .wp-caption,
body.page:not(.woocommerce-page) .entry-content .wp-caption {
  margin-inline: auto;
}

body.single-post .entry-content figure > img,
body.page:not(.woocommerce-page) .entry-content figure > img,
body.single-post .entry-content p > img:only-child,
body.page:not(.woocommerce-page) .entry-content p > img:only-child {
  display: block;
  margin-inline: auto;
}

/* Inline legacy width values may be wider than their parent. Clamp, don't rewrite HTML. */
body.single-post .entry-content [style*="width:"],
body.page:not(.woocommerce-page) .entry-content [style*="width:"] {
  max-width: 100% !important;
}

/* Tables scroll inside themselves instead of widening the entire site. */
body.single-post .entry-content .wp-block-table,
body.page:not(.woocommerce-page) .entry-content .wp-block-table,
body.single-post .entry-content .blsc-table-scroll,
body.page:not(.woocommerce-page) .entry-content .blsc-table-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

body.single-post .entry-content table,
body.page:not(.woocommerce-page) .entry-content table {
  max-width: 100%;
}

/* Elementor pages are intentionally full width, but old nested sections must not overflow. */
body.page .blsc-elementor-content,
body.page .blsc-elementor-content > .elementor,
body.page .blsc-elementor-content .elementor,
body.page .blsc-elementor-content .elementor-section-wrap,
body.page .blsc-elementor-content .elementor-section,
body.page .blsc-elementor-content .elementor-container,
body.page .blsc-elementor-content .elementor-column,
body.page .blsc-elementor-content .elementor-widget-wrap,
body.page .blsc-elementor-content .elementor-widget,
body.page .blsc-elementor-content .e-con,
body.page .blsc-elementor-content .e-con-inner {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

@media (max-width: 1100px) {
  body.single-post .blsc-content-shell,
  body.page:not(.woocommerce-page) .blsc-content-shell {
    width: calc(100% - 28px);
  }

  /* Old desktop rows/columns are the common cause of half-screen content on tablets. */
  body.single-post .entry-content > [style*="float"],
  body.page:not(.woocommerce-page) .entry-content > [style*="float"],
  body.single-post .entry-content > .vc_row,
  body.page:not(.woocommerce-page) .entry-content > .vc_row {
    float: none !important;
    margin-inline: auto !important;
  }

  body.single-post .entry-content > [style*="width:"],
  body.page:not(.woocommerce-page) .entry-content > [style*="width:"] {
    width: 100% !important;
  }
}

@media (max-width: 767px) {
  body.single-post .blsc-content-shell,
  body.page:not(.woocommerce-page) .blsc-content-shell {
    width: calc(100% - 20px);
  }

  body.single-post .blsc-article,
  body.page:not(.woocommerce-page) .blsc-article,
  body.single-post .entry-content,
  body.page:not(.woocommerce-page) .entry-content {
    width: 100%;
    max-width: 100%;
  }

  /* Remove old negative margins/offsets only on narrow screens. */
  body.single-post .entry-content > [style*="margin-left"],
  body.single-post .entry-content > [style*="margin-right"],
  body.page:not(.woocommerce-page) .entry-content > [style*="margin-left"],
  body.page:not(.woocommerce-page) .entry-content > [style*="margin-right"] {
    margin-inline: 0 !important;
  }

  body.page .blsc-elementor-content .elementor-section.elementor-section-stretched {
    left: auto !important;
    right: auto !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  body.single-post .entry-content iframe,
  body.page:not(.woocommerce-page) .entry-content iframe {
    width: 100% !important;
  }

  body.single-post .entry-content pre,
  body.page:not(.woocommerce-page) .entry-content pre {
    max-width: 100%;
    overflow-x: auto;
  }
}

@media (max-width: 420px) {
  body.single-post .blsc-content-shell,
  body.page:not(.woocommerce-page) .blsc-content-shell {
    width: calc(100% - 16px);
  }

  body.single-post .entry-content h2,
  body.page:not(.woocommerce-page) .entry-content h2 {
    font-size: clamp(20px, 6vw, 24px);
  }

  body.single-post .entry-content h3,
  body.page:not(.woocommerce-page) .entry-content h3 {
    font-size: clamp(18px, 5.5vw, 21px);
  }
}
