/*!
 * Stepping Stone - sticky header and navigation ergonomics.
 */

/*
 * Sticky belongs on the Theme Builder WRAPPER, not on the header bar inside it.
 * A sticky element is constrained by its containing block, and that wrapper is
 * exactly the height of the bar - so sticking the bar to it buys zero travel
 * and the header just scrolls away, looking like sticky "did not work". The
 * wrapper's own parent is <body>, which spans the document, so it has the whole
 * page to travel through.
 */
.elementor-location-header {
  position: sticky;
  top: 0;
  z-index: 1000;
}

/*
 * THE SCROLLED STATE.
 *
 * The bar used to carry an opaque #060010 ground and a permanent hairline, and
 * it looked identical whether it was resting at the top of the page or pinned
 * over moving content. Pinned, that reads badly: the page ground is *almost*
 * the same near-black but never exactly (sections sit on #0B0520 and #120A2A),
 * so the bar showed up as a slightly-wrong rectangle pasted over the page, and
 * any line of copy passing beneath it was guillotined mid-x-height against a
 * hard edge.
 *
 * So the ground moves here and becomes a state. At rest the bar is transparent
 * over the body's own #060010 - visually identical to before, because nothing
 * is behind it yet - and carries no rule, which lets the hero read edge to
 * edge. Once anything is actually passing underneath, it becomes the system's
 * glass panel: the ground at 72% with a real backdrop blur, plus the #241A3F
 * hairline. Copy dissolves into the blur instead of being cut, and the rule
 * appears at the moment it has something to separate.
 *
 * 72% is the floor that keeps the white labels legible over the worst backdrop
 * on the site: a white client logo blurred under it lands near #4C4757, which
 * still holds white text well past AA.
 *
 * The bar is NOT condensed on scroll, deliberately. A sticky element keeps its
 * space in the flow, so shrinking it while pinned drags every following section
 * up by the difference - a visible jolt mid-scroll. Condensing properly would
 * mean a fixed header plus a spacer, which is a rebuild this does not need.
 */
/*
 * The doubled-up selectors are not decoration. The ground being replaced here
 * is set twice by Elementor at 0,2,0 - `.elementor-15:not(...)` in post-15.css
 * (the header template's document background) and `.elementor .s-site-header`
 * in the v4 atomic styles - so a single class would silently lose. `body .x .y`
 * clears both without reaching for !important.
 */
body .elementor.elementor-location-header {
  background-color: transparent;
  border-block-end: 1px solid transparent;
  transition:
    background-color 220ms ease,
    backdrop-filter 220ms ease,
    -webkit-backdrop-filter 220ms ease,
    border-color 220ms ease;
}

body .elementor.elementor-location-header.is-stuck {
  background-color: rgba(6, 0, 16, 0.72);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  backdrop-filter: blur(18px) saturate(1.4);
  border-block-end-color: #241A3F;
}

/* Without backdrop-filter, a 72% wash over unblurred content is just muddy and
   hard to read, so fall back to the opaque ground. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  body .elementor.elementor-location-header.is-stuck {
    background-color: #060010;
  }
}

@media (prefers-reduced-motion: reduce) {
  body .elementor.elementor-location-header {
    transition: none;
  }
}

/*
 * The 1px probe that tells the header when it has left the top of the document.
 * An IntersectionObserver on this costs nothing per frame, unlike a scroll
 * listener; position: absolute keeps it out of <body>'s column flex flow so it
 * adds no height. (CSS scroll-driven animation would remove the JS entirely,
 * but it is still missing from the older iOS Safari this site's visitors run.)
 */
