/* RC8: safe presentation for ordinary native Gutenberg content.
 * The same sheet is loaded in the editor canvas. Saved content is never changed.
 * Named flagship, footer and People compositions retain their own contracts.
 * Defaults have no !important: native authored spacing and type take precedence.
 */

/* An action belongs to the preceding copy. Remove that copy's trailing margin
 * only when an action is its immediate next sibling; use one modest gap, then
 * leave the following paragraph or heading room to start a new thought.
 * Adjacent Button blocks inside one Buttons layout keep core wrapping/gaps.
 */
:is(.entry-content--interior, .editor-styles-wrapper) :is(p, ul, ol):has(+ :is(.wp-block-buttons, .wp-block-button)):not(:where(.bwcet-section *, .bwcet-hero-v1 *, .bwcet-hero *, .bwcet-footer-information *, .site-footer__content *, .bwcet-person-card *, .is-style-person *, .is-style-person-card *)) { margin-block-end: 0; }
:is(.entry-content--interior, .editor-styles-wrapper) :is(p, ul, ol) + :is(.wp-block-buttons, .wp-block-button):not(:where(.bwcet-section *, .bwcet-hero-v1 *, .bwcet-hero *, .bwcet-footer-information *, .site-footer__content *, .bwcet-person-card *, .is-style-person *, .is-style-person-card *)) { margin-block: .75rem 0; }
:is(.entry-content--interior, .editor-styles-wrapper) :is(.wp-block-buttons, .wp-block-button) + p:not(:where(.bwcet-section *, .bwcet-hero-v1 *, .bwcet-hero *, .bwcet-footer-information *, .site-footer__content *, .bwcet-person-card *, .is-style-person *, .is-style-person-card *)) { margin-block-start: 1.75rem; }
:is(.entry-content--interior, .editor-styles-wrapper) :is(.wp-block-buttons, .wp-block-button) + :is(h2, h3, h4, h5, h6):not(:where(.bwcet-section *, .bwcet-hero-v1 *, .bwcet-hero *, .bwcet-footer-information *, .site-footer__content *, .bwcet-person-card *, .is-style-person *, .is-style-person-card *)) { margin-block-start: 2.5rem; }

/* A native Image between prose is a measured pause, not a new decorated card.
 * Whole source images remain uncropped; explicit dimensions, floats, alignment,
 * native lightboxes and author-selected Image styles are retained.
 */
:is(.entry-content--interior, .editor-styles-wrapper) .wp-block-image:not(:where(.alignleft, .alignright, .bwcet-section *, .bwcet-hero-v1 *, .bwcet-hero *, .bwcet-footer-information *, .site-footer__content *, .wp-block-gallery *, .bwcet-person-card *, .is-style-person *, .is-style-person-card *)) { margin-block-end: 2rem; }
:is(.entry-content--interior, .editor-styles-wrapper) :is(p, ul, ol) + :is(.wp-block-image, .wp-block-gallery, .wp-block-media-text):not(:where(.alignleft, .alignright, .bwcet-section *, .bwcet-hero-v1 *, .bwcet-hero *, .bwcet-footer-information *, .site-footer__content *, .bwcet-person-card *, .is-style-person *, .is-style-person-card *)) { margin-block-start: 2rem; }
:is(.entry-content--interior, .editor-styles-wrapper) :is(h2, h3, h4) + :is(.wp-block-image, .wp-block-gallery):not(:where(.alignleft, .alignright, .bwcet-section *, .bwcet-hero-v1 *, .bwcet-hero *, .bwcet-footer-information *, .site-footer__content *, .bwcet-person-card *, .is-style-person *, .is-style-person-card *)) { margin-block-start: 1.25rem; }
:is(.entry-content--interior, .editor-styles-wrapper) :is(.wp-block-image, .wp-block-gallery, .wp-block-media-text) + p:not(:where(.alignleft + *, .alignright + *, .bwcet-section *, .bwcet-hero-v1 *, .bwcet-hero *, .bwcet-footer-information *, .site-footer__content *, .bwcet-person-card *, .is-style-person *, .is-style-person-card *)) { margin-block-start: 1.5rem; }
:is(.entry-content--interior, .editor-styles-wrapper) .wp-block-image:not(:where(.alignleft, .alignright, .bwcet-section *, .bwcet-hero-v1 *, .bwcet-hero *, .bwcet-footer-information *, .site-footer__content *, .wp-block-gallery *, .bwcet-person-card *, .is-style-person *, .is-style-person-card *)) > :is(img, a) { margin-inline: auto; }
:is(.entry-content--interior, .editor-styles-wrapper) .wp-block-image:not(:where(.alignleft, .alignright, .alignwide, .alignfull, .bwcet-section *, .bwcet-hero-v1 *, .bwcet-hero *, .bwcet-footer-information *, .site-footer__content *, .wp-block-gallery *, .bwcet-person-card *, .is-style-person *, .is-style-person-card *)) > a { display: block; width: fit-content; max-width: 100%; }
:is(.entry-content--interior, .editor-styles-wrapper) .wp-block-image:not(:where([class*="is-style-"], .has-custom-border, [style*="border-radius"], .bwcet-section *, .bwcet-hero-v1 *, .bwcet-hero *, .bwcet-footer-information *, .site-footer__content *, .wp-block-gallery *, .bwcet-person-card *, .is-style-person *, .is-style-person-card *)) img { border-radius: 3px; }
:is(.entry-content--interior, .editor-styles-wrapper) .wp-block-image:not(:where(.alignleft, .alignright, .bwcet-section *, .bwcet-hero-v1 *, .bwcet-hero *, .bwcet-footer-information *, .site-footer__content *, .wp-block-gallery *, .bwcet-person-card *, .is-style-person *, .is-style-person-card *)) > figcaption {
  width: fit-content;
  max-width: min(100%, 42rem);
  margin: .75rem auto 0;
  font-size: .8125rem;
  line-height: 1.6;
  text-align: start;
}

