/*
Theme Name: CarPlay Mercedes Modern
Author: https://t.me/LR_799
Description: Современная адаптивная тема для блога, оптимизированная для Яндекса
Version: 1.7
*/

:root {
  --primary: #fe4a49;
  --secondary: #333;
  --text: #555;
  --bg-dark: #2c2c2c;
  --white: #fff;
  --light-bg: #f5f5f5;
}

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

body {
  font-family: 'Jost', sans-serif;
  color: var(--text);
  line-height: 1.6;
}

/* Контейнер */
.container {
  /* Шире на десктопе, чтобы не было больших пустых полей */
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 15px;
}

/* Заголовки */
h1 { font-size: 2.8rem; margin-bottom: 1rem; color: var(--primary); font-weight: 700; }
h2 { font-size: 2rem; margin-bottom: 2rem; color: var(--secondary); font-weight: 700; }
h3 { font-size: 1.5rem; margin-bottom: 1rem; color: var(--primary); font-weight: 700; }
h4 { font-size: 1.25rem; color: var(--secondary); font-weight: 600; }
p { font-size: 1.1rem; margin-bottom: 1.5rem; }

a { color: var(--primary); text-decoration: none; transition: color 0.3s ease; }
a:hover { color: #e43f3f; }

/* Кнопки */
.btn {
  display: inline-block;
  padding: 12px 35px;
  border-radius: 50px;
  font-weight: 600;
  font-size: 1.1rem;
  transition: all 0.3s ease;
}

.btn-primary {
  background: var(--primary);
  color: var(--white);
  border: 2px solid var(--primary);
}
.btn-primary:hover { background: transparent; color: var(--primary); }

/* Шапка (идентична основному сайту) */
.navbar {
  background: var(--white);
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  position: sticky;
  top: 0;
  z-index: 1000;
  padding: 1rem 0;
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

.navbar.scrolled {
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.navbar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: nowrap;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  transition: transform 0.3s ease;
}

.logo:hover {
  transform: scale(1.05);
}

.logo img {
  height: 2.5rem;
  transition: filter 0.3s ease;
}

.logo:hover img {
  filter: brightness(1.1);
}

.logo span {
  font-size: 1.5rem;
  color: var(--secondary);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: nowrap;
}

.nav-links a {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--secondary);
  padding: 8px 12px;
  border-radius: 20px;
  transition: all 0.3s ease;
  position: relative;
  white-space: nowrap;
}

.nav-links a:hover {
  color: var(--primary);
}

.nav-links a::after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  bottom: 4px;
  left: 50%;
  background: var(--primary);
  transition: all 0.3s ease;
}

.nav-links a:hover::after {
  width: 60%;
  left: 20%;
}

.nav-links .phone, .nav-links .telegram {
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.nav-links .phone {
  background: #f5f5f5;
}

.nav-links .phone:hover {
  background: #e0e0e0;
  transform: translateY(-2px);
}

.nav-links .telegram {
  background: var(--primary);
  color: var(--white);
}

.nav-links .telegram:hover {
  background: #e43f3f;
  transform: translateY(-2px);
}

.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 5px;
}

.menu-toggle span {
  width: 30px;
  height: 3px;
  background: var(--secondary);
  border-radius: 2px;
  transition: all 0.3s ease;
}

.menu-toggle.active span:nth-child(1) { transform: rotate(45deg) translate(6px, 6px); }
.menu-toggle.active span:nth-child(2) { opacity: 0; }
.menu-toggle.active span:nth-child(3) { transform: rotate(-45deg) translate(6px, -6px); }

/* Hero секция */
.hero-blog {
  background: linear-gradient(135deg, rgba(254, 74, 73, 0.1), rgba(255, 255, 255, 0.9));
  padding: 5rem 0;
  text-align: center;
}

.hero-blog p { color: var(--text); font-size: 1.2rem; max-width: 700px; margin: 0 auto; }

