/* Defaults: any rule directly in ed-utilities wins (nested layer);
   :where() keeps them at zero specificity as a safety net. */
@layer ed-utilities.defaults {
  /* Not a dialog or popover: the user-agent margin: auto is what centers them. */
  [class*='ed-stack'] > :not(:where(dialog, [popover])) {
    margin-block: 0;
    margin-inline: 0;
  }

  :where([class*='ed-stack']) {
    gap: var(--ed-space-4);
    align-items: stretch;
    justify-content: flex-start;
  }
}

@layer ed-utilities {
  [class*='ed-stack'] {
    display: flex;
    flex-direction: column;
  }

  /* The display above beats the user-agent [hidden] rule. until-found hides by content-visibility
     and keeps its box. */
  [class*='ed-stack'][hidden]:not([hidden='until-found' i]) {
    display: none;
  }
}
