/* Native block alignment: unaligned blocks retain their existing widths.
   Wide retains the existing +200px scale, with a site-width cap and fluid gutters.
   Full-wide sections keep their own background/content width controls. */
.post_content :is(.wp-block-image,.wp-block-gallery,.wp-block-video,.wp-block-embed,.pg-layout,.wp-block-primegear-before-after,.wp-block-primegear-image-hotspot,.pg-compare,.wp-block-table,.wp-block-group,.wp-block-media-text,.pg-caption,.pg-data-bar,.pg-spec,.pg-pros-cons,.pg-rating-chart,.pg-review,.pg-tab,.pg-post-list,.pg-post-list-editor-shell,.pg-box-menu,.pg-caption-block,.pg-caption-box,.pg-accordion,.pg-related-post):is(.alignwide,.alignfull) {
  box-sizing: border-box;
  position: relative;
  left: calc((100% - var(--pg-media-width)) / 2);
  width: var(--pg-media-width);
  max-width: none !important;
  margin-inline: 0 !important;
}
.post_content :is(.wp-block-image,.wp-block-gallery,.wp-block-video,.wp-block-embed,.pg-layout,.wp-block-primegear-before-after,.wp-block-primegear-image-hotspot,.pg-compare,.wp-block-table,.wp-block-group,.wp-block-media-text,.pg-caption,.pg-data-bar,.pg-spec,.pg-pros-cons,.pg-rating-chart,.pg-review,.pg-tab,.pg-post-list,.pg-post-list-editor-shell,.pg-box-menu,.pg-caption-block,.pg-caption-box,.pg-accordion,.pg-related-post).alignwide {
  --pg-media-width: min(var(--pg-wide-width),calc(var(--pg-width-viewport) - var(--pg-width-gutter)*2));
}
.post_content :is(.wp-block-image,.wp-block-gallery,.wp-block-video,.wp-block-embed,.pg-layout,.wp-block-primegear-before-after,.wp-block-primegear-image-hotspot,.pg-compare,.wp-block-table,.wp-block-group,.wp-block-media-text,.pg-caption,.pg-data-bar,.pg-spec,.pg-pros-cons,.pg-rating-chart,.pg-review,.pg-tab,.pg-post-list,.pg-post-list-editor-shell,.pg-box-menu,.pg-caption-block,.pg-caption-box,.pg-accordion,.pg-related-post).alignfull {
  --pg-media-width: var(--pg-width-viewport);
}
.post_content :is(.wp-block-image,.wp-block-video,.wp-block-embed):is(.alignwide,.alignfull) > :is(img,video),
.post_content .wp-block-image:is(.alignwide,.alignfull) > a > img {
  max-width: 100%;
  width: 100%;
  height: auto;
}

/* The existing percentage control sizes the comparison inside its selected
   region. Without alignment its original wrapper sizing remains in force. */
.post_content .pg-before-after-wrap:is(.alignwide,.alignfull) > .pg-before-after {
  width: var(--pg-ba-width,100%);
  margin-inline: auto;
}

/* Release the original inner-frame caps only when the author chooses a wider
   region. Image sizes, chart sizes, columns and card styles remain independent. */
:is(.post_content,.editor-styles-wrapper) .pg-review:is(.alignwide,.alignfull) > .pg-review__inner {
  max-width: 100%;
}
:is(.post_content,.editor-styles-wrapper) .pg-related-post:is(.alignwide,.alignfull) :is(.pg-blogCard,.pg-featureCard) {
  max-width: 100%;
}

/* Constrained groups can use a full-width background while retaining a
   readable text measure. Explicit per-group content sizes still take priority. */
:is(.post_content,.editor-styles-wrapper) .wp-block-group:is(.alignwide,.alignfull) {
  --wp--style--global--content-size: min(var(--pg-content-width),calc(var(--pg-width-viewport) - var(--pg-width-gutter)*2));
  --wp--style--global--wide-size: var(--pg-wide-width);
}
.post_content .wp-block-group.alignfull > .wp-block-group__inner-container {
  max-width: var(--wp--style--global--content-size);
  margin-inline: auto;
}

/* A gallery controls its individual images. A column never opens onto the
   neighbouring column, even when old content contains an alignfull child. */
