/* =========================================================
   Montenegro Listings Theme v3.0.5
   TOC placement + anchor scroll correction
   ========================================================= */

:root {
  --ml-toc-anchor-offset: var(--ml-floating-top-offset, 120px);
}

html {
  scroll-padding-top: var(--ml-toc-anchor-offset) !important;
}

body:not(.wp-admin) :where(main#content, .entry-content, .elementor-widget-container) :where(h1[id], h2[id], h3[id], h4[id], h5[id], h6[id]) {
  scroll-margin-top: var(--ml-toc-anchor-offset) !important;
}

/* TOC must sit directly under the hero/media block. */
body:not(.wp-admin) :where(main#content, .entry-content, .elementor-widget-container) :where(.ek-hero, .ek-hero-image, .ek-image-block, .ek-hero__media) + :where(.ek-faq.eko-toc, .ek-faq--toc),
body:not(.wp-admin) :where(main#content, .entry-content, .elementor-widget-container) :where(.ek-hero, .ek-hero-image, .ek-image-block, .ek-hero__media) + p + :where(.ek-faq.eko-toc, .ek-faq--toc),
body:not(.wp-admin) :where(main#content, .entry-content, .elementor-widget-container) :where(.ek-faq.eko-toc.ml-toc-stick-to-hero, .ek-faq--toc.ml-toc-stick-to-hero) {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

body:not(.wp-admin) :where(main#content, .entry-content, .elementor-widget-container) :where(.ek-faq.eko-toc.ml-toc-stick-to-hero, .ek-faq--toc.ml-toc-stick-to-hero) > details,
body:not(.wp-admin) :where(main#content, .entry-content, .elementor-widget-container) :where(.ek-faq.eko-toc.ml-toc-stick-to-hero, .ek-faq--toc.ml-toc-stick-to-hero) > .ek-container > details {
  margin-top: 0 !important;
}

/* Empty paragraphs created by wpautop between hero and TOC must not create a visual gap. */
body:not(.wp-admin) :where(main#content, .entry-content, .elementor-widget-container) p.ml-empty-between-hero-and-toc {
  display: none !important;
  margin: 0 !important;
  padding: 0 !important;
  height: 0 !important;
  line-height: 0 !important;
}
