/* ==========================================================================
   Blog page (Figma 217:342)
   Container 1224px (locked), dark theme
   ========================================================================== */

.blog-page {
  padding-top: 64px;
  padding-bottom: 80px;
  gap: 24px;
}

/* ----- Page title (Figma "Блог", 36/110% Bold) ----- */
.blog-page__title {
  margin: 0;
  font-family: var(--font-main);
  font-size: 36px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--text);
}

/* ----- Tag filters toolbar (Figma Frame 277) ----- */
.blog-toolbar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Mobile "Показать теги" — same pattern as category .filter-btn */
.blog-tags-toggle {
  display: none;
  width: 100%;
}

.blog-filters {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.blog-filters__row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

/* Single tag (Figma Frame 35, h=43, padding 8/16, radius 9, fs 18 Medium) */
.blog-filter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 43px;
  padding: 8px 16px;
  border-radius: 9px;
  background: var(--bg-2);
  border: 1px solid var(--green);
  color: var(--text);
  font-family: var(--font-main);
  font-size: 18px;
  font-weight: 500;
  line-height: 1.5;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--tr), border-color var(--tr), color var(--tr), opacity var(--tr);
  box-sizing: border-box;
}
.blog-filter:hover {
  background: rgba(15, 156, 77, 0.12);
  color: var(--text);
  text-decoration: none;
}

.blog-filter--red {
  border-color: var(--red);
}
.blog-filter--red:hover {
  background: rgba(143, 23, 67, 0.12);
}

/* Active: filled by color */
.blog-filter--active {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}
.blog-filter--active:hover {
  background: var(--green);
  color: #fff;
  opacity: 0.92;
}
.blog-filter--red.blog-filter--active {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}
.blog-filter--red.blog-filter--active:hover {
  background: var(--red);
  color: #fff;
  opacity: 0.92;
}

[data-theme="light"] .blog-filter {
  background: var(--bg);
}
[data-theme="light"] .blog-filter:hover {
  background: rgba(15, 156, 77, 0.1);
}
[data-theme="light"] .blog-filter--red:hover {
  background: rgba(143, 23, 67, 0.1);
}
[data-theme="light"] .blog-filter--active,
[data-theme="light"] .blog-filter--active:hover {
  background: var(--green);
  color: #fff;
}
[data-theme="light"] .blog-filter--red.blog-filter--active,
[data-theme="light"] .blog-filter--red.blog-filter--active:hover {
  background: var(--red);
  color: #fff;
}

/* ----- Articles grid (3 cols × 2 rows, gap 24) ----- */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 8px;
}

/* Reuse .blog-card from home.css, but in grid context fix flex-basis */
.blog-grid .blog-card {
  flex: initial;
}

/* ----- Empty state (Figma 1054:9612) ----- */
/* Title + filters remain visible; only the grid is replaced by centered text. */
.blog-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-top: 8px;
  text-align: center;
}
.blog-empty__title {
  margin: 0;
  font-family: var(--font-main);
  font-size: 28px;
  font-weight: 500;
  line-height: 1.1;
  color: var(--text);
}

/* ==========================================================================
   Responsive — strictly by Figma mockups
   Tablet 720  (903:8223):  content 640, title 24px, filters 4 rows,
                            grid 2 cols × card 310×553, gap 20
   Mobile 360  (553:3428):  content 320, title 22px, tag dropdown 320×48,
                            grid 1 col × card 320×529, gap 12
   ========================================================================== */

/* ---------- TABLET (max-width: 1199px) ---------- */
@media (max-width: 1199px) {
  .blog-page {
    padding-top: 32px;
    padding-bottom: 48px;
    gap: 20px;
    padding-inline: var(--container-px);
  }

  /* title 24 */
  .blog-page__title { font-size: 24px; line-height: 1.2; }

  /* filters: same 2 rows, but flex-wrap reflows into 3-4 per row */
  .blog-filters { gap: 16px; }
  .blog-filters__row { gap: 12px; }
  .blog-filter { font-size: 16px; height: 40px; }

  /* 2-col grid, card 310×553, gap 20 */
  .blog-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-top: 0;
  }

  /* Card body scaled to match Figma: body padding 12, content gap tighter */
  .blog-card { border-radius: 16px; }
  .blog-card__cover { aspect-ratio: 310 / 234; height: auto; }
  .blog-card__body { padding: 12px; gap: 16px; }
  .blog-card__content { min-height: 178px; }
  .blog-card__main { margin-top: 16px; gap: 10px; }
  .blog-card__title { font-size: 18px; line-height: 1.2; }
  .blog-card__excerpt { font-size: 13px; line-height: 1.45; }
  .blog-card__meta { height: 21px; }

  /* Empty state compact */
  .blog-empty { margin-top: 0; }
  .blog-empty__title { font-size: 24px; }
}

/* ---------- MOBILE (max-width: 767px) ---------- */
@media (max-width: 767px) {
  .blog-page {
    padding-top: 20px;
    padding-bottom: 32px;
    gap: 16px;
    padding-inline: var(--container-px);
  }

  /* title 22 (Figma 26 line-height) */
  .blog-page__title { font-size: 22px; line-height: 1.18; }

  /* Mobile: toggle button + collapsible tag panel */
  .blog-tags-toggle { display: inline-flex; }
  .blog-filters { display: none; gap: 12px; }
  .blog-toolbar.is-tags-open .blog-filters { display: flex; }
  .blog-tags-toggle[aria-expanded="true"] { border-color: var(--red); }
  .blog-filters__row { gap: 8px; }
  .blog-filter {
    height: 36px;
    padding: 6px 12px;
    font-size: 14px;
    border-radius: 8px;
  }

  /* 1-col grid */
  .blog-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 0;
  }

  /* Compact cards: height follows content (1-col feed, uneven heights OK) */
  .blog-card { border-radius: 12px; height: auto; }
  .blog-card__cover { aspect-ratio: 320 / 234; height: auto; }
  .blog-card__body { padding: 12px; gap: 12px; flex: none; }
  .blog-card__content { min-height: 0; height: auto; }
  .blog-card__main { margin-top: 12px; gap: 8px; }
  .blog-card__title { font-size: 16px; line-height: 1.25; }
  .blog-card__excerpt { font-size: 12px; line-height: 1.4; }
  .blog-card__meta { height: auto; min-height: 21px; }

  /* Empty state compact */
  .blog-empty { margin-top: 0; }
  .blog-empty__title { font-size: 20px; }
}
