/* ============================================
   CAASS — Central Asia Association of Social Sciences
   Global Styles
   ============================================ */

@font-face {
  font-family: "Glacial Indifference";
  src: url("https://cdn.jsdelivr.net/gh/Glyphter/glyphter-font@master/fonts/GlacialIndifference-Regular.woff2") format("woff2"),
       url("https://cdn.jsdelivr.net/gh/Glyphter/glyphter-font@master/fonts/GlacialIndifference-Regular.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Glacial Indifference";
  src: url("https://cdn.jsdelivr.net/gh/Glyphter/glyphter-font@master/fonts/GlacialIndifference-Bold.woff2") format("woff2"),
       url("https://cdn.jsdelivr.net/gh/Glyphter/glyphter-font@master/fonts/GlacialIndifference-Bold.woff") format("woff");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --navy:        #0c4261;
  --navy-dark:   #082233;
  --gold:        #c9a24b;
  --white:       #ffffff;
  --bg-soft:     #f5f7f9;
  --text-muted:  #5a6b78;
  --border-soft: #e1e7eb;

  --font-display: "Cinzel", serif;
  --font-body:    "Glacial Indifference", "Segoe UI", sans-serif;
  --font-mono:    "IBM Plex Mono", monospace;

  --max-width:    1180px;
  --header-height: 80px;

  --space-xs:  8px;
  --space-sm:  16px;
  --space-md:  32px;
  --space-lg:  64px;
  --space-xl:  96px;
  --space-2xl: 128px;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: 17px;
  color: var(--navy);
  background: var(--white);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a   { color: inherit; text-decoration: none; }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 40px;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: 0.02em;
}

/* ============================================
   Header
   ============================================ */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  right: 0;
  height: var(--header-height);
  
  /* 1. Идеально чистый, непрозрачный белый цвет из ваших переменных */
  background: var(--white) !important;
  
  /* 2. Полностью отключаем любые эффекты размытия заднего фона */
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  
  /* 3. Убираем тени, которые могли давать серый грязный оттенок вокруг логотипа */
  box-shadow: none !important; 
  
  /* 4. Оставляем только тонкую аккуратную рамку снизу, чтобы отделять шапку от сайта.
     Если хотите, чтобы шапка вообще таяла на белом фоне — просто удалите строку ниже */
  border-bottom: 1px solid var(--border-soft);
  
  z-index: 1000;
  box-sizing: border-box; 
  display: flex;
  align-items: center;
}

/* 2. Коррекция контейнера внутри шапки */
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  width: 100%;
  max-width: 1200px; /* Ваше стандартное ограничение */
  margin: 0 auto;
}

@media (max-width: 900px) {
  /* 3. Гарантируем, что при открытии меню body не ломает fixed-элементы */
  body.menu-open {
    overflow: hidden;
    /* Резервируем место под скроллбар, чтобы предотвратить прыжок вправо */
    padding-right: var(--scrollbar-width, 0px); 
  }
}

.logo-link { display: flex; align-items: center; }
.logo-link img.logo-img { height: 46px; width: auto; }

.main-nav {
  display: flex;
  align-items: center;
  gap: 48px;
}

.main-nav ul {
  display: flex;
  list-style: none;
  gap: 36px;
}

.main-nav a {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  position: relative;
  padding: 6px 0;
  transition: color 0.2s;
}

.main-nav a::after {
  content: "";
  position: absolute;
  left: 0; bottom: -2px;
  width: 0; height: 2px;
  background: var(--gold);
  transition: width 0.25s ease;
}
.main-nav a:hover::after,
.main-nav a.active::after { width: 100%; }

.burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 34px; height: 34px;
  background: none; border: none; cursor: pointer;
  z-index: 1100;
}
.burger span {
  display: block; width: 100%; height: 2px;
  background: var(--navy); border-radius: 1px;
  transition: transform 0.3s, opacity 0.3s;
}
.burger.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.burger.active span:nth-child(2) { opacity: 0; }
.burger.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ============================================
   Buttons
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 15px 36px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-radius: 3px;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.btn-primary       { background: var(--navy);  color: var(--white); }
.btn-primary:hover { background: var(--navy-dark); }
.btn-gold          { background: var(--gold);  color: var(--navy-dark); }
.btn-gold:hover    { background: #b8923f; }
.btn-outline       { background: transparent; border-color: var(--navy);  color: var(--navy); }
.btn-outline:hover { background: var(--navy); color: var(--white); }
.btn-outline-light       { background: transparent; border-color: rgba(255,255,255,0.65); color: var(--white); }
.btn-outline-light:hover { background: rgba(255,255,255,0.15); }

/* ============================================ Footer ============================================ */

.site-footer {
  background: var(--navy-dark);
  /* Меняем чистый белый цвет текста на тусклый серо-белый оттенок */
  color: rgba(255, 255, 255, 0.6); 
  padding: 48px 0;
}

/* Новая ссылка на самого создателя вверху футера */
.creator-link-top {
  display: block;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--gold); /* Фирменный золотой оттенок */
  text-decoration: none;
  letter-spacing: 0.05em;
  margin-bottom: 40px; /* Отступ от ссылки до контента ниже */
  transition: opacity 0.3s ease;
}
.creator-link-top:hover {
  opacity: 0.8;
  text-decoration: underline;
}

/* Сетка контента (логотип, текст, меню) */
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 48px;
  margin-bottom: 40px;
}

.footer-brand p {
  line-height: 1.6;
  font-size: 0.9rem;
  /* Делаем описание ассоциации тусклым */
  color: rgba(255, 255, 255, 0.6); 
}

.footer-col h4 {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 20px;
}

/* Убираем точки (маркеры) списков при перечислении */
.footer-col ul {
  list-style: none; 
  padding: 0;
  margin: 0;
}

.footer-col li {
  margin-bottom: 12px;
}

/* Ссылки в меню футера делаем тоже более тусклыми, с легким осветлением при наведении */
.footer-col a {
  color: rgba(255, 255, 255, 0.6);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.3s ease;
}
.footer-col a:hover {
  color: var(--white);
}

/* Самая нижняя часть футера */
.footer-bottom {
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
}
.footer-bottom span {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.35); /* Копирайт делаем еще чуть более приглушенным */
}
/* ============================================
   Shared utilities
   ============================================ */

.eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 18px;
}

.section-heading {
  text-align: center;
  margin-bottom: 56px;
}
.section-heading .eyebrow { display: block; }
.section-heading h2 { font-size: clamp(1.8rem, 3.5vw, 2.6rem); }

.placeholder-image {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-soft);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ============================================
   Обновленная адаптация и исправление багов
   ============================================ */

@media (max-width: 900px) {
  .container { padding: 0 24px; }

  /* 1. ИСПРАВЛЕНИЕ ДЛЯ КНОПОК: разрешаем перенос длинного текста */
  .btn {
    white-space: normal; /* Текст теперь может переноситься на новую строку */
    text-align: center;
    max-width: 100%;
  }

  /* 2. ИСПРАВЛЕНИЕ БУРГЕРА: абсолютное позиционирование вместо flex исключает кривизну */
  .burger {
    display: flex;
    position: relative;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 2001; /* Бургер гарантированно будет выше открытого меню */
    align-items: center;
    justify-content: center;
  }
  
  .burger span {
    position: absolute;
    display: block;
    width: 24px;
    height: 2px;
    background: var(--navy);
    border-radius: 2px;
    transition: transform 0.3s ease, opacity 0.3s ease, top 0.3s ease;
  }
  
  /* Точное попиксельное размещение линий (без зазоров флексбокса) */
  .burger span:nth-child(1) { top: 8px; }
  .burger span:nth-child(2) { top: 15px; }
  .burger span:nth-child(3) { top: 22px; }
  
  /* Идеально ровный крестик (X) при активации */
  .burger.active span:nth-child(1) {
    top: 15px;
    transform: rotate(45deg);
  }
  .burger.active span:nth-child(2) {
    opacity: 0;
    transform: translateX(-10px);
  }
  .burger.active span:nth-child(3) {
    top: 15px;
    transform: rotate(-45deg);
  }

  /* 3. ИСПРАВЛЕНИЕ МЕНЮ: изолируем слой, чтобы контент страницы не лез наверх */
  .main-nav {
    position: fixed;
    inset: 0;
    top: var(--header-height);
    height: calc(100vh - var(--header-height));
    background: var(--white) !important; /* Плотный белый фон без прозрачности */
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    padding: 48px 24px;
    transform: translate3d(100%, 0, 0); /* 3D-трансформация заставляет GPU отрисовывать слой поверх всего */
    transition: transform 0.35s ease;
    z-index: 2000; /* Поднимаем меню над текстом статьи */
    gap: 0;
    backface-visibility: hidden;
  }
  
  .main-nav.open { 
    transform: translate3d(0, 0, 0); 
  }
  
  .main-nav ul { flex-direction: column; gap: 0; }
  .main-nav ul li { border-bottom: 1px solid var(--border-soft); }
  .main-nav a { display: block; padding: 20px 4px; font-size: 1rem; }
  .main-nav a::after { display: none; }
  .nav-cta { margin-top: 36px; }

  .footer-grid { grid-template-columns: 1fr; gap: 40px; }
}

