/* Обёртка обложки не должна участвовать в раскладке карточки:
   у самой картинки отрицательные поля во всю её ширину. */
picture { display: contents; }
/* Блог billing.smit34.ru — те же токены, что на главной, но без её тяжёлой вёрстки. */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-800: #1e293b;
  --slate-900: #0f172a;
  --slate-950: #020617;
  --emerald-400: #34d399;
  --emerald-500: #10b981;
  --emerald-600: #059669;
  --teal-400: #2dd4bf;

  --bg-body: #020617;
  --bg-card: rgba(30, 41, 59, 0.5);
  --bg-card-border: rgba(255, 255, 255, 0.08);
  --bg-header: rgba(2, 6, 23, 0.85);
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --border-light: rgba(255, 255, 255, 0.07);
  --code-bg: #0f172a;
}

[data-theme="light"] {
  /* на светлом фоне мятный акцент нечитаем — берём тёмную зелень */
  --emerald-400: #047857;
  --emerald-500: #065f46;
  --bg-body: #f8fafc;
  --bg-card: rgba(255, 255, 255, 0.75);
  --bg-card-border: rgba(0, 0, 0, 0.08);
  --bg-header: rgba(248, 250, 252, 0.88);
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --border-light: rgba(0, 0, 0, 0.07);
  --code-bg: #1e293b;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--emerald-400); text-decoration: none; }
a:hover { color: var(--emerald-500); }
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--emerald-400); outline-offset: 3px; border-radius: 6px;
}

.container { max-width: 1180px; margin: 0 auto; padding: 0 24px; }
.narrow { max-width: 760px; }

/* ---- Заголовок раздела ---- */
.bhead { padding: 64px 0 28px; }
.bhead h1 { font-size: clamp(2rem, 4vw, 3rem); font-weight: 800; line-height: 1.15; letter-spacing: -.02em; }
.bhead p { margin-top: 14px; color: var(--text-secondary); max-width: 720px; }
.bkicker {
  display: inline-block; margin-bottom: 14px; padding: 6px 14px; border-radius: 999px;
  border: 1px solid rgba(16, 185, 129, .3); background: rgba(16, 185, 129, .08);
  color: var(--emerald-400); font-size: .78rem; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase;
}

/* ---- Карточки постов ---- */
.bgrid {
  display: grid; gap: 22px; padding: 12px 0 72px;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
}
.bcard {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--bg-card); border: 1px solid var(--bg-card-border);
  border-radius: 16px; padding: 0 24px 24px; color: inherit;
  transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease;
}
.bcard:hover {
  transform: translateY(-3px); border-color: rgba(16, 185, 129, .35);
  box-shadow: 0 18px 40px rgba(0, 0, 0, .25); color: inherit;
}
.bcard-cover {
  display: block; width: calc(100% + 48px); height: auto; margin: 0 -24px 18px;
  aspect-ratio: 16/9; object-fit: cover; background: #060d14;
  /* карточка — флекс-колонка, и без этого картинка ужимается обратно
     в поля; max-width снимаем, иначе общее правило для img режет вынос
     за padding обратно до ширины контента */
  flex-shrink: 0; max-width: none;
}
/* Тег и дата лежат на обложке в левом верхнем углу. Под каждым — своя
   подложка: иллюстрации в тёмной и светлой теме разные, одна и та же
   плашка на обеих читалась бы плохо. */
