/* ========================================
   ГЛОБАЛЬНЫЕ СТИЛИ
   ======================================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
}

/* ========================================
   КОНТЕНТ СТАТЬИ
   ======================================== */

.article-content {
  line-height: 1.3;
  font-size: 1.125rem; /* 18px - mobile */
  color: #374151;
}

/* Десктоп: увеличиваем размер текста */
@media (min-width: 768px) {
  .article-content {
    line-height: 1.7;
    font-size: 1.25rem; /* 20px - desktop */
  }
}

/* ========================================
   ПАРАГРАФЫ
   ======================================== */

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

/* Параграф после заголовка: минимальный отступ сверху
   Это создает визуальную связь заголовка с его контентом */
.article-content h2 + p,
.article-content h3 + p {
  margin-top: 0.5rem;
}

/* ========================================
   ЗАГОЛОВКИ
   Стратегия: большой отступ сверху (отделяет от предыдущего блока),
   маленький снизу (связывает со своим контентом)
   ======================================== */

.article-content h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-top: 2rem;        /* 32px - отделяет от предыдущего блока */
  margin-bottom: 0.25rem;  /* 4px - близко к своему контенту */
  color: #111827;
  line-height: 1.25;
}

.article-content h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-top: 1.75rem;     /* 28px - отделяет от предыдущего блока */
  margin-bottom: 0.25rem;  /* 4px - близко к своему контенту */
  color: #1f2937;
  line-height: 1.3;
}

/* ========================================
   СПИСКИ
   ======================================== */

.article-content ul,
.article-content ol {
  margin: 1rem 0 1rem 1.25rem;
  padding-left: 0.5rem;
}

.article-content ul li,
.article-content ol li {
  margin-bottom: 0.3rem;
  line-height: inherit;
  display: list-item;
}

.article-content ul li:last-child,
.article-content ol li:last-child {
  margin-bottom: 0;
}

.article-content ul {
  list-style-type: disc;
}

.article-content ol {
  list-style-type: decimal;
}

/* Цитаты blockquote */
.article-content blockquote:not(.tiktok-embed) {
  margin: 1.5rem 0;
  padding: 1rem 1.5rem;
  border-left: 4px solid #111827;
  background-color: #f9fafb;
  font-style: italic;
}


/* Div элементы (если есть из редактора) */
.article-content div {
  margin-bottom: 1rem;
}

.article-content div:last-child {
  margin-bottom: 0;
}

/* Таблицы */
.article-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
}

.article-content table th,
.article-content table td {
  border: 1px solid #e5e7eb;
  padding: 0.75rem;
  text-align: left;
}

.article-content table th {
  background-color: #f3f4f6;
  font-weight: 600;
}

/* Code blocks */
.article-content pre {
  background-color: #1f2937;
  color: #f9fafb;
  padding: 1rem;
  border-radius: 4px;
  overflow-x: auto;
  margin: 1rem 0;
}

.article-content code {
  background-color: #f3f4f6;
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
  font-size: 0.9em;
  font-family: monospace;
}

.article-content pre code {
  background-color: transparent;
  padding: 0;
}

/* Горизонтальная линия */
.article-content hr {
  border: none;
  border-top: 2px solid #e5e7eb;
  margin: 2rem 0;
}

/* Imágenes в статьях */
.article-content img {
  max-width: 100%;
  width: auto;
  height: auto;
  max-height: 500px;
  display: block;
  margin: 1rem auto;
}

/* Обертка изображений из редактора */
.article-content .image-wrapper {
  padding: 0;
  margin: 1rem 0;
  text-align: center;
  display: block;
}

/* Убираем отступ у img внутри image-wrapper */
.article-content .image-wrapper img {
  margin: 0 auto;
}

/* Wrapper для изображений Amazon с водяным знаком */
.article-content .amazon-image-wrapper {
  position: relative;
  display: block;
  margin: 1rem auto;
  max-width: 100%;
  border: 1px solid #000;
  box-sizing: border-box;
  width: fit-content;
}

/* Убираем отступ у img внутри Amazon wrapper */
.article-content .amazon-image-wrapper img {
  margin: 0;
}