.post_content .wp-block-gallery .wp-block-image:is(.alignwide,.alignfull),
.post_content .pg-full-wide .pg-full-wide :is(.wp-block-image,.wp-block-gallery,.wp-block-video,.wp-block-embed,.pg-layout,.wp-block-primegear-before-after,.wp-block-primegear-image-hotspot,.pg-compare,.wp-block-table,.wp-block-group,.wp-block-media-text,.pg-caption,.pg-data-bar,.pg-spec,.pg-pros-cons,.pg-rating-chart,.pg-review,.pg-tab,.pg-post-list,.pg-post-list-editor-shell,.pg-box-menu,.pg-caption-block,.pg-caption-box,.pg-accordion,.pg-related-post):is(.alignwide,.alignfull),
.post_content :is(.pg-layout__item,.wp-block-column,.wp-block-media-text__content,.is-layout-flex,.is-layout-grid,.pg-tab__body-item,.pg-accordion__body,.pg-accordion-item__body,.pg-caption-box_content,.pg-caption-box__body) :is(.wp-block-image,.wp-block-gallery,.wp-block-video,.wp-block-embed,.pg-layout,.wp-block-primegear-before-after,.wp-block-primegear-image-hotspot,.pg-compare,.wp-block-table,.wp-block-group,.wp-block-media-text,.pg-caption,.pg-data-bar,.pg-spec,.pg-pros-cons,.pg-rating-chart,.pg-review,.pg-tab,.pg-post-list,.pg-post-list-editor-shell,.pg-box-menu,.pg-caption-block,.pg-caption-box,.pg-accordion,.pg-related-post):is(.alignwide,.alignfull) {
  --pg-media-width: 100%;
  left: 0;
  width: 100%;
  max-width: 100% !important;
  margin-inline: 0 !important;
}

/* The mobile full-size style and scroll track already have their own contract.
   Wide media uses the usual article gutter on phones. */
@media (max-width: 599px) {
  .post_content :is(.wp-block-image,.wp-block-gallery,.wp-block-video,.wp-block-embed,.pg-layout,.wp-block-primegear-before-after,.wp-block-primegear-image-hotspot,.pg-compare,.wp-block-table,.wp-block-group,.wp-block-media-text,.pg-caption,.pg-data-bar,.pg-spec,.pg-pros-cons,.pg-rating-chart,.pg-review,.pg-tab,.pg-post-list,.pg-post-list-editor-shell,.pg-box-menu,.pg-caption-block,.pg-caption-box,.pg-accordion,.pg-related-post).alignwide {
    --pg-media-width: 100%;
  }
  .post_content :is(.wp-block-image,.wp-block-video,.wp-block-embed).is-style-full-size:is(.alignwide,.alignfull) {
    --pg-media-width: var(--pg-width-viewport);
  }
  .post_content :is(.pg-layout__item,.wp-block-column,.wp-block-media-text__content,.is-layout-flex,.is-layout-grid,.pg-tab__body-item,.pg-accordion__body,.pg-accordion-item__body,.pg-caption-box_content,.pg-caption-box__body) :is(.wp-block-image,.wp-block-video,.wp-block-embed).is-style-full-size:is(.alignwide,.alignfull) {
    width: 100%;
    max-width: 100% !important;
    margin-inline: 0 !important;
  }
  .post_content :is(.pg-layout__item,.wp-block-column,.wp-block-media-text__content,.is-layout-flex,.is-layout-grid,.pg-tab__body-item,.pg-accordion__body,.pg-accordion-item__body,.pg-caption-box_content,.pg-caption-box__body) .pg-layout:is(.alignwide,.alignfull)[data-scrollable="1"][data-scroll-mobile="1"] > .pg-layout__track {
    width: 100%;
    max-width: 100%;
    margin-inline: 0;
    padding-inline: 0;
    scroll-padding-inline: 0;
  }
}
@media (min-width: 960px) {
  /* The main column of a sidebar page is not centred in the viewport. */
  .-sidebar-on .post_content :is(.wp-block-image,.wp-block-gallery,.wp-block-video,.wp-block-embed,.pg-layout,.wp-block-primegear-before-after,.wp-block-primegear-image-hotspot,.pg-compare,.wp-block-table,.wp-block-group,.wp-block-media-text,.pg-caption,.pg-data-bar,.pg-spec,.pg-pros-cons,.pg-rating-chart,.pg-review,.pg-tab,.pg-post-list,.pg-post-list-editor-shell,.pg-box-menu,.pg-caption-block,.pg-caption-box,.pg-accordion,.pg-related-post):is(.alignwide,.alignfull) {
    --pg-media-width: 100%;
    left: 0;
    width: 100%;
    max-width: 100% !important;
  }
}

/* Preserve the existing 767px mobile-full option on interactive images.
   Native alignment owns centring, so old negative margins must not add a
   second viewport breakout. Inside columns the parent width remains the cap. */
