/* Кастомные стили для сайта */

/* CSS переменные для типографики - упрощение и единообразие */
:root {
  --font-size-h1: 40px;
  --font-size-h1-home: 48px;
  --font-size-h2: 32px;
  --font-size-h2-special: 35.2px;
  --font-size-paragraph: 18px;
  --font-size-paragraph-mobile: 16px;
  --font-size-h1-mobile: 28px;
  --font-size-h2-mobile: 22.4px;
}

/* Кастомизация скроллбара для лучшего вида на Windows/Ubuntu */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--code-bg);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 5px;
  transition: background 0.2s;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--secondary);
}

/* Для Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border) var(--code-bg);
}

/* Плавная прокрутка и предотвращение скачков */
html {
  scroll-behavior: smooth;
}

/* Единый фон для всех страниц */
body {
  background-color: var(--theme) !important;
  /* Предотвращаем горизонтальный скролл */
  overflow-x: hidden;
}

/* Фиксированная высота шапки для всех страниц */
.header,
header {
  min-height: var(--header-height, 56px);
  height: auto;
  box-sizing: border-box;
}

body.list {
  background-color: var(--theme) !important;
}

/* Убираем разный фон для списков */
.list {
  background-color: var(--theme) !important;
}

/* Единое центрирование для всех страниц */
.main {
  position: relative;
  min-height: calc(100vh - var(--header-height) - var(--footer-height));
  max-width: calc(var(--main-width) + var(--gap) * 2);
  margin: auto;
  padding: var(--gap);
  background-color: var(--theme);
}

/* Универсальный контейнер для всех типов страниц - упрощение и единообразие */
.page-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

.page-container-narrow {
  max-width: 800px;
}

.page-container-wide {
  max-width: 1400px;
}

@media (max-width: 768px) {
  .page-container,
  .page-container-narrow,
  .page-container-wide {
    padding: 1rem;
  }
}

/* Улучшаем entry-link для карточек блога - гарантируем, что overlay сверху */
.post-entry .entry-link,
.first-entry .entry-link {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  z-index: 1; /* Гарантируем, что overlay сверху */
  cursor: pointer;
}

/* Мобильные стили для .main */
@media (max-width: 768px) {
  .main {
    padding: 1rem !important;
  }
  
  /* Улучшаем шапку на мобильных */
  .header {
    padding: 0.5rem 1rem;
    min-height: var(--header-height, 56px);
    height: auto;
  }
  
  .nav {
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: space-between;
    align-items: center;
    padding: 0;
    width: 100%;
  }
  
  .logo {
    margin: 0 !important;
    flex: 0 0 auto;
  }
  
  .logo a {
    font-size: 1.25rem !important;
    line-height: 1.4;
    white-space: nowrap;
  }
  
  .logo-switches {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 0 0 auto;
  }
  
  /* Бургер-меню: показать на мобильных */
  .burger-menu {
    display: flex !important;
    flex-direction: column;
    justify-content: space-between;
    width: 24px;
    height: 18px;
    min-width: 44px;
    min-height: 44px;
    background: none;
    border: 0;
    padding: 13px 10px;
    cursor: pointer;
    z-index: 1001;
    position: relative;
    margin-left: auto;
  }
  
  .burger-menu span {
    display: block;
    height: 2px;
    width: 100%;
    background: var(--primary);
    border-radius: 2px;
    transition: all 0.3s ease;
  }
  
  .burger-menu:hover span,
  .burger-menu:focus span {
    background: var(--primary);
    opacity: 0.8;
  }
  
  .burger-menu:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 4px;
  }
  
  /* Меню скрыто по умолчанию на мобильных */
  #menu {
    display: none;
    position: fixed;
    top: var(--header-height, 56px);
    left: 0;
    right: 0;
    background: var(--theme);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    padding: 0.5rem 0.75rem !important;
    max-height: calc(100vh - var(--header-height, 56px));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex-direction: column !important;
  }
  
  /* Меню открыто */
  #menu.menu-open {
    display: flex;
    flex-direction: column;
  }
  
  #menu li {
    margin: 0;
    padding: 0;
  }
  
  #menu li + li {
    margin-top: 0.125rem !important;
  }
  
  #menu a {
    font-size: 0.875rem !important;
    padding: 0.5rem 0.75rem !important;
    min-height: 44px !important;
    display: flex !important;
    align-items: center !important;
    width: 100%;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    font-weight: 500;
    line-height: 1.3 !important;
  }
  
  #menu a:hover,
  #menu a:focus {
    background-color: var(--code-bg);
    outline: 2px solid var(--primary);
    outline-offset: 2px;
  }
  
  button#theme-toggle {
    font-size: 22px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    padding: 0.5rem !important;
  }
  
  /* Активный пункт меню на мобильных */
  #menu a.active {
    font-weight: 600 !important;
    border-bottom: 2px solid var(--primary) !important;
    color: var(--primary) !important;
  }
}

/* Активный пункт меню на десктопе */
#menu a.active,
nav a.active {
  font-weight: 500;
  border-bottom: 2px solid currentColor;
}

/* Бургер-меню скрыто на десктопе */
@media (min-width: 769px) {
  .burger-menu {
    display: none !important;
  }
  
  /* На десктопе меню должно быть видимым и горизонтальным */
  #menu {
    display: flex !important;
    position: static !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    max-height: none !important;
    overflow: visible !important;
  }
  
  #menu li {
    margin: 0 !important;
  }
  
  #menu li + li {
    margin-top: 0 !important;
    margin-inline-start: var(--gap) !important;
  }
  
  #menu a {
    padding: 0 !important;
    width: auto !important;
    border-radius: 0 !important;
    background-color: transparent !important;
    /* Уменьшаем кегль и межбуквенный интервал для лучшей иерархии */
    font-size: 0.9rem !important;
    letter-spacing: -0.01em;
    font-weight: 500;
  }
}

/* Хлебные крошки */
.breadcrumbs {
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  line-height: 1.6;
}

.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  list-style: none;
  padding: 0;
  margin: 0;
  align-items: center;
}

.breadcrumbs li {
  display: inline;
  line-height: 1.6;
}

.breadcrumbs li:not(:last-child)::after {
  content: " / ";
  margin: 0 0.5rem;
  color: var(--secondary);
}

.breadcrumbs a {
  color: var(--secondary);
  text-decoration: none;
  padding: 0.25rem 0;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  transition: color 0.2s ease;
}

.breadcrumbs a:hover {
  color: var(--primary);
  text-decoration: underline;
}

