/*
Theme Name: My Classic Two-Column Theme
Author: Ваше Имя
Description: Лёгкая двухколоночная тема под классический редактор WordPress с карточками статей, липким сайдбаром, похожими записями, кнопками поделиться, комментариями, пагинацией и страницей 404.
Version: 6.9
*/

:root {
  --bg-body: #f4f6f9;
  --bg-surface: #ffffff;
  --text-main: #1f2937;
  --text-muted: #6b7280;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --border: #e5e7eb;
  --radius: 10px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  width: 100%;
}

/* Шапка */
header {
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.admin-bar header {
  top: 32px;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 70px;
  gap: 20px;
}

.logo {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
  text-decoration: none;
}

/* Меню WordPress */
.main-nav ul {
  display: flex;
  list-style: none;
  gap: 24px;
}

.main-nav a {
  text-decoration: none;
  color: var(--text-main);
  font-weight: 500;
  font-size: 0.95rem;
}

.main-nav a:hover, .main-nav .current-menu-item a {
  color: var(--accent);
}

/* Форма поиска в шапке и на странице 404 */
.search-form {
  display: flex;
  align-items: stretch;
  margin: 0;
}

.search-form .search-field,
.search-form input[type="search"],
.search-form input[type="text"] {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-right: none;
  border-radius: 6px 0 0 6px;
  outline: none;
  width: 195px;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text-main);
  background: var(--bg-surface);
  margin: 0;
  height: 38px;
}

.search-form .search-field:focus,
.search-form input[type="search"]:focus {
  border-color: var(--accent);
}

.search-form .search-submit,
.search-form input[type="submit"],
.search-form button[type="submit"] {
  padding: 0 16px;
  background-color: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
  border-radius: 0 6px 6px 0;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  font-family: inherit;
  margin: 0;
  height: 38px;
  transition: background-color 0.2s;
}

.search-form .search-submit:hover,
.search-form input[type="submit"]:hover,
.search-form button[type="submit"]:hover {
  background-color: var(--accent-hover);
}

.screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Двухколоночная сетка */
.main-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 32px;
  margin: 32px auto 48px;
  flex: 1;
  align-items: start;
}

.content-area {
  min-width: 0;
}

/* Верхний блок на главной и в рубриках */
.archive-header {
  background-color: var(--bg-surface);
  padding: 24px 28px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 24px;
}

.archive-header h1 {
  font-size: 1.65rem;
  line-height: 1.25;
  margin-bottom: 0;
}

.archive-description {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.archive-description p:last-child {
  margin-bottom: 0;
}

/* Сетка карточек статей на главной и в рубриках (2 колонки, до 6 статей) */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.post-grid-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.post-grid-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
}

.post-grid-thumb {
  display: block;
  width: 100%;
  height: 185px;
  background-color: #eef2ff;
  overflow: hidden;
}

.post-grid-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.post-grid-card:hover .post-grid-thumb img {
  transform: scale(1.03);
}

.post-grid-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
  background: linear-gradient(135deg, #dbeafe, #eff6ff);
}

.post-grid-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.post-grid-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.post-grid-meta a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.post-grid-meta a:hover {
  text-decoration: underline;
}

.post-grid-title {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 10px;
}

.post-grid-title a {
  color: var(--text-main);
  text-decoration: none;
  transition: color 0.2s;
}

.post-grid-card:hover .post-grid-title a {
  color: var(--accent);
}

.post-grid-excerpt {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Левая колонка: Полная статья / Страница */
.article-card {
  background-color: var(--bg-surface);
  padding: 36px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 24px;
}

.article-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.article-meta a {
  color: var(--accent);
  text-decoration: none;
}

.article-card h1 {
  font-size: 2rem;
  line-height: 1.25;
  margin-bottom: 20px;
}

.post-thumbnail img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  margin-bottom: 24px;
}

/* Стили для контента из Классического редактора */
.entry-content p { margin-bottom: 16px; font-size: 1.05rem; }
.entry-content h2 { font-size: 1.45rem; margin: 28px 0 12px; }
.entry-content h3 { font-size: 1.2rem; margin: 22px 0 10px; }
.entry-content ul, .entry-content ol { margin: 0 0 16px 24px; }
.entry-content blockquote {
  border-left: 4px solid var(--accent);
  padding: 12px 20px;
  background: var(--bg-body);
  margin: 20px 0;
  font-style: italic;
}
.entry-content img { max-width: 100%; height: auto; border-radius: 6px; }
.alignleft { float: left; margin: 0 20px 15px 0; }
.alignright { float: right; margin: 0 0 15px 20px; }
.aligncenter { display: block; margin: 0 auto 20px; }

/* Кнопки Поделиться */
.share-box {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.share-label {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-main);
}

.share-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  color: #fff;
  border: none;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
}