@media (max-width: 767px) {
  .post_content :is(.pg-before-after-wrap,.pg-hotspot-wrap).is-mobile-full:is(.alignwide,.alignfull) {
    --pg-media-width: var(--pg-width-viewport);
    margin-inline: 0 !important;
  }
  .post_content .pg-before-after-wrap.is-mobile-full:is(.alignwide,.alignfull) > .pg-before-after {
    width: 100%;
  }
  .post_content :is(.pg-layout__item,.wp-block-column,.wp-block-media-text__content,.is-layout-flex,.is-layout-grid,.pg-tab__body-item,.pg-accordion__body,.pg-accordion-item__body,.pg-caption-box_content,.pg-caption-box__body) :is(.pg-before-after-wrap,.pg-hotspot-wrap).is-mobile-full:is(.alignwide,.alignfull) {
    --pg-media-width: 100%;
  }
}

/* Editor canvas, not the browser including its inspector, is the full width.
   Inline-size containment leaves the canvas's natural block height intact. */
.editor-styles-wrapper .is-root-container {
  container-type: inline-size;
  --pg-width-viewport: 100cqw;
}
.editor-styles-wrapper .is-root-container > .wp-block {
  max-width: min(calc(100% - var(--pg-width-gutter)*2),var(--pgt-block-width,840px));
  margin-inline: auto;
}
.editor-styles-wrapper .is-root-container > :is(.alignwide,[data-align="wide"]) {
  width: min(calc(100% - var(--pg-width-gutter)*2),var(--pg-editor-wide-width,var(--pg-wide-width)));
  max-width: var(--pg-editor-wide-width,var(--pg-wide-width)) !important;
  margin-inline: auto !important;
  left: 0;
}
.editor-styles-wrapper .is-root-container > :is(.alignfull,[data-align="full"]) {
  width: 100%;
  max-width: var(--pg-editor-full-width,none) !important;
  margin-inline: auto !important;
  left: 0;
}
/* API v2 puts alignment on an outer editor wrapper; API v3 can put it directly
   on the block. Only nested media needs the breakout calculation. */
