/*
Theme Name: Lokteva Psychology v2
Theme URI: https://lokteva-psy.ru
Author: Anna Lokteva
Author URI: https://lokteva-psy.ru
Description: Быстрая, SEO-оптимизированная тема для детского психолога. Адаптивный дизайн для всех устройств.
Version: 2.1.1
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 7.4
License: Private
Text Domain: lokteva-theme-v2
Tags: blog, education, psychology, responsive
*/

:root {
  --primary: #6B5CE7;
  --primary-light: #F0EEFF;
  --primary-dark: #5A4DD4;
  --accent: #FF8A3C;
  --text-dark: #1a1a4d;
  --text-body: #444;
  --bg: #fff;
  --border: #e0e0e6;
  --radius: 16px;
  --shadow: 0 4px 20px rgba(0,0,0,0.07);
  --shadow-hover: 0 12px 32px rgba(0,0,0,0.12);
  --font-main: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-main);
  background: var(--bg);
  color: var(--text-body);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--accent); }

/* ========== UTILITY ========== */
.container { width: 100%; max-width: 100%; margin: 0 auto; padding: 0 24px; }
.container--narrow { max-width: 100%; }
.section { padding: 32px 0; }
.section--light { background: #fafafa; }

.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  padding: 13px 28px;
  border-radius: 50px;
  font-weight: 700;
  font-size: 15px;
  border: none;
  cursor: pointer;
  transition: background 0.3s, transform 0.2s, box-shadow 0.3s;
  text-decoration: none;
}
.btn:hover { background: #e57b2c; transform: translateY(-2px); box-shadow: 0 8px 24px rgba(255,138,60,0.35); color: #fff; }
.btn--outline { background: transparent; border: 2px solid var(--primary); color: var(--primary); }
.btn--outline:hover { background: var(--primary); color: #fff; }
.btn--primary { background: var(--primary); }
.btn--primary:hover { background: var(--primary-dark); box-shadow: 0 8px 24px rgba(107,92,231,0.35); }

.section-title {
  font-size: clamp(24px, 4vw, 34px);
  font-weight: 800;
  color: var(--text-dark);
  margin-bottom: 12px;
  line-height: 1.2;
}
.section-subtitle {
  color: #777;
  font-size: 16px;
  margin-bottom: 20px;
  max-width: 640px;
}
.text-center { text-align: center; }
.text-center .section-subtitle { margin-left: auto; margin-right: auto; }

/* ========== HEADER ========== */
#site-header {
  position: sticky;
  top: 0;
  z-index: 9999;
  background: #fff;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  width: 100%;
  overflow: visible;
}
/* Однострочная шапка — меню слева после логотипа */
@media (min-width: 769px) {
  .header-inner {
    height: 64px;
    flex-wrap: nowrap;
    overflow: visible;
    justify-content: flex-start;
    gap: 0;
  }
  .site-logo { flex-shrink: 0; }
  #primary-nav {
    flex: 0 1 auto;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    justify-content: flex-start;
    margin-left: 16px;
    margin-right: 0;
  }
  #primary-nav::-webkit-scrollbar { display: none; }
  #primary-nav > ul {
    flex-wrap: nowrap;
    width: max-content;
    gap: 0;
    justify-content: flex-start;
  }
  #primary-nav a {
    font-size: 13px;
    padding: 8px 10px;
    white-space: nowrap;
  }
  /* Поиск прижат вправо */
  .search-toggle { margin-left: auto; }
}
/* When WP admin bar is visible */
.admin-bar #site-header { top: 32px; }
@media screen and (max-width: 782px) {
  .admin-bar #site-header { top: 46px; }
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
  gap: 16px;
  overflow: visible;
  position: relative;
}
.site-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
  white-space: nowrap;
}
.site-logo img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  border-radius: 50%;
}
.logo-text { display: flex; flex-direction: column; }
.logo-name {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-dark);
  line-height: 1;
  white-space: nowrap;
}
.logo-tagline {
  font-size: 11px;
  color: #888;
  line-height: 1.3;
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: none;
}

/* NAV */
#primary-nav { display: flex; align-items: center; gap: 2px; overflow: visible; position: relative; flex: 1; justify-content: flex-end; }
#primary-nav > ul { display: flex; align-items: center; gap: 2px; list-style: none; margin: 0; padding: 0; overflow: visible; flex-wrap: nowrap; }
#primary-nav li { list-style: none; }
#primary-nav a {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dark);
  padding: 6px 10px;
  border-radius: 8px;
  transition: background 0.2s, color 0.2s;
  white-space: nowrap;
  text-decoration: none;
  display: block;
}
#primary-nav a:hover,
#primary-nav .current-menu-item > a,
#primary-nav .current_page_item > a { background: var(--primary-light); color: var(--primary); }

/* Dropdown */
#primary-nav .menu-item-has-children { position: relative; }
#primary-nav .sub-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: #fff;
  border: 1px solid #e0e0e6;
  border-radius: 12px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.18);
  min-width: 260px;
  z-index: 999999;
  list-style: none;
  margin: 2px 0 0 0;
  padding: 6px 0;
}
#primary-nav .menu-item-has-children:hover > .sub-menu { display: block; }
#primary-nav .sub-menu li { list-style: none; }
#primary-nav .sub-menu a {
  display: block;
  padding: 10px 20px;
  font-size: 14px;
  color: var(--text-dark);
  white-space: normal;
  border-radius: 0;
  background: none;
}
#primary-nav .sub-menu a:hover { background: var(--primary-light); color: var(--primary); }

/* Search */
.header-search { display: flex; align-items: center; }
.search-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--text-dark);
  border-radius: 8px;
  transition: background 0.2s;
}
.search-toggle:hover { background: var(--primary-light); color: var(--primary); }
.search-toggle svg { width: 20px; height: 20px; }

/* Mobile menu toggle */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--text-dark);
  border-radius: 8px;
}
.menu-toggle svg { width: 24px; height: 24px; display: block; }

/* Mobile nav */
#mobile-nav {
  display: none;
  background: #fff;
  border-top: 1px solid var(--border);
  padding: 16px 24px 24px;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  box-shadow: 0 8px 32px rgba(0,0,0,0.1);
  z-index: 999;
}
#mobile-nav.is-open { display: block; }
#mobile-nav a {
  display: block;
  padding: 12px 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-dark);
  border-bottom: 1px solid var(--border);
}
#mobile-nav a:last-child { border-bottom: none; }
#mobile-nav .sub-menu { padding-left: 16px; }
#mobile-nav .sub-menu a { font-size: 14px; font-weight: 500; color: #666; }

