/*
Theme Name: MindFlow Custom
Author: You
Description: Minimal custom theme for mindflow.moscow without Elementor
Version: 1.0
Text Domain: mindflow
*/

@import url('https://fonts.googleapis.com/css2?family=Raleway:wght@600;700&family=Playfair+Display:wght@600;700&family=Montserrat:wght@300;400;500;600;700&display=swap');

:root {
  --beige-color: #f9f6f0;
  --dark-brown: #5D4037;
  --green-color: #2E5D3E;
}

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

body {
  font-family: 'Montserrat', sans-serif;
  background: #f9f6f0;
  color: #5D4037;
  line-height: 1.65;
}

/* Шапка сайта */
header {
  background: white;
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(139, 115, 85, 0.06);
  border-bottom: 1px solid rgba(139, 115, 85, 0.08);
}

.header-container {
  max-width: 1800px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 80px;
  padding: 0 2rem;
}

.header-left {
  display: flex;
  gap: 8px;
}

.header-center {
  flex: 1;
  text-align: center;
}

.header-right {
  width: 56px;
}

/* Боковое меню */
.sidebar-menu {
  position: fixed;
  top: 0;
  left: -300px;
  width: 300px;
  height: 100vh;
  background: #fff;
  z-index: 1001;
  transition: left 0.4s ease;
  box-shadow: 2px 0 10px rgba(0,0,0,0.1);
  padding: 40px 20px;
  overflow-y: auto;
}

.sidebar-menu.open {
  left: 0;
}

.sidebar-menu h3 {
  margin-top: 0;
  font-family: 'Montserrat', serif;
  font-weight: 700;
  font-size: 24px;
  color: #000;
  text-align: center;
}

.sidebar-menu ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-menu li {
  list-style: none;
  margin: 0 0 5px 0;
}

.sidebar-menu a {
  text-decoration: none;
  color: var(--dark-brown) !important;
  font-family: 'Montserrat', sans-serif;
  font-size: 16px;
  display: block;
  padding: 8px 12px;
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  font-weight: 300;
  transition: color 0.3s ease;
}

.sidebar-menu a:hover {
  color: var(--green-color) !important;
  background: transparent !important;
  text-decoration: underline;
}

.sidebar-menu .close-btn {
  position: absolute;
  top: 15px;
  left: 25px;
  background: #000;
  color: white;
  border: none;
  padding: 5px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
}

/* Иконки соцсетей */
.social-icons {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid #eee;
}

.social-icons a {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 60px;
  height: 60px;
  color: var(--dark-brown) !important;
  text-decoration: none;
  font-size: 24px;
  border-radius: 50%;
  transition: all 0.3s ease;
}

.social-icons a:hover {
  transform: scale(1.1);
  color: var(--green-color) !important;
}

.social-icons i {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Кнопки меню и поиска */
.mf-menu-btn, .mf-search-btn {
  background: var(--beige-color);
  color: #000;
  border: none;
  padding: 12px 16px;
  border-radius: 6px;
  cursor: pointer;
  min-width: 40px;
  text-align: center;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all 0.3s ease;
}

.mf-menu-btn:hover, .mf-search-btn:hover {
  background: var(--green-color);
  color: white;
}

.mf-menu-btn::before {
  content: "☰";
  font-size: 18px;
  color: #000;
}

.mf-search-btn svg {
  width: 18px;
  height: 27px;
  stroke: #000;
}

/* Логотип */
.logo {
  font-family: 'Raleway', sans-serif;
  font-size: 2.8rem;
  font-weight: 700;
  color: var(--green-color) !important;
  letter-spacing: -1.1px;
  text-transform: lowercase;
  text-decoration: none;
  display: inline-block;
  transition: color 0.3s ease;
}

.logo:hover {
  color: var(--dark-brown) !important;
}

/* Нижняя панель с рубриками — для десктопа */
.nav-container {
  display: flex;
  justify-content: center;
  width: 100%;
  padding: 0.8rem 0;
  background: #f9f6f0;
  margin-top: -1px;
}

.nav {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: center;
  list-style: none;
  padding: 0;
  margin: 0;
}

.nav li {
  list-style: none;
}

.nav a {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.92rem;
  color: var(--dark-brown) !important;
  text-decoration: none;
  font-weight: 300;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  transition: color 0.2s;
  padding: 0.4rem 0.8rem;
  white-space: nowrap;
  background: white;
  border: 1px solid rgba(139, 115, 85, 0.1);
  border-radius: 6px;
  display: inline-block;
}

.nav a:hover {
  color: var(--green-color) !important;
}

/* Скрываем меню рубрик на мобильных */
@media (max-width: 768px) {
  .nav-container {
    display: none;
  }
}

/* Модальное окно поиска */
.search-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 2000;
  display: none;
  justify-content: center;
  align-items: center;
}

