.header {
  position: sticky;
  top: 0;
  padding: 16px 0 12px 0;
  border-bottom: 1px solid var(--color-border-primary);
  background-color: var(--color-bg-primary);
  z-index: 150;
}

.header .header__menu-button {
  display: none;
}

.header.is-opened .header__menu-button .icon {
  background-image: url("../../images/icons/close.svg");
}

.header__content-block {
  display: flex;
  gap: 16px 12px;
  justify-content: space-between;
  align-items: center;
}

/* Contants */
.header__contacts {
  display: flex;
  align-items: center;
  gap: 4px;
}

.header-contacts__line {
  display: flex;
  gap: 0px 12px;
  align-items: center;
}

.header-contacts__phones {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
}

.header-contacts-phones__item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.header-contacts-phones__item .span {
  color: var(--color-elem-secondary);
}

/* Logo */
.header-logo {
  display: flex;
  justify-content: center;
  align-items: center;
}

.header-logo img {
  height: 100%;
  max-height: 32px;
}

.header__heading {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 100%;
}

.header-filial {
  display: flex;
  justify-content: center;
  flex-direction: column;
  gap: 2px;
  height: 100%;
  padding-left: 12px;
  border-left: 2px solid var(--color-elem-accent-primary);
}

.header__actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

/* Social */
.header__social {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 4px;
}

/* ---------- Adaptation ---------- */

@media screen and (max-width: 1432px) {
  .header .header__menu-button {
    display: flex;
  }

  .header::after {
    content: "";
    position: absolute;
    left: 0;
    top: 100%;
    width: 100%;
    height: 75px;
    background: var(--color-bg-secondary-highlight);
    transition: var(--transition-m);
    opacity: 0;
    transform: translateX(-100vw);
    z-index: -1;
  }

  .header.is-opened::after {
    opacity: 1;
    transform: translateY(0);
  }

  .header__heading {
    margin-right: auto;
  }

  .header:not(.is-opened) .header__contacts {
    display: none;
  }

  .header__contacts {
    position: fixed;
    top: calc(var(--header-height) + 18px);
    z-index: 1;
  }

  .header__contacts .button.is-aspect-ratio-1b1,
  .header__contacts .button.is-aspect-ratio-1b1:hover,
  .header__contacts .button.is-aspect-ratio-1b1:active {
    --button-bg: var(--color-bg-primary);
  }
}

@media screen and (max-width: 1024px) {
  .header::after {
    height: calc(100vh - 100%);
  }

  .header__contacts {
    top: auto;
    bottom: 16px;
    flex-wrap: wrap;
    gap: 16px 4px;
    max-width: calc(100vw - var(--padding-content-area));
  }

  .header-contacts__phones {
    overflow: auto;
  }

  .header:not(.is-opened) .header__social,
  .header:not(.is-opened) .header__nav {
    display: none;
  }

  .header__social {
    position: fixed;
    right: var(--padding-content-area);
    bottom: 16px;
  }

  .header__social .button.is-style-secondary {
    --button-bg: var(--color-bg-primary);
  }

  .header__nav {
    --header-nav-bottom-margin: 122px;
    position: absolute;
    top: calc(100% + 16px);
    width: calc(100% - var(--padding-content-area) * 2);
    max-height: calc(
      100dvh - 100% - var(--header-nav-bottom-margin) -
        var(--padding-content-area)
    );
    overflow-y: auto;
    padding-bottom: 32px;
    box-sizing: border-box;
  }

  .header__nav::after {
    content: "";
    position: fixed;
    left: var(--padding-content-area);
    bottom: var(--header-nav-bottom-margin);
    z-index: 1;
    width: 100%;
    height: 32px;
    background: linear-gradient(
      to bottom,
      #ecf6f600,
      var(--color-bg-secondary-highlight)
    );
  }

  .header__nav > ul {
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
  }

  .header__nav a {
    padding: 0;
    justify-content: flex-start;
    text-align: left;
  }

  .header__nav > ul > li > a {
    font-weight: 700;
  }

  .header__nav > ul > li > ul a::before {
    content: "";
    display: inline-block;
    height: 14px;
    aspect-ratio: 1/1;
    background-size: contain;
    background-image: url("../../images/icons/arrow-right-md.svg");
    filter: brightness(550%) hue-rotate(208deg) contrast(150%);
  }
}

@media screen and (max-width: 640px) {
  .header__content-block {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .header__heading {
    grid-column: 1/3;
    grid-row-start: 1;
    width: 100%;
    justify-content: center;
  }

  .header-filial .dropdown-menu > ul > li > ul {
    left: auto;
    right: 0;
    transform: translate(0, 0) !important;
  }

  .header-filial .dropdown-menu > ul > li > ul::after {
    left: auto;
    right: 14px;
    transform: translate(0, -50%) rotate(45deg) !important;
  }
}

@media screen and (max-width: 380px) {
  .header__heading .header-logo img {
    max-height: 20px;
  }
}
