/* SPEAKID Blog Styles */

:root {
  /* Colors */
  --color_red_default: #F04F4F;
  --color_red_active: #E12F2F;
  --color_red_light: #F27171;
  --color_red_ultra_light: #F4BEBE;
  --color_red_warning: #CE2222;
  
  --color_grey_ultra_dark: #363636;
  --color_grey_dark: #B1B1B1;
  --color_grey_light: #D9D9D9;
  --color_grey_ultra_light: #F5F5F5;
  
  --color_black: #000000;
  --color_black_light: #2B2B2B;
  --color_black_ultra_light: #494949;
  
  --color_green: #2ED886;
  --color_green_dark: #17AD65;
  --color_green_light: #EAFBF3;
  
  --color_blue: #0085FF;
  --color_blue_light: #E6F3FF;
  
  --color_yellow: #FFC700;
  --color_yellow_light: #FFF5D4;
  
  --color_white: #FFFFFF;
  
  /* Font sizes */
  --font_size_small: 14px;
  --font_size_default: 16px;
  --font_size_medium: 18px;
  --font_size_big: 32px;
  
  /* Border radius */
  --radius_small: 10px;
  --radius_medium: 16px;
  --radius_large: 20px;
  --radius_circle: 50%;
  
  /* Spacing */
  --gap_small: 10px;
  --gap_medium: 15px;
  --gap_large: 20px;
  --gap_xlarge: 25px;
  
  --padding_small: 20px;
  --padding_medium: 30px;
  --padding_large: 50px;
}

* {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Onest', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: var(--font_size_default);
  font-weight: 400;
  line-height: 1.6;
  color: var(--color_black);
  background-color: var(--color_grey_ultra_light);
  margin: 0;
  padding: var(--padding_small);
}

/* Container - для страниц статей (по умолчанию) */
body {
  max-width: 900px;
  margin: 0 auto;
  padding: var(--padding_large) var(--padding_medium);
}

/* Home page - расширяем контейнер */
body.home-body {
  max-width: 1200px;
}

@media (max-width: 768px) {
  body {
    padding: var(--padding_medium) var(--padding_small);
  }
  
  body.home-body {
    padding: var(--padding_medium) var(--padding_small);
  }
}

@media (max-width: 500px) {
  body {
    padding: var(--padding_small);
  }
  
  body.home-body {
    padding: var(--padding_small);
  }
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Onest', sans-serif;
  font-weight: 700;
  margin-top: 40px;
  margin-bottom: var(--gap_large);
  color: var(--color_black);
}

h1 {
  font-size: var(--font_size_big);
  font-weight: 700;
  margin-top: 0;
}

h2 {
  font-size: 24px;
  font-weight: 600;
}

h3 {
  font-size: var(--font_size_medium);
  font-weight: 600;
}

p, ul, ol {
  margin-bottom: var(--gap_large);
  font-size: var(--font_size_default);
  font-weight: 400;
  line-height: 1.6;
}

ul, ol {
  padding-left: 25px;
}

li {
  margin-bottom: var(--gap_small);
}

/* Links */
a {
  color: var(--color_red_default);
  text-decoration: none;
  border-bottom: 1px solid var(--color_red_default);
  padding-bottom: 2px;
  transition: color 0.2s ease, border-color 0.2s ease;
}

a:hover {
  color: var(--color_red_active);
  border-bottom-color: var(--color_red_active);
}

/* Breadcrumbs */
.breadcrumbs {
  margin-bottom: var(--gap_large);
  font-size: var(--font_size_small);
}

.breadcrumbs ol {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--gap_small);
}

.breadcrumbs li {
  display: flex;
  align-items: center;
  margin: 0;
}

.breadcrumbs li span[aria-label="separator"] {
  color: var(--color_grey_dark);
  margin: 0 var(--gap_small);
}

.breadcrumbs a {
  color: var(--color_grey_ultra_dark);
  text-decoration: none;
  border-bottom: none;
  transition: color 0.2s ease;
}

.breadcrumbs a:hover {
  color: var(--color_red_default);
  border-bottom: none;
}

.breadcrumbs li:last-child span {
  color: var(--color_black);
  font-weight: 400;
}