.search-modal.open {
  display: flex;
}

.search-modal-content {
  background: white;
  padding: 20px;
  border-radius: 8px;
  width: 90%;
  max-width: 500px;
  position: relative;
}

.search-modal .close-btn {
  position: absolute;
  top: 10px;
  right: 15px;
  background: #000;
  color: white;
  border: none;
  padding: 5px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
}

.search-modal form {
  display: flex;
  flex-direction: column;
}

.search-modal input[type="search"] {
  padding: 10px;
  font-size: 16px;
  border: 1px solid #ccc;
  border-radius: 4px;
  margin-bottom: 10px;
}

.search-modal input[type="submit"] {
  padding: 10px;
  background: #000;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

/* Адаптация */
@media (max-width: 1024px) {
  .header-left { padding-left: 2rem; }
  .header-container { padding: 0 2rem; }
}

@media (max-width: 768px) {
  .header-container {
    flex-direction: row;
    height: 80px;
    padding: 0 1.5rem;
    gap: 0.8rem;
  }
  .logo { font-size: 2.2rem; letter-spacing: -0.9px; }
  .header-left { width: auto; justify-content: flex-start; padding-left: 0; }
  .mf-menu-btn, .mf-search-btn {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    padding: 0;
    min-width: auto;
  }
  .mf-menu-btn::before { font-size: 22px; }
  .mf-search-btn svg { width: 22px; height: 22px; }
}

@media (max-width: 480px) {
  .header-container {
    flex-direction: row;
    height: 60px;
    padding: 0 1rem;
    align-items: center;
    gap: 10px;
  }
  .logo { font-size: 1.8rem; letter-spacing: -0.6px; }
  .mf-menu-btn, .mf-search-btn {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    padding: 0;
    min-width: auto;
  }
  .mf-menu-btn::before { font-size: 18px; }
  .mf-search-btn svg { width: 18px; height: 18px; }
  .social-icons { gap: 15px; }
}

/* WordPress Menu Styles */
.main-navigation ul {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: center;
  list-style: none;
  padding: 0;
  margin: 0;
}

.main-navigation li {
  list-style: none;
  margin: 0;
}

.main-navigation a {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.92rem;
  color: var(--dark-brown) !important;
  text-decoration: none;
  font-weight: 300;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  transition: color 0.2s;
  padding: 0.4rem 0.8rem;
  white-space: nowrap;
  background: white;
  border: 1px solid rgba(139, 115, 85, 0.1);
  border-radius: 6px;
  display: inline-block;
}

.main-navigation a:hover {
  color: var(--green-color) !important;
}

.sidebar-menu .main-navigation ul {
  display: block !important;
  gap: 0 !important;
  flex-wrap: nowrap !important;
  justify-content: flex-start !important;
}

.sidebar-menu .main-navigation li {
  margin: 0 0 5px 0 !important;
}

/* === ПАТЧ: меню рубрик в линию без точек === */
.nav-container ul,
.nav-container li {
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

.nav-container ul {
  display: flex !important;
  flex-wrap: wrap !important;
  justify-content: center !important;
  gap: 0.6rem !important;
}

.nav-container a {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.92rem;
  color: var(--dark-brown) !important;
  text-decoration: none;
  font-weight: 300;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  padding: 0.4rem 0.8rem;
  white-space: nowrap;
  background: white;
  border: 1px solid rgba(139, 115, 85, 0.1);
  border-radius: 6px;
  transition: color 0.2s;
  display: inline-block;
}

.nav-container a:hover {
  color: var(--green-color) !important;
}

/* === СТИЛИ ДЛЯ КОНТЕНТА — ОГРАНИЧЕНИЕ ШИРИНЫ 1000px + ВЫРАВНИВАНИЕ ПО ШИРИНЕ (ТОЛЬКО ДЛЯ СТАТЕЙ) === */
main article {
  max-width: 1000px;
  margin: 2rem auto;
  padding: 0 2rem;
}

/* Выравнивание по ширине — ТОЛЬКО для полного текста в статьях */
main p,
main ul,
main ol,
main blockquote {
  margin-bottom: 1.5rem;
  line-height: 1.7;
  color: #5D4037;
  text-align: justify;
}

/* Анонсы на главной — НЕ выравниваем по ширине, ограничиваем до 1000px, центрируем */
.post-excerpt {
  color: #5D4037;
  line-height: 1.6;
  margin-bottom: 1rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 1000px;
  margin: 0 auto;
  /* ❗️ ЯВНО УКАЗЫВАЕМ text-align: left — чтобы НИКОГДА не было justify */
  text-align: left;
}

main h1, main h2, main h3, main h4, main h5, main h6 {
  margin-top: 2rem;
  margin-bottom: 1rem;
  font-family: 'Montserrat', serif;
  color: #5D4037;
}

main h1 { font-size: 2.2rem; font-weight: 700; }
main h2 { font-size: 1.8rem; font-weight: 600; }
main h3 { font-size: 1.5rem; font-weight: 600; }

main ul, main ol {
  margin: 1rem 0 1.5rem 1.5rem;
  padding: 0;
}

main li {
  margin: 0.5rem 0;
  line-height: 1.6;
  text-align: justify;
}

main a {
  color: #2E5D3E;
  text-decoration: underline;
  transition: color 0.2s;
}

main a:hover {
  color: #5D4037;
}

main blockquote {
  margin: 1.5rem 0;
  padding: 1rem 1.5rem;
  border-left: 4px solid #2E5D3E;
  background: #f9f6f0;
  font-style: italic;
  color: #5D4037;
}

main img {
  max-width: 100%;
  height: auto;
  margin: 1.5rem 0;
  border-radius: 6px;
}

main table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
}

main th, main td {
  padding: 0.6rem;
  border: 1px solid rgba(139, 115, 85, 0.1);
}

main th {
  background: #f5f5f5;
  font-weight: 600;
}

/* === БАННЕР ДЛЯ ПЕРВОЙ СТАТЬИ — УСИЛЕННЫЙ (730px) === */
.post-banner {
  position: relative;
  width: 100%;
  max-width: 1800px;
  margin: 2rem auto 0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  height: 730px;
}

.banner-image {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* === ЗАТЕМНЕНИЕ НАЧИНАЕТСЯ С 25px СВЕРХУ === */
.banner-image::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    to bottom,
    transparent 25px,
    rgba(0,0,0,0.6) 25px,
    rgba(0,0,0,0.6) 100%
  );
  z-index: 5;
}

