/* ============================================================
   news-blog.css — раздел «Блог» (/blog/ список + /blog/<id>/ статья)
   Дизайн-система ВЭР v2.9. Реализация по спецификации web-designer.
   Всё скоупится под .tg-blog / .tg-article, префикс классов tg- —
   чтобы не пересекаться с общими стилями сайта. Mobile-first.
   ============================================================ */
.tg-blog, .tg-article{
  --tg-yellow:#FFCE00;
  --tg-dark:#1C1F24;
  --tg-cream:#EFEAEA;
  --tg-charcoal:#363636;
  --tg-border:#D9D9D9;
  --tg-muted:#767676;              /* дата — приглушённая, AA-контрастная */
  --tg-card-bg:#fff;
  --tg-r-sm:8px; --tg-r-md:15px; --tg-r-lg:20px; --tg-r-pill:100px;
  --tg-shadow-soft:0 2px 8px rgba(28,31,36,.07);
  --tg-shadow-med:0 8px 24px rgba(0,0,0,.10);
}

/* ---------- заголовок раздела ---------- */
.tg-blog-head{ padding-top:24px; }
.tg-blog-h1{
  font-family:'Manrope',sans-serif; font-weight:700; font-size:32px; line-height:1.1;
  text-transform:uppercase; letter-spacing:.01em; color:#000; margin:0;
}
.tg-blog-intro{
  font-family:'Inter',sans-serif; font-weight:300; font-size:17px; line-height:1.55;
  color:var(--tg-charcoal); max-width:680px; margin:16px 0 0;
}
.tg-blog-intro p{ margin:0 0 12px; }
.tg-blog-intro p:last-child{ margin-bottom:0; }