/* Native background Groups become modest panels. This replaces a missing
 * padding value; it never adds another wrapper or adds to authored padding.
 * Inline padding longhands/shorthands win normally, including an explicit 0.
 * Existing named panel/section styles keep their deliberate compositions.
 */
:is(.entry-content--interior, .editor-styles-wrapper) .wp-block-group.has-background:not(:where([class*="is-style-"]:not(:where(.is-style-reveal, .is-style-reveal-up, .is-style-reveal-left, .is-style-reveal-right)), .bwcet-section, .bwcet-section *, .bwcet-hero-v1, .bwcet-hero-v1 *, .bwcet-footer-information, .bwcet-footer-information *, .site-footer__content *, .bwcet-person-card, .bwcet-person-card *)) {
  padding: clamp(1.25rem, 4%, 2rem);
  border-radius: 4px;
}
:is(.entry-content--interior, .editor-styles-wrapper) .wp-block-group.has-background .wp-block-group.has-background:not(:where([class*="is-style-"]:not(:where(.is-style-reveal, .is-style-reveal-up, .is-style-reveal-left, .is-style-reveal-right)), .bwcet-section *, .bwcet-hero-v1 *, .bwcet-footer-information *, .site-footer__content *, .bwcet-person-card *)) { padding: 1rem; }
:is(.entry-content--interior, .editor-styles-wrapper) :is(p, ul, ol, .wp-block-buttons) + .wp-block-group.has-background:not(:where(.bwcet-section, .bwcet-section *, .bwcet-hero-v1 *, .bwcet-footer-information *, .site-footer__content *)) { margin-block-start: 2rem; }
:is(.entry-content--interior, .editor-styles-wrapper) .wp-block-group.has-background + :is(p, ul, ol):not(:where(.bwcet-section *, .bwcet-hero-v1 *, .bwcet-footer-information *, .site-footer__content *)) { margin-block-start: 2rem; }
:is(.entry-content--interior, .editor-styles-wrapper) .wp-block-group.has-background:not(:where(.bwcet-section, .bwcet-section *, .bwcet-hero-v1, .bwcet-hero-v1 *, .bwcet-footer-information, .bwcet-footer-information *, .site-footer__content *, .bwcet-person-card, .bwcet-person-card *, .is-style-person, .is-style-person *, .is-style-person-card *)) > :first-child,
:is(.entry-content--interior, .editor-styles-wrapper) .wp-block-group.has-background:not(:where(.bwcet-section, .bwcet-section *, .bwcet-hero-v1, .bwcet-hero-v1 *, .bwcet-footer-information, .bwcet-footer-information *, .site-footer__content *, .bwcet-person-card, .bwcet-person-card *, .is-style-person, .is-style-person *, .is-style-person-card *)) > .wp-block-group__inner-container > :first-child { margin-block-start: 0; }
:is(.entry-content--interior, .editor-styles-wrapper) .wp-block-group.has-background:not(:where(.bwcet-section, .bwcet-section *, .bwcet-hero-v1, .bwcet-hero-v1 *, .bwcet-footer-information, .bwcet-footer-information *, .site-footer__content *, .bwcet-person-card, .bwcet-person-card *, .is-style-person, .is-style-person *, .is-style-person-card *)) > :last-child,
:is(.entry-content--interior, .editor-styles-wrapper) .wp-block-group.has-background:not(:where(.bwcet-section, .bwcet-section *, .bwcet-hero-v1, .bwcet-hero-v1 *, .bwcet-footer-information, .bwcet-footer-information *, .site-footer__content *, .bwcet-person-card, .bwcet-person-card *, .is-style-person, .is-style-person *, .is-style-person-card *)) > .wp-block-group__inner-container > :last-child { margin-block-end: 0; }

