/* Mobile contact action. Keep the fixed control out of the way of navigation,
   consent controls and form entry; the body class is the JS-measured state. */
#fw-mobile-cta,
#fw-mobile-cta-hidden {
  display: none;
}

@media (width <= 500px) {
  body.fw-mobile-cta-active:not(.fw-mobile-cta-suspended) {
    padding-bottom: var(--fw-mobile-cta-height, calc(9rem + env(safe-area-inset-bottom)));
    scroll-padding-bottom: var(--fw-mobile-cta-height, 6rem);
  }
  html:has(body.fw-mobile-cta-active:not(.fw-mobile-cta-suspended)) {
    scroll-padding-bottom: var(--fw-mobile-cta-height, 6rem);
  }
  body:has(#fw-mobile-cta-hidden) footer { padding-right: max(60px, env(safe-area-inset-right)); }

  body.fw-mobile-cta-active #fw-mobile-cta {
    position: fixed;
    z-index: 55;
    inset-inline: 0;
    bottom: 0;
    display: block;
    box-sizing: border-box;
    padding: 12px max(16px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    border-top: 1px solid rgba(227, 224, 214, .2);
    background: #2E4053;
    box-shadow: 0 -5px 18px rgba(38, 54, 74, .16);
  }

  #fw-mobile-cta .fw-mobile-cta-intro {
    margin: 0 auto 10px;
    max-width: 640px;
    color: #FFFFFF;
    font: inherit;
    font-size: 14px;
    line-height: 1.4;
    text-align: center;
  }

  .fw-mobile-cta-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 50px;
    align-items: stretch;
    gap: 12px;
    max-width: 640px;
    margin-inline: auto;
  }

  #fw-mobile-cta .fw-mobile-cta-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    min-height: 50px;
    margin: 0;
    padding: 12px;
    border: 1px solid #2F6D8C;
    border-radius: 4px;
    background: #2F6D8C;
    color: #fff;
    font: inherit;
    font-size: clamp(16px, 4.8vw, 22px);
    font-weight: 700;
    line-height: 1.3;
    text-align: center;
    text-decoration: none;
    overflow-wrap: anywhere;
    transition: background-color .18s ease, border-color .18s ease, transform .18s ease;
    -webkit-tap-highlight-color: transparent;
  }

  #fw-mobile-cta .fw-mobile-cta-link:hover {
    border-color: #fff;
    background: #26364A;
    color: #fff;
  }

  .fw-mobile-cta-link:active {
    transform: translateY(1px);
  }

  .fw-mobile-cta-link img,
  .fw-mobile-cta-call img {
    display: block;
    flex-shrink: 0;
    width: 24px;
    height: 24px;
  }

  #fw-mobile-cta .fw-mobile-cta-call {
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-width: 44px;
    min-height: 50px;
    border: 1px solid #9FB0BE;
    border-radius: 4px;
    background: transparent;
    color: #FFFFFF;
    text-decoration: none;
  }

  #fw-mobile-cta .fw-mobile-cta-call:hover { background: #435E74; }

  #fw-mobile-cta :is(a, button):focus-visible,
  #fw-mobile-cta-hidden:focus-visible {
    outline: 3px solid #E3E0D6;
    outline-offset: 3px;
  }

  /* The preview-only status is a compact, text-first fallback when no banner
     is active. The [hidden] attribute remains authoritative. */
  body:not(.fw-mobile-cta-active) #fw-mobile-cta-hidden:not([hidden]) {
    position: fixed;
    z-index: 56;
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    min-width: 44px;
    justify-content: center;
    max-width: min(70vw, 240px);
    padding: 7px 11px;
    border: 1px solid #8F302B;
    border-radius: 50%;
    background: #A83B35;
    color: #fff;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.25;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    overflow-wrap: anywhere;
    box-shadow: 0 2px 9px rgba(38, 54, 74, .2);
  }

  /* In development the consent script creates this control dynamically.
     Lift it above the CTA only while the action is actually occupying space. */
  body.fw-mobile-cta-active:not(.fw-mobile-cta-suspended) #fw-preview-cookie {
    bottom: var(--fw-mobile-cta-cookie-bottom, calc(var(--fw-mobile-cta-height, 0px) + 16px + env(safe-area-inset-bottom)));
  }

  /* CSS fallback for states that may become active before JS updates its class. */
  body.fw-mobile-cta-active:has(.mobile-nav.open),
  html.navigation-ready body.fw-mobile-cta-active:has(#fw-consent-banner:not(.hidden)),
  body.fw-mobile-cta-active:has(input:focus, textarea:focus, select:focus) {
    padding-bottom: 0;
  }

  body.fw-mobile-cta-suspended #fw-mobile-cta,
  body.fw-mobile-cta-suspended #fw-mobile-cta-hidden,
  body:has(.mobile-nav.open) #fw-mobile-cta,
  body:has(.mobile-nav.open) #fw-mobile-cta-hidden,
  html.navigation-ready body:has(#fw-consent-banner:not(.hidden)) #fw-mobile-cta,
  html.navigation-ready body:has(#fw-consent-banner:not(.hidden)) #fw-mobile-cta-hidden,
  body:has(input:focus, textarea:focus, select:focus) #fw-mobile-cta,
  body:has(input:focus, textarea:focus, select:focus) #fw-mobile-cta-hidden {
    display: none !important;
  }

  @media (prefers-reduced-motion: reduce) {
    .fw-mobile-cta-link {
      transition: none;
    }
  }
}
