/* ---------------------------------------------------------------------------
   Mountainside BH — navigation dropdown refinement

   Additive layer over the mirrored Elementor markup. Nothing in the page HTML
   changes; this only restyles the submenus that Elementor already renders.

   Two constraints drive the implementation:
     1. Elementor uses SmartMenus, which sets width/left/max-width as INLINE
        styles, so geometry overrides need !important.
     2. The Symptoms menu has 22 items. As a single column it rendered ~1012px
        tall and ran off the bottom of the viewport. It is switched to a grid.

   Scoped to the desktop horizontal menu only, so the mobile off-canvas menu
   keeps its native single-column behaviour.
--------------------------------------------------------------------------- */

@media (min-width: 1025px) {

  .elementor-nav-menu--main .elementor-nav-menu--dropdown {
    /* panel */
    background: #fff !important;
    border-radius: 16px !important;
    padding: 12px !important;
    margin-top: 12px !important;
    border: 1px solid rgba(34, 34, 34, 0.07) !important;
    box-shadow:
      0 1px 2px rgba(34, 34, 34, 0.04),
      0 12px 24px -8px rgba(34, 34, 34, 0.14),
      0 28px 56px -16px rgba(34, 34, 34, 0.18) !important;

    /* `translate` is animated separately from `transform`, so centring the
       mega panel below does not fight the entrance animation. */
    animation: msbh-drop 0.18s cubic-bezier(0.2, 0.7, 0.3, 1) both;
  }

  @keyframes msbh-drop {
    from { opacity: 0; translate: 0 -8px; }
    to   { opacity: 1; translate: 0 0; }
  }

  /* ---- items ---- */
  .elementor-nav-menu--main .elementor-nav-menu--dropdown li > a {
    position: relative;
    display: flex !important;
    align-items: center;
    border-radius: 10px !important;
    padding: 9px 14px !important;
    font-family: "Manrope", sans-serif;
    font-size: 15px !important;
    line-height: 1.35 !important;
    color: #222 !important;
    background: transparent !important;
    transition: background-color 0.15s ease, color 0.15s ease, padding-left 0.15s ease;

    /* SmartMenus adds .sm-nowrap, which forces white-space:nowrap and made the
       longest disorder names overflow their grid cell and collide with the
       neighbouring column. Let them wrap instead. */
    white-space: normal !important;
    overflow-wrap: anywhere;
    hyphens: none;
  }

  /* the same nowrap has to be cleared on the panel itself */
  .elementor-nav-menu--main .elementor-nav-menu--dropdown,
  .elementor-nav-menu--main .elementor-nav-menu--dropdown li {
    white-space: normal !important;
  }

  /* accent bar that grows in on hover */
  .elementor-nav-menu--main .elementor-nav-menu--dropdown li > a::before {
    content: "";
    position: absolute;
    left: 6px;
    top: 50%;
    width: 3px;
    height: 0;
    border-radius: 3px;
    background: #365C13;
    transform: translateY(-50%);
    transition: height 0.18s ease;
  }

  .elementor-nav-menu--main .elementor-nav-menu--dropdown li > a:hover,
  .elementor-nav-menu--main .elementor-nav-menu--dropdown li > a:focus-visible {
    background: rgba(54, 92, 19, 0.07) !important;
    color: #365C13 !important;
    padding-left: 20px !important;
  }

  .elementor-nav-menu--main .elementor-nav-menu--dropdown li > a:hover::before,
  .elementor-nav-menu--main .elementor-nav-menu--dropdown li > a:focus-visible::before {
    height: 18px;
  }

  /* current page */
  .elementor-nav-menu--main .elementor-nav-menu--dropdown li.current-menu-item > a {
    color: #365C13 !important;
    background: rgba(54, 92, 19, 0.06) !important;
    font-weight: 600;
  }

  /* ---- mega panel: any submenu with 12+ items becomes a 3-column grid ---- */
  .elementor-nav-menu--main .elementor-nav-menu--dropdown:has(> li:nth-child(12)) {
    /* Multi-column rather than grid, for two reasons:
         - the list is alphabetical, and columns flow DOWN then across, which
           keeps the A-Z scan intact;
         - grid couples row heights across columns, so one wrapped label
           ("Post-Traumatic Stress Disorder (PTSD)") punched a blank gap into
           the neighbouring columns. Columns size each item independently. */

    /* Deliberately NOT setting `display` here. SmartMenus closes the panel with
       display:none and opens it with an inline display:block, so a
       `display: block !important` override pinned the panel permanently open.
       column-count applies fine to the block it becomes when opened. */
    column-count: 3;
    column-gap: 10px;

    width: 900px !important;
    max-width: calc(100vw - 48px) !important;
    min-width: 0 !important;

    /* Anchor the panel to the header's inner container rather than the narrow
       <li>. SmartMenus positions it with an INLINE margin-left computed from the
       trigger's offset, and that drifts with viewport width — at ~1250px it put
       the left edge 100px off-screen and clipped the whole first column. The
       containing block only changes if the <li> is static, hence the rule below.
       margin-left must be zeroed or SmartMenus' inline value still applies. */
    /* Stays ABSOLUTE. position:fixed centred it horizontally but destroyed the
       vertical placement: with top:auto a fixed box does NOT fall back to its
       static position here — `top` resolved to the viewport height, dropping the
       whole panel below the fold. Absolute keeps SmartMenus' vertical placement
       under the trigger; only the horizontal drift is corrected, by zeroing the
       inline margin-left and centring on the trigger. */
    left: 50% !important;
    right: auto !important;
    margin-left: 0 !important;
    transform: translateX(-50%);
  }

  /* Give the wide panel a predictable containing block: the centred header
     container. Only the <li> that owns a 12+ item submenu goes static, so the
     small Services dropdown stays anchored under its own parent. */
  /* Nothing here tries to re-parent the containing block any more. The chain is
     li(relative) > ul(relative) > nav > div(relative) > .e-con-inner(relative) —
     .elementor-nav-menu--main is the <nav>, not the <ul>, so a `> li` selector
     never matched, and neutralising the <li> only promotes the <ul>. The panel
     is fixed to the viewport instead, which no ancestor or nav wrap can shift. */

  .elementor-nav-menu--main .elementor-nav-menu--dropdown:has(> li:nth-child(12)) > li {
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
  }

  /* keep long disorder names on one line where they fit */
  .elementor-nav-menu--main .elementor-nav-menu--dropdown:has(> li:nth-child(12)) li > a {
    font-size: 14.5px !important;
    padding: 8px 12px !important;
  }

  /* ---- small panels (e.g. Services) ---- */
  .elementor-nav-menu--main .elementor-nav-menu--dropdown:not(:has(> li:nth-child(12))) {
    min-width: 268px !important;
  }

  /* caret on the open parent */
  .elementor-nav-menu--main .menu-item-has-children > a[aria-expanded="true"] .sub-arrow,
  .elementor-nav-menu--main .menu-item-has-children > a[aria-expanded="true"] i {
    transform: rotate(180deg);
    transition: transform 0.2s ease;
  }
  .elementor-nav-menu--main .menu-item-has-children > a .sub-arrow,
  .elementor-nav-menu--main .menu-item-has-children > a i {
    transition: transform 0.2s ease;
  }
}