/* ========== BREADCRUMB ========== */
.breadcrumb {
  padding: 14px 0;
  font-size: 13px;
  color: #999;
}
.breadcrumb a { color: var(--primary); font-weight: 600; }
.breadcrumb span { margin: 0 6px; }

/* Single post / page */
.single-hero {
  background: #fff;
  padding: 20px 0 0;
  margin-bottom: 0;
}
.single-hero-inner { width: 100%; margin: 0 auto; padding: 0 48px; }
.post-content-wrap { width: 100%; margin: 0 auto; padding: 20px 48px 20px; }
.post-category-badge {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 16px;
}
.single-post-title {
  font-size: clamp(22px, 4vw, 36px);
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1.25;
  margin-bottom: 14px;
}
.post-meta {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 13px;
  color: #888;
  margin-bottom: 32px;
  flex-wrap: wrap;
}
.post-meta svg { width: 14px; height: 14px; flex-shrink: 0; }
.post-meta span { display: flex; align-items: center; gap: 5px; }

/* Share bar */
.share-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 0;
  flex-wrap: wrap;
}
.share-bar-label { font-size: 13px; font-weight: 600; color: #888; margin-right: 4px; }
.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: 50px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: opacity 0.2s, transform 0.2s;
  border: none;
  cursor: pointer;
}
.share-btn:hover { opacity: 0.85; transform: translateY(-1px); }
.share-btn--vk { background: #4C75A3; color: #fff; }
.share-btn--tg { background: #2AABEE; color: #fff; }
.share-btn--ok { background: #EE8208; color: #fff; }
.share-btn--wa { background: #25D366; color: #fff; }
.share-btn--max { background: linear-gradient(135deg, #6B4EFF, #A855F7); color: #fff; }
.share-btn--copy { background: var(--primary-light); color: var(--primary); }

/* Featured image */
.single-featured {
  width: 100%;
  margin: 0 auto;
  padding: 0 24px;
}
.single-featured {
  width: 100%;
  margin: 0;
  padding: 0;
}
.single-featured img {
  width: 100%;
  height: 480px;
  object-fit: cover;
  border-radius: 0;
  display: block;
}

/* Post content */
.entry-content {
  font-size: 16px;
  line-height: 1.75;
  color: #2d2d2d;
  font-weight: 400;
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
  overflow-x: hidden;
  max-width: 100%;
  padding-top: 20px;
}

/* Заголовки — чёткие, не перегруженные */
.entry-content h2 {
  font-size: clamp(19px, 2.5vw, 24px);
  font-weight: 700;
  color: var(--text-dark);
  margin: 32px 0 10px;
  line-height: 1.3;
}
.entry-content h3 {
  font-size: clamp(17px, 2vw, 20px);
  font-weight: 700;
  color: var(--text-dark);
  margin: 24px 0 8px;
  line-height: 1.35;
}
.entry-content > h2:first-child,
.entry-content > h3:first-child { margin-top: 0; }
.entry-content h4 {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-dark);
  margin: 20px 0 8px;
}

/* Абзацы */
.entry-content p {
  margin-bottom: 16px;
  font-size: 16px;
  line-height: 1.75;
  color: #2d2d2d;
}

/* Списки */
.entry-content ul, .entry-content ol { margin: 0 0 16px 20px; }
.entry-content li { margin-bottom: 6px; font-size: 16px; line-height: 1.7; }
.entry-content ul li::marker { color: var(--accent); font-size: 16px; }

/* Цитата */
.entry-content blockquote {
  border-left: 3px solid var(--primary);
  background: var(--primary-light);
  padding: 16px 20px;
  margin: 24px 0;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 16px;
  font-style: italic;
  color: var(--text-dark);
  line-height: 1.7;
}

/* Картинки в тексте */
.entry-content img {
  border-radius: var(--radius);
  margin: 20px 0;
  width: 100%;
  height: auto;
}
.entry-content a { color: var(--primary); font-weight: 500; text-decoration: underline; }
.entry-content a:hover { color: var(--accent); }
.entry-content strong { color: var(--text-dark); font-weight: 600; }
.entry-content table { width: 100%; border-collapse: collapse; margin: 20px 0; font-size: 15px; }
.entry-content th { background: var(--primary); color: #fff; padding: 12px 16px; text-align: left; }
.entry-content td { padding: 12px 16px; border-bottom: 1px solid var(--border); }

/* Таблица с горизонтальным скроллом на мобильном */
.entry-content table {
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  white-space: nowrap;
  border-radius: 8px;
}
.entry-content table thead,
.entry-content table tbody,
.entry-content table tr { display: table; width: 100%; table-layout: fixed; }
.entry-content table { display: block; }

@media (max-width: 768px) {
  .entry-content table { font-size: 13px; }
  .entry-content th { padding: 10px 12px; }
  .entry-content td { padding: 10px 12px; white-space: normal; word-break: break-word; }
}
@media (max-width: 480px) {
  .entry-content table { font-size: 12px; }
  .entry-content th,
  .entry-content td { padding: 8px 10px; }
}
.entry-content tr:nth-child(even) td { background: var(--primary-light); }

/* Post bottom share */
.post-share-bottom {
  border-top: 1px solid var(--border);
  padding-top: 20px;
  margin-top: 24px;
}
.post-share-bottom h4 { font-size: 18px; font-weight: 700; color: var(--text-dark); margin-bottom: 16px; }

/* ========== RELATED POSTS ========== */
.related-posts-section {
  background: #fff;
  padding: 20px 0 28px;
}
.related-posts-section .section-title { margin-bottom: 32px; }
.related-grid {
  display: grid;
  /* Десктоп — 4 в ряд. Планшет и мобильный переопределяются ниже,
     в едином блоке «RELATED GRID». */
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  align-items: start;
}
.related-card {
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.3s, box-shadow 0.3s;
  display: flex;
  flex-direction: column;
}
.related-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-hover); }
.related-card-img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}
.related-card-img-placeholder {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
}
.related-card-body { padding: 16px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.related-card-cat {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--primary);
  letter-spacing: 0.5px;
}
.related-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1.4;
  flex: 1;
}
.related-card-title a { color: inherit; text-decoration: none; }
.related-card-title a:hover { color: var(--primary); }
.related-card-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  margin-top: auto;
}
.related-card-link:hover { color: var(--accent); }

/* ========== ARCHIVE / CATEGORY ========== */
.archive-hero {
  background: var(--primary);
  padding: 28px 0;
  margin-bottom: 24px;
}
.archive-category-badge {
  display: inline-block;
  background: rgba(255,255,255,0.2);
  color: #fff;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}
.archive-title {
  font-size: clamp(28px, 5vw, 44px);
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
  margin-bottom: 12px;
}
.archive-description { color: rgba(255,255,255,0.85); font-size: 17px; max-width: 600px; }

/* Featured (first) post */
.archive-featured {
  margin-bottom: 24px;
}
.featured-post-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: #fff;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: var(--shadow-hover);
  transition: transform 0.3s;
}
.featured-post-card:hover { transform: translateY(-4px); }
.featured-post-img {
  width: 100%;
  height: 100%;
  min-height: 360px;
  object-fit: cover;
  display: block;
}
.featured-post-img-placeholder {
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 80px;
  min-height: 360px;
}
.featured-post-body {
  padding: 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 16px;
}
.featured-badge {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  width: fit-content;
}
.featured-post-title {
  font-size: clamp(22px, 3vw, 32px);
  font-weight: 800;
  color: var(--text-dark);
  line-height: 1.3;
}
.featured-post-title a { color: inherit; text-decoration: none; }
.featured-post-title a:hover { color: var(--primary); }
.featured-post-excerpt { font-size: 15px; color: #666; line-height: 1.7; }
.featured-post-meta { font-size: 13px; color: #999; }
.featured-post-link { margin-top: 8px; }

/* Posts grid */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 24px;
  align-items: start;
}
.post-card {
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.3s, box-shadow 0.3s;
  display: flex;
  flex-direction: column;
}
.post-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-hover); }
.post-card-img-wrap { position: relative; overflow: hidden; }
/* height:220px давал 1.5:1 на компьютере и совсем другой кадр на планшете.
   aspect-ratio держит 16:9 при любой ширине колонки. */
