/* New visual builder layout: independent of all legacy .homepage-* selectors. */
.hpb-homepage, .hpb-homepage * { box-sizing:border-box; }
.hpb-homepage { width:100%; min-width:0; }
/* CSS flex is a safe fallback when JavaScript is disabled. */
.hpb-homepage .hpb-layout { display:flex; flex-wrap:wrap; align-items:flex-start; gap:20px; width:100%; }
.hpb-homepage .hpb-module { flex-grow:0; flex-shrink:0; min-width:0; width:auto; position:relative; padding:0 20px 15px; border:1px solid #eee; border-radius:6px; background:#fff; box-shadow:1px 1px 10px #eee; overflow-wrap:break-word; }
/* v11: Consistent H4 spacing within all homepage-builder modules. */
.hpb-homepage .hpb-module h4 { margin-top:20px; margin-bottom:20px; }
.hpb-homepage .hpb-module-unframed { background:transparent; border:0; box-shadow:none; padding:0; }
.hpb-homepage .hpb-module img, .hpb-homepage .hpb-module iframe { max-width:100%; }
/* Heights and positions are computed separately for each module. */
.hpb-homepage .hpb-layout.hpb-is-masonry { display:block; position:relative; height:auto; gap:0; }
.hpb-homepage .hpb-layout.hpb-is-masonry > .hpb-module { position:absolute; margin-left:0; margin-right:0; }
@media (max-width:720px) { .hpb-homepage .hpb-layout { gap:14px; } .hpb-homepage .hpb-module { padding:0 14px 14px; } .hpb-homepage .hpb-module-unframed {padding:0;} }

/* v5: unframed modules (for advertisements / custom embeds): no visible container chrome. */
.hpb-homepage .hpb-layout > .hpb-module.hpb-module-unframed {
  padding:0; border:0; border-radius:0; background:transparent; box-shadow:none;
}
@media (max-width:720px) {
  .hpb-homepage .hpb-layout > .hpb-module.hpb-module-unframed {padding:0;}
}

/* V8: shortcode charts must not draw across neighbouring masonry modules.
 * They are resized by JS after a module has received its final width.
 * clip (not hidden) is a non-scrolling safety net while that redraw runs. */
.hpb-homepage .hpb-layout > .hpb-module:not(.hpb-module-unframed) {
  overflow-x: clip;
}
/* Ads and other deliberately unframed embeds retain their natural overflow. */
.hpb-homepage .hpb-layout > .hpb-module.hpb-module-unframed {
  overflow: visible;
}
.hpb-homepage .hpb-module :where(canvas, svg, video, img) {
  max-width: 100%;
}
.hpb-homepage .hpb-module :where(
  .ew-country-top-chart, #polls-range-chart, .apexcharts-canvas,
  .highcharts-container, .chart-container, .chartjs-render-monitor,
  .js-plotly-plot, .plotly, .echarts-for-react
) {
  min-width: 0;
  max-width: 100%;
}