/* Контент блога */
.blog-content { padding: 5rem 0; }
.content-with-sidebar { display: flex; gap: 30px; }
.main-content { flex: 3; }
.sidebar { flex: 1; }

.blog-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, auto);
  gap: 30px;
  max-width: 1400px;
  margin: 0 auto;
}

.blog-post {
  background: var(--white);
  border-radius: 15px;
  padding: 2rem;
  box-shadow: 0 5px 20px rgba(0,0,0,0.05);
  border: 1px solid rgba(0,0,0,0.05);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  display: flex;
  flex-direction: column;
}
.blog-post:hover {
  transform: translateY(-10px);
  box-shadow: 0 15px 35px rgba(0,0,0,0.1);
}

.post-thumbnail {
  margin-bottom: 1.5rem;
}
.post-thumbnail img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 10px;
  transition: transform 0.3s ease;
}
.post-thumbnail img:hover { transform: scale(1.05); }

.post-content {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.blog-post .post-content .btn {
  margin-top: auto;
  align-self: flex-start;
}

.post-meta { font-size: 0.95rem; color: #777; margin-bottom: 1rem; }
.post-meta span { margin-right: 10px; }
.post-excerpt { color: var(--text); font-size: 1.05rem; margin-bottom: 1.5rem; flex-grow: 1; }
.post-content h3 { font-size: 1.4rem; line-height: 1.4; }

.single-post-content {
  background: var(--white);
  border-radius: 15px;
  padding: 2.5rem;
  /* Шире, чтобы контент/таблицы/похожие записи не были «узкими» */
  max-width: 1300px;
  margin: 3rem auto;
  box-shadow: 0 5px 25px rgba(0,0,0,0.05);
  border: 1px solid rgba(0,0,0,0.05);
}

.single-post-content .the-content img { max-width: 100%; height: auto; border-radius: 10px; margin: 1.5rem 0; }
.single-post-content .the-content ul, .single-post-content .the-content ol { margin: 1.5rem 0 1.5rem 2rem; }
.single-post-content .the-content ul li, .single-post-content .the-content ol li { margin-bottom: 0.75rem; }

/* Таблицы в контенте (адаптивно) */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1.5rem 0;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,0.10);
  background: var(--white);
}

.single-post-content .the-content table {
  width: 100%;
  border-collapse: collapse;
}

.single-post-content .the-content th,
.single-post-content .the-content td {
  padding: 12px 14px;
  border: 1px solid rgba(0,0,0,0.10);
  vertical-align: top;
  font-size: 1.05rem;
}

.single-post-content .the-content th {
  background: var(--light-bg);
  color: var(--secondary);
  font-weight: 700;
}

.single-post-content .the-content caption {
  caption-side: top;
  text-align: left;
  font-weight: 700;
  color: var(--secondary);
  padding: 12px 14px;
}

/* Блок в конце записи (CTA + похожие записи) */
.post-end { margin-top: 2.5rem; }

.post-cta {
  display: flex;
  gap: 22px;
  align-items: center;
  justify-content: space-between;
  padding: 22px 24px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(44,44,44,0.96), rgba(58,58,58,0.96));
  border: 1px solid rgba(254,74,73,0.40);
  color: var(--white);
}

.post-cta__title {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 0.75rem;
}

.post-cta__desc {
  color: rgba(255,255,255,0.88);
  font-size: 1.05rem;
}

.post-cta__text { flex: 1 1 auto; min-width: 0; }

.post-cta__actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-end;
  flex: 0 0 auto;
}

.post-cta__actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 240px;
  min-height: 52px;
  padding: 12px 22px;
  text-align: center;
  white-space: nowrap;
  line-height: 1.1;
}

.post-cta__actions .btn.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}

.post-cta__actions .btn.btn-outline:hover {
  background: var(--primary);
  color: var(--white);
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}

.btn-outline:hover {
  background: var(--primary);
  color: var(--white);
}

