/* Сохранённые состояния бренда и навигации до canonical-правил ниже. */
/* Шапка, бренд и основная навигация. */
.header {
  transition: transform .3s var(--ease), box-shadow .3s ease, background .3s ease;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  width: fit-content;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -.02em;
}

.brand__mark {
  display: grid;
  place-items: center;
  color: var(--acid);
  letter-spacing: .05em;
}

.brand__copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.brand--header .brand__copy strong {
  width: fit-content;
  background-image: linear-gradient(90deg, transparent 34%, rgba(113,128,255,.2) 42%, rgba(113,128,255,.96) 50%, rgba(78,92,255,.24) 58%, transparent 66%), linear-gradient(105deg, var(--night) 0 76%, #3443a8 87%, var(--blue) 100%);
  color: var(--night);
  font-family: "Segoe UI Variable Display", Inter, "Segoe UI", Arial, sans-serif;
  font-weight: 900;
  letter-spacing: -.045em;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand__copy small {
  text-transform: uppercase;
}

.brand--header .brand__copy small {
  display: block;
}

.brand--header .brand__mark {
  animation: brand-mark-intro .85s var(--ease) both;
  transition: transform .5s var(--ease), box-shadow .5s ease;
}

.brand--header .brand__copy strong {
  background-position: 100% 50%, 0 50%;
  background-size: 220% 100%, 100% 100%;
  animation: brand-name-intro 1.1s .14s var(--ease) both;
  transition: filter .55s ease;
}

.brand--header .brand__copy small {
  animation: brand-subtitle-intro .58s .72s var(--ease) both;
}

@keyframes brand-mark-intro {
  0% { opacity: 0; translate: -6px 0; scale: .86; rotate: -8deg; }
  72% { opacity: 1; translate: 0; scale: 1.02; rotate: 1deg; }
  100% { opacity: 1; translate: 0; scale: 1; rotate: 0deg; }
}

@keyframes brand-name-intro {
  0% { opacity: 0; clip-path: inset(0 100% 0 0); background-position: 100% 50%, 0 50%; }
  16% { opacity: 1; }
  100% { opacity: 1; clip-path: inset(0); background-position: 0 50%, 0 50%; }
}

@keyframes brand-subtitle-intro {
  from { opacity: 0; translate: 0 5px; }
  to { opacity: 1; translate: 0; }
}

.navigation {
  display: flex;
  align-items: center;
}

.navigation__link {
  border-radius: 999px;
  transition: background .2s ease, color .2s ease, transform .2s ease;
}

.header__contact {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: white;
  font-weight: 800;
  transition: transform .25s var(--ease), background .25s ease;
}

.header__menu-toggle {
  display: none;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: var(--night);
  cursor: pointer;
}

.header__menu-toggle > span {
  display: block;
  width: 18px;
  height: 2px;
  margin: 4px auto;
  border-radius: 2px;
  background: white;
  transition: transform .2s ease, opacity .2s ease;
}

/* Шапка сайта. Поведенческие хуки остаются в data-атрибутах. */
.header {
  position: sticky;
  top: 0;
  z-index: 30;
  width: 100%;
  min-height: 84px;
  margin: 0;
  padding: 15px var(--layout-inline);
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(120px, 1fr);
  align-items: center;
  gap: var(--space-6);
  border: 0;
  border-bottom: 1px solid var(--border-subtle);
  border-radius: 0;
  background: rgba(246, 244, 239, .93);
  box-shadow: none;
  backdrop-filter: blur(14px);
  transition: transform .3s var(--ease-standard), box-shadow .3s ease, background .3s ease;
}

.header.is-scrolled {
  background: rgba(251, 250, 246, .92);
  box-shadow: 0 18px 60px rgba(17, 24, 42, .14);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  width: fit-content;
}

.brand__copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.brand--header {
  justify-self: start;
}

.brand--header .brand__copy strong {
  font-size: 17px;
}

.brand__copy small {
  color: var(--text-tertiary);
  font-family: var(--font-body);
  font-size: var(--type-small);
  font-weight: 600;
  letter-spacing: .1em;
}

/* Изображение логотипа не наследует анимацию и оформление текстового знака. */
.header .brand__mark--image {
  display: block;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  object-fit: contain;
  transform: none;
  animation: none;
  font-family: "Manrope", sans-serif;
  font-size: 10px;
  line-height: 1.68;
  letter-spacing: .05em;
}

.navigation {
  display: flex;
  align-items: center;
  gap: var(--space-5);
}

@media (min-width: 1101px) {
  .navigation {
    justify-self: center;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #5f687d;
    font-size: 12px;
  }
}

.navigation__link {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  position: relative;
  padding: 8px 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--color-text-secondary);
  font-family: var(--font-family-heading);
  font-size: var(--font-size-caption);
  font-weight: 600;
}

.navigation__link::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 1px;
  left: 0;
  height: 2px;
  background: var(--color-brand-lime);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .25s ease;
}

.navigation__link:hover::after,
.navigation__link--active::after {
  transform: scaleX(1);
}

.navigation__link:hover,
.navigation__link--active {
  color: var(--color-text-primary);
}

.header__contact {
  justify-self: end;
}

@media (max-width: 1100px) {
  .header {
    grid-template-columns: 1fr auto;
  }

  .header__menu-toggle {
    display: block;
    order: 2;
  }

  .header__menu-toggle[aria-expanded="true"] > span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
  }

  .header__menu-toggle[aria-expanded="true"] > span:nth-child(2) {
    opacity: 0;
  }

  .header__menu-toggle[aria-expanded="true"] > span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
  }

  .navigation {
    position: absolute;
    inset: calc(100% + 8px) 0 auto;
    grid-column: 1 / -1;
    grid-row: 2;
    max-height: calc(100dvh - 112px);
    overflow-y: auto;
    padding: 22px;
    gap: var(--space-2);
    border: 1px solid rgba(255, 255, 255, .65);
    border-radius: 24px;
    background: rgba(251, 250, 246, .97);
    box-shadow: var(--shadow);
    transform: translateY(-18px);
    opacity: 0;
    visibility: hidden;
    transition: .25s var(--ease);
  }

  .navigation.is-open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }

  /*
    CTA "Связаться" на мобильной ширине переносится JS (initMobileHeaderContact)
    внутрь nav — последней строкой раскрывающегося меню. Пока узел ещё не
    перенесён (до выполнения скрипта) или если JS отключён, скрываем его в
    закрытой шапке: раньше он оставался отдельным grid-item в .header при
    всего двух колонках на мобильной ширине и переносился на вторую строку,
    раздувая закрытую шапку.
  */
  .header > .header__contact {
    display: none;
  }

  .navigation > .header__contact {
    align-self: stretch;
    justify-content: center;
    margin-top: var(--space-1);
  }
}

@media (max-width: 720px) {
  .header {
    min-height: 76px;
    padding-inline: 18px;
  }

  .brand--header {
    min-width: 0;
  }

  .brand__copy {
    min-width: 0;
  }

  .brand__copy strong {
    line-height: 1.05;
    white-space: nowrap;
  }

  .brand--header .brand__copy small {
    max-width: 172px;
    line-height: 1.2;
  }

  .brand--header .brand__copy small span {
    min-width: 0;
  }

  .navigation {
    inset: calc(100% + 8px) 0 auto;
    width: 100%;
    max-height: calc(100dvh - 88px);
    padding: 16px 0 8px;
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }

  .header__menu-toggle {
    width: 42px;
    height: 42px;
  }
}
