/* Consilium.AI — кнопка переключения темы (общая для всех страниц)
   Палитры тёмной/светлой темы задаются в CSS каждой страницы
   через [data-theme="light"]. */

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 999px;
  border: 1px solid var(--border, #1f2937);
  background: transparent;
  color: var(--text-muted, var(--muted, #9ca3af));
  cursor: pointer;
  padding: 0;
  transition:
    color 0.2s,
    border-color 0.2s,
    background 0.2s;
}

.theme-toggle:hover {
  color: var(--accent-cyan, var(--cyan, #06b6d4));
  border-color: currentColor;
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--accent-cyan, var(--cyan, #06b6d4));
  outline-offset: 2px;
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
  display: block;
}

/* В тёмной теме показываем луну (нажмём — станет светло),
   в светлой — солнце (нажмём — станет темно). */
.theme-toggle .icon-sun {
  display: none;
}

[data-theme='light'] .theme-toggle .icon-sun {
  display: block;
}

[data-theme='light'] .theme-toggle .icon-moon {
  display: none;
}

/* Фолбэк для страниц без шапки (например, 404):
   фиксированная кнопка в правом верхнем углу. */
.theme-toggle.floating {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 300;
  background: var(--card, #111827);
}

/* ============================================================================
   ЕДИНАЯ НАВИГАЦИЯ (шапка + мобильное меню)
   Каноническая разметка — site/_partials/header.html, логика — site/nav.js.
   Палитра берётся из CSS-переменных страницы:
     --bg-color, --card-bg, --text-main, --text-muted,
     --accent-cyan, --accent-blue, --border
   (все страницы сайта их определяют в :root и [data-theme='light']).
   ========================================================================== */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--header-bg, rgba(3, 7, 18, 0.8));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border, #1f2937);
  z-index: 200;
}

/* Глобальный отступ под фиксированную шапку */
main {
  padding-top: 5.5rem;
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.25rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

/* Логотип (шапка и футер) */
.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text-main, #f9fafb);
  text-decoration: none;
  flex: none;
}

.logo img {
  display: inline-block;
  vertical-align: middle;
}

.logo span {
  color: var(--accent-cyan, #06b6d4);
}

.nav-links {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Dropdown-контейнер (Как работает / Ресурсы) */
.nav-dropdown {
  position: relative;
}

.nav-dropdown > a {
  color: var(--text-muted, #9ca3af);
  text-decoration: none;
  font-size: 0.95rem;
  transition: color 0.2s;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
}

.nav-dropdown > a::after {
  content: '';
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  transition: transform 0.2s;
}

.nav-dropdown > a:hover,
.nav-dropdown.active > a {
  color: var(--accent-cyan, #06b6d4);
}

/* Выпадающее меню */
.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  min-width: 220px;
  background: var(--card-bg, #111827);
  border: 1px solid var(--border, #1f2937);
  border-radius: 12px;
  padding: 0.5rem;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.2s,
    transform 0.2s,
    visibility 0.2s;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  z-index: 300;
  list-style: none;
  margin: 0;
}

.dropdown-menu::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 0;
  right: 0;
  height: 8px;
}

.nav-dropdown:hover .dropdown-menu,
.nav-dropdown.active .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.nav-dropdown:hover > a::after,
.nav-dropdown.active > a::after {
  transform: rotate(180deg);
}

.dropdown-menu a {
  display: block;
  padding: 0.6rem 1rem;
  color: var(--text-muted, #9ca3af);
  text-decoration: none;
  font-size: 0.9rem;
  border-radius: 8px;
  transition:
    background 0.15s,
    color 0.15s;
}

.dropdown-menu a:hover {
  background: rgba(6, 182, 212, 0.1);
  color: var(--accent-cyan, #06b6d4);
}

/* Активная страница (пункты выпадающих меню: Документы, Нормативная база) */
.dropdown-menu a.active {
  color: var(--accent-cyan, #06b6d4);
  font-weight: 600;
}

/* Качество — красный акцент (первый пункт) */
.nav-quality-link {
  color: #ef4444;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-radius: 999px;
  padding: 0.25rem 0.9rem;
  background: rgba(239, 68, 68, 0.08);
  transition:
    background 0.2s,
    color 0.2s;
}

.nav-quality-link:hover {
  background: rgba(239, 68, 68, 0.16);
  color: #ef4444;
}

.nav-quality-link.active {
  background: rgba(239, 68, 68, 0.2);
}

/* Блог — циановая «пилюля» */
.nav-blog-link {
  color: var(--accent-cyan, #06b6d4);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  padding: 0.5rem 0.75rem;
  border: 1px solid rgba(6, 182, 212, 0.4);
  border-radius: 999px;
  background: rgba(6, 182, 212, 0.08);
  transition:
    background 0.2s,
    border-color 0.2s;
}

.nav-blog-link:hover {
  background: rgba(6, 182, 212, 0.16);
  border-color: var(--accent-cyan, #06b6d4);
}

.nav-blog-link.active {
  background: rgba(6, 182, 212, 0.2);
  border-color: var(--accent-cyan, #06b6d4);
}

/* Обычный верхний пункт (Тарифы) */
.nav-top-link {
  color: var(--text-muted, #9ca3af);
  text-decoration: none;
  font-size: 0.95rem;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  transition:
    color 0.2s,
    background 0.2s;
}

.nav-top-link:hover {
  color: var(--accent-cyan, #06b6d4);
  background: rgba(6, 182, 212, 0.06);
}

/* Кнопка (общий стиль; в шапке переопределяется .site-header .btn) */
.btn {
  background: linear-gradient(135deg, var(--accent-blue, #3b82f6), var(--accent-cyan, #06b6d4));
  color: #fff;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  display: inline-block;
  transition:
    opacity 0.2s,
    transform 0.2s;
}

.btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

/* Кнопка «Тест-драйв» в шапке */
.site-header .btn {
  background: linear-gradient(135deg, var(--accent-blue, #3b82f6), var(--accent-cyan, #06b6d4));
  color: #fff;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  flex: none;
  transition:
    opacity 0.2s,
    transform 0.2s;
}

.site-header .btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

/* Кнопка темы в шапке — не сжимается */
.site-header .theme-toggle {
  flex: none;
}

/* BURGER */
.burger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 8px;
  z-index: 200;
  flex: none;
}

.burger span {
  width: 24px;
  height: 2px;
  background: var(--text-main, #f9fafb);
  border-radius: 2px;
  transition:
    transform 0.3s,
    opacity 0.3s;
}

.burger.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.burger.active span:nth-child(2) {
  opacity: 0;
}

.burger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* МОБИЛЬНОЕ МЕНЮ (оверлей) */
.mobile-menu {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--menu-bg, rgba(3, 7, 18, 0.97));
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 150;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  padding: 5rem 1.5rem 2rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Safe centering: центрирует контент, но не обрезает при переполнении */
.mobile-menu::before,
.mobile-menu::after {
  content: '';
  flex: 1;
  flex-shrink: 1;
}

.mobile-menu.open {
  display: flex;
}

.mobile-menu a {
  color: var(--text-main, #f9fafb);
  text-decoration: none;
  font-size: 1.4rem;
  font-weight: 600;
  transition: color 0.2s;
}

.mobile-menu a:hover {
  color: var(--accent-cyan, #06b6d4);
}

/* Качество в мобильном меню — красная «пилюля» */
.mobile-menu a.mobile-quality-link {
  color: #ef4444;
  font-size: 1.6rem;
  font-weight: 700;
  border: 1px solid #ef4444;
  border-radius: 999px;
  padding: 0.5rem 1.5rem;
  background: rgba(239, 68, 68, 0.08);
}

/* Блог в мобильном меню — циановая «пилюля» */
.mobile-menu a.blog-link {
  color: var(--accent-cyan, #06b6d4);
  font-size: 1.6rem;
  font-weight: 700;
  border: 1px solid var(--accent-cyan, #06b6d4);
  border-radius: 999px;
  padding: 0.5rem 1.5rem;
  background: rgba(6, 182, 212, 0.08);
}

.mobile-menu a.blog-link.active {
  background: rgba(6, 182, 212, 0.2);
}

/* Тест-драйв в мобильном меню — циановая «пилюля» */
.mobile-menu a.mobile-pilot-link {
  color: var(--accent-cyan, #06b6d4);
  font-size: 1.6rem;
  font-weight: 700;
  border: 1px solid var(--accent-cyan, #06b6d4);
  border-radius: 999px;
  padding: 0.5rem 1.5rem;
  background: rgba(6, 182, 212, 0.08);
}

/* Мобильные группы с подменю */
.mobile-nav-group {
  width: 100%;
  text-align: center;
}

.mobile-nav-toggle {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-main, #f9fafb);
  font-size: 1.4rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: color 0.2s;
}

.mobile-nav-toggle:hover {
  color: var(--accent-cyan, #06b6d4);
}

.mobile-nav-toggle .arrow {
  display: inline-block;
  transition: transform 0.2s;
  font-size: 1rem;
}

.mobile-nav-toggle.open .arrow {
  transform: rotate(180deg);
}

.mobile-sub-menu {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 0;
  overflow: hidden;
  transition:
    max-height 0.3s ease,
    padding 0.3s ease;
}

.mobile-sub-menu.open {
  max-height: 300px;
  padding: 0.5rem 0 1rem 0;
}

.mobile-sub-menu li a {
  display: block;
  padding: 0.6rem 1.5rem;
  color: var(--text-muted, #9ca3af);
  font-size: 1.1rem;
  font-weight: 400;
  border-radius: 8px;
  transition:
    background 0.15s,
    color 0.15s;
}

.mobile-sub-menu li a:hover {
  background: rgba(6, 182, 212, 0.1);
  color: var(--accent-cyan, #06b6d4);
}

/* Адаптивность: ≤1200px — бургер вместо горизонтального меню */
@media (max-width: 1200px) {
  .nav-links {
    display: none;
  }
  .burger {
    display: flex;
  }
  .nav-container > .btn {
    margin-left: auto;
  }
}

/* ≤600px — прячем кнопку «Тест-драйв» (она есть в мобильном меню) */
@media (max-width: 600px) {
  .nav-container {
    padding: 0.9rem 1rem;
  }
  .site-header .logo {
    font-size: 1.125rem;
  }
  .nav-container > .btn {
    display: none;
  }
  .nav-container > .burger {
    margin-left: auto;
  }
  /* Уменьшаем шрифт в мобильном меню, чтобы pill-кнопки не переполняли */
  .mobile-menu a {
    font-size: 1.2rem;
  }
  .mobile-menu a.mobile-quality-link,
  .mobile-menu a.blog-link,
  .mobile-menu a.mobile-pilot-link {
    font-size: 1.3rem;
    padding: 0.4rem 1.2rem;
  }
  .mobile-nav-toggle {
    font-size: 1.2rem;
  }
  .mobile-sub-menu li a {
    font-size: 1rem;
  }
}

/* ============================================================================
   ЕДИНЫЙ ПОДВАЛ
   Каноническая разметка — site/_partials/footer.html.
   Палитра берётся из CSS-переменных страницы:
     --bg-color, --card-bg, --text-main, --text-muted,
     --accent-cyan, --accent-blue, --border
   ========================================================================== */

.site-footer {
  border-top: 1px solid var(--border, #1f2937);
  background: var(--footer-bg, #020613);
  padding: 3.5rem 2rem 2rem;
}

.footer-grid {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 2.5rem;
}

.footer-col h2 {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-main, #f9fafb);
  margin-bottom: 1rem;
}

.footer-col ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-col ul li {
  margin-bottom: 0.5rem;
}

.footer-col ul li a {
  color: var(--text-muted, #9ca3af);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s;
}

.footer-col ul li a:hover {
  color: var(--accent-cyan, #06b6d4);
}

/* Бренд-колонка */
.footer-brand .logo {
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
}

.footer-brand .logo img {
  width: 28px;
  height: 28px;
}

.footer-brand p {
  color: var(--text-muted, #9ca3af);
  font-size: 0.85rem;
  line-height: 1.5;
  max-width: 280px;
}

/* Контакты */
.footer-contacts-list li a {
  color: var(--accent-cyan, #06b6d4);
}

/* Нижняя часть */
.footer-bottom {
  max-width: 1200px;
  margin: 2.5rem auto 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border, #1f2937);
}

.footer-disclaimer {
  color: var(--text-muted, #9ca3af);
  font-size: 0.8rem;
  line-height: 1.5;
  margin-bottom: 0.5rem;
}

.footer-age-restriction {
  color: var(--text-muted, #9ca3af);
  font-size: 0.75rem;
  line-height: 1.4;
  margin-bottom: 1rem;
  font-weight: 500;
}

.footer-legal {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.5rem;
  align-items: center;
}

.footer-legal p {
  color: var(--text-muted, #9ca3af);
  font-size: 0.8rem;
  margin: 0;
}

.footer-legal-links {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.footer-legal-links a {
  color: var(--text-muted, #9ca3af);
  text-decoration: none;
  font-size: 0.8rem;
  transition: color 0.2s;
}

.footer-legal-links a:hover {
  color: var(--accent-cyan, #06b6d4);
}

.footer-fz152 {
  color: var(--accent-cyan, #06b6d4) !important;
  font-weight: 500;
}

/* Адаптивность подвала */
@media (max-width: 968px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
  }
  .footer-brand {
    grid-column: 1 / -1;
  }
  .footer-brand p {
    max-width: 100%;
  }
}

@media (max-width: 600px) {
  .site-footer {
    padding: 2.5rem 1.25rem 1.5rem;
  }
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  .footer-legal {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }
}

/* ===== Горизонтальные перекрёстные ссылки (cross-links) ===== */
.cross-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 1.25rem 1.5rem;
  margin: 2.5rem auto;
  max-width: 1200px;
  background: var(--card-bg, #111827);
  border: 1px solid var(--border, #1f2937);
  border-radius: 12px;
}

.cross-links-title {
  width: 100%;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted, #9ca3af);
  margin-bottom: 0.25rem;
}

.cross-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-main, #f9fafb);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border, #1f2937);
  border-radius: 8px;
  transition:
    border-color 0.2s,
    color 0.2s,
    background 0.2s;
}

.cross-links a:hover {
  color: var(--accent-cyan, #06b6d4);
  border-color: var(--accent-cyan, #06b6d4);
  background: rgba(6, 182, 212, 0.06);
}

.cross-links a .cl-icon {
  font-size: 1rem;
  line-height: 1;
}

@media (max-width: 600px) {
  .cross-links {
    padding: 1rem;
    gap: 0.5rem;
  }
  .cross-links a {
    font-size: 0.82rem;
    padding: 0.4rem 0.7rem;
  }
}
