:root {
  --bg-light: #ffffff;
  --text-light: #1f1f1f;
  --bg-dark: #121212;
  --text-dark: #e4e4e4;
  --accent: #0d6efd;
  --card-bg-light: rgba(0,0,0,0.03);
  --card-bg-dark: #1f1f1f;
  --border-light: var(--accent);
  --border-dark: #444444;
  --nav-bg-light: #f9f9f9;
  --nav-bg-dark: #1f1f1f;
  --submenu-bg-light: #ffffff;
  --submenu-bg-dark: #1f1f1f;
  --hover-light: rgba(0,0,0,0.05);
  --hover-dark: rgba(255,255,255,0.1);
}

html {
  font-size: 18px;
  scroll-behavior: smooth;
}

html.light {
  background-color: var(--bg-light);
  color: var(--text-light);
  --card-bg: var(--card-bg-light);
  --border-color: var(--border-light);
  --nav-bg: var(--nav-bg-light);
  --submenu-bg: var(--submenu-bg-light);
  --hover-bg: var(--hover-light);
}
html.dark {
  background-color: var(--bg-dark);
  color: var(--text-dark);
  --card-bg: var(--card-bg-dark);
  --border-color: var(--border-dark);
  --nav-bg: var(--nav-bg-dark);
  --submenu-bg: var(--submenu-bg-dark);
  --hover-bg: var(--hover-dark);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Inter', sans-serif;
  line-height: 1.6;
  opacity: 1;
  transition: opacity .5s ease, background .3s, color .3s;
}

/* Header & Nav */
header {
  background: var(--nav-bg);
  position: static;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo { display: none; }
.controls {
  display: flex;
  gap: .5rem;
}
.theme-toggle,
.menu-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.5rem;
}
.navbar {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.navbar a {
  display: flex;
  align-items: center;
  gap: .25rem;
  text-decoration: none;
  color: inherit;
  font-weight: 500;
  padding: .5rem .75rem;
  border-radius: 4px;
  transition: transform .2s ease, background .2s ease, box-shadow .2s ease;
}
.navbar a:hover {
  transform: translateY(-2px);
  background: var(--hover-bg);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Submenu */
.has-submenu {
  position: relative;
}
.submenu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--submenu-bg);
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  list-style: none;
  margin: 0;
  padding: .5rem 0;
  border-radius: 4px;
  min-width: 180px;
  z-index: 1001;
}
.has-submenu:hover .submenu {
  display: block;
}
.submenu a {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem 1rem;
}
.submenu a:hover {
  background: var(--hover-bg);
}

/* Content Wrapper */
.content-wrapper {
  max-width: 1200px;
  margin: 3rem auto;
  padding: 3rem 2rem;
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.08);
  position: relative;
  z-index: 1;
}

/* Центрируем заголовок PDF по горизонтали */
#pdf-title {
  text-align: center;
  margin-bottom: 1.5rem; /* если хотите добавить отступ от содержимого ниже */
}


/* Section Banners */
.section-banner {
  width: 100%;
  height: 600px;
  background-size: cover;
  background-position: center;
  border-radius: 118px;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}


/* Topics Links */
/* === Уніфікуємо всі .topics у grid === */
.topics {
  display: grid;
  /* стільки колонок, скільки влізе мінімум по 220px і максимум рівномірно */
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 3rem 4rem;  /* 1.5rem по вертикалі, 2rem по горизонталі */
  margin: 1rem 0;
}

/* Усі кнопки/посилання в .topics */
.topic {
  /* щоб текст завжди по центру кнопки */
  display: flex;
  align-items: center;
  justify-content: center;

  /* фіксована висота, як в Семінарах */
  height: 3.5rem;

  /* фоновий колір та рамка як у всіх */
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 6px;

  /* текст та відступи */
  padding: 0 1rem;
  text-decoration: none;
  color: inherit;
  font-weight: 500;

  /* hover-ефект */
  transition: transform .2s ease, background-color .2s ease, box-shadow .2s ease;
}
.topic:hover {
  transform: translateY(-2px);
  background-color: var(--hover-bg);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Якщо ви використовуєте <button class="topic"> */
button.topic {
  background: none;
  border: none;
  width: 100%;
  cursor: pointer;
  font: inherit;
}


/* Author Card on Index */
/* === Карточка автора: широкая рамка, центрированный текст, равные отступы и чистая тень === */
.content-wrapper {
  max-width: 1200px;   /* чтобы карточка могла быть шире */
  margin: 3rem auto;
  padding: 0 1rem;
}

.author-card {
  /* Ширина карточки: по всей доступной ширине контента */
  width: 100%;
  /* можно ограничить максимальную, если нужно: */
  max-width: 1200px;
  margin: 0 auto 3rem;

  /* Рамка */
  border: 3px solid var(--accent);
  border-radius: 111px;

  /* Внутренние отступы */
  padding: 4rem 3rem;

  /* Выравнивание текста */
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;

  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.08),   /* лёгкая широкая тень */
    0 8px 32px rgba(0, 0, 0, 0.12);   /* более глубокая вторичная тень */
}

