/* =========================================================
   Montenegro Listings Theme v3.0.7
   Homepage TOC anchor cleanup + hero/TOC docking
   ========================================================= */

/*
 * The homepage previously had its own 120px scroll-margin rules in
 * estate-slim-header-footer.css. Those rules were removed in v3.0.7 so the
 * TOC uses the same anchor behaviour as the pages where it already works.
 */

/* Turquoise border around the complete hero image/media area. */
body:not(.wp-admin) main#content.montenegro-listings-page .ek-hero__media,
body:not(.wp-admin) main#content.ml-homepage .ek-hero__media {
  box-sizing: border-box !important;
  border: 1px solid #00dcff !important;
  margin: 0 !important;
}

/* Ensure the image itself does not create an inline baseline gap. */
body:not(.wp-admin) main#content.montenegro-listings-page .ek-hero__media > img,
body:not(.wp-admin) main#content.ml-homepage .ek-hero__media > img {
  display: block !important;
}

/*
 * Attach the TOC directly to the hero image. Covers direct shortcode output,
 * an optional wpautop paragraph wrapper and the helper class added by v3.0.5.
 */
body:not(.wp-admin) main#content.montenegro-listings-page .ek-hero > .ek-hero__media + :where(.ek-faq.eko-toc, .ek-faq--toc),
body:not(.wp-admin) main#content.montenegro-listings-page .ek-hero > .ek-hero__media + p + :where(.ek-faq.eko-toc, .ek-faq--toc),
body:not(.wp-admin) main#content.montenegro-listings-page .ek-hero :where(.ek-faq.eko-toc.ml-toc-stick-to-hero, .ek-faq--toc.ml-toc-stick-to-hero),
body:not(.wp-admin) main#content.ml-homepage .ek-hero > .ek-hero__media + :where(.ek-faq.eko-toc, .ek-faq--toc),
body:not(.wp-admin) main#content.ml-homepage .ek-hero > .ek-hero__media + p + :where(.ek-faq.eko-toc, .ek-faq--toc) {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

/* Remove only empty wpautop wrappers between hero media and TOC. */
body:not(.wp-admin) main#content.montenegro-listings-page .ek-hero > .ek-hero__media + p:empty,
body:not(.wp-admin) main#content.ml-homepage .ek-hero > .ek-hero__media + p:empty,
body:not(.wp-admin) main#content.montenegro-listings-page .ek-hero > .ek-hero__media + p.ml-empty-between-hero-and-toc,
body:not(.wp-admin) main#content.ml-homepage .ek-hero > .ek-hero__media + p.ml-empty-between-hero-and-toc {
  display: none !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  line-height: 0 !important;
}

/* Remove a possible top margin from the TOC's first structural child. */
body:not(.wp-admin) main#content.montenegro-listings-page .ek-hero :where(.ek-faq.eko-toc, .ek-faq--toc) > details,
body:not(.wp-admin) main#content.montenegro-listings-page .ek-hero :where(.ek-faq.eko-toc, .ek-faq--toc) > .ek-container > details,
body:not(.wp-admin) main#content.ml-homepage .ek-hero :where(.ek-faq.eko-toc, .ek-faq--toc) > details,
body:not(.wp-admin) main#content.ml-homepage .ek-hero :where(.ek-faq.eko-toc, .ek-faq--toc) > .ek-container > details {
  margin-top: 0 !important;
}
