* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Rubik', sans-serif;
  background: linear-gradient(135deg, #0f0f0f, #1a1a1a);
  color: white;
  overflow-x: hidden;
}

header {
  position: relative;
  overflow: hidden;
  text-align: center;
  padding: 100px 20px 60px;
  background: black; /* fallback */
}

header .bg-video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  opacity: 0.4;
}

header h1,
header p,
header .button {
  position: relative;
  z-index: 1;
}

header h1 {
  font-size: 3.5em;
  margin-bottom: 20px;
  text-shadow: 0 0 10px rgba(109, 40, 217, 0.7);
}

header p {
  font-size: 1.3em;
  color: #ccc;
}

section {
  padding: 60px 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.section-title {
  text-align: center;
  margin-bottom: 40px;
  font-size: 2em;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.card {
  background: #2c2c2c;
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  transition: transform 0.3s, background 0.3s, box-shadow 0.3s;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 200px; /* Минимальная высота карточки */
}

.card:hover {
  background: linear-gradient(135deg, #6d28d9, #9333ea);
  box-shadow: 0 0 20px rgba(109, 40, 217, 0.4);
  transform: scale(1.05);
}

.card h3 {
  margin-bottom: 10px;
  color: #fff;
  font-size: 1.5em;
  min-height: 48px; /* Фиксированная высота для заголовков */
  display: flex;
  align-items: center;
  justify-content: center;
}

.card p {
  color: #ddd;
  font-size: 1em;
  min-height: 40px; /* Фиксированная высота для описаний */
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-details {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transform: scaleY(0.95);
  transition: all 0.4s ease;
  transform-origin: top;
  margin-top: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card.active .card-details {
  max-height: 1000px; /* Чтобы влезло любое содержимое */
  opacity: 1;
  transform: scaleY(1);
  margin-top: 15px;
}

.card-details img {
  display: block;
  max-width: 100%;
  height: 200px; /* Фиксированная высота для изображений */
  object-fit: cover;
  border-radius: 8px;
}

.card-details p {
  min-height: auto; /* Отменяем фиксированную высоту для текста в деталях */
}

.card-details .button {
  margin-top: 10px;
  align-self: center; /* Выравнивание кнопки по центру */
}

a.button {
  display: inline-block;
  margin-top: 30px;
  padding: 12px 24px;
  background: #6d28d9;
  color: white;
  text-decoration: none;
  border-radius: 8px;
  transition: background 0.2s;
}

a.button:hover {
  background: #4c1d95;
}

a.button.small {
  padding: 8px 16px;
  font-size: 0.9em;
}

footer {
  text-align: center;
  padding: 40px 20px;
  background: #111;
  font-size: 0.9em;
  color: #777;
}

.lang-switcher {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 2;
}

.lang-switcher select {
  background: rgba(0, 0, 0, 0.5);
  color: white;
  font-family: 'Russo One', sans-serif;
  font-size: 0.9em;
  border: 1px solid #6d28d9;
  border-radius: 8px;
  padding: 6px 12px;
  outline: none;
  appearance: none;
  backdrop-filter: blur(6px);
  cursor: pointer;
  transition: 0.3s;
}

.lang-switcher select option {
  background: #2c2c2c;
  color: white;
  font-family: 'Russo One', sans-serif;
}

.lang-switcher select:hover {
  background: rgba(0, 0, 0, 0.7);
  border-color: #a855f7;
}

/* Адаптивные стили для мобильных устройств (max-width: 768px) */
@media (max-width: 768px) {
  /* Header */
  header {
    padding: 60px 15px 40px; /* Уменьшаем высоту */
  }

  header h1 {
    font-size: 2.2em; /* Меньший шрифт */
    margin-bottom: 15px;
  }

  header p {
    font-size: 1em; /* Меньший шрифт */
    padding: 0 10px; /* Добавляем горизонтальные отступы для читаемости */
  }

  /* Секции */
  section {
    padding: 40px 15px; /* Уменьшаем отступы */
  }

  .section-title {
    font-size: 1.5em; /* Чуть меньше заголовок секции */
  }

  /* Grid в одну колонку */
  .grid {
    grid-template-columns: 1fr; /* Одна колонка */
    gap: 15px; /* Уменьшаем промежутки */
  }

  /* Карточки */
  .card {
    min-height: 150px; /* Меньшая минимальная высота */
    padding: 15px; /* Уменьшаем внутренние отступы */
  }

  .card h3 {
    font-size: 1.2em; /* Меньший заголовок */
    min-height: 40px; /* Корректируем высоту */
  }

  .card p {
    font-size: 0.9em; /* Меньший текст */
    min-height: 32px; /* Корректируем высоту */
  }

  .card-details img {
    height: 150px; /* Меньшая высота изображений */
  }

  /* Кнопки */
  a.button {
    margin-top: 20px;
    padding: 10px 20px;
  }

  a.button.small {
    padding: 6px 12px;
    font-size: 0.8em;
  }

  /* Переключатель языка */
  .lang-switcher {
    top: 10px;
    right: 10px;
  }

  .lang-switcher select {
    font-size: 0.8em;
    padding: 4px 8px;
  }
}

.hero-logo-wrapper {
  position: relative;
  z-index: 1;
  margin-bottom: 20px;
}

.hero-logo {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 50%;
  box-shadow: 0 0 20px rgba(109, 40, 217, 0.6);
  transition: transform 0.3s ease;
}

.hero-logo:hover {
  transform: scale(1.05);
}

@media (max-width: 768px) {
  .hero-logo {
    width: 90px;
    height: 90px;
  }
}

#latest-news {
  background: #1e1e1e;
  border-top: 2px solid #6d28d9;
  padding: 60px 20px;
  margin-top: -30px;
}

#latest-news-card img {
  width: 100%;
  max-height: 240px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 15px;
}

@media (max-width: 768px) {
  #latest-news-card img {
    max-height: 180px;
  }
}

footer .footer-link {
  display: inline-block;
  margin-top: 10px;
  color: #a855f7;
  text-decoration: none;
  font-weight: bold;
  transition: color 0.3s;
}

footer .footer-link:hover {
  color: #d8b4fe;
}

.main-nav {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 2;
  display: flex;
  gap: 20px;
}

.main-nav a {
  color: white;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95em;
  padding: 6px 12px;
  border-radius: 6px;
  transition: background 0.3s;
  background: rgba(255, 255, 255, 0.05);
}

.main-nav a:hover {
  background: rgba(109, 40, 217, 0.4);
}

@media (max-width: 768px) {
  .main-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    display: flex;
    flex-direction: row;            /* горизонтально */
    justify-content: space-around;  /* ссылки равномерно по ширине */
    background: rgba(15, 15, 15, 0.9);
    padding: 8px 0;
    z-index: 1000;
  }

  .main-nav a {
    font-size: 0.9em;
    padding: 8px 12px;
  }
}

.main-nav a.active {
  background: rgba(109, 40, 217, 0.8);
}

.nav-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 100;
  transition: transform 0.3s ease;
}

.nav-wrapper.hidden {
  transform: translateY(-100%);
}

@media (max-width: 768px) {
  .lang-switcher {
    position: fixed;    /* чтобы не смещался при прокрутке */
    top: 10px;
    right: 10px;
    z-index: 1100;      /* выше, чем у .main-nav */
  }
}