.author-info {
  /* Чтобы текст не растягивался слишком широко */
  max-width: 900px;
  width: 100%;
}

.author-info h3 {
  margin: 0 0 1.5rem;
  font-size: 2rem;
  color: inherit; /* нейтральный цвет */
}

.author-info h4 {
  margin: 2rem 0 1rem;
  font-size: 1.25rem;
}

.author-info p {
  margin: 0.75rem 0;
  line-height: 1.7;
  /* дополнительные отступы внутри текста, если нужно */
  padding: 0 1rem;
}




/* Test Questions */
.question {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem 1.5rem;
  margin-bottom: 1rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

/* Game Input/Button */
.game input {
  padding: .75rem;
  font-size: 1rem;
  width: 200px;
  margin-right: .5rem;
}
.game button {
  padding: .75rem 1.25rem;
  font-size: 1rem;
}

/* Decorative Blobs Around */
body.light {
  background-image:
    radial-gradient(circle at 15% 20%, rgba(13,110,253,0.15) 180px, transparent 200px),
    radial-gradient(circle at 80% 25%, rgba(0,123,255,0.12) 140px, transparent 160px),
    radial-gradient(circle at 30% 80%, rgba(40,167,69,0.14) 200px, transparent 220px),
    radial-gradient(circle at 75% 75%, rgba(255,193,7,0.10) 220px, transparent 240px);
  background-repeat: no-repeat;
  background-attachment: fixed;
}
body.dark {
  background-image:
    radial-gradient(circle at 15% 20%, rgba(255,65,108,0.15) 180px, transparent 200px),
    radial-gradient(circle at 80% 25%, rgba(32,191,107,0.12) 140px, transparent 160px),
    radial-gradient(circle at 30% 80%, rgba(131,52,113,0.14) 200px, transparent 220px),
    radial-gradient(circle at 75% 75%, rgba(255,159,64,0.10) 220px, transparent 240px);
  background-repeat: no-repeat;
  background-attachment: fixed;
}

/* Responsive */
@media (max-width: 768px) {
  .container { flex-wrap: wrap; }
  .navbar {
    flex-direction: column;
    display: none;
    background: var(--nav-bg);
    width: 100%;
    padding: 1rem 0;
  }
  .navbar.active { display: flex; }
  .navbar a { width: 100%; padding: .75rem 1rem; }
  .submenu { position: static; box-shadow: none; }
}

/* === Плавающий лоадер при переключении страниц === */
.page-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.3); /* полупрозрачный фон */
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.page-loader.hidden {
  display: none;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255,255,255,0.3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Маленький баннер в шапке */
.header-banner {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
}
.header-banner img {
  height: 80px;         /* нужная высота баннера */
  width: auto;
  object-fit: contain;
  border-radius: 8px;   /* чуть скруглим уголки */
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  margin-right: 1rem;   /* отступ от кнопок */
}

/* Убираем фон, границу и тень у баннера в шапке */
.header-banner {
  background: transparent; /* прозрачный фон контейнера */
}

.header-banner img {
  border: none !important;      /* удаляем любую рамку */
  background: transparent;       /* убираем фон изображения */
  box-shadow: none !important;   /* убираем тень, если была */
}

/* === Баннер поверху === */
.top-banner {
  width: 100%;
  height: 200px; /* или любая нужная высота */
  background-image: url('/images/header-full-banner.png'); /* ваш баннер */
  background-size: cover;
  background-position: center;
}

/* Немного отодвинем навигацию вниз, чтобы меню «опустилось» под баннер */
.nav-container {
  margin-top: -1.5rem;  /* если надо дополнительный отступ */
  /* либо отрицательный margin-top для наложения чуть */
  /* margin-top: -50px; */
}

/* === Текстовый баннер вместо картинки === */
.top-banner {
  width: 100%;
  height: 70px;               /* задайте нужную высоту */
  background: var(--accent);   /* используем акцентную переменную */
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0px;
  margin-bottom: 1.5rem;
  box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}

.top-banner h1 {
  margin: 0;
  color: #fff;
  font-size: 2.5rem;             /* масштабируйте под себя */
  letter-spacing: 1px;
  text-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

/* В dark-теме акцентная переменная та же, но при необходимости можно осветлить фон: */
html.dark .top-banner {
  background: var(--accent);
}

/* === Стили для кнопок тем в тестах === */
#topic-buttons.topics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 3rem 5rem;
  margin: 1rem 0;
}

#topic-buttons.topics .topic {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 3.5rem;
  background-color: var(--card-bg);      /* светлый фон в light, тёмный в dark */
  border: 1px solid var(--accent);       /* синяя рамка */
  border-radius: 6px;
  color: inherit;
  font-weight: 500;
  padding: 0 1rem;
  text-decoration: none;
  transition: 
    background-color .2s ease, 
    transform .2s ease, 
    box-shadow .2s ease;
  cursor: pointer;
}