.breadcrumbs a:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Мобильные стили для хлебных крошек */
@media (max-width: 768px) {
  .breadcrumbs {
    font-size: 0.95rem;
    margin-bottom: 1rem;
    line-height: 1.8;
    /* Увеличиваем контрастность */
    color: var(--primary);
  }
  
  .breadcrumbs a {
    min-height: 40px;
    padding: 0.3rem 0.5rem;
    color: var(--primary);
    font-weight: 500;
    opacity: 0.85;
    border-radius: 4px;
  }
  
  .breadcrumbs a:hover {
    opacity: 1;
    background-color: var(--code-bg);
  }
  
  .breadcrumbs li:not(:last-child)::after {
    margin: 0 0.4rem;
    color: var(--secondary);
    opacity: 0.7;
    font-weight: 400;
  }
  
  .breadcrumbs span[aria-current="page"] {
    color: var(--primary);
    font-weight: 600;
    padding: 0.3rem 0.5rem;
  }
}

/* Единое оформление для всех страниц */
.post-single {
  max-width: 100%;
  margin: 0 auto;
  padding: 2rem;
  background: var(--entry);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.post-content {
  max-width: 100%;
  margin: 0 auto;
  line-height: 1.8;
}

/* ============================================
   ЕДИНАЯ ТИПОГРАФИКА ДЛЯ ВСЕХ СТРАНИЦ
   ============================================ */

/* H1 - единый размер для всех страниц (desktop) */
h1,
.post-title,
.page-header h1,
.section-header h1,
.journey-header h1,
.post-content h1 {
  font-size: var(--font-size-h1);
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 1rem;
  color: var(--primary);
}

.post-content h1 {
  margin-bottom: 1.5rem;
}

/* Исключение для главной страницы */
.home-header h1 {
  font-size: var(--font-size-h1-home);
  font-weight: 300;
}

/* H2 - единый размер для всех страниц (desktop) */
h2,
.post-content h2,
.page-header h2,
.section-header h2,
.journey-content h2:not(.metaphors-subtitle) {
  font-size: var(--font-size-h2);
  font-weight: 600;
  line-height: 1.3;
  margin-top: 2rem;
  margin-bottom: 1rem;
  color: var(--primary);
}

/* Исключения для специальных H2 на главной странице */
.journey-quiz h2,
.metaphors-showcase h2,
.tools-preview h2 {
  font-size: var(--font-size-h2-special);
  font-weight: 400;
  text-align: center;
}

/* Специальные стили для главной страницы */
.home-content,
.home-content p {
  font-size: var(--font-size-paragraph);
}

/* Стили для glossary */
.glossary-header h1 {
  font-size: var(--font-size-h1);
}

.glossary-extra-content p {
  font-size: var(--font-size-paragraph);
}

/* Параграфы - единый размер для всех страниц (desktop) */
p,
.post-content p,
.page-container-single p,
.journey-content p,
.journey-page p {
  font-size: var(--font-size-paragraph);
  line-height: 1.8;
  margin-bottom: 1.25rem;
  color: var(--content);
}

/* Исключения для специальных параграфов */
.post-description,
.section-description,
.journey-description {
  font-size: 1.2rem !important;
  line-height: 1.6;
  color: var(--secondary);
}

/* Мобильные стили - единые размеры */
@media (max-width: 768px) {
  /* H1 на мобильных */
  h1,
  .post-title,
  .page-header h1,
  .section-header h1,
  .journey-header h1,
  .post-content h1 {
    font-size: var(--font-size-h1-mobile);
    line-height: 1.3;
  }
  
  .home-header h1 {
    font-size: 28.8px; /* 1.8rem */
  }
  
  /* H2 на мобильных */
  h2,
  .post-content h2,
  .page-header h2,
  .section-header h2 {
    font-size: var(--font-size-h2-mobile);
    line-height: 1.4;
    margin-top: 1.5rem;
  }
  
  .journey-quiz h2,
  .metaphors-showcase h2,
  .tools-preview h2 {
    font-size: 25.6px; /* 1.6rem */
  }
  
  /* Параграфы на мобильных */
  p,
  .post-content p,
  .page-container-single p,
  .journey-content p,
  .journey-page p,
  .home-content,
  .home-content p,
  .glossary-extra-content p {
    font-size: var(--font-size-paragraph-mobile);
    line-height: 1.7;
  }
  
  .post-description,
  .section-description,
  .journey-description {
    font-size: 1rem;
  }
}

.post-content ul,
.post-content ol {
  margin-bottom: 1.25rem;
  padding-left: 2rem;
}

.post-content li {
  margin-bottom: 0.5rem;
}

/* Внешние ссылки должны быть достаточно большими для тапа на мобильных */
@media (max-width: 768px) {
  /* Минимальный размер для внешних ссылок (a[href^="http"]) */
  a[href^="http"] {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    /* Если ссылка в тексте, убеждаемся, что она кликабельна */
    line-height: 1.6;
  }
  
  /* Ссылки в таблицах и специальных контейнерах */
  .post-content a[href^="http"],
  .journey-content a[href^="http"],
  table a[href^="http"],
  td a[href^="http"] {
    min-height: 30px;
    min-width: 30px;
    padding: 0.375rem 0.5rem;
    display: inline-flex;
    align-items: center;
  }
}

/* Сетка постов на главной странице - 2 колонки */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  margin: 2rem 0;
}

/* Базовые стили для карточек постов - объединено для упрощения */
.post-card,
.first-entry,
.post-entry {
  background: var(--entry);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  transition: transform 0.2s, box-shadow 0.3s, border-color 0.2s;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Специфичные стили для разных типов карточек */
.post-card {
  padding: 1.75rem;
}

.first-entry {
  padding: 2rem;
  margin: 1.5rem 0;
}

.first-entry:last-child {
  margin-bottom: 0;
}

/* Общий визуальный маркер кликабельности */
.post-card::before,
.first-entry::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(180deg, var(--primary), var(--secondary));
  opacity: 0;
  transition: opacity 0.3s;
}

.post-card:hover,
.first-entry:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
  border-color: var(--primary);
}

.post-card:hover::before,
.first-entry:hover::before {
  opacity: 1;
}

/* Стрелка для post-card (только для сетки) */
.post-card::after {
  content: '→';
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  font-size: 1.5rem;
  color: var(--secondary);
  opacity: 0.3;
  transition: opacity 0.3s ease, transform 0.3s ease;
  transform: translateX(-5px);
  pointer-events: none;
}

.post-card:hover::after {
  opacity: 1;
  transform: translateX(0);
}

/* Заголовок карточки */
.post-card .entry-header,
.first-entry .entry-header {
  margin-bottom: 1rem;
}

.post-card .entry-header {
  padding-left: 0.5rem;
}

.first-entry .entry-header {
  padding-left: 1rem;
}