/* Header */
header {
  margin-bottom: 40px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.logo-link {
  display: inline-block;
  border-bottom: none;
  text-decoration: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.logo-link:hover {
  opacity: 0.8;
  transform: scale(1.02);
  border-bottom: none;
}

.logo-link:active {
  transform: scale(0.98);
}

.logo {
  height: 40px;
  width: auto;
  display: block;
  border-radius: 0;
  margin: 0;
}

@media (max-width: 768px) {
  .logo {
    height: 32px;
  }
}

@media (max-width: 500px) {
  .logo {
    height: 28px;
  }
}

/* Article (for default layout) */
article {
  background: var(--color_white);
  padding: var(--padding_medium);
  border-radius: var(--radius_large);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Исключаем карточки статей из общего стиля article */
article.article-card {
  padding: 0;
  border-radius: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

@media (max-width: 768px) {
  article {
    padding: var(--padding_small);
  }
  
  article.article-card {
    padding: 0;
  }
}

/* Images */
img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius_large);
  margin: var(--gap_large) 0;
}

/* Убираем margin у изображений в карточках */
.article-card-image img,
.article-card img {
  margin: 0;
  border-radius: 0;
}

/* Code */
pre, code {
  font-family: Consolas, Monaco, 'Courier New', monospace;
  background: var(--color_grey_ultra_light);
  padding: 4px 6px;
  border-radius: var(--radius_small);
  font-size: var(--font_size_small);
}

pre {
  padding: var(--gap_large);
  overflow-x: auto;
  border-radius: var(--radius_medium);
}

code {
  padding: 2px 6px;
}

pre code {
  padding: 0;
  background: transparent;
}

/* Horizontal rule */
hr {
  border: none;
  border-top: 1px solid var(--color_grey_light);
  margin: var(--gap_large) 0;
}

.post-content hr {
  margin: 40px 0;
  border-top: 1px solid var(--color_grey_light);
}

/* Blockquote */
blockquote {
  border-left: 4px solid var(--color_red_default);
  padding-left: var(--gap_large);
  margin: var(--gap_large) 0;
  color: var(--color_grey_ultra_dark);
  font-style: italic;
}

/* Lists in articles */
article ul, article ol {
  margin-bottom: var(--gap_large);
}

article li {
  margin-bottom: var(--gap_small);
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--gap_large) 0;
  font-size: var(--font_size_default);
  background: var(--color_white);
  border-radius: var(--radius_medium);
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

thead {
  background: var(--color_grey_ultra_light);
}

th {
  padding: var(--gap_medium) var(--gap_large);
  text-align: left;
  font-weight: 600;
  color: var(--color_black);
  border-bottom: 2px solid var(--color_grey_light);
  font-size: var(--font_size_default);
}

td {
  padding: var(--gap_medium) var(--gap_large);
  text-align: left;
  color: var(--color_black);
  border-bottom: 1px solid var(--color_grey_light);
  vertical-align: top;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: var(--color_grey_ultra_light);
  transition: background-color 0.2s ease;
}

/* Responsive tables */
@media (max-width: 768px) {
  table {
    font-size: var(--font_size_small);
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  th, td {
    padding: var(--gap_small) var(--gap_medium);
    min-width: 120px;
  }
}

@media (max-width: 500px) {
  table {
    font-size: var(--font_size_small);
  }
  
  th, td {
    padding: 8px 12px;
    font-size: var(--font_size_small);
  }
}

/* Strong and emphasis */
strong, b {
  font-weight: 600;
}

em, i {
  font-style: italic;
}

/* Small text */
small {
  font-size: var(--font_size_small);
}

/* Post Styles */
.post {
  background: var(--color_white);
  padding: var(--padding_medium);
  border-radius: var(--radius_large);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.post-header {
  padding-bottom: 0;
  margin-bottom: var(--gap_large);
  width: 100%;
  padding-bottom: var(--gap_large);
  border-bottom: 1px solid var(--color_grey_light);
}

.post-meta-top {
  display: flex;
  align-items: center;
  gap: var(--gap_medium);
  margin-bottom: var(--gap_medium);
  font-size: var(--font_size_small);
  color: var(--color_grey_dark);
  flex-wrap: wrap;
}

.post-date-top {
  font-size: var(--font_size_small);
  color: var(--color_grey_dark);
  font-weight: 400;
}

.post-title {
  font-size: var(--font_size_big);
  font-weight: 700;
  color: var(--color_black);
  margin: 0 0 var(--gap_large) 0;
  line-height: 1.2;
}

.reading-time {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--font_size_small);
  color: var(--color_grey_dark);
  font-weight: 400;
}

.reading-time-icon {
  width: 14px;
  height: 14px;
  opacity: 0.7;
  flex-shrink: 0;
}

/* Table of Contents */
.table-of-contents {
  background: var(--color_grey_ultra_light);
  border-radius: var(--radius_medium);
  padding: var(--gap_large);
  margin-bottom: var(--gap_large);
  border: 1px solid var(--color_grey_light);
}

.toc-title {
  font-size: var(--font_size_medium);
  font-weight: 600;
  color: var(--color_black);
  margin: 0 0 var(--gap_medium) 0;
  padding: 0;
}

.toc-nav {
  display: block;
}

.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: toc-counter;
}

.toc-item {
  margin-bottom: var(--gap_small);
  padding-left: 0;
  position: relative;
}

.toc-item-h2 {
  font-weight: 500;
  margin-left: 0;
}

.toc-item-h3 {
  font-weight: 400;
  margin-left: var(--gap_medium);
  font-size: var(--font_size_small);
}

.toc-link {
  color: var(--color_grey_ultra_dark);
  text-decoration: none;
  border-bottom: none;
  display: block;
  padding: 4px 0;
  transition: opacity 0.2s ease;
  line-height: 1.5;
}

.toc-link:hover {
  opacity: 0.7;
  border-bottom: none;
}

.toc-link.active {
  color: var(--color_grey_ultra_dark);
  font-weight: 500;
  opacity: 1;
}

@media (max-width: 768px) {
  .table-of-contents {
    padding: var(--gap_medium);
  }

  .toc-title {
    font-size: var(--font_size_default);
  }

  .toc-item-h3 {
    margin-left: var(--gap_small);
  }
}

.post-footer {
  margin-top: var(--gap_large);
  padding-top: var(--gap_large);
  border-top: 1px solid var(--color_grey_light);
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap_small);
  justify-content: flex-start;
}

.post-tag {
  display: inline-block;
  padding: 6px 14px;
  background: var(--color_grey_ultra_light);
  color: var(--color_grey_ultra_dark);
  border-radius: var(--radius_small);
  font-size: var(--font_size_small);
  font-weight: 400;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.post-tag:hover {
  background: var(--color_red_ultra_light);
  color: var(--color_red_active);
  border-color: var(--color_red_light);
  transform: translateY(-1px);
}

.post-content {
  line-height: 1.7;
}

.post-content h1 {
  margin-top: 0;
}

.post-content h2 {
  margin-top: 40px;
  padding-top: var(--gap_large);
  scroll-margin-top: 80px;
}

.post-content h2[id],
.post-content h3[id] {
  position: relative;
}

.post-content h3 {
  margin-top: 30px;
  scroll-margin-top: 80px;
}

.post-content > *:first-child {
  margin-top: 0;
}

.post-content > *:last-child {
  margin-bottom: 0;
}

/* Responsive typography */
@media (max-width: 768px) {
  h1 {
    font-size: 28px;
  }
  
  h2 {
    font-size: 22px;
  }
  
  h3 {
    font-size: var(--font_size_default);
  }
  
  body {
    font-size: var(--font_size_default);
  }

  .post-title {
    font-size: 28px;
  }

  .post {
    padding: var(--padding_small);
  }
}

@media (max-width: 500px) {
  h1 {
    font-size: 24px;
  }
  
  h2 {
    font-size: 20px;
  }
  
  body {
    font-size: var(--font_size_small);
  }

  .post-title {
    font-size: 24px;
  }

  .breadcrumbs {
    font-size: 12px;
  }
}

/* Home Page Styles */
.home-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0;
}

.home-page header {
  margin-bottom: var(--padding_large);
}

/* Hero Section */
.hero-section {
  text-align: center;
  padding: var(--padding_large) 0;
  margin-bottom: var(--padding_large);
}

.hero-title {
  font-size: 48px;
  font-weight: 700;
  color: var(--color_black);
  margin: 0 0 var(--gap_medium) 0;
  line-height: 1.2;
}

.hero-subtitle {
  font-size: var(--font_size_medium);
  color: var(--color_grey_ultra_dark);
  font-weight: 400;
  line-height: 1.6;
  margin: 0;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* Category Filter */
.category-filter {
  display: flex;
  gap: 8px;
  margin-bottom: 32px;
  padding: 20px 0;
  flex-wrap: wrap;
  border-bottom: 1px solid #E5E5E5;
  position: sticky;
  top: 0;
  background: var(--color_grey_ultra_light);
  z-index: 10;
}

.filter-btn {
  padding: 8px 16px;
  background: var(--color_white);
  border: 1px solid #E5E5E5;
  border-radius: 20px;
  font-family: 'Onest', sans-serif;
  font-size: 15px;
  font-weight: 400;
  color: #666666;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-btn:hover {
  border-color: var(--color_red_default);
  color: var(--color_red_default);
  background: var(--color_white);
}

.filter-btn.active {
  background: var(--color_red_default);
  color: var(--color_white);
  border-color: var(--color_red_default);
  font-weight: 500;
}

/* Articles Grid */
.articles-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px 20px;
  margin-bottom: var(--padding_large);
  align-items: start;
}

/* Article Card */
.article-card {
  background: var(--color_white);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0;
}

.article-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  transform: translateY(-2px);
}

