/* responsive.css — улучшенная мобильная навигация (заменяет старый файл) */
@media (max-width: 900px) {
  /* Гамбургер */
  .hamburger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 44px;
    height: 44px;
    cursor: pointer;
    position: relative;
    z-index: 1100;
    transition: transform 0.25s ease;
    padding: 8px;
    background: transparent;
    border: none;
  }

  .hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--primary-color, #333);
    margin: 3px 0;
    transition: transform 0.28s ease, opacity 0.28s ease;
    transform-origin: center;
    border-radius: 2px;
  }

  .hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translateY(6px);
  }
  .hamburger.active span:nth-child(2) {
    opacity: 0;
    transform: scale(0);
  }
  .hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translateY(-6px);
  }

  /* Панель навигации: фиксированная ширина, выезжает справа */
  .nav-links {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: var(--navbar-height, 70px);
    right: 0;
    left: auto;
    width: min(320px, 85%);
    height: calc(100vh - var(--navbar-height, 70px));
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    gap: 0;
    padding: 0.5rem 0;
    box-shadow: -8px 0 24px rgba(0, 0, 0, 0.12);
    z-index: 1105;
    transform: translateX(100%);
    transition: transform 0.36s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.28s ease;
    opacity: 0;
    pointer-events: none;
    overflow-y: auto;
  }

  .nav-links.active {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
  }

  /* Пункты меню — анимация входа с правой стороны */
  .nav-links li {
    width: 100%;
    padding: 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    transform: translateX(20px);
    opacity: 0;
    transition: transform 0.32s ease, opacity 0.32s ease;
  }

  .nav-links.active li {
    transform: translateX(0);
    opacity: 1;
  }

  .nav-links.active li:nth-child(1) { transition-delay: 0.06s; }
  .nav-links.active li:nth-child(2) { transition-delay: 0.10s; }
  .nav-links.active li:nth-child(3) { transition-delay: 0.14s; }
  .nav-links.active li:nth-child(4) { transition-delay: 0.18s; }
  .nav-links.active li:nth-child(5) { transition-delay: 0.22s; }

  /* Ссылки */
  .nav-links a {
    display: block;
    width: 100%;
    padding: 1rem 1.25rem;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-color, #222);
    text-decoration: none;
    position: relative;
    transition: background 0.18s ease, padding-left 0.18s ease, color 0.18s ease;
  }

  .nav-links a:hover,
  .nav-links a:focus {
    background: rgba(var(--primary-color-rgb, 51, 122, 183), 0.06);
    color: var(--primary-color, #337ab7);
    padding-left: 1.75rem;
  }

  .nav-links a.active {
    background: rgba(var(--primary-color-rgb, 51, 122, 183), 0.12);
    color: var(--primary-color, #337ab7);
    border-left: 4px solid var(--primary-color, #337ab7);
    padding-left: 1.25rem;
  }

  /* Индикатор текущей страницы (малый кружок справа) */
  .nav-links a::after {
    content: '';
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--primary-color, #337ab7);
    opacity: 0;
    transition: opacity 0.18s ease;
  }
  .nav-links a.active::after { opacity: 1; }

  /* Языковой селектор — аккуратные плашки
     Поддерживаются оба варианта структуры:
     (1) .language-selector .lang-buttons > .lang-btn
     (2) .language-selector .lang-btn (когда контейнера .lang-buttons нет)
  */
  .language-selector {
    display: flex;                /* единое поведение: контейнер - flex */
    gap: 0.5rem;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: nowrap;
    padding: 0.75rem 1rem;

   
    background: transparent;
  }

  .language-selector .lang-buttons { /* если есть вложенный контейнер — тоже делаем flex */
    display: flex;
    gap: 0.5rem;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: nowrap;
    width: 100%;
  }

  .lang-btn {
    position: relative;
    padding: var(--spacing-xs, 0.25rem) 1.25rem;
    border: none;
    border-radius: 30px;
    background: transparent;
    color: var(--text-color, #222);
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
  }

  .lang-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--gradient);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
  }

  .lang-btn:hover {
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(42, 94, 232, 0.3);
  }

  .lang-btn:hover::before {
    opacity: 1;
  }

  /* Поддержка двух форм активации: классом и атрибутом (из Кода2) */
  .lang-btn.active {
    color: white;
    background: var(--gradient);
    box-shadow: 0 4px 15px rgba(42, 94, 232, 0.3);
  }

  .lang-btn.active::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    background: var(--secondary, #ff6b6b);
    border-radius: 50%;
    animation: pulse 1.5s infinite;
  }

  /* Анимация pulse (ранее отсутствовала) */
  @keyframes pulse {
    0%   { transform: translateX(-50%) scale(1); opacity: 1; }
    50%  { transform: translateX(-50%) scale(1.4); opacity: 0.6; }
    100% { transform: translateX(-50%) scale(1); opacity: 1; }
  }

  /* Убираем браузерную окантовку на кнопках языка при клике/фокусе мышью,
     но сохраняем видимый фокус для клавиатурных пользователей (:focus-visible). */
  .lang-btn:focus { outline: none; box-shadow: none; }
  .lang-btn:focus-visible {
    outline: 2px solid rgba(51,122,183,0.25);
    outline-offset: 2px;
    border-radius: 20px;
  }

  /* Оверлей — всегда в документе, анимация через opacity/visibility */
  .nav-overlay {
    position: fixed;
    top: var(--navbar-height, 70px);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.28);
    z-index: 1100;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.28s ease, visibility 0.28s;
    pointer-events: none;
  }
  .nav-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  /* Предотвращение прокрутки страницы когда меню открыто */
  body.nav-open {
    overflow: hidden;
  }

  /* Фокус-стили для доступности */
  .hamburger:focus {
    outline: 2px solid rgba(51,122,183,0.25);
    outline-offset: 2px;
    border-radius: 6px;
  }
  .nav-links a:focus {
    outline: 2px solid rgba(51,122,183,0.18);
    outline-offset: -4px;
  }

  /* Мелкие корректировки для маленьких экранов */
  @media (max-width: 480px) {
    .nav-links { width: 90%; }
    .nav-links a { font-size: 1rem; padding: 0.9rem 1rem; }
    .language-selector .lang-btn { padding: 0.5rem 0.8rem; font-size: 0.9rem; min-width: 48px; }
  }
}