/* Водяной знак Amazon - полоса снизу */
.article-content .amazon-watermark {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: #000000;
  color: #ffffff;
  padding: 4px 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  pointer-events: none;
  z-index: 100;
  text-align: right;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  white-space: nowrap;
  text-transform: uppercase;
}

.article-content a {
  color: #111827;
  text-decoration: underline;
  transition: color 0.2s ease;
}

.article-content a:hover {
  color: #6b7280;
}

/* Стиль для внутренних ссылок (автоматическая перелинковка) */
.article-content a.internal-link {
  color: #111827;
  text-decoration: underline;
  text-decoration-style: solid;
  text-underline-offset: 2px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.article-content a.internal-link:hover {
  color: #000000;
  text-decoration-thickness: 2px;
}

.article-content strong {
  font-weight: 700;
  color: #111827;
}

.article-content em {
  font-style: italic;
}

.article-content br {
  line-height: 0;
  display: block;
  margin: 0;
  padding: 0;
}

/* Скрываем br внутри списков (они создают лишние переносы строк) */
.article-content ul br,
.article-content ol br {
  display: none;
}

.category-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Эффект подсветки для навигации в хедере */
header nav a {
  position: relative;
  transition: all 0.3s ease;
}

header nav a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background-color: #111827;
  transition: width 0.3s ease;
}

header nav a:hover::after {
  width: 100%;
}

header nav a:hover {
  color: #111827;
}

/* Кнопки Amazon в фирменном стиле */
.amazon-button {
  display: inline-block;
  background: linear-gradient(to bottom, #f7dfa5, #f0c14b);
  border: 1px solid #a88734;
  border-radius: 8px;
  padding: 12px 24px;
  color: #111;
  font-weight: 600;
  text-decoration: none;
  text-align: center;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.4) inset;
  transition: all 0.15s ease;
  cursor: pointer;
  font-size: 15px;
  line-height: 1.4;
}

.amazon-button:hover {
  background: linear-gradient(to bottom, #f5d78e, #edb932);
  border-color: #9c7e31;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) inset;
  color: #111;
  text-decoration: none;
}

.amazon-button:active {
  background: linear-gradient(to bottom, #edb932, #f0c14b);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2) inset;
  text-decoration: none;
}

/* Amazon кнопка в контенте статьи */
.article-content .amazon-button {
  margin: 16px auto;
  text-decoration: none;
}

.article-content .amazon-button:hover,
.article-content .amazon-button:active,
.article-content .amazon-button:focus {
  text-decoration: none;
}

/* Amazon кнопка на десктопе: ширина 500px по центру */
@media (min-width: 768px) {
  .article-content .amazon-button {
    display: block;
    width: 500px;
    max-width: 100%;
  }
}

/* Amazon кнопка на всю ширину на мобильных */
@media (max-width: 767px) {
  .article-content .amazon-button {
    display: block;
    width: 100%;
  }
}

/* TikTok и другие embeds в одну строку на ПК */
.article-content blockquote.tiktok-embed {
  display: inline-block;
  vertical-align: top;
  margin: 1rem 10px;
  max-width: 325px;
  min-width: 280px;
  border: none;
  box-shadow: none;
}

/* Контейнер для группы TikTok в ряд */
.article-content .tiktok-row {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin: 1.5rem 0;
  justify-content: flex-start;
  align-items: flex-start;
}

.article-content .tiktok-row blockquote.tiktok-embed {
  margin: 0;
  flex: 0 0 auto;
}

/* Контейнер для столбцов */
.article-content .columns-container {
  display: grid;
  gap: 15px;
  margin: 1.5rem 0;
}

.article-content .columns-container[data-columns="2"] {
  grid-template-columns: repeat(2, 1fr);
}

.article-content .columns-container[data-columns="3"] {
  grid-template-columns: repeat(3, 1fr);
}

.article-content .column {
  display: block;
}

/* На мобильных - вертикально */
@media (max-width: 768px) {
  .article-content blockquote.tiktok-embed {
    display: block;
    margin: 1rem auto;
    max-width: 100%;
    min-width: 0;
    border: none;
    box-shadow: none;
  }
  
  .article-content .tiktok-row {
    flex-direction: column;
    align-items: center;
    margin-bottom: 0.5rem;
  }
  
  .article-content .tiktok-row blockquote.tiktok-embed {
    margin: 0.5rem 0;
    width: 100%;
  }
  
  /* Столбцы на мобильных - вертикально */
  .article-content .columns-container {
    grid-template-columns: 1fr;
  }
}

/* ========================================
   МОБИЛЬНОЕ МЕНЮ (HAMBURGER)
   ======================================== */

/* Overlay (затемнение фона) */
.mobile-menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0);
  z-index: 9998;
  transition: background-color 0.3s ease;
}

