/**
 * Блог ПочеркПро — стили страниц /blog/ и блока «Последние записи» на главной
 * Изолированные селекторы: .blog-section, .latest-blog-posts, .blog-index, .blog-article
 * Без !important, без глобальных перезаписей
 */

/* ═══════════════════════════════════════════════════════════════
   Общая секция блога (и индекс, и блок на главной)
   ═══════════════════════════════════════════════════════════════ */

.blog-section {
  padding: 4rem 2rem;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #16213e 100%);
  position: relative;
  overflow: hidden;
}

.blog-section::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.5), rgba(139, 92, 246, 0.5), transparent);
  pointer-events: none;
}

.blog-section .blog-container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 1.5rem;
  position: relative;
  z-index: 1;
}

.blog-section .blog-section-title {
  font-size: clamp(1.75rem, 3.5vw, 2.25rem);
  font-weight: 700;
  color: rgba(255, 255, 255, 0.95);
  margin: 0 0 0.5rem;
  text-align: center;
  line-height: 1.25;
}

.blog-section .blog-section-subtitle {
  font-size: clamp(0.9375rem, 1.8vw, 1.0625rem);
  color: rgba(255, 255, 255, 0.75);
  margin: 0 auto 2.5rem;
  text-align: center;
  line-height: 1.6;
  max-width: 560px;
}

/* Сетка карточек */
.blog-section .blog-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .blog-section .blog-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.75rem;
  }
}

@media (min-width: 1200px) {
  .blog-section .blog-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
  }
}