@media (max-width: 768px) {
  .post-card::after {
    opacity: 0.4;
  }
  
  .post-card:active,
  .first-entry:active {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
  }
  
  .post-card:active::after {
    opacity: 1;
    transform: translateX(3px);
  }
}

/* Бейджи рубрик для карточек блога */
.entry-badges {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.entry-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 12px;
  background: var(--code-bg);
  color: var(--primary);
  border: 1px solid var(--border);
  transition: all 0.2s ease;
}

.entry-badge-category {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: var(--theme);
  border-color: transparent;
}

.entry-badge-tag {
  background: var(--entry);
  color: var(--secondary);
}

.post-entry .entry-badges {
  margin-bottom: 0.5rem;
}

.first-entry .entry-badges {
  margin-bottom: 0.75rem;
}

/* Заголовки в карточках */
.post-card .entry-header h2 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--primary);
  margin: 0;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
}

.first-entry .entry-header h2 {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--primary);
  margin: 0;
  line-height: 1.3;
}

/* Контент карточки */
.post-card .entry-content {
  margin: 0.75rem 0;
  padding-left: 0.5rem;
  color: var(--content);
  font-size: 0.95rem;
  line-height: 1.6;
  flex-grow: 1;
}

.post-card .entry-content p {
  margin: 0;
}

.first-entry .entry-content {
  margin: 1rem 0;
  padding-left: 1rem;
  color: var(--content);
  font-size: 1rem;
  line-height: 1.7;
}

/* Футер карточки */
.post-card .entry-footer {
  margin-top: auto;
  padding-top: 1rem;
  padding-left: 0.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--secondary);
}

.first-entry .entry-footer {
  margin-top: 1.25rem;
  padding-top: 1rem;
  padding-left: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--secondary);
}

/* Отступ между контентом главной и превью постов */
.post-content {
  margin-bottom: 2.5rem;
}

/* Пагинация - единые стили (объединено для упрощения) */
.page-footer {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

nav.pagination,
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin: 2rem 0;
  padding: 1rem 0;
  flex-wrap: wrap;
}

nav.pagination .prev,
nav.pagination .next,
nav.pagination a,
.pagination .prev,
.pagination .next,
.pagination a {
  display: inline-flex;
  align-items: center;
  padding: 0.75rem 1.5rem;
  background-color: var(--entry);
  color: var(--primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  font-weight: 500;
  font-size: 1rem;
  line-height: 1.5;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

nav.pagination .prev:hover,
nav.pagination .next:hover,
nav.pagination a:hover,
.pagination .prev:hover,
.pagination .next:hover,
.pagination a:hover {
  background-color: var(--primary);
  color: var(--theme);
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

nav.pagination .prev:active,
nav.pagination .next:active,
nav.pagination a:active,
.pagination .prev:active,
.pagination .next:active,
.pagination a:active {
  transform: translateY(0);
}

@media (max-width: 768px) {
  nav.pagination,
  .pagination {
    gap: 0.75rem;
  }
  
  nav.pagination .prev,
  nav.pagination .next,
  nav.pagination a,
  .pagination .prev,
  .pagination .next,
  .pagination a {
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
  }
}

.page-numbers {
  color: var(--secondary);
}

/* Социальные контакты на странице контактов */
.social-contacts {
  display: flex;
  gap: 1.5rem;
    align-items: center;
  margin: 2rem 0;
  flex-wrap: wrap;
}

.social-contact-link {
    display: inline-flex;
    align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--primary);
  font-size: 1.1rem;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  transition: background-color 0.2s;
}

.social-contact-link:hover {
  background-color: var(--code-bg);
}

  .social-contact-link svg {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
  }

/* Улучшение доступности с клавиатуры - focus states */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Убираем outline для мыши, но оставляем для клавиатуры */
button:focus:not(:focus-visible),
a:focus:not(:focus-visible) {
  outline: none;
}

/* Специальные стили для кнопки переключения темы */
#theme-toggle:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Стили для ссылок в футере */
.footer-links a:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Стили для ссылок в меню на десктопе */
@media (min-width: 769px) {
  #menu a:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 4px;
  }
}

/* Секция связанных постов */
.related-posts-section {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 2px solid var(--border);
}

.related-posts-title {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 1.5rem;
  padding-left: 0.5rem;
}

.related-posts-section .posts-grid {
  margin-top: 0;
}

.related-posts-section .post-card .entry-header h3 {
  font-size: 1.35rem;
  margin: 0;
}

.related-posts-section .post-card .entry-header h3 a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s;
}

.related-posts-section .post-card .entry-header h3 a:hover {
  color: var(--primary);
  text-decoration: underline;
}

/* Адаптивность */
@media (max-width: 768px) {
  /* На мобильных - 1 колонка */
  .posts-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .post-card {
    padding: 1.5rem;
  }
  
  .post-card .entry-header h2 {
    font-size: 1.35rem;
  }
  
  .breadcrumbs {
    font-size: 0.85rem;
  }
  
  .pagination {
    flex-direction: column;
  }
  
  /* Кнопка "Сбросить" на мобильных должна быть 100% ширины */
  .reset-btn,
  #reset-filters {
    width: 100% !important;
  }
  
  /* Glossary термины должны быть достаточно большими для тапа на мобильных */
  .terms-tags a {
    min-height: 44px !important;
    min-width: 44px !important;
    padding: 0.75rem 1rem !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0.5rem !important;
    box-sizing: border-box !important;
  }
    gap: 0.5rem;
  }
  
  .main {
    padding: calc(var(--gap) / 2);
    }
    
  .social-contacts {
    flex-direction: column;
    align-items: flex-start;
    }
}

/* Планшеты - тоже 2 колонки, но с меньшим отступом */
@media (min-width: 769px) and (max-width: 1024px) {
  .posts-grid {
    gap: 1.25rem;
  }
  
  .post-card {
    padding: 1.5rem;
    }
}

/* Стили для tools секции */
.tools-list {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

.tools-filters {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.filter-group label {
  font-weight: 600;
  font-size: 0.9rem;
}

.filter-select {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--entry);
  color: var(--primary);
  font-size: 1rem;
  min-height: 44px;
  line-height: 1.6;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.filter-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(100, 108, 255, 0.3);
}

.reset-btn,
#reset-filters {
  padding: 0.75rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--primary);
  font-size: 1rem;
  min-height: 44px;
  line-height: 1.6;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s;
}

.reset-btn:hover,
#reset-filters:hover {
  background: var(--entry);
  border-color: var(--primary);
}

.tools-matrix-wrapper {
  margin-top: 2rem;
}

/* Скрытие элементов при фильтрации */
.tool-row.hidden,
.tool-card-mobile.hidden {
  display: none !important;
}