.banner-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

/* === ЦЕНТРИРОВКА ПО ВЕРТИКАЛИ И ГОРИЗОНТАЛИ === */
.banner-content {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  transform: translateY(-50%);
  padding: 2rem;
  background: transparent;
  color: white;
  text-align: center;
  z-index: 10;
}

/* === РУБРИКА В БАННЕРЕ — по центру, увеличенная в 2 раза === */
.banner-category {
  font-family: 'Montserrat', sans-serif;
  font-size: 1.84rem;
  color: white;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.5rem;
  padding: 0;
  display: block;
  line-height: 1.4;
  height: 25px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}

/* === ЗАГОЛОВОК В БАННЕРЕ — по центру, без hover === */
.banner-content .post-title {
  font-family: 'Playfair Display', serif;
  font-size: 3.2rem;
  font-weight: 600;
  color: white;
  text-decoration: none;
  line-height: 1.05;
  margin: 0.5rem 0 1rem 0;
  display: block;
  word-wrap: break-word;
  overflow-wrap: break-word;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
  padding-left: 0;
  padding-right: 0;
  margin: 0 auto;
  max-width: 80%;
}

/* ❗️ ФИКС: ЗАГОЛОВОК В БАННЕРЕ — ВСЕГДА БЕЛЫЙ, НИКОГДА НЕ МЕНЯЕТСЯ ПРИ НАВЕДЕНИИ */
.banner-content .post-title:hover,
.banner-content .post-title:focus {
  color: white !important;
}