/* ---------- фильтр-чипы категорий ---------- */
.tg-chip-row{
  display:flex; gap:10px; overflow-x:auto; padding:28px 0 8px;
  scrollbar-width:none; -ms-overflow-style:none;
  margin-left:-2px; padding-left:2px; /* чтобы focus-ring первого чипа не обрезался */
}
.tg-chip-row::-webkit-scrollbar{ display:none; }
.tg-chip{
  font-family:'Manrope',sans-serif; font-weight:600; font-size:14px; white-space:nowrap;
  padding:11px 20px; border-radius:var(--tg-r-pill); border:1px solid var(--tg-border);
  background:#fff; color:var(--tg-charcoal); text-decoration:none;
  transition:.15s ease; flex:none; cursor:pointer;
  min-height:44px; display:inline-flex; align-items:center;
}
.tg-chip:hover{ background:var(--tg-yellow); border-color:var(--tg-yellow); color:#0A0A0A; text-decoration:none; transform:translateY(-1px); }
.tg-chip.is-active{ background:var(--tg-dark); border-color:var(--tg-dark); color:#fff; }
.tg-chip:focus-visible{ outline:2px solid var(--tg-yellow); outline-offset:2px; }

/* ---------- сетка карточек ---------- */
.tg-card-grid{
  display:grid; grid-template-columns:1fr; gap:24px; margin-top:24px;
}
@media (min-width:641px){ .tg-card-grid{ grid-template-columns:repeat(2,1fr); } }
@media (min-width:1001px){ .tg-card-grid{ grid-template-columns:repeat(3,1fr); } }

/* ---------- карточка статьи ---------- */
.tg-card{
  background:var(--tg-card-bg); border-radius:var(--tg-r-lg); box-shadow:var(--tg-shadow-soft);
  overflow:hidden; display:flex; flex-direction:column; text-decoration:none; color:inherit;
  transition:box-shadow .25s ease, transform .25s ease;
}
.tg-card:hover{ box-shadow:var(--tg-shadow-med); transform:translateY(-4px); text-decoration:none; color:inherit; }
/* карточка-ссылка: снимаем любое браузерное/глобальное подчёркивание на hover со всех текстовых узлов */
.tg-card, .tg-card:hover, .tg-card:focus, .tg-card:active, .tg-card:visited{ text-decoration:none; }
.tg-card *, .tg-card:hover *{ text-decoration:none; }
.tg-card:hover .tg-card-title, .tg-card:hover .tg-card-excerpt,
.tg-card:hover .tg-rt, .tg-card:hover .tg-date, .tg-card:hover .tg-dot{ text-decoration:none; color:inherit; }
.tg-card:focus-visible{ outline:2px solid var(--tg-yellow); outline-offset:3px; }
.tg-card-thumb{
  position:relative; aspect-ratio:16/9; overflow:hidden;
  background:linear-gradient(135deg,#2b2e33,#484d55);
  display:flex; align-items:center; justify-content:center;
}
.tg-card-img{ width:100%; height:100%; object-fit:cover; display:block; }
.tg-thumb-ph{ display:flex; align-items:center; justify-content:center; width:100%; height:100%; }
.tg-thumb-ph svg{ width:44%; max-width:120px; opacity:.5; }
.tg-cat-badge{
  position:absolute; top:16px; left:16px; z-index:2; background:var(--tg-yellow); color:#000;
  font-family:'Manrope',sans-serif; font-weight:700; font-size:11px; text-transform:uppercase;
  letter-spacing:.04em; padding:6px 13px; border-radius:var(--tg-r-pill);
}
.tg-card-body{ padding:24px; display:flex; flex-direction:column; gap:10px; flex:1; }
.tg-card-title{
  font-family:'Manrope',sans-serif; font-weight:700; font-size:19px; line-height:1.32; color:#0A0A0A; margin:0;
  display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden;
}
.tg-card-excerpt{
  font-family:'Inter',sans-serif; font-weight:400; font-size:14.5px; line-height:1.5; color:var(--tg-charcoal); margin:0;
  display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden;
}
.tg-card-meta{ display:flex; align-items:center; gap:8px; font-size:13px; margin-top:auto; padding-top:4px; }
.tg-rt{ display:inline-flex; align-items:center; gap:5px; font-family:'Inter',sans-serif; font-weight:500; color:var(--tg-charcoal); }
.tg-rt svg{ width:14px; height:14px; flex:none; }
.tg-dot{ color:var(--tg-border); }
.tg-date{ font-family:'Inter',sans-serif; font-weight:400; color:var(--tg-muted); }

/* ---------- пустое состояние ---------- */
.tg-empty{
  margin:40px 0 64px; padding:48px 24px; text-align:center;
  border:1px dashed var(--tg-border); border-radius:var(--tg-r-lg); background:#fff;
}
.tg-empty h2{ font-family:'Manrope',sans-serif; font-weight:700; font-size:20px; color:#0A0A0A; margin:0 0 8px; }
.tg-empty p{ font-family:'Inter',sans-serif; font-weight:300; font-size:15px; color:var(--tg-charcoal); margin:0 0 20px; }
.tg-empty a{
  display:inline-flex; align-items:center; min-height:44px; padding:0 22px; border-radius:var(--tg-r-pill);
  background:var(--tg-dark); color:#fff; font-family:'Manrope',sans-serif; font-weight:600; font-size:14px; text-decoration:none;
}
.tg-empty a:hover{ background:#000; }

/* ---------- пагинация ---------- */
.tg-pager{ display:flex; align-items:center; justify-content:center; gap:8px; margin:56px 0 64px; flex-wrap:wrap; }
.tg-pg-btn{
  min-width:44px; height:44px; padding:0 6px; border-radius:var(--tg-r-sm); border:1px solid var(--tg-border);
  background:#fff; font-family:'Manrope',sans-serif; font-weight:600; font-size:14px; color:var(--tg-charcoal);
  display:inline-flex; align-items:center; justify-content:center; text-decoration:none; transition:.15s ease;
}
.tg-pg-btn:hover{ border-color:#000; transform:translateY(-1px); color:#000; }
.tg-pg-btn.is-current{ background:var(--tg-dark); border-color:var(--tg-dark); color:#fff; }
.tg-pg-btn.is-disabled{ opacity:.35; pointer-events:none; }
.tg-pg-btn:focus-visible{ outline:2px solid var(--tg-yellow); outline-offset:2px; }
.tg-pg-dots{ color:#b3b3b3; font-size:14px; padding:0 2px; }

/* ============================================================
   Страница статьи /blog/<id>/
   ============================================================ */
.tg-article-top{ padding-top:20px; }
.tg-article-cat{
  display:inline-block; background:var(--tg-yellow); color:#000; font-family:'Manrope',sans-serif; font-weight:700;
  font-size:12px; text-transform:uppercase; letter-spacing:.04em; padding:6px 14px; border-radius:var(--tg-r-pill); margin-bottom:16px;
}
.tg-article-h1{
  font-family:'Manrope',sans-serif; font-weight:700; font-size:30px; line-height:1.18; color:#000; margin:0; max-width:820px;
}
.tg-article-meta{ display:flex; align-items:center; gap:10px; margin:16px 0 28px; font-size:14px; flex-wrap:wrap; }
.tg-article-meta .tg-rt svg{ width:16px; height:16px; }

.tg-hero-img{
  width:100%; max-width:780px; aspect-ratio:16/9; border-radius:var(--tg-r-lg); margin-bottom:28px; overflow:hidden;
  background:linear-gradient(135deg,#2b2e33,#4b515a); display:flex; align-items:center; justify-content:center;
}
.tg-hero-img img{ width:100%; height:100%; object-fit:cover; display:block; }
.tg-hero-img .tg-thumb-ph svg{ width:22%; max-width:140px; }

.tg-article-grid{ display:block; }

.tg-article-body{
  font-family:'Inter',sans-serif; font-weight:300; font-size:16px; line-height:1.75; color:var(--tg-charcoal); max-width:780px;
}
.tg-article-body p{ margin:0 0 24px; }
.tg-article-body h2{
  font-family:'Manrope',sans-serif; font-weight:700; font-size:22px; line-height:1.3; color:#0A0A0A; margin:48px 0 18px;
  scroll-margin-top:90px;
}
.tg-article-body h2:first-child{ margin-top:8px; }
.tg-article-body ol,.tg-article-body ul{ padding-left:22px; margin:0 0 24px; }
.tg-article-body li{ margin-bottom:10px; line-height:1.6; }
.tg-article-body a{
  color:#0A0A0A; text-decoration:underline; text-decoration-color:var(--tg-yellow);
  text-decoration-thickness:2px; text-underline-offset:3px;
}
.tg-article-body a:hover{ text-decoration-color:#000; }
.tg-article-body strong,.tg-article-body b{ font-weight:600; color:#0A0A0A; }
.tg-article-body img{ max-width:100%; height:auto; border-radius:var(--tg-r-md); }

/* blockquote -> callout */
.tg-article-body blockquote{
  background:var(--tg-cream); border-left:4px solid var(--tg-yellow); border-radius:0 12px 12px 0;
  padding:20px 24px; margin:32px 0; font-weight:300; font-size:16px; line-height:1.6; color:var(--tg-charcoal);
}
.tg-article-body blockquote p{ margin:0; }
.tg-article-body blockquote p + p{ margin-top:12px; }
.tg-article-body blockquote strong{ color:#0A0A0A; font-weight:600; }

/* table -> art-table (обёртывается в PHP в .tg-table-wrap>.tg-table-scroll) */
.tg-table-wrap{ border:1px solid var(--tg-border); border-radius:12px; overflow:hidden; margin:40px 0; }
.tg-table-scroll{ overflow-x:auto; -webkit-overflow-scrolling:touch; }
.tg-article-body table{ width:100%; border-collapse:collapse; font-family:'Inter',sans-serif; font-size:14.5px; min-width:520px; }
.tg-article-body th{
  background:var(--tg-dark); color:#fff; font-family:'Manrope',sans-serif; font-weight:600; font-size:13.5px;
  text-align:left; padding:13px 20px;
}
.tg-article-body td{ padding:13px 20px; color:var(--tg-charcoal); border-bottom:1px solid var(--tg-border); }
.tg-article-body tr:last-child td{ border-bottom:none; }
.tg-article-body tbody tr:nth-child(even) td{ background:#FAFAFA; }

/* ---------- TOC ---------- */
.tg-toc-desktop{ display:none; }
.tg-toc-mobile{ display:block; max-width:780px; margin:0 0 32px; }
.tg-toc-mobile summary{
  cursor:pointer; list-style:none; background:#fff; border:1px solid var(--tg-border); border-radius:var(--tg-r-lg);
  padding:16px 20px; font-family:'Manrope',sans-serif; font-weight:700; font-size:14px;
  display:flex; justify-content:space-between; align-items:center; gap:12px;
}
.tg-toc-mobile summary::-webkit-details-marker{ display:none; }
.tg-toc-mobile summary .tg-chev{ transition:transform .2s ease; color:var(--tg-muted); }
.tg-toc-mobile[open] summary{ border-radius:var(--tg-r-lg) var(--tg-r-lg) 0 0; }
.tg-toc-mobile[open] summary .tg-chev{ transform:rotate(180deg); }
.tg-toc-inner{ border:1px solid var(--tg-border); border-top:none; border-radius:0 0 var(--tg-r-lg) var(--tg-r-lg); padding:8px 20px 16px; }
.tg-toc-label{ font-family:'Manrope',sans-serif; font-weight:700; font-size:12px; text-transform:uppercase; letter-spacing:.06em; color:#9a9aa2; margin:0 0 14px; }
.tg-toc-list{ list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:10px; }
.tg-toc-list a{
  font-family:'Inter',sans-serif; font-size:14.5px; color:var(--tg-charcoal); text-decoration:none;
  display:block; padding:6px 0 6px 12px; border-left:2px solid transparent;
}
.tg-toc-list a:hover{ color:#000; }
.tg-toc-list a.is-active{ color:#000; font-weight:500; border-left-color:var(--tg-yellow); }

/* ---------- похожие статьи ---------- */
.tg-related{ margin-top:80px; padding-top:56px; border-top:1px solid var(--tg-border); }
.tg-related-title{ font-family:'Manrope',sans-serif; font-weight:700; font-size:24px; color:#000; margin:0 0 24px; }

/* ============================================================
   Desktop-раскладка статьи: контент 780px + sticky TOC справа
   ============================================================ */
@media (min-width:1024px){
  .tg-blog-h1{ font-size:56px; }
  .tg-blog-intro{ font-size:20px; }
  .tg-article-h1{ font-size:44px; }
  .tg-article-body h2{ font-size:28px; margin:64px 0 24px; }
  .tg-article-grid{
    display:grid; grid-template-columns:minmax(0,780px) 1fr; gap:64px; align-items:start;
  }
  .tg-toc-mobile{ display:none; }
  .tg-toc-desktop{ display:block; }
  .tg-toc{
    position:sticky; top:24px; background:#fff; border:1px solid var(--tg-border);
    border-radius:var(--tg-r-lg); padding:24px; box-shadow:var(--tg-shadow-soft);
  }
  .tg-related .tg-card-grid{ grid-template-columns:repeat(3,1fr); }
}

@media (prefers-reduced-motion: reduce){
  .tg-card, .tg-chip, .tg-pg-btn, .tg-toc-mobile summary .tg-chev{ transition:none !important; }
  .tg-card:hover, .tg-chip:hover, .tg-pg-btn:hover{ transform:none; }
}