#topic-buttons.topics .topic:hover {
  background-color: var(--hover-bg);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* ==== Кнопки в тестах: нейтральная рамка в обеих темах ==== */
#topic-buttons.topics .topic {
  /* вместо синей рамки используем общую border-color */
  border: 1px solid var(--border-color);
}

/* ==== Текстовый баннер: разный фон в light/dark ==== */
html.light .top-banner {
  background: var(--accent);
}
html.dark .top-banner {
  background: var(--border-color);
}

/* Текст на баннере: белый в light, светло-серый в dark */
.top-banner h1 {
  color: #fff;
}
html.dark .top-banner h1 {
  color: var(--text-dark);
}

/* === Варианты ответов в тестах — по одной строке === */
.question label {
  display: block;         /* каждый label — на новой строке */
  margin: 0.5rem 0;       /* небольшие отступы между ними */
  cursor: pointer;        /* чтобы было ясно, что это кликабельно */
}

/* при наведении чуть подсвечиваем фон ответа */
.question label:hover {
  background-color: var(--hover-bg);
}

/* === Вьювер PDF === */
.pdf-viewer {
  position: relative;
  margin-top: 2rem;
  height: 0;
  padding-bottom: 66.66%; /* соотношение сторон */
  overflow: hidden;
  transition: height .3s ease, padding-bottom .3s ease;
}
.pdf-viewer iframe {
  position: absolute;
  top:0; left:0; width:100%; height:100%;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}
.pdf-viewer.hidden {
  height: 0 !important;
  padding-bottom: 0 !important;
}
.pdf-close {
  position: absolute;
  top: 8px; right: 12px;
  background: rgba(0,0,0,0.6);
  color: #fff;
  border: none;
  font-size: 1.2rem;
  width: 32px; height: 32px;
  border-radius: 50%;
  cursor: pointer;
  z-index: 10;
}

/* ===== контейнер для всех разделов (лекції, семінари, і т.д.) ===== */
.topics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;              /* расстояние между карточками */
  margin: 1.5rem 0;
}