/* Infer foreground only for approved semantic palette surfaces, never from
 * arbitrary legacy hex colours or organisational meaning. Native explicit text
 * colours/inline styles retain priority. Nested light panels reset their roles.
 */
@media (forced-colors: none) {
  :where(.entry-content--interior, .editor-styles-wrapper) .wp-block-group.has-background:is(.has-brand-background-color, .has-brand-dark-background-color, .has-ink-background-color, .has-muted-background-color),
  :where(.entry-content--interior, .editor-styles-wrapper) .wp-block-group.is-style-brand-panel {
    color: var(--wp--preset--color--white);
    --bwcet-panel-action-fill: var(--wp--preset--color--accent);
    --bwcet-panel-action-ink: var(--wp--custom--bwcet--accent-foreground, var(--wp--preset--color--brand-dark));
  }
  :where(.entry-content--interior, .editor-styles-wrapper) .wp-block-group.has-background:is(.has-paper-background-color, .has-white-background-color, .has-surface-background-color, .has-line-background-color),
  :where(.entry-content--interior, .editor-styles-wrapper) .wp-block-group:is(.is-style-information, .is-style-notice, .is-style-card, .is-style-panel) {
    color: var(--wp--preset--color--ink);
    --bwcet-panel-action-fill: var(--wp--preset--color--brand);
    --bwcet-panel-action-ink: var(--wp--preset--color--white);
  }
  :where(.entry-content--interior, .editor-styles-wrapper) .wp-block-group.has-background:is(.has-accent-background-color) {
    --bwcet-panel-action-fill: var(--wp--preset--color--white);
    --bwcet-panel-action-ink: var(--wp--preset--color--brand-dark);
  }
  :is(.entry-content--interior, .editor-styles-wrapper) .wp-block-group.has-background:not(:where(.bwcet-section, .bwcet-section *, .bwcet-hero-v1 *, .bwcet-footer-information *, .site-footer__content *)) :where(h1, h2, h3, h4, h5, h6, a:not(.wp-block-button__link):not(.wp-block-file__button), figcaption, cite, summary, .bwcet-person-card__role, .is-style-person > p) { color: inherit; }
  :is(.entry-content--interior, .editor-styles-wrapper) .wp-block-group.has-background:not(:where(.bwcet-section, .bwcet-section *, .bwcet-hero-v1 *, .bwcet-footer-information *, .site-footer__content *)) .wp-block-button:not(.is-style-outline):not(.is-style-action-link) > .wp-block-button__link {
    color: var(--bwcet-panel-action-ink, var(--wp--preset--color--white));
    background: var(--bwcet-panel-action-fill, var(--wp--preset--color--brand));
    border-color: currentColor;
  }
  :is(.entry-content--interior, .editor-styles-wrapper) .wp-block-group.has-background:not(:where(.bwcet-section, .bwcet-section *, .bwcet-hero-v1 *, .bwcet-footer-information *, .site-footer__content *)) .wp-block-button:is(.is-style-outline, .is-style-action-link) > .wp-block-button__link { color: inherit; }
  :is(.entry-content--interior, .editor-styles-wrapper) .wp-block-group.has-background:not(:where(.bwcet-section, .bwcet-section *, .bwcet-hero-v1 *, .bwcet-footer-information *, .site-footer__content *)) .wp-block-button > .wp-block-button__link:hover {
    color: var(--wp--preset--color--brand-dark);
    background: var(--wp--preset--color--white);
    border-color: var(--wp--preset--color--brand-dark);
  }
}

/* Core Grid owns its selected count, responsive minimum and explicit spans.
 * A min-width floor on children of fixed tracks would force page overflow;
 * resetting all grids would erase deliberate editorial placements. Keep those
 * choices and make intrinsic child sizing safe. Core automatic Grid already
 * uses repeat(auto-fill,minmax(min(12rem,100%),1fr)) in WordPress 7.1.
 */