.share-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.share-max { background-color: #7b42f6; }
.share-tg { background-color: #229ed9; }
.share-vk { background-color: #0077ff; }
.share-wa { background-color: #25d366; }
.share-copy {
  background-color: var(--bg-body);
  color: var(--text-main);
  border: 1px solid var(--border);
}

/* Похожие записи */
.related-posts-box {
  background-color: var(--bg-surface);
  padding: 28px 36px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 24px;
}

.related-posts-box h3 {
  font-size: 1.25rem;
  margin-bottom: 18px;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.related-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  text-decoration: none;
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  min-width: 0;
  transition: border-color 0.2s, transform 0.2s;
}

.related-item:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.related-thumb {
  width: 100%;
  height: 110px;
  background-color: #eef2ff;
  object-fit: cover;
}

.related-thumb-placeholder {
  width: 100%;
  height: 110px;
  background: linear-gradient(135deg, #dbeafe, #eff6ff);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
}

.related-info {
  padding: 12px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.related-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.related-title {
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 6px;
}

.related-excerpt {
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Страница ошибки 404 */
.error-404-card {
  text-align: center;
  padding: 56px 36px;
}

.error-404-code {
  font-size: 5rem;
  font-weight: 900;
  line-height: 1;
  color: var(--accent);
  margin-bottom: 16px;
  letter-spacing: -2px;
}

.error-404-card h1 {
  font-size: 1.75rem;
  margin-bottom: 12px;
}

.error-404-text {
  color: var(--text-muted);
  max-width: 500px;
  margin: 0 auto 28px;
  font-size: 1.05rem;
}

.error-404-search {
  display: flex;
  justify-content: center;
  margin-bottom: 24px;
}

.error-404-search .search-form .search-field,
.error-404-search .search-form input[type="search"] {
  width: 260px;
}

.btn-home {
  display: inline-block;
  padding: 10px 22px;
  background-color: var(--bg-body);
  color: var(--text-main);
  border: 1px solid var(--border);
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.2s;
}

.btn-home:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Пагинация */
.pagination {
  margin-top: 28px;
}

.pagination .nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pagination .page-numbers {
  display: inline-block;
  padding: 8px 14px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-main);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
}

.pagination .page-numbers:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.pagination .page-numbers.current {
  background-color: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Блок комментариев */
.comments-area {
  background-color: var(--bg-surface);
  padding: 36px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.comments-title {
  font-size: 1.35rem;
  margin-bottom: 24px;
}

.comment-list {
  list-style: none;
  margin-bottom: 32px;
}

.comment-list .children {
  list-style: none;
  margin-left: 28px;
  border-left: 2px solid var(--border);
  padding-left: 16px;
}

.comment-body {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.comment-author {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.comment-author img {
  border-radius: 50%;
}

.comment-metadata {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.comment-metadata a {
  color: var(--text-muted);
  text-decoration: none;
}

.comment-content p {
  margin-bottom: 10px;
  font-size: 0.98rem;
}

.reply a {
  font-size: 0.85rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

/* Форма добавления комментария */
.comment-reply-title {
  font-size: 1.2rem;
  margin-bottom: 16px;
}

.comment-form p {
  margin-bottom: 14px;
}

.comment-form label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 4px;
}

.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.95rem;
}

.comment-form input:focus,
.comment-form textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.comment-form .form-submit input[type="submit"] {
  padding: 10px 20px;
  background-color: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
}

.comment-form .form-submit input[type="submit"]:hover {
  background-color: var(--accent-hover);
}

/* Правая колонка: Липкий сайдбар */
aside.sticky-sidebar {
  position: sticky;
  top: 94px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.admin-bar aside.sticky-sidebar {
  top: 126px;
}

.widget {
  background-color: var(--bg-surface);
  padding: 24px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.widget-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.widget ul { list-style: none; }
.widget ul li { margin-bottom: 10px; font-size: 0.95rem; }
.widget ul li:last-child { margin-bottom: 0; }
.widget ul li a { text-decoration: none; color: var(--text-main); }
.widget ul li a:hover { color: var(--accent); }

/* Список рубрик (оглавления) со стандартными кружками */
.widget_categories ul {
  list-style-type: circle;
  padding-left: 20px;
}

.widget_categories ul ul {
  list-style-type: circle;
  padding-left: 18px;
  margin-top: 8px;
}

.widget_categories ul li {
  margin-bottom: 10px;
}

.widget_categories ul li.current-cat > a {
  color: var(--accent);
  font-weight: 600;
}

/* Подвал */
footer {
  background-color: var(--bg-surface);
  border-top: 1px solid var(--border);
  padding: 24px 0;
  margin-top: auto;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.footer-nav ul {
  display: flex;
  list-style: none;
  gap: 20px;
}

.footer-nav a { color: var(--text-muted); text-decoration: none; }
.footer-nav a:hover { color: var(--accent); }

@media (max-width: 900px) {
  .main-layout { grid-template-columns: 1fr; }
  aside.sticky-sidebar { position: static; }
  .header-inner { flex-wrap: wrap; padding: 15px 0; }
  .posts-grid { grid-template-columns: 1fr; }
  .related-grid { grid-template-columns: 1fr; }
  .article-card, .comments-area, .related-posts-box { padding: 24px; }
}