/* Десктопная версия - показываем таблицу, скрываем карточки */
.tools-matrix-desktop {
  display: block;
}

.tools-matrix-mobile {
  display: none;
}

.tools-matrix-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

.tools-matrix-table th,
.tools-matrix-table td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.tools-matrix-table th {
  font-weight: 600;
  background: var(--entry);
}

.tool-name-col {
  max-width: 300px;
}

.level-col {
  max-width: 150px;
  text-align: center;
}

.matrix-link {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: var(--entry);
  color: var(--primary);
  text-decoration: none;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.matrix-link:hover {
  background: var(--code-bg);
}

.matrix-link-disabled {
  color: var(--tertiary);
}

/* Мобильная версия - скрываем таблицу, показываем карточки */
@media (max-width: 768px) {
  .tools-list {
    padding: 1rem;
  }
  
  .tools-filters {
    flex-direction: column;
  }
  
  .reset-btn,
  #reset-filters {
    width: 100% !important;
  }
  
  .tools-matrix-desktop {
    display: none !important;
  }
  
  .tools-matrix-mobile {
    display: block;
  }
  
  .tool-card-mobile {
    padding: 1.5rem;
    background: var(--entry);
    border-radius: 8px;
    border: 1px solid var(--border);
    margin-bottom: 1rem;
  }
  
  .tool-card-title {
    margin-bottom: 1rem;
    font-size: 1.2rem;
  }
  
  .tool-card-levels {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .level-card {
    padding: 0.75rem;
    background: var(--theme);
    border-radius: 4px;
    border: 1px solid var(--border);
  }
  
  .level-card-link {
    display: block;
    color: var(--primary);
    text-decoration: none;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .level-card-disabled {
    color: var(--tertiary);
    display: block;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* Футер - стили вынесены из footer.html для улучшения структуры */
.site-footer {
  background-color: var(--footer-bg, var(--code-bg));
  padding: 3rem 2rem 2rem;
  margin-top: 3rem;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--secondary);
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
}

.footer-columns {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3rem 2rem;
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 2px solid var(--border);
}

.footer-column {
  display: flex;
  flex-direction: column;
}

.footer-column-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 1rem 0;
  color: var(--primary);
}

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

.footer-links-list li {
  margin-bottom: 0.5rem;
}

.footer-links-list a {
  color: var(--secondary);
  text-decoration: none;
  transition: color 0.2s ease;
  display: inline-block;
  padding: 0.25rem 0;
  font-size: 0.9rem;
}

.footer-links-list a:hover,
.footer-links-list a:focus-visible {
  color: var(--primary);
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  outline: none;
}

.footer-bottom {
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
  text-align: left;
}

.footer-copyright {
  width: 100%;
  max-width: 100%;
}

.footer-copyright small {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--secondary);
  font-size: 0.875rem;
  font-weight: 500;
}

.footer-copyright p {
  margin: 0;
  color: var(--secondary);
  font-size: 0.875rem;
  line-height: 1.6;
  opacity: 0.9;
}

@media (max-width: 768px) {
  .site-footer {
    padding: 2rem 1rem 1.5rem;
    margin-top: 2rem;
  }

  .footer-columns {
    grid-template-columns: 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
  }

  .footer-column-title {
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
  }

  .footer-links-list {
    margin-bottom: 0;
  }

  .footer-links-list li {
    margin-bottom: 0.4rem;
  }

  .footer-links-list a {
    font-size: 0.875rem;
    padding: 0.3rem 0;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  .footer-bottom {
    justify-content: center;
    text-align: center;
  }

  .footer-copyright {
    width: 100%;
    text-align: center;
  }

  .footer-copyright small,
  .footer-copyright p {
    font-size: 0.8125rem;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .footer-columns {
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem 1.5rem;
  }
}

/* ============================================
   СТИЛИ ДЛЯ JOURNEY LIST (вынесены из journey/list.html)
   ============================================ */
.journey-levels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  margin-bottom: 3rem;
}

.journey-card {
  padding: 2rem;
  background: var(--entry);
  border-radius: 8px;
  border-left: 4px solid var(--primary);
  transition: transform 0.3s, box-shadow 0.3s;
}

.journey-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.journey-card h2 {
  margin-bottom: 1rem;
  font-size: 1.8rem;
  color: var(--primary);
}

.journey-card p {
  color: var(--secondary);
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.btn-journey {
  display: inline-block;
  padding: 0.8rem 1.5rem;
  background: var(--primary);
  color: var(--theme);
  text-decoration: none;
  border-radius: 4px;
  transition: background 0.3s;
}

.btn-journey:hover {
  background: var(--secondary);
}

.card-metaphors {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.metaphor-tag {
  display: inline-block;
  padding: 0.3rem 0.8rem;
  background: var(--theme);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 0.85rem;
  margin-right: 0.5rem;
  margin-top: 0.5rem;
  color: var(--primary);
}

@media (max-width: 768px) {
  .journey-levels-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

/* ============================================
   СТИЛИ ДЛЯ TOOL TERM (вынесены из tool/term.html)
   ============================================ */
.term-pages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2rem;
  margin-top: 3rem;
}

.term-page-card {
  padding: 1.5rem;
  background: var(--entry);
  border-radius: 8px;
  border: 1px solid var(--border);
  transition: transform 0.3s, box-shadow 0.3s;
}

.term-page-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.term-page-card h2 {
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

.term-page-card h2 a {
  color: var(--primary);
  text-decoration: none;
}

.term-page-card h2 a:hover {
  color: var(--secondary);
}

.page-description {
  color: var(--secondary);
  margin: 1rem 0;
  line-height: 1.6;
}

.btn-read {
  display: inline-block;
  padding: 0.6rem 1.2rem;
  background: var(--primary);
  color: var(--theme);
  text-decoration: none;
  border-radius: 4px;
  margin-top: 1rem;
  transition: background 0.3s;
}

.btn-read:hover {
  background: var(--secondary);
}

/* ============================================
   СТИЛИ ДЛЯ SECTION (вынесены из _default/section.html)
   ============================================ */
.section-content {
  margin: 2rem 0;
}

.section-pages-list {
  margin-top: 3rem;
}

.section-pages-list .post-entry {
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.section-pages-list .post-entry:last-child {
  border-bottom: none;
}

.section-pages-list .entry-header h2 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.section-pages-list .entry-header a {
  color: var(--primary);
  text-decoration: none;
}

.section-pages-list .entry-header a:hover {
  text-decoration: underline;
}

.section-pages-list .entry-content {
  color: var(--secondary);
  margin-top: 0.5rem;
}

/* ============================================
   СТИЛИ ДЛЯ 404 СТРАНИЦЫ (вынесены из 404.html)
   ============================================ */
/* Стили для страницы 404 - используют .page-container.error-page */
.page-container.error-page {
  min-height: calc(100vh - var(--header-height) - var(--footer-height));
  display: flex;
  align-items: center;
  justify-content: center;
  /* padding наследуется от .page-container, но можем переопределить при необходимости */
}

.error-page {
  min-height: calc(100vh - var(--header-height) - var(--footer-height));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.error-container {
  max-width: 600px;
  width: 100%;
  margin: 0 auto;
}

.error-content {
  text-align: center;
}

.error-header {
  margin-bottom: 3rem;
}

.error-title {
  font-size: 6rem;
  font-weight: 700;
  line-height: 1;
  margin: 0 0 1rem 0;
  color: var(--primary);
  letter-spacing: -0.02em;
}

.error-subtitle {
  font-size: 1.75rem;
  font-weight: 500;
  margin: 0 0 1rem 0;
  color: var(--primary);
}

.error-description {
  font-size: 1.1rem;
  color: var(--secondary);
  line-height: 1.6;
  margin: 0;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.error-actions {
  margin-top: 3rem;
  padding: 2.5rem 2rem;
  background-color: var(--entry);
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.error-actions-title {
  margin: 0 0 1.5rem 0;
  font-size: 1.5rem;
  color: var(--primary);
  font-weight: 600;
}

.error-links {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.error-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 1.5rem;
  background-color: var(--theme);
  color: var(--primary);
  text-decoration: none;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 500;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  min-height: 52px;
}

.error-link:hover {
  background-color: var(--entry);
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  color: var(--primary);
}

.error-link-primary {
  background-color: var(--primary);
  color: var(--theme);
  border-color: var(--primary);
  font-weight: 600;
}

.error-link-primary:hover {
  background-color: var(--secondary);
  border-color: var(--secondary);
  color: var(--theme);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.2);
}

@media (max-width: 768px) {
  .page-container.error-page,
  .error-page {
    padding: 1.5rem 1rem;
    min-height: calc(100vh - var(--header-height) - var(--footer-height) - 2rem);
  }

  .error-title {
    font-size: 4rem;
    margin-bottom: 0.75rem;
  }

  .error-subtitle {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
  }

  .error-description {
    font-size: 1rem;
    padding: 0 0.5rem;
  }

  .error-header {
    margin-bottom: 2rem;
  }

  .error-actions {
    margin-top: 2rem;
    padding: 2rem 1.5rem;
    border-radius: 12px;
  }

  .error-actions-title {
    font-size: 1.25rem;
    margin-bottom: 1.25rem;
  }

  .error-links {
    gap: 0.875rem;
  }

  .error-link {
    padding: 0.875rem 1.25rem;
    font-size: 0.95rem;
    min-height: 48px;
    border-radius: 10px;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .error-title {
    font-size: 5rem;
  }

  .error-subtitle {
    font-size: 1.6rem;
  }
}

/* ============================================
   ПРОГРЕСС-БАР ЧТЕНИЯ (вынесен из _default/single.html)
   ============================================ */
.reading-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  z-index: 9999;
  transition: width 0.1s ease-out;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.post-meta .reading-time {
  color: var(--secondary);
  font-size: 0.9em;
}

@media (max-width: 768px) {
  .reading-progress-bar {
    height: 2px;
  }
}

/* ============================================
   СТИЛИ ДЛЯ GLOSSARY (вынесены из glossary/list.html и glossary/single.html)
   ============================================ */
.glossary-subtitle {
  font-size: 0.95rem;
  color: var(--secondary);
  opacity: 0.9;
  margin-top: 1rem;
}

.glossary-subtitle a {
  color: var(--primary);
  text-decoration: underline;
}

.glossary-letter-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  margin-bottom: 1.75rem;
  padding: 0.75rem 1.25rem;
  background: var(--entry);
  border-radius: 12px;
  border: 1px solid var(--border);
  font-size: 0.9rem;
}

.glossary-letter-nav-label {
  color: var(--secondary);
  white-space: nowrap;
}

.glossary-letter-nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.glossary-letter-nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s, transform 0.1s;
}

.glossary-letter-nav-link:hover {
  background: var(--code-bg);
  border-color: var(--border);
  transform: translateY(-1px);
}

.glossary-search-block {
  margin-bottom: 2.5rem;
  padding: 1.5rem 1.75rem;
  background: var(--entry);
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

.glossary-search-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  color: var(--primary);
}

.glossary-search-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 1rem;
  background: var(--theme);
  color: var(--primary);
  transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
  box-sizing: border-box;
}

.glossary-search-input::placeholder {
  color: var(--tertiary);
}

.glossary-search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(100, 108, 255, 0.3);
}

.glossary-search-help {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--secondary);
  opacity: 0.9;
}

.glossary-count {
  margin-top: 0.35rem;
  font-size: 0.9rem;
  color: var(--secondary);
}

.glossary-list {
  margin-bottom: 2rem;
}

.glossary-letter {
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary);
}

.glossary-items {
  list-style: none;
  padding: 0;
  margin: 0;
}

.glossary-item {
  margin-bottom: 0.5rem;
}

.glossary-term-link {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem;
  text-decoration: none;
  color: var(--primary);
  padding: 0.4rem 0.1rem;
  border-radius: 6px;
  transition: background-color 0.15s, color 0.15s;
}

.glossary-term-link:hover {
  background: var(--code-bg);
  color: var(--primary);
}

.glossary-term-title {
  font-weight: 600;
}

.glossary-term-short {
  font-size: 0.95rem;
  color: var(--secondary);
}

.glossary-empty {
  margin-top: 1.5rem;
  font-size: 0.95rem;
  color: var(--secondary);
}

.glossary-extra-content {
  margin-top: 3rem;
}

.glossary-extra-content ul,
.glossary-extra-content ol {
  padding-left: 1.5rem;
  margin: 1rem 0;
  list-style-position: outside;
}

.glossary-extra-content li {
  margin: 0.5rem 0;
  line-height: 1.6;
}

.glossary-extra-content p {
  margin: 1rem 0;
  line-height: 1.7;
}

.glossary-extra-content strong {
  font-weight: 600;
}

.glossary-hidden {
  display: none !important;
}

/* Glossary single page */
.glossary-single {
  background: var(--entry);
  border-radius: 16px;
  padding: 2rem 2.25rem 2.5rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  border: 1px solid var(--border);
}

.glossary-single-header {
  margin-bottom: 1.75rem;
}

.glossary-single-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  background: var(--code-bg);
  color: var(--secondary);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.75rem;
}

.glossary-single-title {
  font-size: 2.1rem;
  margin: 0 0 0.75rem;
  color: var(--primary);
}

.glossary-single-short {
  margin: 0 0 1.25rem;
  font-size: 1rem;
  color: var(--secondary);
}

.glossary-back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.9rem;
  color: var(--secondary);
  text-decoration: none;
  border-bottom: 1px dashed transparent;
  transition: color 0.15s, border-color 0.15s, transform 0.1s;
}

.glossary-back-link:hover {
  color: var(--primary);
  border-color: var(--primary);
  transform: translateY(-1px);
}

.glossary-single-content {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--primary);
}