/* Narrow desktops: two columns rather than three */
@media (min-width: 1025px) and (max-width: 1200px) {
  .elementor-nav-menu--main .elementor-nav-menu--dropdown:has(> li:nth-child(12)) {
    column-count: 2;
    width: 620px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .elementor-nav-menu--main .elementor-nav-menu--dropdown { animation: none; }
  .elementor-nav-menu--main .elementor-nav-menu--dropdown li > a,
  .elementor-nav-menu--main .elementor-nav-menu--dropdown li > a::before { transition: none; }
}

/* ---------------------------------------------------------------------------
   Blog index (/blog-mountainside/)
   The origin ships that page with an empty .page-content, so the 29 posts had
   no listing. scripts/build-blog-index.mjs injects the cards; this styles them
   to match the site's existing type and brand green.
   --------------------------------------------------------------------------- */
.msbh-blog-index {
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 20px 80px;
}
.msbh-blog-index__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 32px 28px;
}
.msbh-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid #e6eae4;
  border-radius: 14px;
  overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.msbh-card:hover,
.msbh-card:focus-within {
  transform: translateY(-3px);
  border-color: #d2ddc6;
  box-shadow: 0 12px 28px rgba(24, 42, 10, .12);
}
.msbh-card__media {
  display: block;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  background: #eef1ea;
}
.msbh-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.msbh-card__body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 22px 22px 24px;
  flex: 1;
}
.msbh-card__date {
  font-size: 13px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #6d7a67;
}
.msbh-card__title {
  margin: 0;
  font-size: 20px;
  line-height: 1.32;
}
.msbh-card__title a {
  color: #16232b;
  text-decoration: none;
}
.msbh-card__title a:hover,
.msbh-card__title a:focus-visible {
  color: #365C13;
}
.msbh-card__excerpt {
  margin: 0;
  font-size: 15px;
  line-height: 1.6;
  color: #4d5a52;
  /* Keep the grid tidy without truncating the underlying text for crawlers. */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.msbh-card__more {
  margin-top: auto;
  padding-top: 6px;
  font-size: 15px;
  font-weight: 600;
  color: #365C13;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.msbh-card__more span {
  transition: transform .18s ease;
}
.msbh-card:hover .msbh-card__more span {
  transform: translateX(4px);
}
/* The whole card is clickable via the title link; make the focus ring visible. */
.msbh-card a:focus-visible {
  outline: 2px solid #365C13;
  outline-offset: 3px;
}
@media (max-width: 640px) {
  .msbh-blog-index { padding: 32px 16px 56px; }
  .msbh-blog-index__grid { gap: 24px; }
}

/* The bare WordPress template pages (blog index, category and author archives)
   render .page-header with no spacing, so the H1 sits underneath the overlaying
   site header. Affects all 15 of them. */
.site-main > .page-header {
  max-width: 1200px;
  margin: 0 auto;
  padding: 150px 20px 0;
}
.site-main > .page-header .entry-title {
  margin: 0;
  color: #16232b;
  font-size: clamp(32px, 5vw, 46px);
  line-height: 1.15;
}

/* The site header is transparent by design because every Elementor page opens
   on a dark photographic hero. The bare template pages have no hero, so the
   white logo and white nav links rendered white-on-white and the navigation was
   effectively invisible — only the green button showed. Give the header a solid
   backdrop on exactly those pages. */
/* The <header> itself collapses to height 0 — its inner bar is absolutely
   positioned — so painting the background on it does nothing. Target the bar. */
body:has(.site-main > .page-header) .elementor-location-header .main-header {
  background: #16232b;
}

/* ---------------------------------------------------------------------------
   Expanded service-page prose (/denver-dbt-therapy/)
   Injected by scripts/build-dbt-content.mjs. Sized and coloured to sit with the
   Elementor sections above it rather than read as a bolted-on block.
   --------------------------------------------------------------------------- */
.msbh-rich {
  max-width: 1140px;
  margin: 0 auto;
  padding: 8px 20px 56px;
  color: #34423a;
  font-size: 17px;
  line-height: 1.75;
}
.msbh-rich p { margin: 0 0 18px; }
.msbh-rich a { color: #365C13; text-decoration: underline; text-underline-offset: 2px; }
.msbh-rich a:hover, .msbh-rich a:focus-visible { color: #24400c; }
.msbh-rich__h2 {
  margin: 44px 0 16px;
  font-size: clamp(26px, 3.2vw, 34px);
  line-height: 1.25;
  color: #16232b;
}
.msbh-rich__h3 {
  margin: 26px 0 10px;
  font-size: 20px;
  line-height: 1.35;
  color: #16232b;
}
.msbh-rich__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin: 24px 0 8px;
}
.msbh-rich__card {
  background: #f6f8f4;
  border: 1px solid #e4ebdd;
  border-radius: 12px;
  padding: 20px 22px 6px;
}
.msbh-rich__card .msbh-rich__h3 { margin-top: 0; }
.msbh-rich__list { margin: 0 0 20px; padding-left: 22px; }
.msbh-rich__list li { margin-bottom: 10px; }
/* FAQ accordion — native <details>, so it works without JS and stays accessible. */
.msbh-rich__faq { margin-top: 20px; border-top: 1px solid #e4ebdd; }
.msbh-rich__faq details { border-bottom: 1px solid #e4ebdd; }
.msbh-rich__faq summary {
  cursor: pointer;
  list-style: none;
  padding: 18px 40px 18px 0;
  position: relative;
  font-weight: 600;
  font-size: 17px;
  color: #16232b;
}
.msbh-rich__faq summary::-webkit-details-marker { display: none; }
.msbh-rich__faq summary::after {
  content: "";
  position: absolute;
  right: 8px;
  top: 50%;
  width: 9px;
  height: 9px;
  border-right: 2px solid #365C13;
  border-bottom: 2px solid #365C13;
  transform: translateY(-70%) rotate(45deg);
  transition: transform .2s ease;
}
.msbh-rich__faq details[open] summary::after { transform: translateY(-30%) rotate(-135deg); }
.msbh-rich__faq summary:focus-visible { outline: 2px solid #365C13; outline-offset: 2px; }
.msbh-rich__faq details p { margin: 0 0 18px; }
@media (max-width: 640px) {
  .msbh-rich { font-size: 16px; padding-bottom: 40px; }
}
