/**
 * Clixlogix mobile nav + back-to-top — replaces the old .clx-mob-toggle /
 * .clx-mob-nav drawer and the parent theme's #scrollUp button.
 *
 * Loaded sitewide. Visual rules are scoped to ≤991px (mobile / tablet);
 * desktop (≥992px) sees nothing except the back-to-top.
 *
 * Tokens scoped to the mobile-nav block so they don't fight the existing
 * --clx-orange (#ff6a1c) defined in navbar-new.css.
 */

.clx-burger,
.clx-panel,
.clx-top {
  --clx-mn-orange: #fb6515;
  --clx-mn-orange-shadow: rgba(251, 101, 21, .35);
  --clx-mn-ink: #222;
  --clx-mn-line: #f1f1f1;
  --clx-mn-line-strong: #e3e3e3;
}

/* ===========================================================
   MOBILE (≤ 991px) — burger + slide-in panel
   =========================================================== */
@media (max-width: 991px) {

  /* Hide the OLD mobile UI so it doesn't fight the new one. */
  .clx-mob-toggle,
  .clx-mob-nav { display: none !important; }

  /* Burger trigger */
  .clx-burger {
    position: relative;
    display: block;
    width: 40px; height: 40px;
    border: 0;
    background: transparent;
    cursor: pointer;
    padding: 8px;
    z-index: 1001;
  }
  .clx-burger .lines { position: relative; display: block; width: 100%; height: 100%; }
  .clx-burger .lines span {
    position: absolute; left: 4px; right: 4px;
    height: 2px;
    background: var(--clx-mn-ink);
    border-radius: 2px;
    transition: transform .35s cubic-bezier(.4,0,.2,1),
                top .35s cubic-bezier(.4,0,.2,1),
                opacity .2s linear;
  }
  .clx-burger .lines span:nth-child(1) { top: 7px; }
  .clx-burger .lines span:nth-child(2) { top: 50%; transform: translateY(-50%); }
  .clx-burger .lines span:nth-child(3) { top: auto; bottom: 7px; }
  .clx-burger[aria-expanded="true"] .lines span:nth-child(1) { top: 50%; transform: translateY(-50%) rotate(45deg); }
  .clx-burger[aria-expanded="true"] .lines span:nth-child(2) { opacity: 0; }
  .clx-burger[aria-expanded="true"] .lines span:nth-child(3) { bottom: auto; top: 50%; transform: translateY(-50%) rotate(-45deg); }

  /* Slide-in panel */
  .clx-panel {
    position: fixed; inset: 0;
    background: #fff;
    z-index: 1000;
    display: flex; flex-direction: column;
    transform: translateX(100%);
    transition: transform .42s cubic-bezier(.4,0,.2,1);
    will-change: transform;
    overflow: hidden;
  }
  .clx-panel[hidden] { display: none; }
  body.clx-menu-open { overflow: hidden; }
  body.clx-menu-open .clx-panel { transform: translateX(0); }
  body.clx-menu-open #page,
  body.clx-menu-open .site-main {
    transform: scale(.98);
    opacity: .85;
    transition: transform .35s ease, opacity .35s ease;
  }

  .clx-panel-body {
    flex: 1 1 auto;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    padding: 64px 0 8px;
  }

  /* Reset the menu UL */
  .clx-panel .clx-nav-mobile {
    list-style: none;
    margin: 0;
    padding: 0;
  }
  .clx-panel .clx-nav-mobile > li { border-bottom: 1px solid var(--clx-mn-line); }

  /* Top-level rows */
  .clx-panel .clx-toggle,
  .clx-panel .clx-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 16px 18px;
    background: none;
    border: 0;
    font: 600 16px/1.2 'DM Sans', sans-serif;
    color: var(--clx-mn-ink);
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    box-sizing: border-box;
  }
  .clx-panel .clx-link { font-weight: 600; }
  .clx-panel .chev {
    width: 18px; height: 18px;
    color: #888;
    transition: transform .25s ease, color .25s ease;
    flex: 0 0 auto;
  }
  .clx-panel .clx-acc.expanded > .clx-toggle .chev,
  .clx-panel .clx-acc[aria-expanded="true"] > .clx-toggle .chev {
    transform: rotate(180deg);
    color: var(--clx-mn-orange);
  }

  /* Sub-menu accordion */
  .clx-panel .clx-sub {
    max-height: 0;
    overflow: hidden;
    transition: max-height .35s cubic-bezier(.4,0,.2,1);
    background: #fafafa;
  }
  .clx-panel .clx-acc.expanded > .clx-sub { max-height: 1200px; }
  .clx-panel .clx-sub-item {
    display: block;
    padding: 14px 18px 14px 36px;
    font: 500 15px/1.4 'DM Sans', sans-serif;
    color: #333;
    text-decoration: none;
    border-bottom: 1px solid var(--clx-mn-line);
  }
  .clx-panel .clx-sub-item:last-child { border-bottom: 0; }
  .clx-panel .clx-sub-item.clx-view-all { font-weight: 700; color: var(--clx-mn-orange); }
  .clx-panel .clx-sub-item.clx-view-all span { opacity: .7; margin-left: 6px; }

  /* Active page state — Clx_Mobile_Walker emits these classes when WP
     marks the menu item as current-menu-item / current-menu-ancestor.
     Top-level current item: orange + bold. Top-level ancestor (a parent
     of the current page): orange so the user sees the path. Sub-item
     current: orange + bold + 3px left rail. */
  .clx-panel .clx-link.clx-link--current,
  .clx-panel .clx-toggle.clx-toggle--current {
    color: var(--clx-mn-orange);
    font-weight: 700;
  }
  .clx-panel .clx-sub-item.clx-sub-item--current {
    color: var(--clx-mn-orange);
    font-weight: 700;
    box-shadow: inset 3px 0 0 var(--clx-mn-orange);
  }

  /* Sticky footer */
  .clx-panel-foot {
    flex: 0 0 auto;
    padding: 14px 16px 16px;
    display: flex; flex-direction: column; gap: 12px;
    border-top: 1px solid #eee;
    background: #fff;
  }
  .clx-cta {
    display: block;
    text-align: center;
    background: var(--clx-mn-orange);
    color: #fff;
    font: 700 14px/1 'Cabin', sans-serif;
    letter-spacing: .5px;
    text-transform: uppercase;
    padding: 14px 18px;
    border-radius: 999px;
    text-decoration: none;
    box-shadow: 0 6px 18px var(--clx-mn-orange-shadow);
  }
  .clx-cta:hover, .clx-cta:focus-visible { color: #fff; opacity: .92; }

  .clx-foot-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    flex-wrap: nowrap;
  }
  .clx-foot-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--clx-mn-ink);
    text-decoration: none;
    font: 600 13px/1 'DM Sans', sans-serif;
    white-space: nowrap;
  }
  .clx-foot-link img,
  .clx-foot-link svg { flex: 0 0 auto; }
  .clx-foot-link.clx-tel svg { color: var(--clx-mn-orange); }
  .clx-foot-div {
    display: inline-block;
    width: 1px; height: 18px;
    background: var(--clx-mn-line-strong);
  }
}

/* Hide mobile-only elements on desktop */
@media (min-width: 992px) {
  .clx-burger,
  .clx-panel { display: none !important; }
}

/* ===========================================================
   BACK-TO-TOP (.clx-top) — replaces parent theme #scrollUp
   =========================================================== */
.clx-top {
  position: fixed;
  right: 14px; bottom: 88px;          /* sits above SalesIQ launcher (bottom:14, ~64x64) */
  width: 36px; height: 36px;
  border: 0; border-radius: 50%;
  background: rgba(17, 17, 17, .85);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  -webkit-backdrop-filter: saturate(140%) blur(6px);
  backdrop-filter: saturate(140%) blur(6px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .25);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .25s ease, transform .25s ease, background .2s ease;
  z-index: 990;
}
.clx-top.is-visible { opacity: 1; transform: translateY(0); }
.clx-top:hover,
.clx-top:focus-visible { background: var(--clx-mn-orange); outline: 0; }
@media (min-width: 992px) {
  .clx-top { width: 40px; height: 40px; right: 20px; bottom: 96px; }
}

/* Hide the old #scrollUp from parent theme + child overrides */
#scrollUp { display: none !important; }
