/**
 * @file
 * Editor-only overrides for Gutenberg Base theme.
 *
 * Loaded after structural.css in editorSettings.styles to neutralise rules
 * that use viewport units — structural.css uses width:100vw and negative
 * margin-left/right for .alignfull, which works on the frontend (full-page
 * context) but overflows the non-iframe editor canvas (100vw = the entire
 * browser viewport including the admin sidebar).
 *
 * In the editor, "full width" means spanning the editor canvas; the
 * is-layout-constrained CSS generated from globalStyles already handles
 * this correctly via the :not(.alignfull) exclusion rule.
 */

.alignfull {
  width: auto;
  margin-left: 0;
  margin-right: 0;
}

/**
 * Mirror frontend flow/constrained layout gap rules in the editor.
 *
 * On the frontend, GlobalStylesGenerator::generateLayoutGapCss() outputs:
 *   :where(.is-layout-flow) > *     { margin-block-start: 0; ... }        (0,0,0)
 *   :where(.is-layout-flow) > * + * { margin-block-start: 1.5rem; ... }   (0,0,0)
 *
 * In the editor, block-library/reset.css applies:
 *   :where(.editor-styles-wrapper) p { margin: revert; }                  (0,0,1)
 *
 * The p-element selector gives reset.css specificity (0,0,1), which beats the
 * :where()-wrapped layout rules at (0,0,0). Paragraphs therefore get browser-
 * default margins (~1em) instead of the flow gap — no gap at all for the first
 * child and double-margin for adjacent ones.
 *
 * WordPress has this same discrepancy (it also uses :where() for layout CSS)
 * and accepts it. We fix it here so the editor matches the frontend.
 *
 * Omitting :where() from the container class gives specificity (0,1,0), which
 * beats reset.css. Both the reset rule and the sibling gap rule are required:
 * the first zeros all margins, the second restores the gap between siblings.
 */
.is-layout-flow > *,
.is-layout-constrained > * {
  margin-block-start: 0;
  margin-block-end: 0;
}
.is-layout-flow > * + *,
.is-layout-constrained > * + * {
  margin-block-start: var(--wp--style--block-gap, 1.5rem);
  margin-block-end: 0;
}
