/* ==========================================================================
   БЛОГ (blog.php)
   По макету: заголовок с поиском, чипы категорий, крупная карточка статьи,
   сетка 3 в ряд, сайдбар «Популярные статьи» + «Не нашли тему».
   ========================================================================== */

/* --- шапка раздела: заголовок слева, поиск справа --- */
.blog-head{
  display:flex;align-items:flex-end;justify-content:space-between;
  gap:24px;margin-bottom:22px;
}
.blog-head__lead{
  margin:6px 0 0;font-size:15px;color:var(--muted);max-width:60ch;
}
.blog-search{
  position:relative;flex:none;width:300px;
}
.blog-search .field{margin-bottom:0;padding-left:42px}
.blog-search__ic{
  position:absolute;left:14px;top:50%;transform:translateY(-50%);
  width:18px;height:18px;color:var(--muted-2);pointer-events:none;
}

/* --- чипы категорий --- */
.blog-chips{
  display:flex;flex-wrap:wrap;gap:8px;margin-bottom:24px;
}
.blog-chip{
  display:inline-flex;align-items:center;gap:7px;
  height:36px;padding:0 15px;border:1px solid var(--border);border-radius:var(--pill);
  background:#fff;color:var(--navy);
  font-family:inherit;font-size:13.5px;font-weight:600;white-space:nowrap;
  cursor:pointer;transition:background .18s,border-color .18s,color .18s;
}
.blog-chip:hover{border-color:#bcd0e4}
.blog-chip.is-active{background:var(--blue);border-color:var(--blue);color:#fff}
.blog-chip__n{
  min-width:20px;height:20px;padding:0 6px;border-radius:var(--pill);
  background:var(--panel);color:var(--muted);
  display:inline-flex;align-items:center;justify-content:center;
  font-size:11.5px;font-weight:700;
}
.blog-chip.is-active .blog-chip__n{background:rgba(255,255,255,.22);color:#fff}

/* --- карточка статьи --- */
.bpost{
  display:flex;flex-direction:column;
  border:1px solid var(--border);border-radius:var(--r-lg);background:#fff;
  overflow:hidden;
  transition:border-color .18s;
}
.bpost:hover{border-color:#cfdcea}
.bpost__media{
  position:relative;display:block;aspect-ratio:16 / 9;background:var(--panel);
}
.bpost__media img{width:100%;height:100%;object-fit:cover;display:block}
.bpost__tag{
  position:absolute;top:12px;left:12px;z-index:2;
  display:inline-flex;align-items:center;height:26px;padding:0 12px;
  border-radius:var(--pill);background:rgba(255,255,255,.94);
  font-size:12px;font-weight:600;color:var(--navy);
}
.bpost__body{display:flex;flex-direction:column;flex:1;padding:16px 18px 18px}
.bpost__meta{
  display:flex;align-items:center;gap:8px;flex-wrap:wrap;
  font-size:12.5px;color:var(--muted);margin-bottom:8px;
}
.bpost__meta .ic{width:15px;height:15px;color:var(--muted-2)}
.bpost__name{
  margin:0 0 8px;font-size:17px;font-weight:700;color:var(--navy);line-height:1.3;
}
.bpost__name a{color:inherit}
.bpost__name a:hover{color:var(--blue-bright)}
.bpost__text{
  margin:0 0 14px;font-size:13.5px;line-height:1.45;color:var(--muted);
  display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;
}
.bpost__foot{
  display:flex;align-items:center;gap:10px;margin-top:auto;
  padding-top:12px;border-top:1px solid var(--border-soft);
}
/* монограмма автора: фото не используем — чужие обрезанные лица выглядят
   хуже, чем аккуратные инициалы, и это честнее для прототипа */
.bpost__ava{
  flex:none;width:36px;height:36px;border-radius:50%;
  display:flex;align-items:center;justify-content:center;
  font-size:12.5px;font-weight:700;color:#fff;letter-spacing:.02em;
}
.bpost__ava--blue{background:var(--blue)}
.bpost__ava--navy{background:var(--navy)}
.bpost__ava--green{background:#0aa653}
.bpost__author{font-size:13px;font-weight:600;color:var(--navy);line-height:1.25}
.bpost__role{display:block;font-size:11.5px;font-weight:400;color:var(--muted)}
.bpost__views{
  display:inline-flex;align-items:center;gap:6px;margin-left:auto;
  font-size:12.5px;color:var(--muted);white-space:nowrap;
}
.bpost__views .ic{width:15px;height:15px}

/* --- крупная карточка (первая) --- */
.bpost--lead{flex-direction:row;margin-bottom:20px}
.bpost--lead .bpost__media{flex:none;width:48%;aspect-ratio:auto}
.bpost--lead .bpost__body{padding:24px 26px}
.bpost--lead .bpost__name{font-size:23px;line-height:1.25}
.bpost--lead .bpost__text{
  font-size:14.5px;-webkit-line-clamp:4;margin-bottom:18px;
}
.bpost--lead .bpost__foot{border-top:0;padding-top:0}

/* --- сетка статей --- */
.blog-grid{
  display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:20px;
}
.blog-more{
  display:flex;flex-direction:column;align-items:center;gap:8px;
  margin:26px 0 0;
}
.blog-more__btn{
  min-width:190px;height:46px;padding:0 26px;
  border:1.5px solid var(--blue);border-radius:var(--r);background:#fff;
  color:var(--blue);font-family:inherit;font-size:14.5px;font-weight:600;
  cursor:pointer;transition:background .18s,color .18s;
}
.blog-more__btn:hover{background:var(--blue);color:#fff}
.blog-more__note{font-size:12.5px;color:var(--muted)}

/* --- раскладка: контент + сайдбар --- */
.blog-layout{
  display:grid;grid-template-columns:minmax(0,1fr) 316px;gap:24px;
  align-items:start;
}

/* ==========================================================================
   САЙДБАР
   ========================================================================== */
.blog-side{
  display:flex;flex-direction:column;gap:16px;
}
.bside{
  border:1px solid var(--border);border-radius:var(--r-lg);background:#fff;
  padding:18px 20px;
}
.bside__h{margin:0 0 14px;font-size:17px;font-weight:700;color:var(--navy)}

/* популярные статьи — нумерованный список */
.bside__item{
  display:flex;align-items:flex-start;gap:12px;
  padding:12px 0;border-top:1px solid var(--border-soft);
}
.bside__item:first-of-type{border-top:0;padding-top:0}
.bside__item:last-of-type{padding-bottom:0}
.bside__n{
  flex:none;width:20px;font-size:15px;font-weight:700;color:var(--blue-bright);
  line-height:1.35;
}
.bside__img{
  flex:none;width:64px;height:64px;border-radius:var(--r-sm);
  background:var(--panel);overflow:hidden;
}
.bside__img img{width:100%;height:100%;object-fit:cover;display:block}
.bside__body{flex:1;min-width:0}
.bside__name{
  display:block;font-size:13.5px;font-weight:600;color:var(--navy);line-height:1.3;
  margin-bottom:5px;
}
.bside__name:hover{color:var(--blue-bright)}
.bside__views{
  display:inline-flex;align-items:center;gap:6px;
  font-size:12px;color:var(--muted);
}
.bside__views .ic{width:14px;height:14px}

/* «Не нашли подходящую тему?» */
.bside--ask{
  display:flex;flex-direction:column;align-items:flex-start;gap:10px;
  background:var(--tint);
}
.bside--ask .bside__h{margin:0;font-size:16px;line-height:1.3}
.bside__text{margin:0;font-size:12.5px;line-height:1.45;color:var(--muted)}
.bside--ask .btn{width:100%;margin-top:4px}
.bside__ic{
  width:40px;height:40px;border-radius:var(--pill);background:#fff;
  color:var(--blue-bright);display:flex;align-items:center;justify-content:center;
}
.bside__ic .ic{width:21px;height:21px}

/* ==========================================================================
   МОБИЛЬНАЯ ВЕРСИЯ
   ========================================================================== */
@media (max-width:1023px){
  .blog-head{flex-direction:column;align-items:stretch;gap:14px}
  .blog-search{width:100%}
  /* чипы — горизонтальная лента */
  .blog-chips{
    flex-wrap:nowrap;overflow-x:auto;gap:8px;
    margin:0 calc(var(--gutter) * -1) 18px;
    padding:2px var(--gutter) 10px;
    scroll-padding:0 var(--gutter);
    -webkit-overflow-scrolling:touch;scrollbar-width:none;
  }
  .blog-chips::-webkit-scrollbar{display:none}
  .blog-chip{flex:none}

  /* крупная карточка становится обычной */
  .bpost--lead{flex-direction:column}
  .bpost--lead .bpost__media{width:100%;aspect-ratio:16 / 9}
  .bpost--lead .bpost__body{padding:16px 18px 18px}
  .bpost--lead .bpost__name{font-size:19px}
  .bpost--lead .bpost__text{font-size:13.5px;-webkit-line-clamp:3;margin-bottom:12px}
  .bpost--lead .bpost__foot{border-top:1px solid var(--border-soft);padding-top:12px}

  .blog-layout{grid-template-columns:1fr;gap:22px}
  .blog-grid{grid-template-columns:1fr;gap:14px}
  /* в сайдбаре на мобильном скрываем «Популярные» — дублируют ленту */
  .bside:not(.bside--ask){display:none}
  /* на мобильном показываем 3 статьи, остальные по кнопке */
  .blog-grid .bpost[hidden]{display:none}
}