/* Карточка поста */
.blog-section .blog-card {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: 16px;
  padding: 1.5rem 1.25rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.blog-section .blog-card:hover {
  border-color: rgba(59, 130, 246, 0.45);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.blog-section .blog-card-badge {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(59, 130, 246, 0.95);
  margin-bottom: 0.75rem;
}

.blog-section .blog-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.0625rem;
  line-height: 1.35;
  font-weight: 600;
}

.blog-section .blog-card h3 a {
  color: rgba(255, 255, 255, 0.95);
  text-decoration: none;
  transition: color 0.2s ease;
}

.blog-section .blog-card h3 a:hover {
  color: rgba(96, 165, 250, 1);
}

.blog-section .blog-card-desc {
  font-size: 0.9375rem;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.55;
  margin-bottom: 1rem;
  flex-grow: 1;
}

.blog-section .blog-card-cta {
  display: inline-block;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: rgba(59, 130, 246, 1);
  text-decoration: none;
  border: 1px solid rgba(59, 130, 246, 0.4);
  border-radius: 8px;
  background: rgba(59, 130, 246, 0.1);
  transition: background 0.2s ease, border-color 0.2s ease;
  align-self: flex-start;
}

.blog-section .blog-card-cta:hover {
  background: rgba(59, 130, 246, 0.2);
  border-color: rgba(59, 130, 246, 0.6);
}

.blog-section .blog-all-link {
  display: block;
  text-align: center;
  margin-top: 2rem;
  font-size: 1rem;
  font-weight: 600;
  color: rgba(139, 92, 246, 0.95);
  text-decoration: none;
  transition: color 0.2s ease;
}

.blog-section .blog-all-link:hover {
  color: rgba(167, 139, 250, 1);
}

/* ═══════════════════════════════════════════════════════════════
   Страница индекса блога (/blog/)
   ═══════════════════════════════════════════════════════════════ */

.blog-index .blog-container {
  max-width: 1240px;
}

.blog-index .blog-list {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .blog-index .blog-list {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.75rem;
  }
}

@media (min-width: 1200px) {
  .blog-index .blog-list {
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
  }
}

.blog-index .blog-list article {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: 16px;
  padding: 1.5rem 1.25rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.blog-index .blog-list article:hover {
  border-color: rgba(59, 130, 246, 0.45);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.blog-index .blog-list .blog-list-badge {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(59, 130, 246, 0.95);
  margin-bottom: 0.5rem;
}

.blog-index .blog-list h2 {
  margin: 0 0 0.5rem;
  font-size: 1.125rem;
  line-height: 1.35;
  font-weight: 600;
}

.blog-index .blog-list h2 a {
  color: rgba(255, 255, 255, 0.95);
  text-decoration: none;
  transition: color 0.2s ease;
}

.blog-index .blog-list h2 a:hover {
  color: rgba(96, 165, 250, 1);
}

.blog-index .blog-list p {
  margin: 0;
  font-size: 0.9375rem;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.55;
}

.blog-index .blog-nav {
  margin-top: 2.5rem;
  text-align: center;
}

.blog-index .blog-nav a {
  color: rgba(139, 92, 246, 0.95);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.blog-index .blog-nav a:hover {
  color: rgba(167, 139, 250, 1);
}

/* ═══════════════════════════════════════════════════════════════
   Страница одной статьи блога (/blog/*.html)
   ═══════════════════════════════════════════════════════════════ */

body.blog-article-page {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #16213e 100%);
  min-height: 100vh;
  color: rgba(255, 255, 255, 0.9);
}

/* Текст статьи — всегда в светлом контейнере (документ) */
.blog-article .blog-container {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  background: #fff;
  color: #1e293b;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.blog-article .blog-article-content h1,
.blog-article .blog-article-content h2 {
  scroll-margin-top: 4rem;
}

.blog-article .blog-article-content h1 {
  color: #0f172a;
}

.blog-article .blog-article-content h2 {
  color: #1e293b;
}

.blog-article .blog-article-content p,
.blog-article .blog-article-content li {
  color: #334155;
}

.blog-article .blog-article-content a {
  color: #6366f1;
  border-bottom-color: rgba(99, 102, 241, 0.4);
}

.blog-article .blog-article-content a:hover {
  color: #4f46e5;
  border-bottom-color: #4f46e5;
}

.blog-article .blog-article-content .blog-article-footer {
  border-top-color: #e2e8f0;
  color: #64748b;
}

.blog-article .blog-article-content .blog-article-footer a {
  color: #6366f1;
}

.blog-article .blog-article-content .blog-article-footer a:hover {
  color: #4f46e5;
}

/* Ритм и читаемость: воздух вокруг заголовков и списков */
.blog-article .blog-article-content {
  font-size: 16px;
  line-height: 1.65;
}

.blog-article .blog-article-content h2 {
  margin: 2.5rem 0 0.75rem;
  letter-spacing: 0.01em;
}

.blog-article .blog-article-content h2:first-of-type {
  margin-top: 0;
}

.blog-article .blog-article-content p {
  margin-bottom: 1rem;
}

.blog-article .blog-article-content ul {
  margin: 0 0 1.5rem 1.5rem;
}

/* Placeholder под картинку — тот же визуальный якорь, что и в статьях */
.blog-article .blog-article-content .article-figure-placeholder {
  min-height: 220px;
  height: 220px;
  background: #e2e8f0;
  border: 2px solid #cbd5e1;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 2.25rem 0;
  gap: 0.5rem;
  box-sizing: border-box;
}

.blog-article .blog-article-content .article-figure-placeholder figcaption {
  display: none;
}

.blog-article .blog-article-content .article-figure-placeholder::before {
  content: "";
  display: block;
  width: 40px;
  height: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='18' height='18' rx='2'/%3E%3Ccircle cx='8.5' cy='8.5' r='1.5'/%3E%3Cpath d='M21 15l-5-5L5 21'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 24px 24px;
  flex-shrink: 0;
}

.blog-article .blog-article-content .article-figure-placeholder::after {
  content: "Здесь будет схема / пример";
  font-size: 0.8125rem;
  color: #64748b;
  line-height: 1.3;
}

.blog-article .blog-article-header {
  margin-bottom: 2rem;
}

.blog-article .blog-article h1 {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 700;
  line-height: 1.3;
  margin: 0 0 1rem;
  color: rgba(255, 255, 255, 0.98);
}

.blog-article .blog-article h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 2rem 0 0.75rem;
  color: rgba(255, 255, 255, 0.95);
}

.blog-article .blog-article p,
.blog-article .blog-article li {
  font-size: 1rem;
  line-height: 1.7;
  margin-bottom: 1rem;
  color: rgba(255, 255, 255, 0.88);
}

.blog-article .blog-article ul {
  margin: 0 0 1rem 1.5rem;
  padding: 0;
}

.blog-article .blog-article li {
  margin-bottom: 0.5rem;
}

.blog-article .blog-article a {
  color: rgba(96, 165, 250, 1);
  text-decoration: none;
  border-bottom: 1px solid rgba(96, 165, 250, 0.4);
  transition: color 0.2s ease, border-color 0.2s ease;
}

.blog-article .blog-article a:hover {
  color: rgba(147, 197, 253, 1);
  border-color: rgba(147, 197, 253, 0.6);
}

.blog-article .blog-article-footer {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.9375rem;
  color: rgba(255, 255, 255, 0.75);
}

.blog-article .blog-article-footer a {
  color: rgba(139, 92, 246, 0.95);
  border-bottom: none;
}

.blog-article .blog-article-footer a:hover {
  color: rgba(167, 139, 250, 1);
}

/* Мобильная адаптация */
/* ═══════════════════════════════════════════════════════════════
   Хедер страниц блога
   ═══════════════════════════════════════════════════════════════ */

.blog-header {
  padding: 1rem 1.5rem;
  background: rgba(15, 23, 42, 0.9);
  border-bottom: 1px solid rgba(59, 130, 246, 0.2);
}

.blog-header .blog-container {
  max-width: 1240px;
  margin: 0 auto;
}

.blog-header a {
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  font-weight: 600;
}

.blog-header a[href="/blog/"] {
  color: rgba(139, 92, 246, 0.95);
}

.blog-header a:hover {
  text-decoration: underline;
}

.blog-header .blog-sep {
  color: rgba(255, 255, 255, 0.5);
  margin: 0 0.5rem;
}

@media (max-width: 767px) {
  .blog-section {
    padding: 3rem 1rem;
  }

  .blog-section .blog-container {
    padding: 0 1rem;
  }

  .blog-article .blog-container {
    padding: 1.5rem 1rem;
  }

  .blog-header {
    padding: 1rem;
  }
}
