/* Большой — брендбук: 5 цветов (+ белый для карточек) */
:root {
  /* 1. Slate — шапка, подвал, лёгкий тон hero (не чёрный) */
  --brand: #70859a;
  --brand-deep: #5f7388;
  /* 2. Синий — акцент: кнопки, ссылки, активное меню */
  --accent: #1c3d78; /* акцент сайта (макет v1) — единственное место, где задан цвет */
  --accent-h: #14305f;
  /* 3. Ink — основной текст */
  --ink: #1b2430;
  /* 4. Muted — подписи, вторичный текст */
  --muted: #6b7685;
  /* 5. Surface — фон страницы, чередующиеся секции */
  --surface: #f0f3f7;

  /* Статусы — один зелёный / красный / синий на весь сайт */
  --ok: #1a8f5c;
  --danger: #e63946;
  --info: #1a5fb4;

  --text: var(--ink);
  --bg: #ffffff;
  --bg-alt: var(--surface);
  --border: #dde3eb;
  --radius: 12px;

  /* На тёмном фоне шапки / hero */
  --on-brand: #ffffff;
  --on-brand-muted: rgba(255, 255, 255, 0.78);

  /* Совместимость */
  --dark: var(--brand-deep);
  --dark2: var(--brand);

  /* UI поиска / меню полей — фирменный гротеск (не system/Arial) */
  --font-ui: "Outfit", "Segoe UI", sans-serif;

  /* Один горизонтальный зазор: шапка, форма поиска, карточки, выдача */
  --site-gutter-x: 16px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
  overflow-y: auto;
  /* Иначе на коротких страницах нет полосы прокрутки — шапка прыгает влево-вправо */
  scrollbar-gutter: stable;
}

body {
  font-family: var(--font-ui);
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
  width: 100%;
  max-width: 100%;
  /* Только html скроллит — иначе второй scrollbar при открытии dropdown */
  overflow-x: clip;
  overflow-y: visible;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 var(--site-gutter-x);
}

/* ---------- Site chrome: единый блок (меню + форма поиска) ---------- */
.header--chrome {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  color: var(--ink);
  box-shadow: 0 6px 16px rgba(13, 27, 42, 0.04);
}

.header--chrome .header-bar {
  border-bottom: none;
}

.header--chrome .site-chrome__search,
.header--chrome .home-search-dock {
  position: static;
  top: auto;
  z-index: auto;
  margin: 0;
  padding: 10px var(--site-gutter-x) 12px;
  background: var(--bg);
  border-top: 1px solid rgba(27, 38, 59, 0.08);
  border-bottom: 1px solid var(--border);
  box-shadow: none;
}

/* ---------- Шапка (единая на главной, поиске, кабинете) ---------- */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  color: var(--ink);
  box-shadow: none;
  --hdr-rule-h: 3px;
  --hdr-rule-offset: 5px;
  --hdr-tools-pad: 10px;
}

/* Верхняя полоса: лого | меню по центру | кабинет / язык / вход */
.header-bar {
  position: relative;
  background: var(--bg);
  color: var(--ink);
  border-bottom: 1px solid rgba(27, 38, 59, 0.08);
}

.header-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 10px;
  padding-bottom: 10px;
  min-height: 52px;
}

.header-brand {
  display: flex;
  flex-direction: row;
  align-items: center;
  position: relative;
  z-index: 2;
  flex-shrink: 0;
}

/* VIN-поиск — справа на подстраницах (на главной в dock) */
.header-quick-search {
  position: static;
  left: auto;
  top: auto;
  transform: none;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 12px;
  width: auto;
  flex: 0 1 20rem;
  max-width: min(20rem, 34vw);
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  overflow: visible;
}

.header-quick-input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  border-bottom: 1px solid rgba(15, 23, 42, 0.22);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  caret-color: var(--accent);
  font-size: 0.84rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  padding: 6px 0;
  outline: none;
  box-shadow: none;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.15s ease;
}

.header-quick-input:focus {
  border-bottom-color: var(--accent);
  outline: none;
  box-shadow: none;
}

.header-quick-input::-webkit-search-decoration,
.header-quick-input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.header-quick-input::placeholder {
  color: var(--muted);
}

.header-quick-btn {
  appearance: none;
  flex-shrink: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0;
  cursor: pointer;
  white-space: nowrap;
}

.header-quick-btn:hover {
  color: var(--accent);
  background: transparent;
}

/* Меню — абсолютный центр верхней строки */
.header-inner > .nav,
.header .nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  flex-wrap: nowrap;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: max-content;
  max-width: min(680px, calc(100% - 20rem));
  overflow-x: auto;
  scrollbar-width: none;
  z-index: 1;
}
.header .nav::-webkit-scrollbar { display: none; }

.header-tools {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 14px;
  flex-shrink: 0;
  min-width: 0;
  margin-left: auto;
}

[data-site-header-variant="home"] .header-tools {
  margin-left: auto;
}

/* Войти / Выйти — без плитки, как пункты меню */
.site-auth-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: var(--ink);
  border-radius: 0;
  padding: 0;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  text-transform: uppercase;
  min-width: 4.5rem;
  box-sizing: border-box;
}
.site-auth-btn:hover {
  color: var(--accent);
  background: transparent;
  border: 0;
}
.site-auth-btn[hidden] { display: none !important; }