/* Дополнительная полировка для экранов смартфонов (меньше 600px) */
@media (max-width: 600px) {
  /* Кнопка регистрации в секции Lecture Hall */
  .lh-cta .btn {
    width: 100%; /* Растягиваем кнопку на всю ширину экрана смартфона */
    font-size: 0.8rem;
    padding: 16px 20px;
    line-height: 1.4;
  }
}

/* ============================================
   Адаптация для мобильных телефонов (max-width: 600px)
   ============================================ */

@media (max-width: 600px) {
  /* --- Глобальные стили и сетка --- */
  .container { 
    padding: 0 16px; 
  }
  
  .section-heading {
    margin-bottom: 40px;
  }

  /* --- Кнопки --- */
  .hero-actions { 
    flex-direction: column; 
    gap: 16px; 
    width: 100%; 
    padding: 0 16px;
  }
  
  .hero-actions .btn { 
    width: 100%; 
    text-align: center; 
  }

  /* --- Главная страница (Home) --- */
  .hero-inner {
    padding: 60px 0 80px;
  }
  
  .stat-number { 
    font-size: 2.5rem; /* Уменьшаем крупные цифры в статистике */
  }
  
  .affiliation-card { 
    padding: 24px 16px; 
    width: 100%; 
  }
  
  .news-card-body { 
    padding: 20px; 
  }

  /* --- Публикации (Publications) --- */
  .pub-hero {
    padding: 40px 0 32px;
  }

  .article-header {
    padding: 32px 0 24px;
  }

  .article-meta { 
    flex-direction: column; 
    align-items: flex-start; 
    gap: 8px; 
  }
  
  .meta-dot {
    display: none; /* Прячем разделители, так как элементы идут в колонку */
  }

  .article-body { 
    font-size: 1rem; 
    line-height: 1.7; 
  }

  .article-credits { 
    flex-direction: column; 
    gap: 16px; 
    align-items: flex-start; 
  }

  .article-img-row {
    margin: 32px auto;
  }

  /* --- Лекторий (Lecture Hall) --- */
  .lh-hero h1 {
    font-size: 2rem;
  }

  .lh-cta {
    padding: 48px 0;
  }

  /* --- Подвал (Footer) --- */
  .footer-grid { 
    text-align: center; 
    gap: 32px; 
  }
  
  .footer-col { 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
  }
}

/* ============================================
   Адаптация для очень маленьких экранов (max-width: 400px)
   ============================================ */

@media (max-width: 400px) {
  .logo-link img.logo-img { 
    height: 38px; /* Немного уменьшаем логотип в шапке */
  }
  
  .stat-item {
    padding: 24px 0;
  }
}

/* ============================================
   Исправление шапки, логотипа и срезания табов
   ============================================ */

/* 1. Корректируем базовое положение контента */
body {
  /* Сдвигаем весь сайт вниз на чистую высоту шапки, чтобы ничего не срезалось */
  padding-top: var(--header-height); 
}

/* Если табы используют якорные ссылки (переход по #id), 
   добавляем отступ для скролла, чтобы шапка не перекрывала заголовки */
section, [id] {
  scroll-margin-top: calc(var(--header-height) + 24px);
}

/* 2. Защищаем логотип от деформации и улучшаем читаемость */
.logo-link {
  display: inline-flex;
  align-items: center;
  height: 100%;
  padding: 8px 0; /* Создает безопасные отступы внутри шапки */
  flex-shrink: 0; /* Запрещает флексбоксу сжимать логотип в ширину */
}

.logo-img {
  height: 100%;
  max-height: 42px; /* Фиксируем аккуратный размер */
  width: auto;
  object-fit: contain; /* Гарантирует сохранение пропорций картинки */
  display: block;
}