.glossary-single-content h2,
.glossary-single-content h3 {
  margin-top: 1.75rem;
  margin-bottom: 0.75rem;
}

.glossary-single-content p {
  margin: 0 0 1rem;
}

.glossary-single-content ul,
.glossary-single-content ol {
  padding-left: 1.25rem;
  margin-bottom: 1rem;
}

.glossary-single-content li + li {
  margin-top: 0.25rem;
}

.glossary-single-content strong {
  font-weight: 600;
}

.glossary-related {
  margin-top: 2.5rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--border);
}

.glossary-related-title {
  font-size: 1.25rem;
  margin: 0 0 1rem;
  color: var(--primary);
}

.glossary-related-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.glossary-related-item + .glossary-related-item {
  margin-top: 0.4rem;
}

.glossary-related-link {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  align-items: baseline;
  text-decoration: none;
  color: var(--primary);
  padding: 0.25rem 0.1rem;
  border-radius: 6px;
  transition: background-color 0.15s, color 0.15s;
}

.glossary-related-link:hover {
  background: var(--code-bg);
}

.glossary-related-term {
  font-weight: 600;
}

.glossary-related-short {
  font-size: 0.95rem;
  color: var(--secondary);
}

@media (max-width: 768px) {
  .glossary-letter-nav {
    border-radius: 12px;
    padding: 0.75rem 0.75rem;
  }

  .glossary-search-block {
    padding: 1.25rem 1rem;
  }

  .glossary-single {
    padding: 1.5rem 1.5rem 2rem;
    border-radius: 14px;
  }
}