.post-back { margin-top: 1.25rem; }

.btn-back { padding: 12px 22px; }

.related-posts-cards { margin-top: 2.25rem; }

.related-posts-cards h2 {
  font-size: 2rem;
  color: var(--secondary);
  margin-bottom: 1.25rem;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}

.related-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 18px 16px;
  border-radius: 16px;
  text-decoration: none;
  background: rgba(44,44,44,0.94);
  border: 1px solid rgba(255,255,255,0.10);
  color: var(--white);
  box-shadow: 0 10px 25px rgba(0,0,0,0.18);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.related-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 16px 40px rgba(0,0,0,0.28);
  border-color: rgba(254,74,73,0.45);
}

.related-card__title {
  font-size: 1.2rem;
  font-weight: 800;
  line-height: 1.25;
  color: var(--white);
}

.related-card__date {
  font-size: 0.95rem;
  color: rgba(255,255,255,0.75);
}

.related-card__excerpt {
  font-size: 1.02rem;
  color: rgba(255,255,255,0.85);
  margin-top: 6px;
}

.related-empty {
  padding: 16px 18px;
  border-radius: 14px;
  background: rgba(0,0,0,0.04);
  border: 1px solid rgba(0,0,0,0.06);
}

/* Кнопка «вверх» */
.scroll-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 0;
  background: var(--primary);
  color: var(--white);
  font-size: 1.4rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 14px 30px rgba(0,0,0,0.22);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 9999;
}

.scroll-top.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* Пагинация */
.pagination { display: flex; justify-content: center; gap: 15px; margin-top: 3rem; }
.pagination .page-numbers { padding: 12px 20px; background: var(--white); border: 2px solid var(--primary); color: var(--primary); border-radius: 30px; font-weight: 600; transition: all 0.3s ease; }
.pagination .page-numbers:hover, .pagination .page-numbers.current { background: var(--primary); color: var(--white); }

/* Похожие посты */
.related-posts { margin-top: 3rem; padding-top: 2rem; border-top: 1px solid #eee; }
.related-posts h2 { font-size: 1.75rem; color: var(--primary); margin-bottom: 1.5rem; }
.related-posts-list { list-style: none; padding: 0; }
.related-posts-list li { margin-bottom: 1rem; }
.related-posts-list a { font-size: 1.1rem; color: var(--secondary); font-weight: 500; transition: color 0.3s ease; }
.related-posts-list a:hover { color: var(--primary); }

/* Комментарии */
.comments { margin-top: 3rem; }
.comment-list { list-style: none; padding: 0; }
.comment { margin-bottom: 2rem; }
.comment-meta { font-size: 0.9rem; color: #777; margin-bottom: 0.5rem; }
.comment-content { background: #f9f9f9; padding: 1rem; border-radius: 10px; }

/* Форма комментариев */
.comment-respond { margin-top: 2rem; }
.comment-respond h3 { margin-bottom: 1rem; }
.comment-form p { margin-bottom: 1rem; }
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid rgba(0,0,0,0.15);
  border-radius: 12px;
  font-family: inherit;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.comment-form textarea { min-height: 140px; resize: vertical; }
.comment-form input:focus,
.comment-form textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(254,74,73,0.15);
}
.comment-form .submit {
  display: inline-block;
  padding: 12px 28px;
  border-radius: 50px;
  font-weight: 600;
  font-size: 1.05rem;
  border: 2px solid var(--primary);
  background: var(--primary);
  color: var(--white);
  cursor: pointer;
  transition: all 0.3s ease;
}
.comment-form .submit:hover { background: transparent; color: var(--primary); }

/* Поиск */
.search-form { display: flex; gap: 10px; align-items: center; }
.search-field {
  flex: 1;
  padding: 12px 14px;
  border: 1px solid rgba(0,0,0,0.15);
  border-radius: 12px;
  font-family: inherit;
  font-size: 1rem;
  outline: none;
}
.search-field:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(254,74,73,0.15); }
.search-submit {
  padding: 12px 18px;
  border-radius: 12px;
  font-weight: 600;
  border: 2px solid var(--primary);
  background: var(--primary);
  color: var(--white);
  cursor: pointer;
  transition: all 0.3s ease;
}
.search-submit:hover { background: transparent; color: var(--primary); }

/* Боковая панель */
.widget { background: var(--white); padding: 1.5rem; border-radius: 15px; box-shadow: 0 5px 25px rgba(0,0,0,0.05); margin-bottom: 2rem; }
.widget h3 { font-size: 1.2rem; color: var(--primary); margin-bottom: 1rem; }

/* Подвал (идентичен основному сайту) */
footer {
  background: linear-gradient(135deg, var(--bg-dark), #3a3a3a);
  color: var(--white);
  padding: 2.5rem 0;
  text-align: center;
  position: relative;
}

footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.2);
  z-index: 0;
}

