/*
 * APSAIDAL front-page header switch.
 * 1107 stays in normal flow and never sticks.
 * 715 is rendered independently at body level and is revealed only after
 * the real rendered height of 1107 has been passed.
 */

html body.aps-home-header-stack-enabled header[data-elementor-id="1107"].elementor-location-header {
  position: relative !important;
  top: auto !important;
  right: auto !important;
  bottom: auto !important;
  left: auto !important;
  width: 100% !important;
  transform: none !important;
  z-index: auto !important;
}

html body.aps-home-header-stack-enabled header[data-elementor-id="1107"] [data-settings*='"sticky":"top"'],
html body.aps-home-header-stack-enabled header[data-elementor-id="1107"] .elementor-sticky--active {
  position: relative !important;
  top: auto !important;
  right: auto !important;
  bottom: auto !important;
  left: auto !important;
  width: auto !important;
  transform: none !important;
}

/* Legacy slot inserted during the earlier configuration pass: keep saved content,
 * but never render it. The active 715 is now a body-level sibling. */
html body.aps-home-header-stack-enabled header[data-elementor-id="1107"] .aps-home-global-header-slot {
  display: none !important;
}

html body.aps-home-header-stack-enabled .aps-home-global-overlay[data-aps-home-global-overlay="1"] {
  position: fixed !important;
  top: var(--aps-home-admin-bar-height, 0px) !important;
  right: 0 !important;
  left: 0 !important;
  bottom: auto !important;
  z-index: 10020 !important;
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  transform: translate3d(0, -110%, 0) !important;
  transition:
    transform 220ms ease,
    opacity 150ms ease,
    visibility 0s linear 220ms;
}

html body.aps-home-header-stack-enabled.aps-home-global-header-visible .aps-home-global-overlay[data-aps-home-global-overlay="1"] {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  transform: translate3d(0, 0, 0) !important;
  transition:
    transform 220ms ease,
    opacity 150ms ease,
    visibility 0s linear 0s;
}

/* Elementor's own sticky state inside 715 must not create a second positioning context. */
html body.aps-home-header-stack-enabled .aps-home-global-overlay [data-settings*='"sticky":"top"'],
html body.aps-home-header-stack-enabled .aps-home-global-overlay .elementor-sticky--active {
  position: relative !important;
  top: auto !important;
  right: auto !important;
  bottom: auto !important;
  left: auto !important;
  width: 100% !important;
  transform: none !important;
}

@media (max-width: 1024px) {
  /* Search is a required 715 action on both tablet and phone. */
  header[data-elementor-id="715"] .elementor-widget-icon:has(a[href*="?s="]),
  header[data-elementor-id="715"] .elementor-widget-icon:has(a[href*="/search"]) {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    align-items: center !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  html body.aps-home-header-stack-enabled .aps-home-global-overlay[data-aps-home-global-overlay="1"] {
    transition: none !important;
  }
}


/* Elementor sticky may leave a spacer from an earlier initialization before
 * Core takes ownership. It must never reserve vertical space in the HOME stack. */
html body.aps-home-header-stack-enabled
header[data-elementor-id="1107"] .elementor-sticky__spacer,
html body.aps-home-header-stack-enabled
.aps-home-global-overlay[data-aps-home-global-overlay="1"] .elementor-sticky__spacer {
  display: none !important;
  height: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Safari/tablet guard: HOME itself always owns only its natural rendered height. */
html body.aps-home-header-stack-enabled
header[data-elementor-id="1107"].elementor-location-header {
  min-height: 0 !important;
  margin-bottom: 0 !important;
}
