/* LCT sticky chrome v20260730k — anti-jitter */
:root{
  --lct-sticky-cta-h: 58px;
  --lct-header-bg: #fff;
}

/* Kill wheel/trackpad "rubber" against sticky header (beats Astro bundle) */
html{
  scroll-behavior: auto !important;
}

/* ===== Desktop sticky header (≥1024px) ===== */
@media (min-width: 1024px){
  .site-header{
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--lct-header-bg);
    /* no transition on layout props */
    box-shadow: none;
  }
  .site-header.is-scrolled{
    box-shadow: 0 4px 12px rgba(0,0,0,.07);
  }
  /* NEVER collapse topbar / logo — causes CLS jitter */
  .site-header .topbar{
    overflow: visible;
    max-height: none;
    opacity: 1;
  }
  .site-header .header__cta{
    display: inline-flex !important;
    align-items: center;
    white-space: nowrap;
  }
  #lct-sticky-cta{ display: none !important; }

  /* Desktop contact FAB: contain paint, no transform transitions */
  #cb-nav.contactbar{
    transition: none !important;
    will-change: auto;
    contain: layout style;
  }
  body.lct-footer-inview #cb-nav.contactbar{
    /* hard hide without anim — avoids opacity flicker mid-scroll */
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }
}

/* tablet */
@media (min-width: 768px) and (max-width: 1023.98px){
  .site-header{
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--lct-header-bg);
  }
  .site-header.is-scrolled{
    box-shadow: 0 4px 12px rgba(0,0,0,.07);
  }
  #lct-sticky-cta{ display: none !important; }

  #cb-nav.contactbar{
    transition: none !important;
  }
  body.lct-footer-inview #cb-nav.contactbar{
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }
}

/* ===== Mobile Sticky CTA (<768px) ===== */
@media (max-width: 767.98px){
  .site-header{
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--lct-header-bg);
  }
  .site-header.is-scrolled{
    box-shadow: 0 4px 12px rgba(0,0,0,.07);
  }

  #lct-sticky-cta{
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 1100;
    display: grid;
    grid-template-columns: 1fr 1fr 1.15fr;
    gap: 8px;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
    background: rgba(255,255,255,.97);
    border-top: 1px solid var(--c-border, #dde6e0);
    box-shadow: 0 -8px 24px rgba(0,0,0,.08);
    transform: translate3d(0, 110%, 0);
    transition: none; /* no slide anim = no jitter feel */
  }
  #lct-sticky-cta.is-visible{
    transform: translate3d(0, 0, 0);
  }
  #lct-sticky-cta a{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    border-radius: 999px;
    font-weight: 700;
    font-size: .88rem;
    text-decoration: none;
    border: 0;
  }
  #lct-sticky-cta .scta--call{
    background: var(--c-bg-soft, #f4f8f5);
    color: var(--c-primary, #0d6e3f);
    border: 1px solid var(--c-primary, #0d6e3f);
  }
  #lct-sticky-cta .scta--zalo{ background: #0068ff; color: #fff; }
  #lct-sticky-cta .scta--quote{ background: var(--c-primary, #0d6e3f); color: #fff; }

  #cb-nav.contactbar{ display: none !important; }

  body.lct-has-sticky-cta main#main,
  body.lct-has-sticky-cta main{
    padding-bottom: calc(var(--lct-sticky-cta-h) + 24px + env(safe-area-inset-bottom, 0px));
  }
  footer.footer,
  .footer{
    padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px)) !important;
  }
  body.lct-has-sticky-cta footer.footer,
  body.lct-has-sticky-cta .footer{
    padding-bottom: calc(var(--lct-sticky-cta-h) + 48px + env(safe-area-inset-bottom, 0px)) !important;
  }

  body.lct-footer-inview #lct-sticky-cta{
    transform: translate3d(0, 110%, 0) !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }
}

@media (prefers-reduced-motion: reduce){
  html{ scroll-behavior: auto !important; }
  .site-header, #lct-sticky-cta, #cb-nav.contactbar{ transition: none !important; }
}
