/* ============================================================
   layout.css — шапка, меню, футер, заголовок страницы, 404
   ============================================================ */

/* ---------- Шапка: вся липкая, всегда видна при прокрутке ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  box-shadow: 0 1px 0 var(--line);
}

/* ---------- Верхняя полоса ---------- */
.topbar { background: var(--navy); color: var(--on-dark); font-size: 13.5px; }
.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 46px;
  flex-wrap: wrap;
  padding-top: 6px;
  padding-bottom: 6px;
}
.topbar__phones { display: flex; gap: 28px; flex-wrap: wrap; }
.topbar__phone { display: flex; align-items: center; gap: 10px; color: var(--on-dark); }
.topbar__phone:hover { color: #fff; }
.topbar__phone-row { display: flex; flex-direction: column; line-height: 1.3; }
.topbar__phone-row b { color: #fff; font-weight: 700; font-size: 14px; }
.topbar__phone-row em { font-style: normal; color: var(--on-dark-muted); font-size: 12.5px; }
.topbar__hours { display: flex; align-items: center; gap: 8px; color: var(--on-dark); }

/* ---------- Кнопка «Позвонить» с выбором филиала ---------- */
.mainbar__cta-wrap { position: relative; }
.mainbar__cta-arrow { transition: transform 0.2s ease; }
.mainbar__cta[aria-expanded="true"] .mainbar__cta-arrow { transform: rotate(180deg); }
.call-menu {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  z-index: 70;
  width: min(320px, calc(100vw - 24px));
  padding: 8px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
}
.call-menu.is-open { opacity: 1; visibility: visible; transform: none; }
.call-menu__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  color: var(--ink);
}
.call-menu__item:hover,
.call-menu__item:focus-visible { background: var(--accent-soft); }
.call-menu__item .icon { color: var(--accent-strong); flex-shrink: 0; }
.call-menu__info { display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.call-menu__info b { font-weight: 700; }
.call-menu__info em { font-style: normal; color: var(--muted); font-size: 13px; }

/* ---------- Основная шапка ---------- */
.mainbar {
  background: var(--white);
}
.mainbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: var(--header-h);
}
.logo { display: block; min-width: 0; }
.logo img { height: 46px; width: auto; max-width: 100%; object-fit: contain; }

/* ---------- Меню ---------- */
.nav__list { display: flex; align-items: center; gap: 6px; }
.nav__item { position: relative; }
.nav__link {
  display: block;
  position: relative;
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
}
.nav__link:hover { color: #fff; background: rgba(35, 81, 200, 0.92); }
.nav__item.is-active > .nav__link { color: #fff; background: var(--accent); }
.nav__item.is-active > .nav__link::after { display: none; }

.nav__submenu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 240px;
  padding: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
}
.has-children:hover .nav__submenu,
.has-children:focus-within .nav__submenu { opacity: 1; visibility: visible; transform: none; }
.nav__submenu a {
  display: block;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
}
.nav__submenu a:hover { background: var(--bg); color: var(--accent-strong); }

.mainbar__right { display: flex; align-items: center; gap: 14px; }

/* ---------- Бургер (мобильное меню) ---------- */
.burger {
  display: none;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 9px;
  background: var(--navy);
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.burger span { width: 18px; height: 2px; background: #fff; border-radius: 2px; }
.nav__close { display: none; }
.nav__logo { display: none; }

@media (max-width: 991px) {
  .nav {
    position: fixed;
    inset: 0 0 0 auto;
    z-index: 80;
    width: min(320px, 85vw);
    padding: 70px 24px 24px;
    background: var(--navy);
    overflow-y: auto;
    transform: translateX(105%);
    transition: transform 0.25s ease;
  }
  .nav.is-open { transform: none; box-shadow: -20px 0 60px rgba(0, 0, 0, 0.35); }
  body.menu-open { overflow: hidden; }

  .nav__close {
    display: block;
    position: absolute;
    top: 14px;
    right: 14px;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.10);
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
  }
  .nav__logo {
    display: flex;
    align-items: center;
    position: absolute;
    top: 16px;
    left: 24px;
    padding: 0;
    background: transparent;
    border-radius: 0;
    text-decoration: none;
    line-height: 0;
  }
  .nav__logo img { height: 43px; width: auto; display: block; border-radius: 8px; }
  .nav__list { margin-top: 32px; flex-direction: column; align-items: stretch; gap: 4px; }
  .nav__link { color: var(--on-dark); font-size: 16px; padding: 12px 14px; }
  .nav__item.is-active > .nav__link { color: #fff; background: var(--accent); }
  .nav__item.is-active > .nav__link::after { display: none; }
  .nav__submenu {
    position: static;
    padding: 6px 0 6px 14px;
    margin: 2px 0 6px;
    background: rgba(255, 255, 255, 0.06);
    border: 0;
    box-shadow: none;
    opacity: 1;
    visibility: visible;
    transform: none;
  }
  .nav__submenu a { color: var(--on-dark); }
  .nav__submenu a:hover { background: rgba(255, 255, 255, 0.08); color: var(--accent); }

  .burger { display: flex; }
  .mainbar__cta { display: inline-flex; }
  .topbar { display: none; }
  [id] { scroll-margin-top: 96px !important; }
}

/* Компактные кнопки на мобильном: «Позвонить» и бургер «три палочки» */
@media (max-width: 991px) {
  .mainbar__cta { padding: 9px 15px; font-size: 14px; gap: 6px; border-radius: 999px; }
  .mainbar__cta .mainbar__cta-arrow { width: 12px; height: 12px; }
  .burger { width: 38px; height: 38px; border-radius: 8px; gap: 3px; }
  .burger span { width: 17px; height: 2px; }
}

@media (max-width: 575px) {
  .mainbar__cta { padding: 8px 14px; font-size: 13.5px; gap: 5px; }
  .burger { width: 36px; height: 36px; }
  .burger span { width: 16px; }
  .page-hero { padding: 38px 0 34px; }
  /* Компактный логотип на мобильном, чтобы не выглядел сплющенным */
  .logo img { height: 36px; }
  .mainbar__inner { gap: 12px; }
  .mainbar__right { gap: 8px; }
}

/* ---------- Заголовок внутренних страниц ---------- */
.page-hero {
  background:
    radial-gradient(ellipse at 88% 150%, rgba(47, 99, 232, 0.25) 0%, transparent 55%),
    linear-gradient(120deg, var(--navy) 0%, var(--navy-soft) 100%);
  padding: 52px 0 48px;
}
.page-hero h1 { color: #fff; font-size: clamp(26px, 3.2vw, 36px); margin-bottom: 10px; }

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 14px;
  color: var(--on-dark-muted);
}
.breadcrumbs a { color: var(--on-dark); }
.breadcrumbs a:hover { color: #fff; }
.breadcrumbs span { color: var(--accent); }

/* ---------- Футер ---------- */
.site-footer { background: var(--navy); color: var(--on-dark-muted); padding-top: 60px; }
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1.2fr;
  gap: 40px;
  padding-bottom: 44px;
}
.footer-col h3 { color: #fff; font-size: 17px; margin-bottom: 16px; }
/* Логотип футера: светлая плашка, чтобы логотип читался на тёмном фоне */
.footer__logo {
  display: inline-flex;
  align-items: center;
  height: 44px;
  width: auto;
  padding: 6px 14px;
  background: var(--white);
  border-radius: 10px;
  object-fit: contain;
}
.footer__about { margin: 14px 0; font-size: 14.5px; }
.footer__email { display: flex; align-items: center; gap: 8px; }
.footer__email a { color: var(--accent); font-weight: 600; }
.footer__links li, .footer__addresses li { margin-bottom: 10px; }
.footer__links a, .footer__addresses a { color: var(--on-dark); }
.footer__links a:hover, .footer__addresses a:hover { color: var(--accent); }
.footer__addresses span { display: block; }
.footer__hours li { margin-bottom: 8px; }

.footer-bottom {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 18px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 13.5px;
  color: var(--on-dark-muted);
}

@media (max-width: 991px) {
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 32px; }
}
@media (max-width: 575px) {
  .footer-grid { grid-template-columns: 1fr; }
}

/* ---------- 404 ---------- */
.notfound { text-align: center; padding: 110px 0 130px; }
.notfound__code { font-size: clamp(80px, 12vw, 140px); font-weight: 800; color: var(--accent); line-height: 1; }
.notfound h1 { margin: 10px 0 14px; }
.notfound p { color: var(--muted); margin-bottom: 28px; }

/* ---------- Якорные секции: отступ от липкой шапки при прокрутке ---------- */
[id] { scroll-margin-top: 140px; }