.mobile-menu-overlay.active {
  background-color: rgba(0, 0, 0, 0.5);
}

/* Контейнер меню (выдвигается справа) */
.mobile-menu-content {
  position: fixed;
  top: 0;
  right: -100%;
  width: 65%;
  max-width: 240px;
  height: 100%;
  background-color: #ffffff;
  border-left: 2px solid #111827;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
  transition: right 0.3s ease;
  overflow-y: auto;
  z-index: 9999;
}

.mobile-menu-overlay.active .mobile-menu-content {
  right: 0;
}

/* Заголовок меню */
.mobile-menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.875rem 1rem;
  border-bottom: 2px solid #111827;
  background-color: #ffffff;
}

.mobile-menu-header span {
  font-size: 1.125rem;
}

.mobile-menu-header button svg {
  width: 1.5rem;
  height: 1.5rem;
}

/* Навигация */
.mobile-menu-nav {
  padding: 0.5rem 0;
}

/* Ссылки меню */
.mobile-menu-link {
  display: block;
  padding: 0.75rem 1rem;
  color: #111827;
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-decoration: none;
  border-bottom: 1px solid #e5e7eb;
  transition: all 0.2s ease;
}

.mobile-menu-link:hover,
.mobile-menu-link:active {
  background-color: #f9fafb;
  padding-left: 1.5rem;
  color: #000000;
}

/* Вторичные ссылки (дополнительные страницы) */
.mobile-menu-link-secondary {
  font-size: 0.75rem;
  font-weight: 500;
  color: #6b7280;
  text-transform: none;
  padding: 0.625rem 1rem;
}

.mobile-menu-link-secondary:hover {
  color: #111827;
}

/* Разделитель */
.mobile-menu-divider {
  height: 2px;
  background-color: #111827;
  margin: 0.5rem 1rem;
}

/* Скрываем overflow body когда меню открыто */
body.menu-open {
  overflow: hidden;
}

/* Анимация кнопки hamburger */
#mobile-menu-button {
  transition: transform 0.2s ease;
}

#mobile-menu-button:active {
  transform: scale(0.95);
}

/* Responsive - только для больших экранов скрываем мобильное меню */
@media (min-width: 769px) {
  .mobile-menu-overlay {
    display: none;
  }
}

/* ========================================
   АДАПТИВНОСТЬ: МОБИЛЬНЫЕ УСТРОЙСТВА
   Оптимизация контента для экранов <768px
   ======================================== */

@media (max-width: 767px) {
  /* Списки: экономим место слева */
  .article-content ul,
  .article-content ol {
    margin-left: 1rem;
  }
  
  /* Blockquote: компактнее на мобильных */
  .article-content blockquote:not(.tiktok-embed) {
    margin: 1.25rem 0;  /* 20px вместо 24px */
  }
  
  /* Заголовки: уменьшаем верхние отступы для компактности */
  .article-content h2 {
    margin-top: 1.75rem;  /* 28px вместо 32px */
  }
  
  .article-content h3 {
    margin-top: 1.5rem;  /* 24px вместо 28px */
  }
  
  /* Параграф после заголовка: еще ближе на мобильных */
  .article-content h2 + p,
  .article-content h3 + p {
    margin-top: 0.375rem;  /* 6px вместо 8px */
  }
  
  /* Специальные случаи: заголовок после медиа-элементов */
  .article-content .tiktok-embed + h3,
  .article-content .amazon-button + h3 {
    margin-top: 0.875rem;  /* 14px - плотнее после кнопок/видео */
  }
}

/* ========================================
   BREADCRUMBS (ХЛЕБНЫЕ КРОШКИ)
   ======================================== */

/* Увеличиваем шрифт breadcrumbs на десктопе */
@media (min-width: 768px) {
  nav[aria-label="Breadcrumb"] .text-xs {
    font-size: 0.875rem; /* 14px вместо 12px */
  }
}
