/* ==========================================================================
   Header
   ========================================================================== */

.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--color-bg);
}

/* ---- Top bar ---- */

.header__top {
  border-bottom: 1px solid var(--color-border);
}

.header__top-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: 8px;
}

.header__info {
  font-size: var(--fs-sm);
  font-weight: var(--fw-sm);
  line-height: var(--lh-sm);
  color: var(--color-primary);
  opacity: 0.8;
  text-decoration: none;
}

.header__info--mobile {
  display: none;
}

/* ---- Main bar ---- */

.header__main-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 88px;
}

.header__logo {
  flex-shrink: 0;
}

.header__logo img {
  display: block;
  width: 198px;
  height: 50px;
}

/* ---- Navigation ---- */

.header__nav {
  flex: 1;
  display: flex;
  justify-content: center;
}

.header__menu {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
}

.header__menu li a {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 12px 24px;
  font-size: var(--fs-body);
  font-weight: var(--fw-body);
  line-height: var(--lh-body);
  color: var(--color-primary);
  text-decoration: none;
  transition: background-color var(--duration-normal) var(--ease-default),
              color var(--duration-normal) var(--ease-default);
}

.header__menu li a:hover,
.header__menu li.current-menu-item a {
  background-color: var(--color-primary);
  color: var(--color-white);
}

/* ---- Actions ---- */

.header__actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.header__phone {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 12px 24px;
  font-size: var(--fs-body);
  font-weight: var(--fw-body-bold);
  line-height: var(--lh-body);
  color: var(--color-primary);
  text-decoration: none;
  width: 200px;
  transition: color var(--duration-normal) var(--ease-default);
}

.header__phone:hover {
  color: var(--color-accent);
}

.header__cta {
  width: 200px;
}

/* ---- Burger ---- */

.header__burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 24px;
  height: 24px;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
}

.header__burger span {
  display: block;
  height: 2px;
  background-color: var(--color-primary);
  transition: transform var(--duration-normal) var(--ease-default),
              opacity var(--duration-fast) var(--ease-default),
              width var(--duration-normal) var(--ease-default);
}

/* Линии разной длины как в макете */
.header__burger span:nth-child(1) {
  width: 100%;
}

.header__burger span:nth-child(2) {
  width: 75%;
}

.header__burger span:nth-child(3) {
  width: 50%;
}

/* Крестик при открытом меню */
.header__burger.is-active span:nth-child(1) {
  width: 100%;
  transform: translateY(7px) rotate(45deg);
}

.header__burger.is-active span:nth-child(2) {
  opacity: 0;
  width: 100%;
}

.header__burger.is-active span:nth-child(3) {
  width: 100%;
  transform: translateY(-7px) rotate(-45deg);
}

/* ---- Mobile Menu Overlay ---- */

.header__mobile-menu {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  z-index: 200;
  background-color: var(--color-bg);
  overflow-y: auto;
}

body.menu-open {
  overflow: hidden;
}

.header__mobile-menu.is-open {
  display: block;
}

.header__mobile-menu-inner {
  display: flex;
  flex-direction: column;
  gap: var(--gap-xl);
  padding: 120px 24px 40px;
  min-height: 100vh;
}

/* ---- Tablet ---- */

@media (max-width: 1199px) {
  .header__nav {
    display: none;
  }

  .header__phone {
    width: auto;
    padding: 12px 16px;
  }

  .header__cta {
    width: auto;
  }

  .header__burger {
    display: flex;
  }
}

/* ---- Mobile ---- */

@media (max-width: 767px) {
  /* Top bar mobile: phone on blue bg */
  .header__top {
    background-color: var(--color-primary);
    border-bottom: none;
  }

  .header__top-inner {
    justify-content: center;
    padding-block: 10px;
  }

  .header__info--desktop {
    display: none;
  }

  .header__info--mobile {
    display: block;
    font-size: var(--fs-body);
    font-weight: var(--fw-body-bold);
    color: var(--color-white);
    opacity: 1;
  }

  /* Main bar mobile */
  .header__main-inner {
    height: 60px;
    padding-block: 12px;
  }

  .header__logo img {
    width: 143px;
    height: 36px;
  }

  .header__nav {
    display: none;
  }

  .header__actions {
    display: none;
  }

  .header__burger {
    display: flex;
  }

  /* ---- Mobile Menu overrides ---- */

  /* Menu list */
  .header__mobile-list {
    list-style: none;
    margin: 0;
    padding: 0;
  }

  .header__mobile-list li a {
    display: block;
    padding: 16px 0;
    font-size: var(--fs-body);
    font-weight: var(--fw-body);
    line-height: var(--lh-body);
    color: var(--color-primary);
    text-decoration: none;
    border-bottom: 1px solid var(--color-border);
  }

  .header__mobile-list li:first-child a {
    border-top: 1px solid var(--color-border);
  }

  /* Info */
  .header__mobile-info {
    display: flex;
    flex-direction: column;
    gap: var(--gap-sm);
  }

  .header__mobile-info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: var(--fs-body);
    font-weight: var(--fw-body);
    line-height: var(--lh-body);
    color: var(--color-primary);
  }

  .header__mobile-info-label {
    font-style: italic;
    opacity: 0.6;
  }

  /* Buttons */
  .header__mobile-buttons {
    display: flex;
    flex-direction: column;
    gap: var(--gap-sm);
  }

  /* Socials */
  .header__mobile-socials {
    display: flex;
    gap: var(--gap-sm);
  }

  .header__mobile-socials a {
    display: block;
    width: 40px;
    height: 40px;
  }

  /* Legal */
  .header__mobile-legal {
    display: flex;
    flex-direction: column;
    gap: var(--gap-sm);
    margin-top: auto;
    padding-top: var(--gap-xl);
    border-top: 1px solid var(--color-primary);
  }

  .header__mobile-legal a {
    font-size: var(--fs-body);
    font-weight: var(--fw-body);
    font-style: italic;
    line-height: var(--lh-body);
    color: var(--color-primary);
    text-decoration: none;
  }
}