:is(.entry-content--interior, .editor-styles-wrapper) .wp-block-group.is-layout-grid:not(:where(.bwcet-section, .bwcet-section *, .bwcet-hero-v1 *, .bwcet-footer-information *, .site-footer__content *)) > * { min-width: 0; }

/* Render-only marker: native Group/Grid containing simple sibling Covers,
 * no placement/spans/viewport overrides or authored gap. A matching editor-only
 * wrapper marker previews the same layout without saving these classes. The
 * column-count cap is retained while tracks wrap before becoming too narrow.
 * auto-fill keeps an incomplete last row the same scale as complete rows.
 */
:is(.entry-content--interior, .editor-styles-wrapper) .wp-block-group.is-layout-grid.bwcet-compatible-cover-grid:not(.bwcet-compatible-people-grid) {
  --bwcet-cover-grid-count: 3;
  --bwcet-cover-grid-gap: 1.5rem;
  gap: var(--bwcet-cover-grid-gap);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, max(15rem, calc((100% - (var(--bwcet-cover-grid-count) - 1) * var(--bwcet-cover-grid-gap)) / var(--bwcet-cover-grid-count)))), 1fr));
  align-items: stretch;
}
:is(.entry-content--interior, .editor-styles-wrapper) .wp-block-group.is-layout-grid.bwcet-compatible-cover-grid:not(.bwcet-compatible-people-grid).bwcet-cover-grid-2 { --bwcet-cover-grid-count: 2; }
:is(.entry-content--interior, .editor-styles-wrapper) .wp-block-group.is-layout-grid.bwcet-compatible-cover-grid:not(.bwcet-compatible-people-grid).bwcet-cover-grid-4 { --bwcet-cover-grid-count: 4; }
:is(.entry-content--interior, .editor-styles-wrapper) .wp-block-group.bwcet-compatible-cover-grid.bwcet-cover-grid-auto:not(.bwcet-compatible-people-grid) { grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); }

/* Unsized Cover copy in ordinary Columns/Grid gets a quiet card scale. Do not
 * change alignment, image focal position, overlay choice or explicit font sizes.
 * A native selected size may be on the text itself or an ancestor Group/Cover.
 */
:is(.entry-content--interior, .editor-styles-wrapper) :is(.wp-block-columns, .is-layout-grid) .wp-block-cover:not(:where(.bwcet-section *, .bwcet-hero-v1 *, .bwcet-footer-information *, .site-footer__content *, .is-style-person-card, .is-style-person-card *)) { padding: clamp(1rem, 6%, 1.75rem); }
:is(.entry-content--interior, .editor-styles-wrapper) :is(.wp-block-columns, .is-layout-grid) .wp-block-cover :is(h2, h3, h4, h5, h6):not(:where([class*="-font-size"], [style*="font-size"], [class*="-font-size"] *, [style*="font-size"] *, .bwcet-section *, .bwcet-hero-v1 *, .bwcet-footer-information *, .site-footer__content *, .is-style-person-card *)) {
  font-size: 1.375rem;
  line-height: 1.28;
  letter-spacing: -.02em;
  text-wrap: pretty;
  word-break: normal;
  overflow-wrap: break-word;
  margin-block: 0 .75rem;
}
:is(.entry-content--interior, .editor-styles-wrapper) :is(.wp-block-columns, .is-layout-grid) .wp-block-cover p:not(:where([class*="-font-size"], [style*="font-size"], [class*="-font-size"] *, [style*="font-size"] *, .bwcet-section *, .bwcet-hero-v1 *, .bwcet-footer-information *, .site-footer__content *, .is-style-person-card *)) { font-size: 1rem; line-height: 1.6; margin-block: .75rem 0; }

/* Native utilities continue the document rhythm without changing semantics. */
:is(.entry-content--interior, .editor-styles-wrapper) :is(.wp-block-table, .wp-block-file, .wp-block-details) + p:not(:where(.bwcet-section *, .bwcet-hero-v1 *, .bwcet-footer-information *, .site-footer__content *)) { margin-block-start: 1.5rem; }
:is(.entry-content--interior, .editor-styles-wrapper) :is(.wp-block-table, .wp-block-file, .wp-block-details) + :is(h2, h3):not(:where(.bwcet-section *, .bwcet-hero-v1 *, .bwcet-footer-information *, .site-footer__content *)) { margin-block-start: 2.5rem; }

@media (forced-colors: active) {
  :is(.entry-content--interior, .editor-styles-wrapper) .wp-block-group.has-background { outline: 1px solid CanvasText; outline-offset: -1px; }
}