/* ============================================
   СТИЛИ ДЛЯ CAREER (вынесены из career/list.html и career/single.html)
   ============================================ */
/* Переопределяем стили для контента career */
.page-container .post-content.section-content {
  max-width: 100%;
  width: 100%;
  padding: 0;
}

/* Убираем ограничения ширины для элементов внутри career */
.page-container .post-content .intro-career {
  max-width: 1000px;
  margin: 0 auto;
  padding: 2rem;
  text-align: center;
}

@media (max-width: 768px) {
  .page-container .post-content .intro-career {
    padding: 1rem;
  }
}

/* ============================================
   СТИЛИ ДЛЯ CAREER SINGLE (вынесены из career/single.html)
   ============================================ */
.career-single {
  width: 100%;
}

/* Переопределяем ширину career-role-page, чтобы она соответствовала контейнеру */
.page-container .career-role-page {
  max-width: 100%;
  width: 100%;
}

/* Стили для блоков пути развития, связанных ролей и инструментов */
.career-path-section,
.career-related-section,
.career-tools-section {
  margin: 2.5rem 0;
  padding: 1.5rem;
  background-color: var(--entry);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.career-path-section h2,
.career-related-section h2,
.career-tools-section h2 {
  color: var(--primary);
  font-size: 1.3rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--border);
  margin-top: 0;
}

.career-path-section p strong {
  font-weight: 600;
  color: var(--primary);
  display: block;
  margin: 1rem 0 0.5rem 0;
}

/* Единые стили для всех списков на страницах career */
.career-content-wrapper ul,
.career-content-wrapper ol {
  margin: 0.75rem 0;
  padding-left: 1.5rem;
  padding-inline-start: 1.5rem;
  list-style-position: outside;
}

.career-content-wrapper li {
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

.career-path-section ul,
.career-related-section ul,
.career-tools-section ul {
  margin: 0.75rem 0;
  padding-left: 1.5rem;
  padding-inline-start: 1.5rem;
}

.career-path-section li,
.career-related-section li,
.career-tools-section li {
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

.career-related-section a,
.career-tools-section a {
  color: var(--primary);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: all 0.2s ease;
}

.career-related-section a:hover,
.career-tools-section a:hover {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

@media (max-width: 768px) {
  .career-path-section,
  .career-related-section,
  .career-tools-section {
    padding: 1rem;
    margin: 2rem 0;
  }

  .career-path-section h2,
  .career-related-section h2,
  .career-tools-section h2 {
    font-size: 1.1rem;
  }
}

/* ============================================
   СТИЛИ ДЛЯ TOOLS TERMS (вынесены из tools/terms.html и _default/terms.html)
   ============================================ */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2rem;
  margin-bottom: 3rem;
}

.tool-card {
  padding: 1.5rem;
  background: var(--entry);
  border-radius: 8px;
  border: 1px solid var(--border);
  transition: transform 0.3s, box-shadow 0.3s;
}

.tool-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.tool-card h2 {
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

.tool-description {
  color: var(--secondary);
  margin: 1rem 0;
  line-height: 1.6;
}

.tools-by-level {
  margin-top: 4rem;
  padding-top: 3rem;
  border-top: 2px solid var(--border);
}

.tools-by-level h2 {
  margin-bottom: 2rem;
  text-align: center;
}

.tool-section {
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: var(--code-bg);
  border-radius: 8px;
}

.tool-section h3 {
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

.tool-levels {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.level-link {
  padding: 0.6rem 1.2rem;
  background: var(--theme);
  border: 1px solid var(--border);
  border-radius: 4px;
  text-decoration: none;
  color: var(--primary);
  transition: background 0.3s, border-color 0.3s;
}

.level-link:hover {
  background: var(--entry);
  border-color: var(--primary);
}

/* ============================================
   КНОПКА SCROLL-TO-TOP (вынесена из footer.html)
   ============================================ */
#scroll-to-top,
.scroll-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background-color: var(--entry);
  color: var(--primary);
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  display: flex !important;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.2s ease;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
}

#scroll-to-top:hover,
.scroll-to-top:hover {
  background-color: var(--primary);
  color: var(--theme);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  border-color: var(--primary);
}

#scroll-to-top:active,
.scroll-to-top:active {
  transform: translateY(0);
}

#scroll-to-top svg,
.scroll-to-top svg {
  width: 1.5rem;
  height: 1.5rem;
  fill: currentColor;
}

@media (max-width: 768px) {
  #scroll-to-top,
  .scroll-to-top {
    width: 2.75rem;
    height: 2.75rem;
    bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
    right: calc(1rem + env(safe-area-inset-right, 0px));
    z-index: 1001;
  }

  #scroll-to-top svg,
  .scroll-to-top svg {
    width: 1.25rem;
    height: 1.25rem;
  }
}

/* ============================================
   СТИЛИ ДЛЯ AI СЕКЦИИ (вынесены из ai/list.html и partials)
   ============================================ */
.ai-list {
  max-width: 1200px;
  margin: 0 auto;
  padding: 3rem 2rem;
}

.ai-content {
  margin: 2rem 0;
}

.ai-pages-list {
  margin-top: 3rem;
}

.ai-tools-heading {
  font-size: 2rem;
  margin-bottom: 2rem;
  color: var(--primary);
}

.ai-tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2rem;
}

.ai-tool-card {
  padding: 1.5rem;
  background: var(--entry);
  border-radius: 8px;
  border: 1px solid var(--border);
  transition: transform 0.3s, box-shadow 0.3s;
}

.ai-tool-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
}

.ai-tool-card h3 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.ai-tool-card h3 a {
  color: var(--primary);
  text-decoration: none;
}

.ai-tool-card h3 a:hover {
  text-decoration: underline;
}

.ai-tool-category {
  display: inline-block;
  font-size: 0.85rem;
  color: var(--secondary);
  margin-top: 0.25rem;
}

/* Стили для категорий AI (из ai-list-styles.html) */
.intro-ai {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem;
  text-align: center;
}

.intro-ai h2 {
  font-size: var(--h2-font-size-desktop);
  margin-bottom: 1.5rem;
  color: var(--primary);
}

.intro-ai h3 {
  font-size: 1.5rem;
  margin: 3rem 0 1.5rem 0;
  color: var(--primary);
}

.intro-ai p {
  font-size: var(--p-font-size-desktop);
  line-height: 1.8;
  margin-bottom: 1.5rem;
  color: var(--content);
  text-align: left;
}

.intro-ai .cta-text {
  margin-top: 3rem;
  text-align: center;
  font-size: 1.2rem;
}

.ai-categories {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
  text-align: center;
}

.ai-categories a {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1.5rem;
  background-color: var(--entry);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-decoration: none;
  color: var(--primary);
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  min-height: 120px;
}

.ai-categories a:hover {
  background-color: var(--code-bg);
  color: var(--primary);
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
  border-color: var(--primary);
}

.category-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.category-name {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--primary);
}

.category-desc {
  font-size: 0.9rem;
  color: var(--secondary);
  line-height: 1.4;
}

/* Стили для страниц категорий AI (из ai-category-styles.html) */
.ai-category-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem;
}

