/* Homepage hero — mobile: search above FAB +, full-width bar, clear of + */

@media (max-width: 767px) {
  body:not(.search-active) .homepage-hero-stage > .hero.hero--homepage .hero-content--homepage {
    scale: 1 !important;
    transform: none !important;
    justify-content: flex-start !important;
    padding-bottom: calc(
      var(--site-fab-expanded-h, 190px) + env(safe-area-inset-bottom, 0px) + 10px
    ) !important;
  }

  body:not(.search-active) .homepage-hero-stage > .hero.hero--homepage .hero-title--homepage,
  body:not(.search-active) .homepage-hero-stage > .hero.hero--homepage .hero-subtitle--homepage,
  body:not(.search-active) .homepage-hero-stage > .hero.hero--homepage .hero-search--homepage {
    position: relative !important;
    top: 0 !important;
  }

  body:not(.search-active) .homepage-hero-stage > .hero.hero--homepage .hero-title--homepage {
    margin-top: clamp(0.15rem, 0.8vh, 0.4rem) !important;
    margin-bottom: 0 !important;
  }

  body:not(.search-active) .homepage-hero-stage > .hero.hero--homepage .hero-subtitle--homepage {
    margin-top: clamp(0.35rem, 1.2vh, 0.65rem) !important;
    margin-bottom: 0 !important;
    text-align: left !important;
    padding-inline: 0 !important;
    max-width: none !important;
  }

  /*
   * Поиск выше середины — над кнопкой «+» FAB, с зазором.
   * Раньше 38dvh давал наезд на «+»; ~26dvh поднимает строку.
   */
  body:not(.search-active) .homepage-hero-stage > .hero.hero--homepage .hero-search--homepage {
    margin-top: max(0.85rem, calc(26dvh - 10.5rem)) !important;
    margin-bottom: 0 !important;
    width: 100% !important;
    max-width: none !important;
    flex: 0 0 auto !important;
    z-index: 4;
    /* Растянуть строку: кнопка поиска в колонке «+», без сжатия справа */
    padding-right: 0 !important;
    box-sizing: border-box;
  }

  body:not(.search-active) .homepage-hero-stage > .hero.hero--homepage .hero-search__bar,
  body:not(.search-active) .homepage-hero-stage > .hero.hero--homepage .hero-search--homepage form.search-box {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
  }

  body:not(.search-active) .homepage-hero-stage > .hero.hero--homepage .hero-stats--homepage {
    margin-top: clamp(0.55rem, 1.6vh, 0.95rem) !important;
    margin-bottom: 0 !important;
    flex: 0 0 auto !important;
  }

  /* Expanded FAB: subtitle/stats не уезжают под остров; поиск уже выше «+» — на всю ширину */
  body:has(#siteFabStack.site-fab-stack:not(.site-fab-stack--collapsed)):not(.search-active)
    .homepage-hero-stage
    > .hero.hero--homepage
    .hero-subtitle--homepage,
  body:has(#siteFabStack.site-fab-stack:not(.site-fab-stack--collapsed)):not(.search-active)
    .homepage-hero-stage
    > .hero.hero--homepage
    .hero-stats--homepage {
    padding-right: calc(var(--site-fab-col-center, 56px) + 10px) !important;
    box-sizing: border-box;
  }

  body:has(#siteFabStack.site-fab-stack:not(.site-fab-stack--collapsed)):not(.search-active)
    .homepage-hero-stage
    > .hero.hero--homepage
    .hero-search--homepage {
    /*
     * Полная ширина контейнера (без прежнего сжатия): кнопка поиска
     * оказывается над колонкой «+», поле не наезжает (поиск выше по Y).
     */
    padding-right: 0 !important;
    width: 100% !important;
    max-width: none !important;
    box-sizing: border-box;
  }

  body:has(#siteFabStack.site-fab-stack:not(.site-fab-stack--collapsed)):not(.search-active)
    .homepage-hero-stage
    .hero-search--homepage
    .search-box {
    width: 100% !important;
    max-width: none !important;
  }

  body:has(#siteFabStack.site-fab-stack:not(.site-fab-stack--collapsed)):not(.search-active)
    .homepage-hero-stage
    .hero-search--homepage
    .search-icon-btn {
    margin-right: 0 !important;
  }
}