.bcard { position: relative; }
.bcard-meta {
  position: absolute; top: 14px; left: 14px; z-index: 2;
  display: flex; gap: 8px; align-items: center; font-size: .8rem;
  color: var(--text-muted);
}
.bcard-meta time {
  padding: 3px 9px; border-radius: 999px;
  background: rgba(2, 6, 23, .62); color: #e2e8f0;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.bcard .btag { background: rgba(2, 6, 23, .62); color: #6ee7b7;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
[data-theme="light"] .bcard-meta time {
  background: rgba(255, 255, 255, .82); color: #334155;
}
[data-theme="light"] .bcard .btag {
  background: rgba(255, 255, 255, .82); color: #047857;
}
.btag {
  padding: 3px 10px; border-radius: 999px; font-weight: 600;
  background: rgba(16, 185, 129, .12); color: var(--emerald-400);
}
.bcard h2, .bcard h3 { margin: 12px 0 8px; font-size: 1.22rem; font-weight: 700; line-height: 1.3; }
.bcard p { color: var(--text-secondary); font-size: .96rem; }
.bcard-more { margin-top: auto; padding-top: 16px; color: var(--emerald-400); font-weight: 600; font-size: .92rem; }

/* ---- Статья ---- */
.bpost { padding: 56px 0 80px; }
.bpost-cover {
  display: block; width: 100%; height: auto; aspect-ratio: 16/9; object-fit: cover;
  border-radius: 14px; border: 1px solid var(--border-light);
  margin: 0 0 30px; background: #060d14;
}
.bpost .btag { display: inline-block; margin-bottom: 14px; }
.bpost h1 { font-size: clamp(1.9rem, 3.6vw, 2.7rem); font-weight: 800; line-height: 1.2; letter-spacing: -.02em; }
.bpost .bmeta { margin: 16px 0 34px; color: var(--text-muted); font-size: .9rem; display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.bpost h2 { margin: 38px 0 12px; font-size: 1.5rem; font-weight: 700; line-height: 1.3; }
.bpost h3 { margin: 28px 0 10px; font-size: 1.16rem; font-weight: 700; }
.bpost p { margin-bottom: 16px; color: var(--text-secondary); }
.bpost ul, .bpost ol { margin: 0 0 18px 22px; color: var(--text-secondary); }
.bpost li { margin-bottom: 8px; }
.bpost strong { color: var(--text-primary); }
.bpost blockquote {
  margin: 22px 0; padding: 16px 20px; border-left: 3px solid var(--emerald-500);
  background: rgba(16, 185, 129, .06); border-radius: 0 12px 12px 0; color: var(--text-secondary);
}
.bpost code {
  background: var(--code-bg); color: #7fe0ae; padding: 2px 7px;
  border-radius: 6px; font-size: .9em; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.bpost table { width: 100%; border-collapse: collapse; margin: 18px 0 22px; font-size: .95rem; }
.bpost th, .bpost td { padding: 10px 12px; border-bottom: 1px solid var(--border-light); text-align: left; vertical-align: top; }
.bpost th { color: var(--text-primary); font-weight: 600; }
.bpost td { color: var(--text-secondary); }
.bpost img { max-width: 100%; border-radius: 12px; border: 1px solid var(--border-light); }
/* Обложка карточки — не иллюстрация в тексте: она вынесена за поля карточки
   на всю её ширину, поэтому общее правило для картинок статьи её не касается. */
.bpost .bcard-cover, .brel-grid .bcard-cover {
  max-width: none; border: 0; border-radius: 0;
}

.bback { display: inline-block; margin-bottom: 14px; color: var(--text-muted); font-size: .92rem; }
.bback:hover { color: var(--emerald-400); }

/* ---- Врезка с призывом ---- */
.bcta {
  margin: 44px 0 0; padding: 26px 28px; border-radius: 16px;
  border: 1px solid rgba(16, 185, 129, .25); background: rgba(16, 185, 129, .07);
}
.bcta h3 { margin: 0 0 8px; font-size: 1.15rem; }
.bcta p { margin: 0 0 16px; color: var(--text-secondary); }
.bcta a { font-weight: 600; }

/* ---- Подвал ---- */
.bfoot {
  border-top: 1px solid var(--border-light); padding: 28px 0 44px;
  color: var(--text-muted); font-size: .9rem;
}
.bfoot .container { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; }
.bfoot a { color: var(--text-muted); }
.bfoot a:hover { color: var(--emerald-400); }
.bfoot .sep { margin-left: auto; }

@media (max-width: 640px) {
  .bhead { padding: 40px 0 20px; }
  .bh-nav { gap: 14px; }
  .bh-nav a { font-size: .9rem; }
  .bpost { padding: 34px 0 60px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  html { scroll-behavior: auto; }
}

/* ---- Хештеги под статьёй ---- */
.bhashes { display: flex; flex-wrap: wrap; gap: 8px; margin: 30px 0 4px; }
.bhash {
  padding: 5px 12px; border-radius: 999px; font-size: .88rem; font-weight: 500;
  border: 1px solid var(--bg-card-border); background: var(--bg-card);
  color: var(--text-secondary);
}
.bhash:hover { border-color: rgba(16,185,129,.4); color: var(--emerald-400); }

/* ---- Читайте также ---- */
.brelated { margin: 56px 0 12px; padding-top: 36px; border-top: 1px solid var(--border-light); }
.brelated h2 { font-size: 1.4rem; font-weight: 700; margin-bottom: 20px; }
.brel-grid {
  display: grid; gap: 20px; padding-bottom: 30px;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

/* ---- Фильтр по тегу в списке ---- */
.bfilter {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 4px 0 18px; color: var(--text-muted); font-size: .95rem;
}
.bfilter strong { color: var(--emerald-400); }
.bempty { color: var(--text-muted); padding: 8px 0 60px; }

/* ---- Схемы и код ---- */
.bmermaid {
  margin: 26px 0 30px; padding: 22px 18px; border-radius: 14px;
  border: 1px solid var(--bg-card-border); background: var(--bg-card);
  overflow-x: auto;                 /* широкая схема скроллится внутри блока */
}
.bmermaid pre.mermaid { margin: 0; background: none; text-align: center; }
.bmermaid svg { max-width: 100%; height: auto; }
/* mermaid считает размер шрифта сам — возвращаем читаемый кегль */
.bmermaid .nodeLabel, .bmermaid .edgeLabel, .bmermaid .label { font-size: 15px !important; }
.bmermaid .edgeLabel { background: transparent !important; }
.bcode {
  margin: 20px 0 24px; padding: 16px 18px; border-radius: 12px;
  background: var(--code-bg); border: 1px solid var(--border-light);
  overflow-x: auto; font-size: .9rem; line-height: 1.55;
}
.bcode code { background: none; padding: 0; color: #cbd5e1; }


/* ---- Светлая тема: схемы и код читаются иначе ---- */
[data-theme="light"] .bmermaid { background: #fff; }
[data-theme="light"] .bmermaid .nodeLabel,
[data-theme="light"] .bmermaid .edgeLabel,
[data-theme="light"] .bmermaid .label,
[data-theme="light"] .bmermaid .edgeLabel p,
[data-theme="light"] .bmermaid foreignObject div { color: #0f172a !important; fill: #0f172a !important; }
[data-theme="light"] .bmermaid .edgeLabel rect { fill: #ffffff !important; }
[data-theme="light"] .bcode code { color: #e2e8f0; }
[data-theme="light"] .bcard-cover, [data-theme="light"] .bpost-cover { background: #e2e8f0; }

[data-theme="light"] .btag,
[data-theme="light"] .bkicker { background: rgba(4,120,87,.10); color: #047857; }
[data-theme="light"] .bmermaid { border-color: rgba(0,0,0,.08); }

/* ---- Шапка: копия главной, чтобы блог не выглядел отдельным сайтом ---- */
.header {
      position: fixed;
      top: 0; left: 0; right: 0;
      height: 64px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 40px;
      z-index: 100;
      background: rgba(2, 6, 23, 0.8);
      backdrop-filter: blur(16px);
      border-bottom: 1px solid rgba(255,255,255,0.06);
      transition: background .3s;
    }
.theme-toggle {
      width: 38px; height: 38px;
      border-radius: 10px;
      border: 1px solid rgba(255,255,255,0.15);
      background: rgba(255,255,255,0.08);
      color: var(--slate-300);
      font-size: 1.1rem;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: background .2s, transform .2s;
      flex-shrink: 0;
    }
.mobile-toggle {
      display: none;
      width: 38px; height: 38px;
      border-radius: 10px;
      border: 1px solid rgba(255,255,255,0.15);
      background: rgba(255,255,255,0.08);
      color: var(--slate-300);
      font-size: 1.3rem;
      cursor: pointer;
      align-items: center;
      justify-content: center;
      transition: background .2s;
      flex-shrink: 0;
    }
.mobile-menu {
      display: flex;
      position: fixed;
      top: 0; left: 0; right: 0; bottom: 0;
      z-index: 200;
      background: rgba(2, 6, 23, 0.95);
      backdrop-filter: blur(24px) saturate(1.5);
      -webkit-backdrop-filter: blur(24px) saturate(1.5);
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 8px;
      pointer-events: none;
      /* на главной скрытие описано отдельным правилом — здесь оно обязательно,
         иначе полупрозрачный оверлей накрывает страницу и она выглядит пустой */
      opacity: 0;
      visibility: hidden;
      transition: opacity .25s ease, visibility .25s ease;
    }
.header-logo {
      display: flex;
      align-items: center;
      gap: 12px;
    }
.header-logo-icon {
      width: 38px; height: 38px;
      background: linear-gradient(135deg, var(--emerald-500), var(--teal-400));
      border-radius: 10px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-weight: 800;
      font-size: 1.1rem;
      color: #fff;
      box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
    }
.header-logo-text {
      font-size: 1.15rem;
      font-weight: 700;
      letter-spacing: .3px;
    }
.header-logo-text span {
      font-weight: 300;
      opacity: .7;
      margin-left: 4px;
    }
.header-nav {
      display: flex;
      align-items: center;
      gap: 32px;
    }
.header-nav a {
      font-size: .9rem;
      font-weight: 500;
      color: var(--slate-300);
      transition: color .2s;
    }
.header-nav a:hover { color: var(--emerald-400); }
.btn-header {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      padding: 10px 22px;
      background: linear-gradient(135deg, var(--emerald-500), var(--teal-400));
      color: #fff;
      font-weight: 600;
      font-size: .9rem;
      border-radius: 10px;
      border: none;
      cursor: pointer;
      transition: transform .2s, box-shadow .2s;
      box-shadow: 0 4px 20px rgba(16, 185, 129, 0.3);
    }
.btn-header:hover {
      transform: translateY(-2px);
      box-shadow: 0 8px 30px rgba(16, 185, 129, 0.4);
    }
.theme-toggle:hover {
      background: rgba(255,255,255,0.15);
      transform: scale(1.05);
    }
[data-theme="light"] .theme-toggle {
      border-color: rgba(0,0,0,0.12);
      background: rgba(0,0,0,0.05);
      color: var(--slate-600);
    }
[data-theme="light"] .theme-toggle:hover {
      background: rgba(0,0,0,0.1);
    }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: inline; }
[data-theme="light"] .theme-toggle .icon-sun { display: inline; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }
[data-theme="light"] .mobile-toggle {
      border-color: rgba(0,0,0,0.12);
      background: rgba(0,0,0,0.05);
      color: var(--slate-600);
    }
[data-theme="light"] .mobile-menu {
      background: rgba(248, 250, 252, 0.97);
    }
.mobile-menu.open { pointer-events: auto; }
.mobile-menu a {
      font-size: 1.3rem;
      font-weight: 600;
      color: var(--slate-200);
      padding: 14px 32px;
      border-radius: 12px;
      transition: background .2s, color .2s;
    }
.mobile-menu a:hover {
      background: rgba(16, 185, 129, 0.1);
      color: var(--emerald-400);
    }
[data-theme="light"] .mobile-menu a { color: var(--text-primary); }
[data-theme="light"] .mobile-menu a:hover { color: var(--emerald-600); }
.mobile-menu .mobile-close {
      position: absolute;
      top: 16px; right: 20px;
      width: 44px; height: 44px;
      border: none;
      background: none;
      color: var(--slate-400);
      font-size: 1.8rem;
      cursor: pointer;
    }
[data-theme="light"] .mobile-menu .mobile-close { color: var(--slate-600); }
[data-theme="light"] .header-logo-text { color: var(--text-primary); }
[data-theme="light"] .header-nav a { color: var(--text-secondary); }
[data-theme="light"] .header-nav a:hover { color: var(--emerald-600); }
.mobile-menu.open {
      opacity: 1;
      visibility: visible;
    }
.mobile-menu a {
      opacity: 0;
      transform: translateY(20px);
      transition: opacity .4s cubic-bezier(.22,1,.36,1), transform .4s cubic-bezier(.22,1,.36,1), background .2s, color .2s;
    }
.mobile-menu.open a:nth-child(2) { opacity: 1; transform: translateY(0); transition-delay: .08s; }
.mobile-menu.open a:nth-child(3) { opacity: 1; transform: translateY(0); transition-delay: .14s; }
.mobile-menu.open a:nth-child(4) { opacity: 1; transform: translateY(0); transition-delay: .20s; }
.mobile-menu.open a:nth-child(5) { opacity: 1; transform: translateY(0); transition-delay: .26s; }
.mobile-menu.open a:nth-child(6) { opacity: 1; transform: translateY(0); transition-delay: .32s; }
.mobile-menu.open a:nth-child(7) { opacity: 1; transform: translateY(0); transition-delay: .38s; }
.mobile-menu.open a:nth-child(8) { opacity: 1; transform: translateY(0); transition-delay: .44s; }
.mobile-menu.open a:nth-child(9) { opacity: 1; transform: translateY(0); transition-delay: .50s; }
.mobile-menu.open a:nth-child(10) { opacity: 1; transform: translateY(0); transition-delay: .56s; }
.mobile-menu .mobile-close {
      opacity: 0;
      transform: rotate(-90deg);
      transition: opacity .3s .1s, transform .3s .1s;
    }
.mobile-menu.open .mobile-close {
      opacity: 1;
      transform: rotate(0);
    }
.header { padding: 0 16px; }
.header-nav { display: none; }
.mobile-toggle { display: flex; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.mobile-menu { height: -webkit-fill-available; }
.header-nav{display:none!important}
.mobile-toggle{display:flex!important}

/* мобильная шапка — тот же медиазапрос, что на главной */
@media (max-width: 768px) {
      section { padding: 60px 20px; }
      .header { padding: 0 16px; }
      .header-nav { display: none; }
      .mobile-toggle { display: flex; }
      .header-actions { display: flex; align-items: center; gap: 8px; }
      .hero h1 { font-size: 2.2rem; }
      .section-title { font-size: 2rem; }
      .features-grid { grid-template-columns: 1fr; }
      .stats-bar .container { grid-template-columns: repeat(2, 1fr); gap: 24px; }
      .stat-item .stat-value { font-size: 2rem; }
      .tech-grid { grid-template-columns: 1fr 1fr; }
      .hero-buttons { flex-direction: column; }
      .hero-buttons .btn-secondary { text-align: center; justify-content: center; }
      .hero-float { display: none; }
      .footer .container { grid-template-columns: 1fr; }
      .footer-bottom { flex-direction: column; gap: 16px; text-align: center; }
    }

/* блог начинается под фиксированной шапкой */
body { padding-top: 64px; }
.bhead { padding-top: 44px; }

/* светлая тема: шапка светлая, как на главной */
[data-theme="light"] .header {
  background: var(--bg-header);
  border-bottom-color: var(--border-light);
}
[data-theme="light"] .header-logo-text { color: var(--text-primary); }

/* hidden у полосы фильтра не работал: display:flex его перебивал */
.bfilter[hidden], .bempty[hidden] { display: none; }

/* Цели касания: минимум 44px. Расширяем зону невидимым слоем, вид не меняем. */
@media (max-width: 768px) {
  .theme-toggle, .mobile-toggle, .header-logo, .bhash, .bback, .bfoot a, .bh-nav a {
    position: relative;
  }
  .theme-toggle::after, .mobile-toggle::after, .header-logo::after, .bhash::after,
  .bback::after, .bfoot a::after, .bh-nav a::after {
    content: ''; position: absolute; top: 50%; left: 50%;
    width: 100%; height: 100%; min-width: 44px; min-height: 44px;
    transform: translate(-50%, -50%);
  }
}

/* Заголовок для навигации по структуре: виден только скринридеру. */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---- Таблица сравнения ---- */
.cmp-wrap { overflow-x: auto; margin: 26px 0; }
.cmp { width: 100%; border-collapse: collapse; font-size: .93rem; min-width: 680px; }
.cmp th, .cmp td { padding: 12px 14px; text-align: left; vertical-align: top;
  border-bottom: 1px solid var(--border-light); }
.cmp thead th { font-weight: 700; color: var(--text-primary); white-space: nowrap; }
.cmp td { color: var(--text-secondary); }
.cmp .cmp-us { background: rgba(16,185,129,.07); color: var(--text-primary); font-weight: 600; }
.cmp thead .cmp-us { color: var(--emerald-400); }
[data-theme="light"] .cmp thead .cmp-us { color: var(--emerald-700); }
.cmp tr.cmp-lose .cmp-us { background: rgba(248,113,113,.09); font-weight: 500; }
.cmp-note { font-size: .88rem; color: var(--text-muted); border-left: 3px solid var(--border-light);
  padding-left: 12px; }
@media (max-width: 640px) { .cmp { font-size: .86rem; } .cmp th, .cmp td { padding: 10px; } }