footer .container {
  position: relative;
  z-index: 1;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 1.5rem;
}

footer h4 {
  color: var(--white);
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}

footer a {
  color: var(--primary);
  font-size: 1rem;
  transition: all 0.3s ease;
}

footer a:hover {
  color: #e43f3f;
  text-decoration: underline;
}

footer .heart {
  color: var(--primary);
  animation: heartbeat 1.5s infinite;
}

@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

/* Адаптивность */
@media (max-width: 1024px) {
  .blog-grid { grid-template-columns: repeat(2, 1fr); grid-template-rows: repeat(5, auto); max-width: 100%; }
  .hero-blog { padding: 4rem 0; }
  .single-post-content { max-width: 100%; }
  .related-grid { grid-template-columns: repeat(2, 1fr); }
  .nav-links { gap: 15px; }
  .nav-links a { font-size: 1rem; padding: 6px 10px; }
  .logo span { font-size: 1.3rem; }
}

@media (max-width: 768px) {
  .navbar .container {
    flex-wrap: wrap;
    gap: 10px;
  }
  .nav-links {
    display: none;
    flex-direction: column;
    width: 100%;
    background: var(--white);
    padding: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    position: absolute;
    top: 100%;
    left: 0;
    border-radius: 0 0 10px 10px;
  }
  .nav-links.active {
    display: flex;
  }
  .nav-links a {
    width: 100%;
    text-align: center;
    padding: 12px;
    font-size: 1.1rem;
  }
  .menu-toggle {
    display: flex;
  }
  .logo img { height: 2.2rem; }
  .logo span { font-size: 1.2rem; }
  .hero-blog h1 { font-size: 2.2rem; }
  .hero-blog p { font-size: 1rem; }
  .blog-grid { grid-template-columns: 1fr; grid-template-rows: auto; max-width: 100%; }
  .blog-content { padding: 3rem 0; }
  .single-post-content { padding: 2rem; max-width: 100%; }
  .single-post-content h1 { font-size: 2rem; }
  .content-with-sidebar { flex-direction: column; }
  .post-cta { flex-direction: column; align-items: stretch; }
  .post-cta__actions { align-items: stretch; width: 100%; }
  .post-cta__actions .btn { width: 100%; }
  .related-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .navbar { padding: 0.75rem 0; }
  .logo img { height: 2rem; }
  .logo span { font-size: 1.1rem; }
  .nav-links a { font-size: 1rem; padding: 10px; }
  .hero-blog { padding: 3rem 0; }
  .hero-blog h1 { font-size: 1.8rem; }
  .hero-blog p { font-size: 0.9rem; }
  .btn { padding: 10px 25px; font-size: 1rem; }
  .single-post-content { padding: 1.5rem; }
  .single-post-content h1 { font-size: 1.75rem; }
  .post-thumbnail img { height: 160px; }
  .scroll-top { right: 16px; bottom: 16px; width: 48px; height: 48px; }
}