.editor-styles-wrapper .wp-block :is(.wp-block-image,.wp-block-gallery,.wp-block-video,.wp-block-embed,.pg-layout,.wp-block-primegear-before-after,.wp-block-primegear-image-hotspot,.pg-compare,.wp-block-table,.wp-block-group,.wp-block-media-text,.pg-caption,.pg-data-bar,.pg-spec,.pg-pros-cons,.pg-rating-chart,.pg-review,.pg-tab,.pg-post-list,.pg-post-list-editor-shell,.pg-box-menu,.pg-caption-block,.pg-caption-box,.pg-accordion,.pg-related-post):is(.alignwide,.alignfull) {
  box-sizing: border-box;
  position: relative;
  --pg-media-width: min(var(--pg-wide-width),calc(var(--pg-width-viewport) - var(--pg-width-gutter)*2));
  left: calc((100% - var(--pg-media-width)) / 2);
  width: var(--pg-media-width);
  max-width: none !important;
  margin-inline: 0 !important;
}
.editor-styles-wrapper .wp-block :is(.wp-block-image,.wp-block-gallery,.wp-block-video,.wp-block-embed,.pg-layout,.wp-block-primegear-before-after,.wp-block-primegear-image-hotspot,.pg-compare,.wp-block-table,.wp-block-group,.wp-block-media-text,.pg-caption,.pg-data-bar,.pg-spec,.pg-pros-cons,.pg-rating-chart,.pg-review,.pg-tab,.pg-post-list,.pg-post-list-editor-shell,.pg-box-menu,.pg-caption-block,.pg-caption-box,.pg-accordion,.pg-related-post).alignfull {
  --pg-media-width: var(--pg-width-viewport);
}
.editor-styles-wrapper .is-root-container > [data-align] > :is(.wp-block-image,.wp-block-gallery,.wp-block-video,.wp-block-embed,.pg-layout,.wp-block-primegear-before-after,.wp-block-primegear-image-hotspot,.pg-compare,.wp-block-table,.wp-block-group,.wp-block-media-text,.pg-caption,.pg-data-bar,.pg-spec,.pg-pros-cons,.pg-rating-chart,.pg-review,.pg-tab,.pg-post-list,.pg-post-list-editor-shell,.pg-box-menu,.pg-caption-block,.pg-caption-box,.pg-accordion,.pg-related-post):is(.alignwide,.alignfull),
.editor-styles-wrapper .pg-post-list-editor-shell .pg-post-list:is(.alignwide,.alignfull),
.editor-styles-wrapper .pg-related-post .pg-related-post:is(.alignwide,.alignfull),
.editor-styles-wrapper .wp-block-gallery .wp-block-image:is(.alignwide,.alignfull),
.editor-styles-wrapper :is([data-type="primegear/layout-item"],[data-type="core/column"],.wp-block-media-text__content,.is-layout-flex,.is-layout-grid,[data-type="primegear/tab-body"],.pg-tab__body-item,.pg-accordion__body,.pg-accordion-item__body,.pg-caption-box_content,.pg-caption-box__body) :is(.wp-block-image,.wp-block-gallery,.wp-block-video,.wp-block-embed,.pg-layout,.wp-block-primegear-before-after,.wp-block-primegear-image-hotspot,.pg-compare,.wp-block-table,.wp-block-group,.wp-block-media-text,.pg-caption,.pg-data-bar,.pg-spec,.pg-pros-cons,.pg-rating-chart,.pg-review,.pg-tab,.pg-post-list,.pg-post-list-editor-shell,.pg-box-menu,.pg-caption-block,.pg-caption-box,.pg-accordion,.pg-related-post):is(.alignwide,.alignfull) {
  --pg-media-width: 100%;
  left: 0;
  width: 100%;
  max-width: 100% !important;
  margin-inline: 0 !important;
}
@media (max-width: 599px) {
  .editor-styles-wrapper .is-root-container > :is(.alignwide,[data-align="wide"]) {
    max-width: 100% !important;
  }
  .editor-styles-wrapper .wp-block :is(.wp-block-image,.wp-block-gallery,.wp-block-video,.wp-block-embed,.pg-layout,.wp-block-primegear-before-after,.wp-block-primegear-image-hotspot,.pg-compare,.wp-block-table,.wp-block-group,.wp-block-media-text,.pg-caption,.pg-data-bar,.pg-spec,.pg-pros-cons,.pg-rating-chart,.pg-review,.pg-tab,.pg-post-list,.pg-post-list-editor-shell,.pg-box-menu,.pg-caption-block,.pg-caption-box,.pg-accordion,.pg-related-post).alignwide {
    --pg-media-width: 100%;
  }
  .editor-styles-wrapper .is-root-container > :is(.wp-block-image,.wp-block-video,.wp-block-embed).is-style-full-size:is(.alignwide,.alignfull),
  .editor-styles-wrapper .is-root-container > :is([data-align="wide"],[data-align="full"]):has(> :is(.wp-block-image,.wp-block-video,.wp-block-embed).is-style-full-size) {
    width: 100%;
    max-width: var(--pg-editor-full-width,none) !important;
  }
  .editor-styles-wrapper .wp-block :is(.wp-block-image,.wp-block-video,.wp-block-embed).is-style-full-size:is(.alignwide,.alignfull) {
    --pg-media-width: var(--pg-width-viewport);
  }
  .editor-styles-wrapper :is([data-type="primegear/layout-item"],[data-type="core/column"],.wp-block-media-text__content,.is-layout-flex,.is-layout-grid,[data-type="primegear/tab-body"],.pg-tab__body-item,.pg-accordion__body,.pg-accordion-item__body,.pg-caption-box_content,.pg-caption-box__body) :is(.wp-block-image,.wp-block-video,.wp-block-embed).is-style-full-size:is(.alignwide,.alignfull) {
    --pg-media-width: 100%;
  }
}

/* These blocks already expose Gutenberg's selected preview device. */
.editor-styles-wrapper .is-root-container > [data-align="wide"]:has(> .is-mobile-full[data-pg-editor-device="mobile"]),
.editor-styles-wrapper .is-root-container > .is-mobile-full[data-pg-editor-device="mobile"].alignwide {
  width: 100%;
  max-width: var(--pg-editor-full-width,none) !important;
}
.editor-styles-wrapper :is(.pg-before-after-block-editor,.pg-hotspot-block-editor).is-mobile-full[data-pg-editor-device="mobile"]:is(.alignwide,.alignfull) {
  --pg-media-width: var(--pg-width-viewport);
}
.editor-styles-wrapper .pg-before-after-block-editor.is-mobile-full[data-pg-editor-device="mobile"]:is(.alignwide,.alignfull) .pg-before-after-editor__canvas,
.editor-styles-wrapper .pg-hotspot-block-editor.is-mobile-full[data-pg-editor-device="mobile"]:is(.alignwide,.alignfull) .pg-hotspot-editor__canvas-wrap {
  width: 100% !important;
}
.editor-styles-wrapper :is([data-type="primegear/layout-item"],[data-type="core/column"],.wp-block-media-text__content,.is-layout-flex,.is-layout-grid,[data-type="primegear/tab-body"],.pg-tab__body-item,.pg-accordion__body,.pg-accordion-item__body,.pg-caption-box_content,.pg-caption-box__body) :is(.pg-before-after-block-editor,.pg-hotspot-block-editor).is-mobile-full[data-pg-editor-device="mobile"]:is(.alignwide,.alignfull) {
  --pg-media-width: 100%;
}