.article-card-link {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  height: 100%;
  cursor: pointer;
  border-bottom: none;
  padding-bottom: 0;
}

.article-card-image {
  width: 100%;
  height: 220px;
  overflow: hidden;
  background: var(--color_grey_ultra_light);
  position: relative;
}

.article-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  margin: 0;
  display: block;
}

.article-card:hover .article-card-image img {
  transform: scale(1.03);
}

.article-card-image-placeholder {
  background: var(--color_grey_ultra_light);
  display: flex;
  align-items: center;
  justify-content: center;
}

.article-card-content {
  padding: 10px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.article-card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  padding-top: 10px;
  font-size: 13px;
  flex-wrap: wrap;
}

.article-card-category {
  background: #F5F5F5;
  color: #666666;
  padding: 4px 10px;
  border-radius: 6px;
  font-weight: 400;
  font-size: 12px;
  line-height: 1.4;
}

.article-card-date {
  color: #999999;
  font-weight: 400;
  font-size: 13px;
}

.article-card-title {
  font-size: 18px;
  font-weight: 500;
  color: #1A1A1A;
  margin: 0 0 10px 0;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  letter-spacing: -0.01em;
}

.article-card-description {
  font-size: 15px;
  color: #666666;
  line-height: 1.5;
  margin: 0 0 16px 0;
  flex-grow: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-card-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid #F0F0F0;
}

.article-card-reading-time {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: #999999;
  font-weight: 400;
}

.article-card-reading-time .reading-time-icon {
  width: 14px;
  height: 14px;
  opacity: 0.7;
}

/* Responsive Grid */
@media (max-width: 1180px) {
  .articles-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 24px 20px;
  }
}

@media (max-width: 768px) {
  .home-page {
    padding: 0 var(--padding_small);
  }

  .hero-title {
    font-size: 36px;
  }

  .hero-subtitle {
    font-size: var(--font_size_default);
  }

  .articles-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .category-filter {
    position: relative;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: var(--gap_small);
  }

  .filter-btn {
    white-space: nowrap;
    font-size: var(--font_size_small);
    padding: 6px 12px;
  }

  .article-card-image {
    height: 200px;
  }
  
  .article-card-content {
    padding: 10px;
  }
}

@media (max-width: 500px) {
  .hero-title {
    font-size: 28px;
  }

  .hero-subtitle {
    font-size: var(--font_size_small);
  }

  .article-card-content {
    padding: 10px;
  }

  .article-card-title {
    font-size: var(--font_size_default);
  }

  .article-card-description {
    font-size: var(--font_size_small);
  }
}