.category-intro {
  font-size: 1.3rem;
  line-height: 1.8;
  margin-bottom: 1rem;
  color: var(--content);
  text-align: center;
  font-style: italic;
}

.category-description {
  font-size: 1.1rem;
  line-height: 1.8;
  margin-bottom: 2rem;
  color: var(--secondary);
  text-align: center;
}

.ai-filters {
  display: flex;
  gap: 1.5rem;
  align-items: flex-end;
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: var(--entry);
  border-radius: 12px;
  flex-wrap: wrap;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  border: 1px solid var(--border);
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
  min-width: 200px;
}

.filter-group label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--primary);
}

.filter-select {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 1rem;
  line-height: 1.6;
  background: var(--theme);
  color: var(--primary);
  cursor: pointer;
  transition: all 0.2s;
}

.filter-select:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.reset-btn {
  padding: 0.75rem 2rem;
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  transition: all 0.3s;
  white-space: nowrap;
  min-height: 44px;
}

.reset-btn:hover {
  border-color: var(--primary);
  background: var(--code-bg);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.level-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  margin: 0.25rem 0.25rem 0.25rem 0;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 500;
  background: var(--code-bg);
  color: var(--primary);
  border: 1px solid var(--border);
}

.ai-tools-table-wrapper {
  overflow-x: auto;
  margin: 2rem 0;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
}

.ai-tools-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--entry);
  border-radius: 12px;
  overflow: hidden;
}

.ai-tools-table thead {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: var(--theme);
}

.ai-tools-table th {
  padding: 1.25rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: 0.5px;
}

.ai-tools-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: all 0.2s;
}

.ai-tools-table tbody tr:hover {
  background: var(--code-bg);
}

.ai-tools-table tbody tr:last-child {
  border-bottom: none;
}

.ai-tools-table tbody tr.hidden {
  display: none;
}

.ai-tools-table td {
  padding: 1.25rem 1rem;
  line-height: 1.6;
  color: var(--content);
}

.ai-tools-table td strong {
  color: var(--primary);
  font-weight: 600;
}

.ai-tools-table td a {
  color: var(--primary);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: all 0.2s;
}

.ai-tools-table td a:hover {
  color: var(--secondary);
  border-bottom-color: var(--primary);
}

.tip {
  margin-top: 2rem;
  padding: 1rem;
  background: var(--code-bg);
  border-left: 4px solid var(--primary);
  border-radius: 6px;
  color: var(--secondary);
  font-size: 0.95rem;
  line-height: 1.6;
}

@media (max-width: 768px) {
  .ai-list {
    padding: 2rem 1rem;
  }

  .ai-tools-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .ai-tool-card h3 {
    font-size: 1rem;
  }

  .intro-ai {
    padding: 1rem;
  }

  .intro-ai h2 {
    font-size: var(--h2-font-size-mobile);
  }

  .intro-ai h3 {
    font-size: 1.3rem;
  }

  .intro-ai p {
    font-size: var(--p-font-size-mobile);
  }

  .ai-categories {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .ai-categories a {
    padding: 1.5rem 1rem;
    min-height: 120px;
  }

  .category-icon {
    font-size: 2rem;
  }

  .category-name {
    font-size: 1.1rem;
  }

  .category-desc {
    font-size: 0.85rem;
  }

  .ai-category-page {
    padding: 1rem;
  }

  .category-intro {
    font-size: 1.1rem;
  }

  .category-description {
    font-size: 1rem;
  }

  .ai-filters {
    flex-direction: column;
    padding: 1rem;
  }

  .filter-group {
    width: 100%;
  }

  .reset-btn {
    width: 100%;
  }

  .ai-tools-table-wrapper {
    margin: 1.5rem 0;
  }

  .ai-tools-table th,
  .ai-tools-table td {
    padding: 1rem 0.75rem;
    font-size: 0.9rem;
  }

  .ai-tools-table th:first-child,
  .ai-tools-table td:first-child {
    min-width: 120px;
  }

  .ai-tools-table th:nth-child(2),
  .ai-tools-table td:nth-child(2) {
    min-width: 200px;
  }
}

/* ============================================
   СТИЛИ ГЛАВНОЙ СТРАНИЦЫ (home/index)
   ============================================ */

/* Заголовок главной страницы */
.home-header {
  text-align: center;
  margin-bottom: 4rem;
  padding-bottom: 2rem;
  border-bottom: 2px solid var(--border);
}

.home-subtitle {
  font-size: 1.3rem;
  color: var(--secondary);
  font-style: italic;
  margin-top: 1rem;
  line-height: 1.6;
}

/* Journey Quiz секция */
.journey-quiz {
  margin: 4rem 0;
}

.journey-levels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.journey-level-card {
  display: flex;
  flex-direction: column;
  padding: 2rem;
  background: var(--entry);
  border-radius: 12px;
  border: 2px solid var(--border);
  text-decoration: none;
  color: var(--primary);
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  position: relative;
  overflow: hidden;
}

.journey-level-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(180deg, var(--primary), var(--secondary));
  opacity: 0;
  transition: opacity 0.3s;
}