/* === ОСТАЛЬНЫЕ СТАТЬИ — КАРТОЧКИ === */
.posts-grid {
  max-width: 1800px;
  margin: 1rem auto 2rem;
  padding: 0 2rem;
  display: grid;
  gap: 1.5rem;
}

.post-card {
  background: white;
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  transition: transform 0.2s ease;
}

.post-card:hover {
  transform: translateY(-2px);
}

/* === 🔥 ЕДИНЫЙ РАЗМЕР ИЗОБРАЖЕНИЙ В КАРТОЧКАХ === */
.post-thumbnail {
  margin-bottom: 1rem;
  overflow: hidden;
  border-radius: 6px;
  width: 100%;
  height: 250px; /* Фиксированная высота для всех изображений */
  position: relative;
  background: #f5f5f5;
  display: flex;
  justify-content: center;
  align-items: center;
}

.post-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover; /* Обрезает изображение, сохраняя пропорции */
  object-position: center; /* Центрирует изображение при обрезке */
  display: block;
  border-radius: 6px;
  transition: transform 0.3s ease;
}

.post-category {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.8rem;
  font-weight: 300;
  color: #2E5D3E;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-bottom: 0.5rem;
}

.post-title {
  font-size: 1.4rem;
  color: #5D4037;
  text-decoration: none;
  font-weight: 600;
  line-height: 1.3;
  margin: 0.5rem 0 1rem 0;
  display: block;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.post-title:hover {
  color: #2E5D3E;
}

.post-meta {
  font-size: 0.85rem;
  color: #777;
  margin-bottom: 1rem;
}

.post-meta span {
  margin-right: 0.5rem;
}

/* === ЭКЗЕРПТ — МАКСИМУМ 3 СТРОКИ — БЕЗ ВЫРАВНИВАНИЯ ПО ШИРИНЕ === */
.read-more {
  display: inline-block;
  color: #2E5D3E;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 300;
  letter-spacing: 0.5px;
  transition: color 0.2s;
}

.read-more:hover {
  color: #5D4037;
  text-decoration: underline;
}

/* Адаптация под мобильные */
@media (max-width: 768px) {
  .posts-grid {
    padding: 0 1rem;
    max-width: 100%;
  }

  .post-card {
    padding: 1rem;
  }

  .post-title {
    font-size: 1.2rem;
  }

  /* Мобильная высота изображений */
  .post-thumbnail {
    height: 200px;
  }

  .post-banner {
    height: 400px;
    margin: 2rem auto 0;
  }

  .banner-content {
    padding: 1rem;
  }

  .banner-category {
    font-size: 1.4rem;
    padding: 0;
    height: 20px;
    line-height: 1.3;
    margin: 0 auto;
  }

  .banner-content .post-title {
    font-size: 2.2rem;
    max-width: 90%;
  }

  .posts-grid {
    margin: 1rem auto 2rem;
  }
}

/* === 🔥 ВСЕГДА 3 КОЛОНКИ НА ДЕСКТОПЕ === */
@media (min-width: 768px) {
  .posts-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 767px) {
  .posts-grid {
    grid-template-columns: 1fr;
  }
}

/* === ЗАГОЛОВОК РУБРИКИ — В НАЧАЛО СТРОКИ, БЕЗ ЖИРНОСТИ === */
.archive-header {
  max-width: 1800px;
  margin: 2rem auto 1rem;
  padding: 0 2rem;
  text-align: left;
}

.archive-header h1 {
  font-family: 'Montserrat', sans-serif;
  font-size: 2.2rem;
  font-weight: 300;
  color: #5D4037;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  margin: 0;
  padding: 0.5rem 0;
  background: transparent;
  border-radius: 0;
  display: block;
}

/* === УБИРАЕМ ЧЕРТУ ПОД МЕНЮ В БОКОВОМ МЕНЮ === */
.sidebar-menu .main-navigation {
  border-bottom: none !important;
  padding-bottom: 0 !important;
}

.sidebar-menu .social-icons {
  margin-top: 1rem !important;
  border-top: none !important;
}

/* === ОТСТУПЫ И ПОЗИЦИОНИРОВАНИЕ В БОКОВОМ МЕНЮ === */
.sidebar-menu h3 {
  margin-top: 30px;
}

.sidebar-menu ul {
  margin-top: 10px;
}

/* === ВЕРТИКАЛЬНОЕ МЕНЮ С ТОЧНЫМ РАССТОЯНИЕМ === */
.sidebar-menu .main-navigation a {
  display: block;
  padding: 8px 12px;
  margin: 0;
  width: 100%;
  text-align: left;
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
}

.sidebar-menu .main-navigation li {
  margin: 0 0 5px 0 !important;
}

/* === СТИЛИ ДЛЯ СТРАНИЦ — ТОЧНО КАК В РУБРИКАХ === */
.page-content,
.archive .page-content {
  max-width: 1000px !important;
  margin: 0 auto !important;
  padding: 0 2rem !important;
}

.page-content h1,
.page-content h2,
.page-content h3,
.page-content h4,
.page-content h5,
.page-content h6,
.archive .page-content h1,
.archive .page-content h2,
.archive .page-content h3,
.archive .page-content h4,
.archive .page-content h5,
.archive .page-content h6 {
  margin-top: 2rem !important;
  margin-bottom: 1rem !important;
  font-family: 'Montserrat', serif !important;
  color: #5D4037 !important;
  line-height: 1.3 !important;
}

.page-content h1,
.archive .page-content h1 { 
  font-size: 2.2rem !important; 
  font-weight: 700 !important; 
}
.page-content h2,
.archive .page-content h2 { 
  font-size: 1.8rem !important; 
  font-weight: 600 !important; 
}
.page-content h3,
.archive .page-content h3 { 
  font-size: 1.5rem !important; 
  font-weight: 600 !important; 
}

.page-content p,
.page-content ul,
.page-content ol,
.page-content blockquote,
.archive .page-content p,
.archive .page-content ul,
.archive .page-content ol,
.archive .page-content blockquote {
  margin-bottom: 1.5rem !important;
  line-height: 1.7 !important;
  color: #5D4037 !important;
  text-align: justify /*!important;*/
}

.page-content ul, 
.page-content ol,
.archive .page-content ul, 
.archive .page-content ol {
  margin: 1rem 0 1.5rem 1.5rem !important;
  padding: 0 !important;
}

.page-content li,
.archive .page-content li {
  margin: 0.5rem 0 !important;
  line-height: 1.6 !important;
  text-align: justify !important;
}

.page-content a,
.archive .page-content a {
  color: #2E5D3E !important;
  text-decoration: underline !important;
  transition: color 0.2s !important;
}

.page-content a:hover,
.archive .page-content a:hover {
  color: #5D4037 !important;
}

.page-content blockquote,
.archive .page-content blockquote {
  margin: 1.5rem 0 !important;
  padding: 1rem 1.5rem !important;
  border-left: 4px solid #2E5D3E !important;
  background: #f9f6f0 !important;
  font-style: italic !important;
  color: #5D4037 !important;
}

.page-content img,
.archive .page-content img {
  max-width: 100% !important;
  height: auto !important;
  margin: 1.5rem 0 !important;
  border-radius: 6px !important;
}
/* === ЦЕНТРИРОВАНИЕ ЗАГОЛОВКА РУБРИКИ НА МОБИЛЬНЫХ === */
@media (max-width: 768px) {
  .archive-header {
    text-align: center !important;
  }
  
  .archive-header h1 {
    text-align: center !important;
    padding: 0.5rem 0 !important;
    margin: 0 auto !important;
    display: inline-block !important;
  }
}
/* === ЦЕНТРИРОВАНИЕ ИЗОБРАЖЕНИЙ В СТАТЬЯХ === */
.entry-content img,
.post-content img,
.page-content img {
  display: block;
  margin: 1rem auto !important;
  max-width: 100% !important;
  height: auto !important;
}

/* Поддержка классов выравнивания из редактора */
.aligncenter,
.aligncenter img {
  display: block;
  margin: 1rem auto !important;
  text-align: center !important;
}

.alignleft,
.alignleft img {
  display: block;
  margin: 1rem 0 1rem 0 !important;
  text-align: left !important;
}

.alignright,
.alignright img {
  display: block;
  margin: 1rem 0 1rem 0 !important;
  text-align: right !important;
}

/* Для новых версий WordPress с блоками */
.wp-block-image.aligncenter {
  text-align: center !important;
}

.wp-block-image.aligncenter img {
  display: inline-block;
  text-align: center !important;
}