/* Кабинет — ТОЛЬКО при html.client-authed (сессия подтверждена). Иначе никогда не показывать. */
#navAccount,
.site-office-link {
  display: none !important;
  align-items: center;
  color: rgba(27, 38, 59, 0.88);
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  padding: 0;
  cursor: pointer;
  pointer-events: none;
}
html.client-authed #navAccount {
  display: inline-flex !important;
  pointer-events: auto;
}
html.client-authed #navAccount:hover,
html.client-authed #navAccount.nav-active {
  color: var(--accent);
}

.logo {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  line-height: 0;
  flex-shrink: 0;
}
.logo img {
  display: block;
  height: 38px;
  width: auto;
  max-width: min(190px, 34vw);
}
.logo:hover img {
  opacity: 0.92;
}

.nav a {
  display: inline-block;
  position: relative;
  color: rgba(27, 38, 59, 0.62);
  text-decoration: none;
  /* фиксированный кегль/вес — активный пункт не меняет ширину слова */
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  padding: 0 0 5px;
  transition: color 0.12s ease;
  flex-shrink: 0;
}

.nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: transparent;
  border-radius: 0;
  z-index: 2;
  pointer-events: none;
}

.nav a:hover {
  color: var(--ink);
}

.nav a.nav-active {
  color: var(--ink);
  font-weight: 600; /* тот же вес, что и обычный — без «разъезда» */
}

.nav a.nav-active::after {
  background: var(--accent);
}

.nav a[hidden] {
  display: none !important;
}

/* Язык: светлый фон шапки — тёмный текст */
.lang-menu {
  position: relative;
  flex-shrink: 0;
  display: inline-flex;
  align-items: baseline;
  gap: 0.4em;
  font-size: 0.78rem;
}
.lang-menu-current {
  color: var(--muted);
  font-size: 0.5em;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1;
  white-space: nowrap;
  user-select: none;
}
.lang-menu-toggle {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink);
  border-radius: 0;
  padding: 0;
  font-size: 1em;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.2;
  cursor: pointer;
  text-transform: uppercase;
  min-width: 0;
}
.lang-menu-toggle:hover {
  background: transparent;
  color: var(--accent);
}
.lang-menu-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 4.5rem;
  padding: 4px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.22);
  z-index: 80;
}
.lang-menu-panel[hidden] { display: none !important; }
.lang-menu-option {
  display: block;
  width: 100%;
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  border-radius: 5px;
  padding: 7px 10px;
  font-size: 0.8rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
}
.lang-menu-option:hover {
  background: var(--surface);
}
.lang-menu-option.is-active {
  background: rgba(28, 61, 120, 0.12);
  color: var(--accent);
}

/* legacy class name — на сайте больше не плитки */
.lang-switch { display: contents; }
.lang-btn { display: none; }

/* Гамбургер — только мобилка; на desktop скрыт */
.site-nav-toggle {
  display: none;
  appearance: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  flex-shrink: 0;
}
.site-nav-toggle__bars,
.site-nav-toggle__bars::before,
.site-nav-toggle__bars::after {
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  transition: transform 0.18s ease, opacity 0.18s ease;
}
.site-nav-toggle__bars {
  position: relative;
}
.site-nav-toggle__bars::before,
.site-nav-toggle__bars::after {
  content: "";
  position: absolute;
  left: 0;
}
.site-nav-toggle__bars::before { top: -6px; }
.site-nav-toggle__bars::after { top: 6px; }
.header.is-nav-open .site-nav-toggle__bars {
  background: transparent;
}
.header.is-nav-open .site-nav-toggle__bars::before {
  top: 0;
  transform: rotate(45deg);
}
.header.is-nav-open .site-nav-toggle__bars::after {
  top: 0;
  transform: rotate(-45deg);
}

@media (max-width: 900px) {
  /* Мобилка: chrome и шапка уезжают при скролле (на десктопе sticky) */
  .header,
  .header--chrome {
    position: static;
  }
  .header--chrome {
    box-shadow: none;
  }
  .header--chrome .site-chrome__search,
  .header--chrome .home-search-dock,
  .home-search-dock {
    position: static;
    top: auto;
    box-shadow: none;
  }
  .header-bar {
    position: relative;
    z-index: 40;
  }
  .header-inner {
    flex-wrap: nowrap;
    min-height: 48px;
    padding-top: 8px;
    padding-bottom: 8px;
    gap: 8px;
  }
  .header-brand { order: 1; flex-shrink: 1; min-width: 0; }
  .header-tools {
    order: 2;
    margin-left: auto;
    gap: 8px;
  }
  
  .lang-menu-current {
    display: none;
  }
  .site-nav-toggle {
    display: inline-flex;
  }
  /* Меню — выезжающая панель, не вторая строка под логотипом */
  .header-inner > .nav,
  .header .nav {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    transform: none;
    order: unset;
    width: 100%;
    max-width: none;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0;
    margin: 0;
    padding: 8px 16px 14px;
    background: #fff;
    border-bottom: 1px solid rgba(15, 23, 42, 0.1);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.1);
    z-index: 55;
  }
  .header.is-nav-open .nav {
    display: flex;
  }
  .header .nav a {
    width: 100%;
    padding: 12px 2px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
    font-size: 0.82rem;
  }
  .header .nav a:last-child {
    border-bottom: 0;
  }
  .header .nav a::after {
    display: none;
  }
  /* VIN в верхней полоске шапки скрыт; в dock (.header-quick-search--dock) — остаётся */
  .header-bar .header-quick-search:not(.header-quick-search--dock) {
    display: none;
  }
}

@media (max-width: 520px) {
  .logo img { height: 32px; }
  .header-quick-btn { font-size: 0.7rem; letter-spacing: 0.08em; }
}