/* ===== универсальный стиль «карточки» темы ===== */
.topic {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  padding: 1rem;
  min-height: 100px;        /* гарантирует одинаковую высоту */
  background: var(--card-bg, #fff);
  border: 1px solid var(--primary-color, #007bff);
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);

  text-align: center;
  word-break: break-word;    /* перенос длинных заголовков */
  transition: transform .2s, box-shadow .2s;
}

/* лёгкий hover-эффект */
.topic:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* если тема чёрная — чуть поменяем фон карточек */
html.dark .topic {
  background: #222;
  border-color: #3399ff;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* ===== Центруємо заголовки секцій (h2) всередині .content-wrapper ===== */
.content-wrapper h2 {
  text-align: center;
  margin-bottom: 1.5rem; /* можна підкоригувати відступ під заголовком */
  font-size: 2rem;       /* за бажанням — налаштувати розмір шрифта */
  color: inherit;        /* успадковує колір відповідно до теми */
}

/* ====================================================================
   1) Основной контейнер баннера
   ==================================================================== */
.top-banner {
  position: relative;
  width: 100%;
  height: 70px;              /* Общая высота баннера – можно подкорректировать */
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;

  /* Градиентный фон: от насыщенно-синего к светло-голубому */
  background: linear-gradient(
    135deg,
    #0d47a1 0%,
    #1976d2 50%,
    #42a5f5 100%
  );
  border-radius: 0px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);

  /* Плавное появление всего баннера */
  opacity: 0;
  animation: bannerFadeIn 0.8s ease-out forwards;
}
@keyframes bannerFadeIn {
  to { opacity: 1; }
}

/* ====================================================================
   2) Декоративная «зернистая» текстура по всему фону
   ==================================================================== */
.top-banner .texture {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;  /* чтобы не мешала кликам */
  background-image:
    radial-gradient(circle at 10% 25%, rgba(255, 255, 255, 0.05) 2px, transparent 5px),
    radial-gradient(circle at 80% 15%, rgba(255, 255, 255, 0.04) 1.5px, transparent 4px),
    radial-gradient(circle at 50% 75%, rgba(255, 255, 255, 0.03) 3px, transparent 6px);
  background-repeat: repeat;
  background-size: 15px 15px;
}

/* ====================================================================
   3) Крупная полупрозрачная фигура: круг (левый верхний угол)
   Скорректировано под высоту баннера 70px
   ==================================================================== */
.top-banner .shape.circle-left {
  position: absolute;
  top: -55px;          /* чуть выше и левее, чем баннер */
  left: -55px;
  width: 180px;        /* уменьшили до 180px */
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(
    circle at center,
    rgba(255, 255, 255, 0.12),
    transparent 70%
  );
  filter: blur(6px);   /* чуть меньше размытие */
}

/* ====================================================================
   4) Крупная полупрозрачная фигура: «ломаный» многоугольник (правый низ)
   Скорректировано под высоту баннера 70px
   ==================================================================== */
.top-banner .shape.polygon-right {
  position: absolute;
  bottom: -180px;       /* чуть ниже, чем сейчас */
  right: -80px;        /* чуть правее */
  width: 150px;        /* уменьшили до 150px */
  height: 150px;
  background: rgba(255, 255, 255, 0.08);
  clip-path: polygon(
    0% 30%,
    20% 0%,
    80% 0%,
    100% 30%,
    100% 80%,
    60% 100%,
    20% 100%,
    0% 80%
  );
  filter: blur(4px);   /* уменьшили размытие */
}

/* ====================================================================
   5) Анимированный заголовок: падение букв справа-налево
   ==================================================================== */
.animated-title {
  display: flex;
  gap: 0.15rem;         /* расстояние между буквами */
  z-index: 1;           /* поверх декоративных фигур */
}
.animated-title span {
  display: inline-block;
  opacity: 0;
  transform: translateY(-120px);
  font-family: 'Inter', sans-serif;
  font-size: 2rem;    /* размер букв */
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.5px;
  text-transform: none;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);

  /* Анимация падения: сначала буква невидима и высоко, затем «подпрыгнет» чуть вниз и встанет ровно */
  animation: letterDrop 0.6s ease-out forwards;
  animation-delay: calc(var(--i) * 0.1s);
}
@keyframes letterDrop {
  0% {
    opacity: 0;
    transform: translateY(-120px);
  }
  60% {
    opacity: 1;
    transform: translateY(10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ====================================================================
   6) Анимация появления текста (с задержкой, чтобы буквы не «вырисовывались» сразу)
   ==================================================================== */
@keyframes bannerTextDrop {
  to {
    transform: translateY(0);
  }
}

/* ====================================================================
   7) Стили для тёмной темы (html.dark …)
   ==================================================================== */
/* При переключении на dark-theme баннер меняется на более приглушённый градиент */
html.dark .top-banner {
  background: linear-gradient(
    135deg,
    #263238 0%,
    #455a64 50%,
    #607d8b 100%
  );
}
/* Текстуры в тёмной теме делаем чуть более прозрачными */
html.dark .top-banner .texture {
  background-image:
    radial-gradient(circle at 10% 25%, rgba(255, 255, 255, 0.03) 2px, transparent 5px),
    radial-gradient(circle at 80% 15%, rgba(255, 255, 255, 0.02) 1.5px, transparent 4px),
    radial-gradient(circle at 50% 75%, rgba(255, 255, 255, 0.015) 3px, transparent 6px);
}
/* Крупные фигуры (круг и многоугольник) тоже чуть приглушаем */
html.dark .top-banner .shape.circle-left {
  background: radial-gradient(
    circle at center,
    rgba(255, 255, 255, 0.05),
    transparent 70%
  );
}
html.dark .top-banner .shape.polygon-right {
  background: rgba(255, 255, 255, 0.04);
}
/* Текст в тёмной теме делаем светло-серым */
html.dark .animated-title span {
  color: #eceff1;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

/* ====================================================================
   8) Адаптив для мобильных: 
      скрываем крупные фигуры и уменьшаем высоту/шрифт
   ==================================================================== */
@media (max-width: 768px) {
  .top-banner {
    height: 140px;
  }
  .animated-title span {
    font-size: 2rem;
  }
  .top-banner .shape.circle-left,
  .top-banner .shape.polygon-right {
    display: none;
  }
}