.journey-level-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  border-color: var(--primary);
}

.journey-level-card:hover::before {
  opacity: 1;
}

.journey-level-card h3 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--primary);
}

.journey-level-card p {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--content);
  margin-bottom: 1.5rem;
  flex-grow: 1;
}

.btn-level {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: var(--primary);
  color: var(--theme);
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 1rem;
  transition: all 0.3s ease;
  margin-top: auto;
  text-align: center;
  /* Кнопка внутри карточки-ссылки не должна перехватывать клики */
  pointer-events: none;
}

.journey-level-card:hover .btn-level {
  background: var(--secondary);
  transform: translateX(4px);
}

.level-metaphors {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.metaphor-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: var(--code-bg);
  color: var(--secondary);
  border-radius: 12px;
  font-size: 0.85rem;
  border: 1px solid var(--border);
}

/* Metaphors Showcase секция */
.metaphors-showcase {
  margin: 4rem 0;
  padding: 3rem 2rem;
  background: var(--entry);
  border-radius: 16px;
  border: 2px solid var(--border);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.metaphors-intro {
  text-align: center;
  font-size: 1.2rem;
  color: var(--secondary);
  margin-bottom: 3rem;
  font-style: italic;
}

.metaphors-gallery-main {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 2rem;
}

.metaphor-showcase-card {
  padding: 2.5rem 2rem;
  background: var(--theme);
  border-radius: 12px;
  border: 2px solid var(--border);
  text-align: center;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.metaphor-showcase-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
  border-color: var(--primary);
}

.metaphor-showcase-card:hover .metaphor-showcase-icon {
  opacity: 1;
  filter: grayscale(0%);
  transform: scale(1.1);
}

.metaphor-showcase-icon {
  width: 120px;
  height: 120px;
  margin-bottom: 1.5rem;
  object-fit: contain;
  opacity: 0.9;
  transition: all 0.4s ease;
  filter: grayscale(20%);
}

.metaphor-showcase-card h3 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--primary);
  line-height: 1.3;
}

.metaphor-showcase-card p {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--secondary);
  margin: 1rem 0 0 0;
  max-width: 500px;
}

/* Tools Preview секция */
.tools-preview {
  margin: 4rem 0;
}

.tools-preview .tools-grid {
  margin-top: 2rem;
}

.tools-preview .tool-card {
  padding: 2rem;
  text-align: center;
  background: var(--entry);
  border-radius: 12px;
  border: 2px solid var(--border);
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.tools-preview .tool-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  border-color: var(--primary);
}

.tools-preview .tool-card h3 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  color: var(--primary);
}

.tools-preview .btn-tool {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: var(--primary);
  color: var(--theme);
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 1rem;
  transition: all 0.3s ease;
}

.tools-preview .btn-tool:hover {
  background: var(--secondary);
  transform: translateX(4px);
}

/* Мобильные стили для главной страницы */
@media (max-width: 768px) {
  .home-header {
    margin-bottom: 3rem;
    padding-bottom: 1.5rem;
  }

  .home-subtitle {
    font-size: 1.1rem;
  }

  .journey-quiz {
    margin: 3rem 0;
  }

  .journey-levels {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .journey-level-card {
    padding: 1.5rem;
  }

  .journey-level-card h3 {
    font-size: 1.3rem;
  }

  .metaphors-showcase {
    padding: 2rem 1.5rem;
    margin: 3rem 0;
  }

  .metaphors-gallery-main {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .metaphor-showcase-card {
    padding: 1.25rem;
  }

  .tools-preview {
    margin: 3rem 0;
  }

  .tools-preview .tool-card {
    padding: 1.5rem;
  }
}

/* ============================================ СТИЛИ ДЛЯ СОДЕРЖАНИЯ СТАТЕЙ БЛОГА (TOC) ============================================ */
.post-toc {
  margin: 2rem 0 3rem 0;
  padding: 1.5rem;
  background-color: var(--entry);
  border-radius: 8px;
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.post-toc .toc-title {
  margin: 0 0 1rem 0;
  font-size: 1.3rem;
  font-weight: 500;
  color: var(--primary);
}

.post-toc .toc-content {
  color: var(--content);
  font-size: 0.95rem;
  line-height: 1.8;
}

.post-toc .toc-content ul {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.post-toc .toc-content > ul {
  padding-left: 0;
}

.post-toc .toc-content ul li {
  margin: 0.5rem 0 !important;
  padding-left: 1.5rem !important;
  position: relative;
}

/* Визуальный индикатор - стрелка через ::before */
.post-toc .toc-content ul li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--secondary);
  font-size: 0.9rem;
  opacity: 0.6;
  transition: all 0.2s ease;
  font-weight: 400;
}

.post-toc .toc-content ul li:hover::before {
  color: var(--primary);
  opacity: 1;
  transform: translateX(2px);
}

.post-toc .toc-content ul li ul {
  margin-top: 0.5rem;
  padding-left: 1.5rem;
  border-left: 2px solid var(--border);
}

.post-toc .toc-content ul li ul li {
  padding-left: 1.5rem !important;
}

.post-toc .toc-content ul li ul li::before {
  content: '→';
  left: -1.5rem;
}

.post-toc .toc-content a {
  color: var(--content);
  text-decoration: none;
  transition: color 0.2s ease;
  display: block;
  padding: 0.25rem 0;
}

.post-toc .toc-content a:hover {
  color: var(--primary);
}

/* Мобильные стили для TOC */
@media (max-width: 768px) {
  .post-toc {
    padding: 1rem;
    margin: 1.5rem 0;
  }
  
  .post-toc .toc-title {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
  }
  
  .post-toc .toc-content {
    font-size: 0.9rem;
  }
  
  .post-toc .toc-content ul li {
    padding-left: 1.25rem;
    margin: 0.4rem 0;
  }
  
  .post-toc .toc-content ul li::before {
    font-size: 0.85rem;
  }
}