.post-card-img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}
.post-card:hover .post-card-img { transform: scale(1.04); }
.post-card-img-placeholder {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 56px;
}
.post-card-cat-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: var(--primary);
  color: #fff;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.post-card-body { padding: 20px; flex: 1; display: flex; flex-direction: column; gap: 10px; }
.post-card-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1.4;
  flex: 1;
}
.post-card-title a { color: inherit; text-decoration: none; }
.post-card-title a:hover { color: var(--primary); }
.post-card-excerpt { font-size: 14px; color: #777; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.post-card-meta { font-size: 12px; color: #bbb; margin-top: auto; }
.post-card-link { font-size: 14px; font-weight: 600; color: var(--primary); display: inline-flex; align-items: center; gap: 4px; }
.post-card-link:hover { color: var(--accent); gap: 8px; }

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
  flex-wrap: wrap;
}
.pagination a, .pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  border: 2px solid var(--border);
  color: var(--text-dark);
  background: #fff;
  transition: all 0.2s;
}
.pagination a:hover, .pagination .current {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* ========== FOOTER ========== */
#site-footer {
  background: #F0EEFF;
  color: var(--text-dark);
  padding: 32px 0 0;
  margin-top: 32px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 40px;
  padding-bottom: 28px;
  border-bottom: 1px solid rgba(107,92,231,0.2);
}
.footer-brand {}
.footer-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  margin-bottom: 16px;
}
.footer-logo img { width: 52px; height: 52px; border-radius: 50%; object-fit: contain; }
.footer-logo-text .logo-name { color: var(--text-dark); font-size: 15px; }
.footer-logo-text .logo-tagline { color: #666; font-size: 11px; max-width: 200px; }
.footer-desc { font-size: 14px; line-height: 1.7; color: #555; margin-bottom: 20px; }
.footer-contacts { display: flex; flex-direction: column; gap: 10px; }
.footer-contact-item { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; }
.footer-contact-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.footer-contact-item a { color: var(--text-dark); transition: color 0.2s; }
.footer-contact-item a:hover { color: var(--accent); }

.footer-col-title { font-size: 15px; font-weight: 800; color: var(--text-dark); margin-bottom: 20px; }
.footer-links { display: flex; flex-direction: column; gap: 10px; }
.footer-links a { font-size: 14px; color: #555; transition: color 0.2s; }
.footer-links a:hover { color: var(--primary); }
.footer-links a::before { content: '→ '; color: var(--accent); font-size: 12px; }

.footer-bottom {
  padding: 20px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.footer-copy { font-size: 13px; color: #888; }
.footer-bottom-links { display: flex; gap: 20px; }
.footer-bottom-links a { font-size: 13px; color: #888; }
.footer-bottom-links a:hover { color: var(--primary); }

/* ========== SEARCH OVERLAY ========== */
.search-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26,26,77,0.9);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.search-overlay.is-open { display: flex; }
.search-overlay-form {
  width: 100%;
  max-width: 640px;
  position: relative;
}
.search-overlay-form input[type="search"] {
  width: 100%;
  padding: 20px 64px 20px 24px;
  border-radius: 50px;
  border: none;
  font-size: 20px;
  font-family: var(--font-main);
  outline: none;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.search-overlay-form button[type="submit"] {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--primary);
  border: none;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}
.search-overlay-form button[type="submit"] svg { width: 20px; height: 20px; }
.search-close {
  position: absolute;
  top: 24px;
  right: 24px;
  background: none;
  border: none;
  color: #fff;
  font-size: 32px;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
}
.search-close:hover { opacity: 1; }

/* ========== RESPONSIVE ========== */
@media (max-width: 1100px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .posts-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
  .posts-grid { grid-template-columns: repeat(2, 1fr); }
  .featured-post-card { grid-template-columns: 1fr; }
  .featured-post-img, .featured-post-img-placeholder { min-height: 0; aspect-ratio: 16 / 9; }
}

@media (max-width: 768px) {
  #primary-nav { display: none; }
  .menu-toggle { display: block; }
  .section { padding: 28px 0; }
  .posts-grid { grid-template-columns: repeat(2, 1fr); }
  .single-featured img { height: 260px; }
  .footer-grid { grid-template-columns: 1fr; gap: 32px; }
  .footer-bottom { flex-direction: column; text-align: center; }
  .header-inner { height: 64px; }
  .site-logo img { width: 44px; height: 44px; }
  .logo-tagline { display: none; }
}

@media (max-width: 480px) {
  .container { padding: 0 16px; }
  .posts-grid { grid-template-columns: 1fr; }
  .share-bar { gap: 6px; }
  .share-btn { padding: 6px 12px; font-size: 12px; }
}

/* ========== FRONT PAGE SPECIFIC ========== */

/* PROMO */
.promo-block{display:flex;flex-wrap:wrap;min-height:400px;width:100%;position:relative;z-index:1}
.promo-image{flex:1;min-width:300px;overflow:hidden;position:relative;z-index:1}
.promo-image img{width:100%;height:100%;object-fit:cover;display:block}
.promo-content{flex:1;min-width:300px;background:var(--primary);padding:60px 40px;display:flex;flex-direction:column;justify-content:center}
.promo-title{font-size:40px;font-weight:800;color:#fff;margin-bottom:16px;line-height:1.2}
.promo-text{font-size:16px;color:#fff;margin-bottom:24px;line-height:1.5;opacity:.9}
.promo-button{display:inline-block;background:var(--accent);color:#fff;padding:16px 32px;border-radius:50px;text-decoration:none;font-size:16px;font-weight:600;text-align:center;transition:all .3s ease;border:none;cursor:pointer}
.promo-button:hover{background:#E57B2C;transform:translateY(-2px);box-shadow:0 10px 25px rgba(255,138,60,.3);color:#fff}

/* BENEFITS */
.benefits-section,.steps-section,.reviews-section,.faq-section,.articles-section,.methods-section,.contact-section{width:100%;padding:28px 20px;background:#fff}
.benefits-container,.steps-container,.reviews-container-wrapper,.faq-container-wrapper,.articles-container,.methods-container,.contact-container-wrapper{width:100%;margin:0 auto;padding:0}
.benefits-title,.steps-title,.reviews-title,.faq-title,.articles-title,.methods-title,.contact-title{font-size:32px;font-weight:800;color:var(--text-dark);margin-bottom:20px;text-align:center}
.benefits-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(280px,1fr));gap:20px;margin-bottom:24px;width:100%}
.benefit-card{background:var(--primary-light);border-radius:16px;padding:24px;display:flex;flex-direction:column;gap:12px;min-height:200px;transition:transform .3s ease}
.benefit-card:hover{transform:translateY(-5px)}
.benefit-content{flex:1}
.benefit-heading{font-size:20px;font-weight:700;color:var(--text-dark);margin-bottom:8px}
.benefit-text{font-size:14px;color:#666;line-height:1.5}
.benefit-image{font-size:56px;align-self:flex-start}
.hidden-benefits{display:none}
.hidden-benefits.show{display:grid}
.toggle-button{width:100%;max-width:400px;margin:0 auto;padding:14px 28px;background:var(--primary);border:none;border-radius:50px;font-size:15px;font-weight:600;color:#fff;cursor:pointer;display:flex;align-items:center;justify-content:center;gap:10px;transition:all .3s ease}
.toggle-button:hover{background:var(--primary-dark);transform:translateY(-2px);box-shadow:0 8px 20px rgba(107,92,231,.3)}
.toggle-icon{transition:transform .3s ease;font-size:12px}
.toggle-button.expanded .toggle-icon{transform:rotate(180deg)}

/* STEPS */
.steps-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(280px,1fr));gap:20px;width:100%}
.step-card{border-radius:24px;padding:28px 32px;color:#fff;display:flex;flex-direction:row;align-items:flex-start;gap:24px;transition:transform .3s ease}
.step-card:hover{transform:translateY(-5px)}
.step-card.blue{background:var(--primary)}
.step-card.orange{background:var(--accent)}
.step-card.emerald{background:#10B981}
.step-card.purple{background:var(--primary-dark)}
.step-number{font-size:72px;font-weight:800;line-height:1;color:#fff;flex-shrink:0;min-width:60px;text-align:center}
.step-content{flex:1;display:flex;flex-direction:column;gap:6px}
.step-title{font-size:22px;font-weight:700;margin:0;line-height:1.2;color:#fff}
.step-text{font-size:15px;line-height:1.5;opacity:.9;margin:0;color:#fff}

/* METHODS */
.methods-subtitle{text-align:center;max-width:700px;margin:0 auto 32px;color:#666;font-size:.95rem;line-height:1.5;padding:0 20px}
.method-tabs{display:flex;justify-content:center;margin-bottom:32px;flex-wrap:wrap;background:var(--primary-light);border-radius:50px;padding:6px;max-width:100%;margin-left:auto;margin-right:auto;gap:6px}
.tab-btn{background:transparent;color:var(--text-dark);border:none;padding:12px 24px;font-size:.9rem;font-weight:600;cursor:pointer;transition:all .3s ease;border-radius:50px;flex:1;min-width:120px;max-width:200px}
.tab-btn.active{background:var(--primary);color:#fff}
.tab-btn:hover:not(.active){background:rgba(107,92,231,.15)}
.tab-content{background:var(--primary-light);border-radius:20px;padding:32px;min-height:280px}
.method-content{display:none;animation:fadeInUp .3s ease}
.method-content.active{display:block}
@keyframes fadeInUp{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}
.method-content h3{color:var(--text-dark);margin-bottom:16px;font-size:1.4rem;font-weight:700}
.method-content p{margin-bottom:12px;line-height:1.7;color:var(--text-dark);opacity:.9}
.method-content strong{color:var(--text-dark);font-weight:600}
.method-content .highlight{color:var(--primary);font-weight:600}
.method-content ul{list-style:none;margin:16px 0;padding-left:0}
.method-content ul li{padding:8px 0 8px 28px;color:var(--text-dark);line-height:1.5;opacity:.9;position:relative}
.method-content ul li:before{content:"•";color:var(--accent);font-weight:700;font-size:20px;line-height:1;position:absolute;left:0;top:6px}

/* READY BANNER */
.ready-banner{
  width:100%;
  background:var(--primary);
  border-radius:24px;
  margin:20px 0;
  overflow:hidden;
  display:flex;
  align-items:center;
  min-height:220px;
  padding:32px 40px;
  gap:32px;
  box-sizing:border-box;
}
.ready-content{
  flex:1;
  z-index:2;
  min-width:0;
}
.ready-text{
  font-size:clamp(22px,3.5vw,42px);
  font-weight:800;
  color:#fff;
  line-height:1.2;
  margin-bottom:12px;
}
.ready-image-wrapper{
  flex-shrink:0;
  width:clamp(180px,28%,320px);
  border-radius:16px;
  overflow:hidden;
  box-shadow:0 8px 32px rgba(0,0,0,0.25);
  align-self:center;
}
.ready-image-wrapper img{
  width:100%;
  height:auto;
  display:block;
}
.ready-button{
  display:inline-block;
  background:#fff;
  color:var(--primary);
  padding:12px 28px;
  border-radius:50px;
  text-decoration:none;
  font-weight:700;
  font-size:15px;
  transition:all 0.3s ease;
  margin-top:16px;
}
.ready-button:hover{background:#f0f0f0;transform:translateY(-2px);color:var(--primary)}

/* REVIEWS / PROBLEMS */
.reviews-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(280px,1fr));gap:20px;width:100%}
.review-card{background:var(--primary-light);border-radius:20px;padding:24px;display:flex;flex-direction:column;gap:12px;transition:transform .3s ease}
.review-card:hover{transform:translateY(-5px)}
.review-name{font-size:18px;font-weight:700;color:var(--text-dark);margin-bottom:6px}
.review-text{font-size:14px;color:var(--text-dark);line-height:1.5;flex:1}

/* FAQ */
.faq-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(320px,1fr));gap:20px;width:100%;align-items:start}
.faq-item{background:var(--primary-light);border-radius:16px;overflow:hidden;display:flex;flex-direction:column}
.faq-question{width:100%;padding:20px;background:none;border:none;text-align:left;font-size:16px;font-weight:600;color:var(--text-dark);cursor:pointer;display:flex;justify-content:space-between;align-items:center;gap:12px;transition:background .2s ease;font-family:inherit}
.faq-question:hover{background:rgba(107,92,231,.08)}
.faq-icon{flex-shrink:0;width:20px;height:20px;transition:transform .3s ease;display:flex;align-items:center;justify-content:center}
.faq-icon svg{width:18px;height:18px;stroke:var(--primary)}
.faq-item.active .faq-icon{transform:rotate(180deg)}
.faq-answer{max-height:0;overflow:hidden;transition:max-height .4s ease-out}
.faq-answer-inner{padding:0 20px 20px;font-size:14px;line-height:1.6;color:var(--text-dark);opacity:.9}

/* ARTICLES */
.articles-container{width:100%;margin:0 auto;padding:0;max-width:100%}
.articles-carousel{position:relative;overflow:hidden;background:var(--primary-light);border-radius:24px;padding:40px;min-height:500px}
.articles-slide{display:none}
.articles-slide.active{display:block;animation:slideIn .4s ease}
@keyframes slideIn{from{opacity:0;transform:translateX(20px)}to{opacity:1;transform:translateX(0)}}
.article-card-large{background:var(--primary-light);border-radius:20px;padding:32px;display:flex;gap:32px;align-items:flex-start}
/* Было width:200px;height:200px — КВАДРАТ: от горизонтального фото оставалась
   центральная четверть. Расширяем слот и держим 16:9. */
.article-image-large{flex-shrink:0;width:320px;height:auto;aspect-ratio:16/9;border-radius:16px;overflow:hidden;background:#e0e0e6}
.article-image-large img{width:100%;height:100%;object-fit:cover;display:block}
.article-content-large{flex:1;display:flex;flex-direction:column;gap:16px}
.article-category{display:inline-block;background:var(--primary);color:#fff;padding:6px 16px;border-radius:20px;font-size:13px;font-weight:600}
.article-title-large{font-size:24px;font-weight:700;color:var(--text-dark);line-height:1.3;margin:0}
.article-excerpt{font-size:15px;color:var(--text-dark);line-height:1.6;opacity:.9;margin:0}
.article-link-large{display:inline-flex;align-items:center;gap:8px;color:var(--primary);font-weight:600;text-decoration:none;font-size:16px;margin-top:8px;transition:all .3s ease}
.article-link-large:hover{color:var(--accent)}
.articles-nav{display:flex;align-items:center;justify-content:space-between;margin-top:12px;gap:12px}
.articles-arrows{display:flex;gap:12px}
.articles-arrow{width:48px;height:48px;border-radius:50%;background:#fff;border:2px solid var(--primary-light);display:flex;align-items:center;justify-content:center;cursor:pointer;transition:all .3s ease;color:var(--primary);font-size:20px;font-family:inherit}
.articles-arrow:hover{background:var(--primary);color:#fff;border-color:var(--primary);transform:translateY(-2px)}
.articles-arrow:disabled{opacity:.3;cursor:not-allowed}
.articles-dots{display:flex;gap:8px;justify-content:center}
.articles-dot{width:10px;height:10px;border-radius:50%;background:rgba(107,92,231,.3);cursor:pointer;transition:all .3s ease;display:inline-block}
.articles-dot.active{background:var(--primary);width:30px;border-radius:5px}
.articles-footer{text-align:center;margin-top:16px}

/* DESKTOP articles grid */
@media(min-width:769px){
  .articles-carousel{display:grid;grid-template-columns:repeat(4,1fr);gap:20px;padding:0;background:transparent;min-height:auto;border-radius:0;overflow:visible}
  .articles-slide{display:block !important;animation:none !important;opacity:1 !important}
  .article-card-large{flex-direction:column !important;padding:0 !important;background:#fff !important;box-shadow:var(--shadow);border-radius:16px !important;overflow:hidden;transition:transform .3s ease,box-shadow .3s ease;min-height:auto !important;height:100%}
  .article-card-large:hover{transform:translateY(-6px) !important;box-shadow:var(--shadow-hover)}
  .article-image-large{width:100% !important;height:auto !important;aspect-ratio:16/9;border-radius:0 !important;margin:0 !important}
  .article-content-large{padding:20px !important;gap:12px !important;flex:1;display:flex !important;flex-direction:column !important}
  .article-category{display:none !important}
  .article-title-large{font-size:17px !important;font-weight:700 !important;margin:0 0 12px 0 !important;line-height:1.4 !important}
  .article-excerpt{display:none !important}
  .article-link-large{margin-top:auto !important;font-size:15px !important;font-weight:600 !important;gap:0 !important}
  .article-link-large:hover{text-decoration:underline !important}
  .articles-nav{display:none !important}
}

/* CONTACT */
.contact-section{background:linear-gradient(135deg,var(--primary-light),#fff);padding:28px 20px;width:100%}
.contact-container{display:grid;grid-template-columns:1fr 1fr;gap:32px;width:100%}
.contact-info,.contact-form{background:#fff;padding:32px;border-radius:20px;box-shadow:0 10px 40px rgba(0,0,0,.08)}
.contact-info h3,.contact-form h3{color:var(--text-dark);margin-bottom:20px;font-size:1.4rem;font-weight:700}
.contact-item{display:flex;align-items:flex-start;margin-bottom:20px;gap:14px}
.contact-icon{width:44px;height:44px;background:var(--primary);color:#fff;border-radius:10px;display:flex;align-items:center;justify-content:center;font-size:18px;flex-shrink:0}
.contact-text h4{color:var(--text-dark);margin-bottom:4px;font-size:.95rem;font-weight:600}
.contact-text p{font-size:.85rem;color:var(--text-dark);margin:0;line-height:1.5;opacity:.9}
.contact-text a{color:var(--text-dark);text-decoration:none;transition:color .3s;font-weight:500}
.contact-text a:hover{color:var(--accent)}
.contact-text .small-text{font-size:.75rem;color:#666 !important;margin-top:4px !important;display:block;opacity:.8}
.form-group{margin-bottom:16px}
.form-group label{display:block;margin-bottom:6px;font-weight:600;color:var(--text-dark);font-size:.85rem}
.form-group input,.form-group textarea{width:100%;padding:12px;border:2px solid #e0e0e6;border-radius:10px;font-family:inherit;font-size:.9rem;background:#f8f9fa;transition:border-color .3s,box-shadow .3s;color:var(--text-dark)}
.form-group input:focus,.form-group textarea:focus{border-color:var(--primary);outline:none;box-shadow:0 0 0 4px rgba(107,92,231,.1);background:#fff}
.form-group textarea{min-height:100px;resize:vertical}
.contact-buttons{display:flex;gap:12px;justify-content:center;margin-top:20px;flex-wrap:wrap}
.form-note{font-size:.8rem;color:#666;text-align:center;margin-top:12px;line-height:1.4}

/* FRONT PAGE RESPONSIVE */
@media(max-width:1024px){
  .promo-content{padding:40px 32px}
  .contact-container{grid-template-columns:1fr}
}
@media(max-width:768px){
  .benefits-section,.steps-section,.reviews-section,.faq-section,.articles-section,.methods-section,.contact-section{padding:20px 12px}
  .promo-block{min-height:auto !important;flex-direction:column}
  .promo-image{width:100% !important;min-width:100% !important;height:auto !important;max-height:450px !important}
  .promo-image img{width:100% !important;height:100% !important;object-fit:cover !important}
  .promo-content{min-width:100%;padding:32px 20px}
  .promo-title{font-size:28px}
  .ready-banner{
    flex-direction:column !important;
    background:url('https://lokteva-psy.ru/wp-content/uploads/2026/06/img_6230.jpeg') no-repeat center top !important;
    background-size:cover !important;
    min-height:420px !important;
    padding:0 !important;
    position:relative !important;
    border-radius:0 !important;
    overflow:hidden !important;
    align-items:flex-end !important;
    margin-left:-12px !important;
    margin-right:-12px !important;
    width:calc(100% + 24px) !important;
  }
  .ready-banner::before{
    display:block !important;
    content:'';
    position:absolute;
    top:0;left:0;right:0;bottom:0;
    background:linear-gradient(to bottom,rgba(27,24,77,0.15) 0%,rgba(27,24,77,0.55) 50%,rgba(27,24,77,0.88) 100%);
    z-index:1;
  }
  .ready-content{
    position:relative !important;
    z-index:2 !important;
    width:100% !important;
    padding:24px 20px !important;
    display:flex !important;
    flex-direction:column !important;
    align-items:flex-start !important;
    justify-content:flex-end !important;
    height:auto !important;
  }
  .ready-text{font-size:26px !important;color:#fff !important;text-align:left !important;margin-bottom:8px !important}
  .ready-image-wrapper{display:none !important;}
  .benefits-grid,.steps-grid,.reviews-grid,.faq-grid{grid-template-columns:1fr}
  .method-tabs{flex-direction:column;border-radius:14px}
  .tab-btn{width:100%;max-width:100%;border-radius:10px}
  .tab-content{padding:20px}
  .contact-container{grid-template-columns:1fr}
  .contact-info,.contact-form{padding:24px}
  .articles-carousel{padding:24px;min-height:auto}
  .article-card-large{flex-direction:column;padding:24px;gap:20px}
  .article-image-large{width:100%;height:auto;aspect-ratio:16/9}
  .article-title-large{font-size:20px}
  .articles-nav{flex-direction:column;gap:16px}
}
@media(max-width:480px){
  .benefits-section,.steps-section,.reviews-section,.faq-section,.articles-section,.methods-section,.contact-section{padding:16px 8px}
  .benefits-title,.steps-title,.reviews-title,.faq-title,.articles-title,.methods-title,.contact-title{font-size:26px;margin-bottom:16px}
  .promo-title{font-size:26px}
  .ready-text{font-size:26px !important}
  .benefit-card{flex-direction:row !important;align-items:flex-start !important;padding:16px !important;gap:12px !important;min-height:auto !important}
  .benefit-image{font-size:36px !important;align-self:flex-start !important;margin:0 !important}
  .benefit-heading{font-size:15px !important;margin-bottom:4px !important}
  .benefit-text{font-size:13px !important}
  .step-card{flex-direction:row !important;padding:18px !important;gap:14px !important}
  .step-number{font-size:42px !important;min-width:36px}
  .step-title{font-size:17px !important}
  .step-text{font-size:13px !important}
  .review-card{flex-direction:column !important;padding:20px !important;gap:10px !important;min-height:auto !important}
  .review-name{font-size:17px !important;margin:0 !important}
  .review-text{font-size:14px !important;margin:0 !important}
}

/* ===== FORCE FULL WIDTH - override any WordPress width restrictions ===== */
html, body { width: 100% !important; max-width: 100% !important; overflow-x: hidden; }
#page, #content, #primary, #main, .site, .site-content,
#wp-content, .wp-site-blocks, .entry-content > *,
.is-layout-constrained > *, .is-layout-flow > * { 
    max-width: 100% !important; 
    width: 100% !important;
}
.container { max-width: 100% !important; width: 100% !important; }

/* Full width images in posts */
.single-featured, .single-featured img,
.entry-content img { max-width: 100% !important; width: 100% !important; }

/* Posts grid full width */
.posts-grid { width: 100% !important; }

/* Related grid responsive overrides */
@media (max-width: 768px) {
    .posts-grid { grid-template-columns: repeat(2, 1fr) !important; }
}
@media (max-width: 480px) {
    .posts-grid { grid-template-columns: 1fr !important; }
    [style*="padding:24px 48px"], [style*="padding:20px 48px"] {
        padding-left: 16px !important;
        padding-right: 16px !important;
    }
}

/* ===== SINGLE POST HERO IMAGE RESPONSIVE ===== */
.single-hero-img-wrap { width: 100%; margin: 0; padding: 0 48px; box-sizing: border-box; }
.single-hero-img-wrap img { width: 100%; height: auto; display: block; border-radius: 12px; }

@media (max-width: 768px) {
  .single-hero-img-wrap { padding: 0 16px; }
  [style*="padding:0 48px"] { padding-left: 16px !important; padding-right: 16px !important; }
}
@media (max-width: 480px) {
  .single-hero-img-wrap { padding: 0 12px; }
}

/* ===== TWO-ROW HEADER ===== */
.header-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 64px;
}
@media (max-width: 768px) {
  .header-inner {
    flex-direction: row !important;
    align-items: center !important;
    height: 64px !important;
    flex-wrap: nowrap !important;
  }
  .site-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
  }
  .site-logo img { width: 36px !important; height: 36px !important; flex-shrink: 0; }
  .logo-name {
    font-size: 12px !important;
    white-space: nowrap;
    overflow: visible !important;
    text-overflow: clip !important;
  }
  #primary-nav { display: none !important; }
  .search-toggle, .menu-toggle {
    flex-shrink: 0;
    margin-left: 0 !important;
  }
}

/* ===== MOBILE: articles full width ===== */
@media (max-width: 768px) {
  .articles-carousel {
    background: transparent !important;
    padding: 0 !important;
    border-radius: 0 !important;
    min-height: auto !important;
  }
  .article-card-large {
    background: transparent !important;
    border-radius: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
    flex-direction: column !important;
    gap: 0 !important;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
    padding-bottom: 24px !important;
  }
  .article-card-large:last-child { border-bottom: none; }
  .article-image-large {
    width: 100% !important;
    height: auto !important;
    border-radius: 12px !important;
    overflow: hidden;
    margin-bottom: 12px !important;
  }
  .article-image-large img {
    width: 100% !important;
    height: auto !important;
    object-fit: cover !important;
    border-radius: 12px !important;
  }
  .article-content-large {
    padding: 0 !important;
    gap: 8px !important;
  }
  .article-title-large { font-size: 18px !important; }
  .article-excerpt { display: block !important; font-size: 14px !important; }
  .article-category { display: inline-block !important; }
}

/* ===== MOBILE: banner full screen with background photo ===== */
@media (max-width: 768px) {
  .ready-banner {
    flex-direction: column !important;
    background: url('https://lokteva-psy.ru/wp-content/uploads/2026/06/img_6230.jpeg') no-repeat center top !important;
    background-size: cover !important;
    min-height: 420px !important;
    padding: 0 !important;
    position: relative !important;
    border-radius: 20px !important;
    overflow: hidden !important;
    align-items: flex-end !important;
  }
  .ready-banner::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(to bottom, rgba(27,24,77,0.1) 0%, rgba(27,24,77,0.85) 100%);
    z-index: 1;
    border-radius: 20px;
  }
  .ready-content {
    position: relative !important;
    z-index: 2 !important;
    width: 100% !important;
    padding: 24px 20px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    justify-content: flex-end !important;
    height: auto !important;
  }
  .ready-text {
    font-size: 26px !important;
    color: #fff !important;
    margin-bottom: 8px !important;
    text-shadow: 0 2px 8px rgba(0,0,0,0.3);
  }
  .ready-content > p {
    color: rgba(255,255,255,0.9) !important;
    font-size: 14px !important;
    margin-bottom: 16px !important;
    text-shadow: 0 1px 4px rgba(0,0,0,0.3);
  }
  .ready-button {
    background: #fff !important;
    color: var(--primary) !important;
    padding: 12px 24px !important;
    font-size: 14px !important;
    margin-top: 0 !important;
  }
  .ready-image-wrapper { display: none !important; }
}

/* ===== MOBILE: banner stretch to full width ===== */
@media (max-width: 768px) {
  .ready-banner {
    margin-left: -20px !important;
    margin-right: -20px !important;
    border-radius: 0 !important;
    width: calc(100% + 40px) !important;
  }
}
@media (max-width: 480px) {
  .ready-banner {
    margin-left: -12px !important;
    margin-right: -12px !important;
    width: calc(100% + 24px) !important;
  }
}

/* ===== MOBILE: banner fix z-index and full bleed ===== */
@media (max-width: 768px) {
  section.ready-banner {
    position: relative !important;
    z-index: 10 !important;
    isolation: isolate !important;
  }
  .ready-banner::before {
    z-index: 1 !important;
    background: linear-gradient(to bottom,
      rgba(27,24,77,0.15) 0%,
      rgba(27,24,77,0.5) 50%,
      rgba(27,24,77,0.92) 100%) !important;
  }
  .ready-content {
    z-index: 2 !important;
    position: relative !important;
  }
}

/* ===== MOBILE: fix articles nav gap and button width ===== */
@media (max-width: 768px) {
  /* Убираем пустой зазор — скрываем nav на мобильном */
  .articles-nav { display: none !important; }

  /* Кнопка "Все статьи" — уже и компактнее */
  .articles-footer .promo-button {
    padding: 12px 32px !important;
    font-size: 15px !important;
    display: block !important;
    width: fit-content !important;
    margin: 0 auto !important;
  }
  .articles-footer { margin-top: 12px !important; }
}

/* ===== MOBILE: fix content overflow ===== */
@media (max-width: 768px) {
  [style*="padding:0 48px"],
  [style*="padding: 0 48px"] {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }
  .single-hero-img-wrap {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }
  .entry-content {
    overflow-x: hidden !important;
    word-break: break-word !important;
  }
}

/* ===== GLOBAL: prevent text overflow on all devices ===== */
html, body {
  overflow-x: hidden !important;
  max-width: 100% !important;
}

/* Все элементы в контенте не выходят за экран */
.entry-content *,
.post-content-wrap * {
  max-width: 100% !important;
  overflow-wrap: break-word !important;
  word-break: break-word !important;
}

/* Списки не выходят за край */
.entry-content ul,
.entry-content ol {
  padding-left: 20px !important;
  margin-left: 0 !important;
}

/* Картинки всегда вписываются */
.entry-content img {
  max-width: 100% !important;
  height: auto !important;
}

/* Ссылки переносятся */
.entry-content a {
  overflow-wrap: break-word !important;
  word-break: break-word !important;
}

/* Отступ после фото перед текстом */
.single-hero-img-wrap + div .entry-content,
.single-hero-img-wrap ~ div .entry-content {
  padding-top: 20px !important;
}

@media (max-width: 768px) {
  .entry-content {
    font-size: 15px !important;
    line-height: 1.7 !important;
  }
  .entry-content ul,
  .entry-content ol {
    padding-left: 16px !important;
  }
}

/* ===== MOBILE: articles carousel with clean card style ===== */
@media (max-width: 768px) {
  /* Возвращаем карусель */
  .articles-carousel {
    background: transparent !important;
    padding: 0 !important;
    border-radius: 0 !important;
    min-height: auto !important;
    position: relative !important;
    overflow: hidden !important;
    display: block !important;
  }

  /* Скрываем все слайды кроме активного */
  .articles-slide {
    display: none !important;
  }
  .articles-slide.active {
    display: block !important;
  }

  /* Карточка — чистый стиль без фона */
  .article-card-large {
    background: transparent !important;
    border-radius: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
    flex-direction: column !important;
    gap: 0 !important;
    border: none !important;
    margin: 0 !important;
  }

  /* Фото на всю ширину */
  .article-image-large {
    width: 100% !important;
    height: auto !important;
    border-radius: 16px !important;
    overflow: hidden !important;
    margin-bottom: 12px !important;
    background: #eee !important;
  }
  .article-image-large img {
    width: 100% !important;
    height: auto !important;
    object-fit: cover !important;
    display: block !important;
    border-radius: 16px !important;
  }

  /* Контент карточки */
  .article-content-large {
    padding: 0 !important;
    gap: 8px !important;
    display: flex !important;
    flex-direction: column !important;
  }

  /* Категория — фиолетовый бейдж */
  .article-category {
    display: inline-block !important;
    background: var(--primary) !important;
    color: #fff !important;
    padding: 5px 16px !important;
    border-radius: 20px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    width: auto !important;
    margin-bottom: 4px !important;
  }

  /* Заголовок */
  .article-title-large {
    font-size: 18px !important;
    font-weight: 700 !important;
    color: var(--text-dark) !important;
    line-height: 1.35 !important;
    margin: 0 !important;
  }

  /* Описание */
  .article-excerpt {
    display: block !important;
    font-size: 14px !important;
    color: #666 !important;
    line-height: 1.6 !important;
    margin: 0 !important;
  }

  /* Ссылка */
  .article-link-large {
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
    color: var(--primary) !important;
    font-weight: 600 !important;
    font-size: 15px !important;
    text-decoration: none !important;
    margin-top: 4px !important;
  }

  /* Показываем навигацию */
  .articles-nav {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    margin-top: 16px !important;
    gap: 12px !important;
  }
  .articles-arrows { display: flex !important; gap: 12px !important; }
  .articles-dots { display: flex !important; gap: 8px !important; justify-content: center !important; }
}

/* ===== GLOBAL ANTI-OVERFLOW (все устройства) ===== */
html { overflow-x: hidden !important; }
body { overflow-x: hidden !important; max-width: 100vw !important; }

/* Контент записей и страниц */
.entry-content,
.entry-content p,
.entry-content li,
.entry-content td,
.entry-content th {
  overflow-wrap: break-word !important;
  word-break: break-word !important;
  max-width: 100% !important;
}
.entry-content img,
.entry-content video,
.entry-content iframe,
.entry-content embed {
  max-width: 100% !important;
  height: auto !important;
}

/* Подвал — всегда вписывается */
#site-footer { overflow-x: hidden !important; }
.footer-grid { overflow-x: hidden !important; }
.footer-links a {
  overflow-wrap: break-word !important;
  word-break: break-word !important;
}

/* Шеринг кнопки не вылезают */
.share-bar { overflow-x: hidden !important; }

/* Таблицы */
.entry-content figure.wp-block-table,
.entry-content .tablepress-table-description,
.entry-content table {
  overflow-x: auto !important;
  display: block !important;
  max-width: 100% !important;
}

/* Мобильный: дополнительный отступ справа для безопасности */
@media (max-width: 768px) {
  .single-hero-img-wrap,
  .post-content-wrap,
  [style*="clamp(16px"] {
    box-sizing: border-box !important;
    max-width: 100vw !important;
  }
}


/* ========== RELATED GRID — единые точки перелома ==========
 * Правила .related-grid были размазаны по файлу ЧЕТЫРЬМЯ блоками
 * (1100 / 900 / 768 / 480 px), причём нижние шли с !important и перебивали
 * верхние. Из-за этого до 768px сетка жёстко вставала в 2 колонки, а правило
 * «1 колонка» ниже 480px до части устройств просто не доезжало.
 * Теперь одно место: компьютер 4 → планшет 2 → мобильный 1.
 */
.related-grid { grid-template-columns: repeat(4, 1fr); }

/* Планшет */
@media (max-width: 1100px) {
  .related-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Мобильный */
@media (max-width: 767px) {
  .related-grid { grid-template-columns: 1fr; }
}

/* Превью одинакового кадра во всех трёх раскладках.
   height:200px давал разное соотношение на каждой ширине колонки:
   1.67:1 на компьютере, 2.39:1 на планшете, 1.71:1 на телефоне.
   aspect-ratio держит 16:9 везде.
   Кадрирование задаём стилем, а не надеемся на файл: размер related-thumb
   сгенерирован не у всех вложений, старые загрузки WordPress отдаёт
   в оригинальных пропорциях. */
.related-grid img,
.related-grid .related-card-placeholder {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}
