/* =========
   Mobile Premium Sticky Header (MPH) — Nexros/PXL + Elementor hardened
   Fixes:
   - removes *top padding* added by theme when sticky activates (the “gap above header”)
   - removes spacer placeholders + fixes gap below header on scroll
   ========= */

:root{
  --mph-border: rgba(255, 255, 255, 0.10);
  --mph-icon: rgba(255, 255, 255, 0.95);
  --mph-blur: 14px;

  --mph-h: 58px;
  --mph-pad-x: 18px;
}

/* hidden on desktop/tablet by default */
.mph-header,
.mph-menu-screen{
  display: none;
}

@media (max-width: 767.98px){

  /* Hide common theme headers to avoid double-headers */
  body.mph-hide-theme-header header.site-header,
  body.mph-hide-theme-header #masthead,
  body.mph-hide-theme-header header#header,
  body.mph-hide-theme-header header.elementor-location-header,
  body.mph-hide-theme-header .elementor-location-header,
  body.mph-hide-theme-header .site-header,
  body.mph-hide-theme-header .header,
  body.mph-hide-theme-header #header,
  body.mph-hide-theme-header .wp-site-blocks > header{
    display: none !important;
  }

  /* Kill common spacer/placeholder elements that create gaps */
  body.mph-hide-theme-header .header-spacer,
  body.mph-hide-theme-header #header-spacer,
  body.mph-hide-theme-header .site-header-spacer,
  body.mph-hide-theme-header .elementor-header--spacer,
  body.mph-hide-theme-header .elementor-sticky__spacer,
  body.mph-hide-theme-header .sticky-header-spacer,
  body.mph-hide-theme-header .pxl-header-sticky-placeholder,
  body.mph-hide-theme-header .pxl-header-placeholder,
  body.mph-hide-theme-header .pxl-header-space,
  body.mph-hide-theme-header .pxl-header-spacer,
  body.mph-hide-theme-header .pxl-sticky-spacer{
    display: none !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* Core: prevent “gap above header” (theme adds padding-top on scroll) */
  html,
  body{
    padding-top: 0 !important;
    margin-top: 0 !important;
  }
  html.pxl-header-sticky,
  html.pxl-header-sticky body,
  body.mph-hide-theme-header{
    padding-top: 0 !important;
    margin-top: 0 !important;
  }

  /*
    Premium behavior:
    - At the very top of the page: header overlays hero (no spacer) and stays more translucent.
    - After user scrolls: spacer returns (prevents content being hidden) and header becomes slightly more opaque.
    JS toggles .mph-at-top / .mph-scrolled on <html>.
  */
  /* Mobile header (fixed + pinned to top; JS corrects any gap) */
  .mph-header{
    display: block;
    position: fixed;
    top: var(--mph-top, 0px) !important;
    left: 0;
    right: 0;
    z-index: 999999;
    height: var(--mph-h);
    padding-top: 0 !important;
    margin: 0;
    color: var(--mph-icon);
    transform: translate3d(0, var(--mph-nudge, 0px), 0) !important;
    will-change: transform;
  }

  /* Keep layout stable: add a spacer after the fixed header (JS inserts it) */
  .mph-fixed-spacer{
    display:block;
    height: var(--mph-spacer-h, calc(var(--mph-h) + var(--mph-top, 0px)));
    transition: height 220ms ease;
  }
  /* premium glass layer */
  .mph-glass{
    position: absolute;
    inset: 0;
    background: linear-gradient(
      180deg,
      rgba(0,0,0,0.26) 0%,
      rgba(0,0,0,0.14) 68%,
      rgba(0,0,0,0.10) 100%
    );
    border-bottom: 1px solid var(--mph-border);
    -webkit-backdrop-filter: blur(var(--mph-blur));
    backdrop-filter: blur(var(--mph-blur));
    box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  }

  /* Top-most: ultra glassy, lets hero show through */
  html.mph-at-top .mph-glass{
    background: linear-gradient(
      180deg,
      rgba(10,18,35,0.28) 0%,
      rgba(10,18,35,0.14) 72%,
      rgba(10,18,35,0.10) 100%
    );
    box-shadow: 0 8px 26px rgba(0,0,0,0.18);
  }

  /* Scrolled: a touch more readable */
  html.mph-scrolled .mph-glass{
    background: linear-gradient(
      180deg,
      rgba(0,0,0,0.70) 0%,
      rgba(0,0,0,0.48) 70%,
      rgba(0,0,0,0.40) 100%
    );
    box-shadow: 0 12px 34px rgba(0,0,0,0.35);
  }

  .mph-inner{
    position: relative;
    height: var(--mph-h);
    display: flex;
    align-items: center;
    padding: 0 var(--mph-pad-x);
    gap: 12px;
  }

  .mph-spacer{ flex: 1; }

  .mph-brand,
  .mph-menu-btn{
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--mph-icon);
    text-decoration: none;

    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;

    transition: transform 120ms ease;
  }

  .mph-brand:active,
  .mph-menu-btn:active{ transform: scale(0.98); }

  .mph-logo{
    display: block;
    width: 40px;
    height: 40px;
    object-fit: contain;
    transform: translateZ(0);
  }

  /* Right side group: CTA + hamburger */
  .mph-right{
    display: inline-flex;
    align-items: center;
    gap: 10px;
  }

  /* Slim CTA: white bg, black text */
  .mph-cta{
    display: inline-flex;
    align-items: center;
    justify-content: center;

    height: 34px;
    padding: 0 12px;
    border-radius: 999px;

    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: 0.2px;
    white-space: nowrap;

    background: rgba(255,255,255,0.96);
    color: rgba(0,0,0,0.92);
    text-decoration: none;

    border: 1px solid rgba(0,0,0,0.06);
    box-shadow: 0 10px 24px rgba(0,0,0,0.18);

    transition: transform 120ms ease, filter 120ms ease;
  }
  .mph-cta:active{ transform: scale(0.99); }
  .mph-cta:hover{ filter: brightness(1.02); }

  @media (max-width: 360px){
    .mph-cta{ height: 32px; padding: 0 10px; font-size: 12px; }
  }

  /* Dynamic gap fix below header (JS applies negative offset to wrapper under header) */
  .mph-gap-fixed-target{
    margin-top: var(--mph-gap-fix, 0px) !important;
  }

  /* ===== Drawer (hamburger menu) ===== */
  /* ===== Full-screen premium menu screen ===== */
  .mph-menu-screen{
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1000000;
    opacity: 0;
    transform: translateY(-10px) scale(0.985);
    pointer-events: none;
    transition: opacity 220ms ease, transform 260ms cubic-bezier(.2,.8,.2,1);
  }
  .mph-menu-screen[hidden]{ display:none !important; }
  .mph-menu-screen.mph-open{
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
  }

  .mph-menu-bg{
    position: absolute;
    inset: 0;
    background:
      radial-gradient(1200px 700px at 15% -10%, rgba(255,255,255,0.10), rgba(0,0,0,0) 55%),
      radial-gradient(1000px 700px at 85% 0%, rgba(255,255,255,0.08), rgba(0,0,0,0) 50%),
      linear-gradient(180deg, rgba(0,0,0,0.98) 0%, rgba(0,0,0,0.92) 55%, rgba(0,0,0,0.98) 100%);
  }

  .mph-menu-shell{
    position: relative;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    padding:
      calc(14px + env(safe-area-inset-top, 0px))
      22px
      calc(18px + env(safe-area-inset-bottom, 0px));
    color: rgba(255,255,255,0.92);
  }

  .mph-menu-top{
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 56px;
  }
  .mph-menu-brand,
  .mph-menu-close{
    width: 46px;
    height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    border: 0;
    background: transparent;
    color: rgba(255,255,255,0.95);
    text-decoration: none;
    transition: transform 120ms ease, background 160ms ease;
  }
  .mph-menu-close:active,
  .mph-menu-brand:active{ transform: scale(0.98); }

  .mph-menu-content{
    padding-top: 10px;
  }

  .mph-menu{
    list-style: none;
    margin: 0;
    padding: 10px 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
  .mph-menu li{ margin: 0; padding: 0; }

  .mph-menu a{
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px 2px;
    font-size: 18px;
    line-height: 1.25;
    font-weight: 500;
    letter-spacing: 0.1px;
    color: rgba(255,255,255,0.70);
    text-decoration: none;
    transition: color 140ms ease, transform 140ms ease;
  }
  .mph-menu a::after{ content: none; }
  .mph-menu a:active{ transform: translateX(1px); }
  .mph-menu a:hover,
  .mph-menu a:focus{ color: rgba(255,255,255,0.96); }

  .mph-menu-actions{
    margin-top: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding-top: 18px;
  }
  .mph-menu-secondary{
    font-size: 14px;
    font-weight: 500;
    color: rgba(255,255,255,0.62);
    text-decoration: none;
    padding: 6px 2px;
  }
  .mph-menu-secondary:hover{ color: rgba(255,255,255,0.86); }

  .mph-menu-primary{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 44px;
    padding: 0 16px;
    border-radius: 999px;
    background: rgba(255,255,255,0.96);
    color: rgba(0,0,0,0.92);
    font-weight: 700;
    font-size: 15px;
    text-decoration: none;
    border: 1px solid rgba(255,255,255,0.18);
    box-shadow: 0 12px 30px rgba(0,0,0,0.40);
    transition: transform 120ms ease, filter 120ms ease;
  }
  .mph-menu-primary:active{ transform: scale(0.99); }
  .mph-menu-primary:hover{ filter: brightness(1.03); }
}
