/* Overrides loaded after styles.css to guarantee cascade */

/* Header: instagram ↔ contacts spacing (desktop only) */
@media (min-width: 1025px) {
  .header-top .header-contacts {
    margin-left: 16px !important;
  }
}

/* HoReCa nav item — принудительно красным в десктопном хедере */
.header.header--transparent:not(.header--solid) .nav-list--header-main .nav-item.nav-item--horeca > a,
.header.header--solid .nav-list--header-main .nav-item.nav-item--horeca > a {
  color: var(--color-primary) !important;
}

.header.header--transparent:not(.header--solid) .nav-list--header-main .nav-item.nav-item--horeca > a:hover,
.header.header--solid .nav-list--header-main .nav-item.nav-item--horeca > a:hover {
  color: var(--color-primary-dark) !important;
}

/* Mobile home hero banner: show as normal image (avoid absolute fill/cropping quirks in Chrome). */
@media (max-width: 960px) {
  body.page-home .home-hero.home-hero--fullwidth {
    min-height: 0 !important;
    aspect-ratio: auto !important;
    overflow: hidden;
  }

  body.page-home .home-hero.home-hero--fullwidth .home-hero-banner {
    position: static !important;
    inset: auto !important;
    width: 100% !important;
    height: auto !important;
    object-fit: contain !important;
    object-position: center !important;
  }

  body.page-home .home-hero.home-hero--fullwidth .home-hero-overlay {
    display: none !important;
  }
}

/* Split-screen desktop: switch header to "mobile" layout only when needed.
   Keep desktop nav longer; collapse closer to real overlap. */
@media (min-width: 961px) and (max-width: 1280px) {
  /* hide desktop nav entirely (split-screen) */
  .header:not(.nav-open) .header-top .nav--main {
    display: none !important;
  }

  /* but keep full-screen mobile menu working */
  .header.nav-open .header-top .nav--main {
    display: flex !important;
  }

  /* Split-screen menu: do not show logo inside opened menu */
  .header.nav-open .header-brand {
    display: none !important;
  }

  .header-top .menu-toggle {
    display: flex !important;
  }

  .header-top .header-contacts {
    display: none !important;
  }

  .header-top {
    gap: 0.75rem !important;
  }

  .header-brand {
    margin-left: 0.45rem !important;
  }

  .header-right {
    gap: 0.5rem !important;
  }

  /* Fixed header should not overlap hero in split-screen */
  body.page-home .home-hero.home-hero--fullwidth {
    margin-top: 76px !important; /* ~ header row + 1px gap (split-screen header) */
  }

  /* Home hero overlay: split-screen safe positioning */
  body.page-home .home-hero.home-hero--fullwidth {
    /* enable container queries when supported */
    container-type: inline-size;
  }

  body.page-home .home-hero.home-hero--fullwidth .home-hero-overlay {
    left: auto !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    /* Move overlay to the RIGHT on narrow desktop windows */
    right: -8px !important;
    width: min(520px, 34vw) !important;
    overflow: hidden;
  }

  body.page-home .home-hero-overlay__logos {
    max-width: 100%;
    overflow: hidden;
  }

  body.page-home .home-hero-overlay__logo--milford {
    max-width: 190px;
    height: auto;
  }

  @supports (width: 1cqw) {
    body.page-home .home-hero.home-hero--fullwidth .home-hero-overlay {
      right: -8px !important;
      width: min(460px, 44cqw) !important;
      padding-right: 84px !important;
    }

    @container (max-width: 980px) {
      body.page-home .home-hero.home-hero--fullwidth .home-hero-overlay {
        right: -6px !important;
        width: min(420px, 48cqw) !important;
        padding-right: 76px !important;
      }

      body.page-home .home-hero-overlay__logo {
        height: clamp(34px, 5cqw, 56px);
      }

      body.page-home .home-hero-overlay__logo--milford {
        max-width: 170px;
      }
    }

    @container (max-width: 860px) {
      body.page-home .home-hero.home-hero--fullwidth .home-hero-overlay {
        right: -4px !important;
        width: min(380px, 50cqw) !important;
        padding-right: 68px !important;
        padding: clamp(0.7rem, 2.4cqw, 1rem) !important;
        padding-right: 68px !important;
      }

      body.page-home .home-hero-overlay__inner {
        max-width: 100% !important;
      }

      body.page-home .home-hero-overlay__title {
        letter-spacing: 0.04em;
        line-height: 1.06;
      }

      body.page-home .home-hero-overlay__title-main {
        font-size: clamp(1.05rem, 4.4cqw, 1.75rem);
      }

      body.page-home .home-hero-overlay__title-sub {
        font-size: clamp(0.98rem, 3.9cqw, 1.6rem);
      }

      body.page-home .home-hero-overlay__lead {
        font-size: clamp(0.72rem, 2.2cqw, 1rem);
        letter-spacing: 0.04em;
      }

      body.page-home .home-hero-overlay__logos {
        gap: 0.75rem;
      }

      body.page-home .home-hero-overlay__logo {
        height: clamp(30px, 5.6cqw, 52px);
      }

      body.page-home .home-hero-overlay__logo--milford {
        max-width: 150px;
      }
    }
  }
}
