/* Opakowania Elementora nie mają wpływu na układ na froncie (widgety mają markup 1:1 z Astro).
   Nie dotyczy edytora — tam zostają zwykłe boksy, żeby działało zaznaczanie elementów. */
body:not(.elementor-editor-active) .elementor,
body:not(.elementor-editor-active) .elementor .e-con,
body:not(.elementor-editor-active) .elementor .e-con-inner,
body:not(.elementor-editor-active) .elementor .elementor-widget,
body:not(.elementor-editor-active) .elementor .elementor-widget-container {
  display: contents;
}

/* Jedyna reguła Astro zależna od bezpośredniego rodzica: `main > .container` (global.css).
   Widget wstawia .container do .elementor-widget-container, więc powtarzamy ją dla tego układu
   (ta sama specyficzność: :where() = 0, div = element). */
:where(body:not(.elementor-editor-active) main .elementor-widget-container) > div.container {
  padding-top: var(--page-top);
  padding-bottom: var(--space-2xl);
}

/* Blok tabeli Gutenberga opakowuje <table> w <figure>; w Astro tabela stoi bezpośrednio w treści. */
.markdown-body figure.wp-block-table {
  margin: 0;
}

/* Reguły sąsiedztwa sekcji dla Elementora (w Astro sekcje są bezpośrednim rodzeństwem, w WP są opakowane w widget/container) */
:is(.e-con, .elementor-widget):has(.page-hero) + :is(.e-con, .elementor-widget) .section {
  padding-top: var(--space-l);
}

:is(.e-con, .elementor-widget):has(.section--sky) + :is(.e-con, .elementor-widget) .section--sky,
:is(.e-con, .elementor-widget):has(.section--sun) + :is(.e-con, .elementor-widget) .section--sun,
:is(.e-con, .elementor-widget):has(.section--rose) + :is(.e-con, .elementor-widget) .section--rose,
:is(.e-con, .elementor-widget):has(.section--light) + :is(.e-con, .elementor-widget) .section--light,
:is(.e-con, .elementor-widget):has(.section--paper) + :is(.e-con, .elementor-widget) .section--paper,
:is(.e-con, .elementor-widget):has(.section--white) + :is(.e-con, .elementor-widget) .section--white {
  padding-top: 0;
}

/* Plakat projektu FAMI w <figure> zachowuje domyślne marginesy przeglądarki z Astro (w Elementorze figure ma margin: 0) */
figure.project-poster-wrap {
  margin: 1em 40px !important;
}
