/* Forest Finance mobile stability v0.51.30.
 * Final, deliberately narrow corrections for the mobile navigation viewport
 * and heading wrapping. Desktop presentation remains unchanged. */

/* Headings must wrap between words. The shared legacy resilience rule also
 * targets paragraphs and controls, so this heading-only correction is loaded
 * last rather than changing that broader rule. */
.ffw-site :is(h1, h2, h3, h4, h5, h6) {
  min-width: 0 !important;
  max-width: 100% !important;
  overflow-wrap: normal !important;
  word-break: normal !important;
  -webkit-hyphens: none !important;
  hyphens: none !important;
}

@media (max-width: 1080px) {
  /* iOS Safari can move a sticky header's absolute drawer outside the visible
   * viewport when page scrolling is locked. Pinning only the open header keeps
   * the existing drawer anchored above its backdrop. */
  html.ffw-nav-open .ffw-site .ffw-header,
  body.ffw-nav-open .ffw-site .ffw-header {
    position: fixed !important;
    top: 0 !important;
    right: 0 !important;
    left: 0 !important;
    width: 100% !important;
    z-index: 10020 !important;
  }

  body.admin-bar.ffw-nav-open .ffw-site .ffw-header {
    top: 32px !important;
  }

  .ffw-site .ffw-header.is-open .ffw-primary-nav {
    z-index: 6 !important;
  }

  .ffw-site .ffw-header.is-open .ffw-nav-backdrop {
    z-index: 2 !important;
  }
}

@media (max-width: 782px) {
  body.admin-bar.ffw-nav-open .ffw-site .ffw-header {
    top: 46px !important;
  }
}

@media (max-width: 760px) {
  /* A consistent fluid type ceiling keeps long headings inside narrow cards
   * and columns while preserving their existing font, colour and weight. */
  .ffw-site.ffw-site.ffw-site.ffw-site h1 {
    font-size: clamp(2.25rem, 10.5vw, 3rem) !important;
    line-height: 1.08 !important;
    text-wrap: pretty;
  }

  .ffw-site.ffw-site.ffw-site.ffw-site h2 {
    font-size: clamp(1.9rem, 8.6vw, 2.5rem) !important;
    line-height: 1.1 !important;
    text-wrap: pretty;
  }

  .ffw-site.ffw-site.ffw-site.ffw-site h3 {
    font-size: clamp(1.25rem, 6vw, 1.625rem) !important;
    line-height: 1.18 !important;
    text-wrap: pretty;
  }

  .ffw-site.ffw-site.ffw-site.ffw-site :is(h4, h5, h6) {
    text-wrap: pretty;
  }

  /* Forms and footer use deliberately smaller heading tiers than content
   * sections; retain that hierarchy after applying the general mobile cap. */
  .ffw-site.ffw-site.ffw-site.ffw-site :is(
    .ffw-hero-form-panel__head,
    .ffw-crm-form,
    .ffw-lower-form-support
  ) h2 {
    font-size: clamp(1.5rem, 7vw, 2rem) !important;
    line-height: 1.16 !important;
  }

  .ffw-site.ffw-site.ffw-site.ffw-site .ffw-footer h3 {
    font-size: 1rem !important;
    line-height: 1.25 !important;
  }
}

@media (max-width: 390px) {
  .ffw-site.ffw-site.ffw-site.ffw-site h1 {
    font-size: clamp(2.1rem, 10.5vw, 2.65rem) !important;
  }

  .ffw-site.ffw-site.ffw-site.ffw-site h2 {
    font-size: clamp(1.7rem, 8.4vw, 2.1rem) !important;
  }

  .ffw-site.ffw-site.ffw-site.ffw-site h3 {
    font-size: clamp(1.18rem, 5.8vw, 1.45rem) !important;
  }
}