.ssp-header-sentinel {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

/*
 * The kit stylesheet (post-10.css) ships `body { overflow-x: hidden !important }`
 * on small screens. That makes <body> a scroll container, which silently
 * disables position: sticky for every descendant - so the header would pin on
 * desktop and fail on phones.
 *
 * `clip` clips identically WITHOUT establishing a scroll container. The
 * !important is only here to outrank the kit's own !important, not by habit.
 * Measured at 390px: scrollWidth equals clientWidth, so nothing actually
 * overflows and the guard is precautionary - kept rather than deleted because
 * proving that for every template would take an audit this change does not need.
 */
html body {
  overflow-x: clip !important;
  overflow-y: visible;
}

/*
 * The same kit stylesheet sets `body, html { height: 100% }` (commented there as
 * "Ensure footer stays at the bottom of the page"). That caps <body> at the
 * viewport height, and a sticky element cannot travel outside its containing
 * block - so the header pinned for the first screenful and then slid away,
 * which looks exactly like sticky working intermittently.
 *
 * min-height preserves the intent: <body> is a column flex container, so it
 * still fills the viewport on a short page like /thank-you/ and keeps the
 * footer down there, while being free to grow on a long page so the header can
 * stay pinned the whole way. `html body` outranks the kit's `body, html` on
 * specificity, so this needs no !important.
 */
html body {
  height: auto;
  min-height: 100%;
}

/*
 * The bar's own ground is cleared so the wrapper above can own it as a state.
 * This overrides a background set on the element in Elementor: the resting and
 * scrolled grounds are two values that the editor has no way to express, so the
 * header's ground lives in this file, not in the header template. Changing the
 * background in Elementor will have no visible effect.
 *
 * Depth here is light, not shadow, so the pinned bar takes a hairline and never
 * a drop shadow.
 */
body .elementor .elementor-element-site-header {
  background-color: transparent;
}

/* Anchored jumps must not land underneath the sticky bar. */
html {
  scroll-padding-top: 108px;
}

@media (max-width: 767px) {
  html {
    scroll-padding-top: 88px;
  }
}

/*
 * Touch targets. The burger rendered at 33x33 and the dropdown links at 40px;
 * 44x44 is the floor for a tap that lands reliably. Only the hit area grows -
 * the burger glyph itself is unchanged.
 */
.elementor-menu-toggle {
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.elementor-nav-menu--dropdown a.elementor-item,
.elementor-nav-menu--dropdown a.elementor-sub-item {
  min-height: 44px;
  display: flex;
  align-items: center;
}

/*
 * A dark ground eats the default focus ring, and the nav is the one place a
 * keyboard user cannot afford to lose their position.
 */
.elementor-menu-toggle:focus-visible,
.elementor-nav-menu a:focus-visible,
.s-header-cta:focus-visible,
.s-header-logo:focus-visible {
  outline: 2px solid #FF9FFC;
  outline-offset: 3px;
  border-radius: 4px;
}

/*
 * The mobile dropdown shipped as Elementor's default: a ~76px white box floating
 * mid-header, clipping "Services" and wrapping "About Us" onto two lines. On a
 * near-black violet site that reads as broken, not merely unstyled.
 *
 * It is rebuilt here as a full-width panel dropping from the bottom edge of the
 * bar. `top: 100%` needs the bar itself as the offset parent, hence the
 * position: relative below - that is on the BAR, not on the sticky wrapper, so
 * it does not disturb the stickiness.
 */
.elementor-element-site-header {
  position: relative;
}

@media (max-width: 767px) {
  /*
   * Elementor makes the nav widget position: relative, and the atomic layout
   * containers around it are relative too, so an absolutely positioned dropdown
   * anchors to a 44px-wide box instead of the bar. Neutralising those inside the
   * header - on mobile only - hands the containing block to the bar itself, so
   * `top: 100%` lands exactly on its bottom edge and left/right: 0 span its full
   * width. Nothing else inside the header is absolutely positioned, so there is
   * nothing else for this to affect. The alternative was position: fixed with a
   * hardcoded top offset, which breaks under the logged-in admin bar.
   */
  .elementor-element-site-header .e-con,
  .elementor-element-header-nav {
    position: static;
  }

  .elementor-location-header .elementor-nav-menu--dropdown {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    /* Elementor ships a margin on the dropdown, which left a strip of the hero
       showing between the bar and the panel. */
    margin: 0;
    background-color: #0B0520;
    border-block-end: 1px solid #241A3F;
  }

  .elementor-location-header .elementor-nav-menu--dropdown a.elementor-item {
    justify-content: flex-start;
    padding: 14px 24px;
    color: #FFFFFF;
    border-block-end: 1px solid #241A3F;
    white-space: nowrap;
  }

  /* The kit's global a:hover turns links pink; pin the label on every state so
     a tapped row reads as a row, not as a colour change. */
  .elementor-location-header .elementor-nav-menu--dropdown a.elementor-item:hover,
  .elementor-location-header .elementor-nav-menu--dropdown a.elementor-item:focus,
  .elementor-location-header .elementor-nav-menu--dropdown a.elementor-item.elementor-item-active {
    color: #FFFFFF;
    background-color: #1A1038;
  }

  .elementor-location-header .elementor-nav-menu--dropdown li:last-child a.elementor-item {
    border-block-end: 0;
  }
}