/* ============================================================
   ∞ 8эйт — UNIFIED HEADER CSS  v2
   Фикс мобильной раскладки: gswitch теперь корректно скрывается
   на узких экранах, grid не схлопывает элементы.
   ============================================================ */

:root {
  --eit-ink: #15140f;
  --eit-ink-mute: #5a5851;
  --eit-ink-dim: #807d76;
  --eit-on-dark: #faf7f0;
  --eit-on-dark-mute: #a5a29a;
  --eit-line: rgba(21,20,15,0.08);
  --eit-line-strong: rgba(21,20,15,0.18);
  --eit-bg: #ffffff;
  --eit-bg-soft: #f6f3ec;

  --eit-font-display: 'Onest', system-ui, sans-serif;
  --eit-font-serif: 'Cormorant Garamond', serif;
  --eit-font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

/* ============================== PAGE PROGRESS BAR ============================== */
.page-progress {
  position: fixed; top: 0; left: 0; right: 0;
  height: 2px; z-index: 99;
  background: transparent;
  pointer-events: none;
}
.page-progress .bar {
  height: 100%;
  background: var(--eit-ink);
  width: 0%;
  transition: width 0.1s linear;
}

/* ============================== HEADER SHELL ============================== */
.header {
  position: sticky; top: 0; z-index: 60;
  background: color-mix(in oklab, #fff 90%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--eit-line);
  font-family: var(--eit-font-display);
  animation: hdrIn .8s cubic-bezier(.4,0,.2,1) both;
  transition: background .3s ease, border-color .3s ease;
}
.header.scrolled {
  background: color-mix(in oklab, #fff 96%, transparent);
  border-bottom-color: var(--eit-line-strong);
}
@keyframes hdrIn {
  from { transform: translateY(-100%); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

.header .inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 48px;
}

/* === DESKTOP — 4 колонки: wordmark | gswitch | nav | right === */
.header-row {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  align-items: center;
  height: 88px;
  gap: 18px;
}

/* === TABLET — 1180px и уже: уменьшаем gap, gs-label скрываем === */
@media (max-width: 1180px) {
  .header-row { gap: 14px; }
  .gs-label { display: none; }
}

/* === TABLET-MOBILE — 980px: убираем nav, остаётся wordmark | gswitch | right (3 колонки) === */
@media (max-width: 980px) {
  .header-row {
    grid-template-columns: auto auto 1fr;
    height: 72px;
    gap: 12px;
  }
  .header-nav { display: none; }
  /* header-right ужимаем — на этой ширине ещё показываем телефон + бургер */
  .header-right {
    grid-column: 3;
    justify-content: flex-end;
  }
}

/* === MOBILE — 640px: gswitch скрываем (он есть в mnav), остаётся wordmark | right === */
@media (max-width: 640px) {
  .header .inner { padding: 0 16px; }
  .header-row {
    grid-template-columns: auto 1fr;
    height: 64px;
    gap: 12px;
  }
  .gswitch { display: none; }
  .header-right { grid-column: 2; }
}

/* ============================== WORDMARK ============================== */
.header-logo {
  display: flex; align-items: center;
  height: 52px;
  text-decoration: none;
  min-width: 0;
}
.wordmark {
  display: inline-flex; align-items: center; gap: 12px;
  color: var(--eit-ink);
  font-family: var(--eit-font-display);
  font-weight: 600;
  font-size: 24px;
  letter-spacing: 0.06em;
  text-transform: lowercase;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}
.wordmark .wm-inf {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 22px;
  flex-shrink: 0;
}
.wordmark .wm-inf svg { width: 100%; height: 100%; overflow: visible; }
.wordmark .wm-inf svg path {
  stroke-dasharray: 220;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1.4s cubic-bezier(.7,0,.2,1);
}
.wordmark:hover .wm-inf svg path {
  animation: infTrace 1.6s cubic-bezier(.7,0,.2,1);
}
@keyframes infTrace {
  0% { stroke-dashoffset: 220; }
  100% { stroke-dashoffset: 0; }
}
.wordmark .wm-text { letter-spacing: 0.16em; }
.wordmark-lg { font-size: 32px; }
.wordmark-lg .wm-inf { width: 56px; height: 28px; }

/* На мобиле логотип чуть меньше, чтобы влез комфортно с правым блоком */
@media (max-width: 640px) {
  .wordmark { font-size: 20px; }
  .wordmark .wm-inf { width: 36px; height: 18px; }
}

/* ============================== NAVIGATION ============================== */
.header-nav {
  display: flex; align-items: center;
  gap: 36px;
  justify-content: center;
}
.header-nav a {
  font-size: 14px;
  color: var(--eit-ink);
  letter-spacing: 0;
  padding: 6px 0;
  position: relative;
  text-decoration: none;
  transition: color .2s;
  font-weight: 500;
  white-space: nowrap;
}
.header-nav a:hover { color: var(--eit-ink-mute); }
.header-nav > a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px;
  height: 1px; background: var(--eit-ink);
  transform: scaleX(0); transform-origin: left;
  transition: transform .35s cubic-bezier(.4,0,.2,1);
}
.header-nav > a.is-active::after,
.header-nav > a:hover::after { transform: scaleX(1); }

/* ============================== RIGHT SIDE ============================== */
.header-right {
  display: flex; gap: 18px; align-items: center;
  min-width: 0;
}
.header-tel {
  font-family: var(--eit-font-mono);
  font-size: 12px;
  color: var(--eit-ink);
  letter-spacing: 0.02em;
  line-height: 1.3;
  text-align: right;
  white-space: nowrap;
}
.header-tel small {
  display: block;
  color: var(--eit-ink-mute);
  font-size: 11px;
}
.header-tel a {
  color: inherit;
  text-decoration: none;
  transition: color .2s;
}
.header-tel a:hover { color: var(--eit-ink-mute); }

.btn-dark {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  background: var(--eit-ink);
  color: var(--eit-on-dark);
  font-family: var(--eit-font-display);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: background .2s, transform .2s;
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}
.btn-dark:hover { background: #2a2820; transform: translateY(-1px); color: var(--eit-on-dark); }
.btn-dark::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,0.15) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform .8s ease;
}
.btn-dark:hover::before { transform: translateX(100%); }

/* На таблете прячем телефон + CTA, остаётся только бургер */
@media (max-width: 980px) {
  .header-right .btn-dark,
  .header-right .header-tel { display: none; }
}

/* ============================== BURGER ============================== */
.burger {
  display: none;
  width: 44px; height: 44px;
  border: 1px solid var(--eit-line-strong);
  border-radius: 999px;
  align-items: center; justify-content: center;
  flex-direction: column; gap: 4px;
  background: transparent;
  cursor: pointer;
  z-index: 100;
  position: relative;
  padding: 0;
  flex-shrink: 0;
}
.burger span {
  display: block;
  width: 16px; height: 1.5px;
  background: var(--eit-ink);
  transition: transform .35s cubic-bezier(.4,0,.2,1), opacity .25s;
}
.burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
.burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }
@media (max-width: 980px) {
  .burger { display: inline-flex; }
}
@media (max-width: 640px) {
  .burger { width: 40px; height: 40px; }
}

/* ============================== GROUP SWITCHER ============================== */
.gswitch {
  position: relative;
  display: inline-flex; align-items: center;
  z-index: 80;
  font-family: var(--eit-font-display);
}
.gs-trigger {
  display: inline-flex; align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 12px 0 10px;
  border: 1px solid var(--eit-line-strong);
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  color: var(--eit-ink);
  transition: background .2s ease, border-color .2s ease, color .2s ease;
}
.gs-trigger:hover {
  background: var(--eit-ink);
  color: var(--eit-on-dark);
  border-color: var(--eit-ink);
}
.gs-mark {
  font-size: 14px;
  line-height: 1;
  color: var(--eit-ink-mute);
  transition: color .2s;
}
.gs-trigger:hover .gs-mark { color: var(--eit-on-dark); }
.gs-label {
  font-size: 11px;
  font-family: var(--eit-font-mono);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}
.gs-chev {
  opacity: 0.65;
  transition: transform .3s cubic-bezier(.4,0,.2,1), opacity .2s;
  flex-shrink: 0;
}
.gswitch.open .gs-chev { transform: rotate(180deg); }
.gs-trigger:hover .gs-chev { opacity: 1; }

/* На таблете — компактный gswitch без текста, только кнопка-кружок */
@media (max-width: 980px) {
  .gs-trigger {
    width: 36px;
    height: 36px;
    padding: 0;
    justify-content: center;
  }
  .gs-chev { display: none; }
}

.gs-pop {
  position: absolute !important;
  top: calc(100% + 12px);
  left: 0;
  min-width: 360px;
  background: #ffffff;
  border: 1px solid var(--eit-line);
  box-shadow: 0 28px 60px -20px rgba(21,20,15,0.18),
              0 8px 16px -10px rgba(21,20,15,0.08);
  padding: 14px 0 8px;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity .25s cubic-bezier(.4,0,.2,1),
              transform .25s cubic-bezier(.4,0,.2,1);
  z-index: 90;
}
.gswitch.open .gs-pop {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* На таблете popover уезжает влево чтобы не вылетал за край экрана */
@media (max-width: 980px) {
  .gs-pop {
    right: auto;
    left: 0;
    min-width: 300px;
  }
}

.gs-pop-head {
  padding: 0 20px 12px;
  font-family: var(--eit-font-mono);
  font-size: 10px;
  color: var(--eit-ink-dim);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--eit-line);
}
.gs-list {
  display: flex; flex-direction: column;
  padding: 6px 0;
}
.gs-item {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  text-decoration: none;
  color: var(--eit-ink);
  transition: background .2s ease;
  position: relative;
}
.gs-item:hover { background: var(--eit-bg-soft); }
.gs-item.is-current {
  background: var(--eit-bg-soft);
  cursor: default;
}
.gs-item.is-current::before {
  content: "";
  position: absolute; left: 0; top: 8px; bottom: 8px;
  width: 2px;
  background: var(--eit-ink);
}
.gs-ix {
  font-family: var(--eit-font-mono);
  font-size: 11px;
  color: var(--eit-ink-dim);
  letter-spacing: 0.06em;
  text-align: center;
}
.gs-item.is-current .gs-ix { color: var(--eit-ink); }
.gs-body {
  display: flex; flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.gs-name {
  font-family: var(--eit-font-display);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.005em;
  text-transform: uppercase;
  line-height: 1.1;
}
.gs-sub {
  font-family: var(--eit-font-mono);
  font-size: 10px;
  color: var(--eit-ink-mute);
  letter-spacing: 0.02em;
}
.gs-here {
  font-family: var(--eit-font-mono);
  font-size: 10px;
  color: var(--eit-ink-dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 8px;
  border: 1px solid var(--eit-line);
  border-radius: 999px;
  white-space: nowrap;
}
.gs-go {
  width: 24px; height: 24px;
  border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--eit-ink-mute);
  transition: background .25s ease, color .25s ease, transform .3s ease;
  flex-shrink: 0;
}
.gs-item:hover .gs-go {
  background: var(--eit-ink);
  color: var(--eit-on-dark);
  transform: rotate(-45deg);
}

/* ============================== MOBILE NAV ============================== */
.mnav {
  position: fixed; inset: 0;
  background: var(--eit-bg);
  z-index: 90;
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .45s cubic-bezier(.4,0,.2,1);
  padding: 88px 24px 32px;
  font-family: var(--eit-font-display);
  overflow-y: auto;
}
.mnav.open { opacity: 1; pointer-events: auto; }
.mnav-inner {
  width: 100%; max-width: 540px;
  display: flex; flex-direction: column; gap: 36px;
  margin: auto 0;
}

.mnav-section + .mnav-section { margin-top: 22px; }
.mnav-section-h {
  font-family: var(--eit-font-mono);
  font-size: 10px;
  color: var(--eit-ink-dim);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.mnav-list {
  display: flex; flex-direction: column;
  border-top: 1px solid var(--eit-line-strong);
}
.mnav-list a {
  display: flex; align-items: baseline; gap: 18px;
  padding: 20px 0;
  border-bottom: 1px solid var(--eit-line-strong);
  font-family: var(--eit-font-display);
  font-weight: 600;
  font-size: clamp(24px, 6vw, 36px);
  text-transform: uppercase;
  letter-spacing: -0.01em;
  color: var(--eit-ink);
  text-decoration: none;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity .5s cubic-bezier(.4,0,.2,1), transform .5s cubic-bezier(.4,0,.2,1);
}
.mnav.open .mnav-list a { opacity: 1; transform: translateY(0); }
.mnav.open .mnav-list a:nth-child(1) { transition-delay: .12s; }
.mnav.open .mnav-list a:nth-child(2) { transition-delay: .18s; }
.mnav.open .mnav-list a:nth-child(3) { transition-delay: .24s; }
.mnav.open .mnav-list a:nth-child(4) { transition-delay: .30s; }
.mnav.open .mnav-list a:nth-child(5) { transition-delay: .36s; }
.mnav.open .mnav-list a:nth-child(6) { transition-delay: .42s; }

.mn-num {
  font-family: var(--eit-font-mono);
  font-size: 11px;
  color: var(--eit-ink-mute);
  letter-spacing: 0.08em;
}

.mnav-ports {
  display: flex; flex-direction: column;
  border-top: 1px solid var(--eit-line-strong);
}
.mnav-port {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px;
  padding: 18px 0;
  border-bottom: 1px solid var(--eit-line-strong);
  text-decoration: none;
  color: var(--eit-ink);
  opacity: 0;
  transform: translateY(20px);
  transition: opacity .5s cubic-bezier(.4,0,.2,1), transform .5s cubic-bezier(.4,0,.2,1);
}
.mnav.open .mnav-ports .mnav-port { opacity: 1; transform: translateY(0); }
.mnav.open .mnav-ports .mnav-port:nth-child(1) { transition-delay: .50s; }
.mnav.open .mnav-ports .mnav-port:nth-child(2) { transition-delay: .56s; }
.mnav.open .mnav-ports .mnav-port:nth-child(3) { transition-delay: .62s; }
.mp-name {
  font-family: var(--eit-font-display);
  font-weight: 600;
  font-size: clamp(18px, 5vw, 22px);
  text-transform: uppercase;
  letter-spacing: -0.005em;
}
.mp-meta {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--eit-font-mono);
  font-size: 10px;
  color: var(--eit-ink-mute);
  letter-spacing: 0.04em;
}

.mnav-foot {
  display: flex; flex-direction: column; gap: 10px;
  padding-top: 24px;
  border-top: 1px solid var(--eit-line);
  opacity: 0;
  transition: opacity .5s ease .5s;
}
.mnav.open .mnav-foot { opacity: 1; }
.mnav-phone {
  font-family: var(--eit-font-display);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: -0.005em;
  color: var(--eit-ink);
  text-decoration: none;
}
.mono {
  font-family: var(--eit-font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--eit-ink-mute);
  text-transform: uppercase;
}
.mono.dim { color: var(--eit-ink-dim); }
body.mnav-open { overflow: hidden; }

/* ============================== STICKY CTA + FAB ============================== */
.sticky-cta,
.fab-top { display: none; }

@media (max-width: 820px) {
  .sticky-cta { display: flex; }
  .fab-top { display: inline-flex; }
}

.sticky-cta {
  position: fixed; left: 16px; right: 16px; bottom: 16px;
  z-index: 50;
  align-items: center;
  gap: 8px;
  padding: 6px;
  background: var(--eit-ink);
  border-radius: 999px;
  box-shadow: 0 20px 50px -16px rgba(21,20,15,0.4);
  transform: translateY(120%);
  transition: transform .45s cubic-bezier(.4,0,.2,1);
  font-family: var(--eit-font-display);
}
.sticky-cta.in { transform: translateY(0); }
.sticky-cta a {
  flex: 1;
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  padding: 12px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--eit-on-dark);
  text-decoration: none;
}
.sticky-cta a.sc-primary {
  background: #fff;
  color: var(--eit-ink);
}
.sticky-cta a.sc-secondary { color: var(--eit-on-dark); }
body.mnav-open .sticky-cta { transform: translateY(120%); }

.fab-top {
  position: fixed; right: 24px; bottom: 24px;
  width: 44px; height: 44px;
  border-radius: 999px;
  background: var(--eit-ink);
  color: var(--eit-on-dark);
  align-items: center; justify-content: center;
  text-decoration: none;
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  transition: opacity .35s ease, transform .35s ease, background .2s;
  z-index: 40;
}
.fab-top.in { opacity: 1; transform: translateY(0); pointer-events: auto; }
.fab-top:hover { background: #2a2820; }
@media (max-width: 820px) {
  .fab-top { bottom: 76px; right: 16px; }
}

/* ============================== REDUCE MOTION ============================== */
@media (prefers-reduced-motion: reduce) {
  .header { animation: none; }
  .wordmark:hover .wm-inf svg path { animation: none; }
}
