/* Блог (/blog/) — HTML рендерит FastAPI (handlers/api_blog.py, blog/templates).
   Цвет бренда приходит в CSS-переменных --accent* из <style> в шаблоне. */
html { scroll-behavior: smooth; }
body { margin: 0; background: #FFFFFF; color: var(--ink); font-family: "Golos Text", system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; text-wrap: pretty; }
* { box-sizing: border-box; }
a { color: var(--accent-text); }
a:hover { color: var(--accent-hover); }
[hidden] { display: none !important; }
img { max-width: 100%; height: auto; }

.wrap { max-width: 1200px; margin: 0 auto; padding-left: 32px; padding-right: 32px; }

/* ── nav ── */
.top { position: sticky; top: 0; z-index: 40; background: rgba(255,255,255,0.88); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid #ECEEF2; }
.nav { height: 68px; display: flex; align-items: center; gap: 28px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.logo img { width: 30px; height: 26px; object-fit: contain; }
.logo span { font-size: 19px; font-weight: 700; letter-spacing: -0.02em; }
.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-link { font-size: 14.5px; font-weight: 500; color: #4B5158; text-decoration: none; padding: 8px 12px; border-radius: 9px; }
.nav-link:hover, .nav-link.on { background: #F4F5F7; color: var(--ink); }
.nav-space { flex: 1; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-size: 15px; font-weight: 600; text-decoration: none; padding: 13px 24px; border-radius: 12px; white-space: nowrap; border: 0; cursor: pointer; font-family: inherit; }
.btn-primary { color: #FFFFFF; background: var(--accent); box-shadow: 0 6px 16px -8px var(--accent); }
.btn-primary:hover { color: #FFFFFF; background: var(--accent-hover); }
.btn-secondary { color: var(--ink); background: #FFFFFF; border: 1px solid #E4E6EB; }
.btn-secondary:hover { color: var(--ink); background: #F7F8FA; }
.btn-sm { font-size: 14.5px; padding: 10px 18px; border-radius: 10px; }
.menu-btn { display: none; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 10px; border: 1px solid #E4E6EB; background: #FFFFFF; cursor: pointer; padding: 0; }
.menu-panel { border-top: 1px solid #ECEEF2; padding: 10px 20px 16px; display: flex; flex-direction: column; gap: 2px; }
.menu-panel a { font-size: 15px; font-weight: 500; color: #4B5158; text-decoration: none; padding: 11px 10px; border-radius: 9px; }
.menu-panel a:hover { background: #F4F5F7; color: var(--ink); }

/* ── crumbs ── */
.crumbs { margin: 28px 0 0; font-size: 13px; color: #9AA0A8; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; list-style: none; }
.crumbs li + li::before { content: "/"; margin-right: 6px; color: #C9CDD4; }
.crumbs a { color: #767C84; text-decoration: none; }
.crumbs a:hover { color: var(--accent-text); }

/* ── blog index ── */
.blog-hero { padding: 8px 0 8px; }
.eyebrow { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-text); }
.blog-hero h1 { font-size: clamp(34px, 4vw, 52px); line-height: 1.06; letter-spacing: -0.035em; font-weight: 700; margin: 22px 0 0; }
.blog-hero .lead { font-size: 18px; line-height: 1.6; color: #5B6167; max-width: 60ch; margin: 16px 0 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 28px 0 0; padding: 0; list-style: none; }
.chips a { display: inline-block; padding: 8px 14px; border-radius: 999px; border: 1px solid #E4E6EB; font-size: 14px; font-weight: 500; color: #4B5158; text-decoration: none; background: #FFFFFF; }
.chips a:hover { border-color: #C9CDD4; color: var(--ink); }
.chips a.on { background: var(--ink); border-color: var(--ink); color: #FFFFFF; }

.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px 24px; margin-top: 40px; }
.post-card { display: flex; flex-direction: column; text-decoration: none; color: inherit; }
.post-card .thumb { aspect-ratio: 1200 / 630; border-radius: 14px; overflow: hidden; background: linear-gradient(135deg, #F4F5F7, #ECEEF2); border: 1px solid #ECEEF2; }
.post-card .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .35s ease; }
.post-card:hover .thumb img { transform: scale(1.03); }
.post-card .thumb-empty { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 600; color: #9AA0A8; padding: 20px; text-align: center; }
.post-card .meta { margin: 16px 0 0; font-size: 13px; color: #8A9098; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.post-card .meta .cat { color: var(--accent-text); font-weight: 600; }
.post-card h2, .post-card h3 { margin: 8px 0 0; font-size: 20px; line-height: 1.25; letter-spacing: -0.02em; font-weight: 700; color: var(--ink); }
.post-card:hover h2, .post-card:hover h3 { color: var(--accent-text); }
.post-card p { margin: 8px 0 0; font-size: 14.5px; line-height: 1.55; color: #5B6167; }
.grid .post-card.featured { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 36px; align-items: center; }
.grid .post-card.featured h2 { font-size: clamp(24px, 2.6vw, 34px); line-height: 1.12; letter-spacing: -0.03em; }
.grid .post-card.featured p { font-size: 16px; }
.empty { margin-top: 40px; padding: 48px 28px; border-radius: 14px; border: 1px dashed #DDE0E6; color: #767C84; text-align: center; }

.pager { display: flex; justify-content: center; gap: 6px; margin-top: 48px; flex-wrap: wrap; }
.pager a, .pager span { min-width: 40px; height: 40px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; border: 1px solid #E4E6EB; font-size: 14.5px; font-weight: 600; text-decoration: none; color: #4B5158; }
.pager a:hover { background: #F7F8FA; }
.pager .on { background: var(--ink); border-color: var(--ink); color: #FFFFFF; }

/* ── article ── */
.article-head { max-width: 760px; }
.article-head h1 { font-size: clamp(32px, 4vw, 48px); line-height: 1.08; letter-spacing: -0.035em; font-weight: 700; margin: 18px 0 0; }
.article-head .lead { font-size: 19px; line-height: 1.6; color: #5B6167; margin: 18px 0 0; }
.byline { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; margin: 22px 0 0; font-size: 14px; color: #767C84; }
.byline .dot { width: 3px; height: 3px; border-radius: 99px; background: #C9CDD4; }
.cover { margin: 36px 0 0; border-radius: 18px; overflow: hidden; border: 1px solid #ECEEF2; background: #F4F5F7; }
.cover img { display: block; width: 100%; height: auto; }

.article-layout { display: grid; grid-template-columns: minmax(0, 720px) minmax(0, 1fr); gap: 72px; margin-top: 44px; align-items: start; }
.toc { position: sticky; top: 96px; font-size: 14px; border-left: 1px solid #ECEEF2; padding-left: 20px; max-height: calc(100vh - 120px); overflow: auto; }
.toc p { margin: 0 0 10px; font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #9AA0A8; }
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc li { margin: 0; }
.toc a { display: block; padding: 6px 0; color: #5B6167; text-decoration: none; line-height: 1.4; }
.toc a:hover, .toc a.on { color: var(--accent-text); }
.toc .l3 a { padding-left: 14px; font-size: 13.5px; }
.toc-mobile { display: none; margin: 28px 0 0; border: 1px solid #ECEEF2; border-radius: 14px; padding: 4px 18px; }
.toc-mobile summary { cursor: pointer; padding: 12px 0; font-weight: 600; font-size: 15px; }
.toc-mobile ol { margin: 0 0 12px; padding-left: 18px; }
.toc-mobile li { padding: 4px 0; font-size: 15px; }
.toc-mobile .l3 { margin-left: 14px; }

.prose { font-size: 18px; line-height: 1.72; color: #2B2F35; overflow-wrap: break-word; }
.prose > :first-child { margin-top: 0; }
.prose p { margin: 0 0 22px; }
.prose h2 { font-size: 30px; line-height: 1.15; letter-spacing: -0.03em; font-weight: 700; color: var(--ink); margin: 52px 0 16px; scroll-margin-top: 90px; }
.prose h3 { font-size: 22px; line-height: 1.25; letter-spacing: -0.02em; font-weight: 700; color: var(--ink); margin: 36px 0 12px; scroll-margin-top: 90px; }
.prose h4 { font-size: 18px; font-weight: 700; color: var(--ink); margin: 28px 0 8px; }
.prose ul, .prose ol { margin: 0 0 22px; padding-left: 26px; }
.prose li { margin: 0 0 8px; padding-left: 4px; }
.prose li > p { margin: 0 0 8px; }
.prose ul li::marker { color: var(--accent); }
.prose ol li::marker { color: #8A9098; font-weight: 600; }
.prose a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.prose strong, .prose b { font-weight: 650; color: var(--ink); }
.prose mark { background: #FFF1B8; padding: 0 3px; border-radius: 3px; }
.prose hr { border: 0; height: 1px; background: #ECEEF2; margin: 44px 0; }
.prose img { display: block; border-radius: 14px; margin: 32px auto; border: 1px solid #ECEEF2; }
.prose figure { margin: 32px 0; }
.prose figure img { margin: 0 auto; }
.prose figcaption { margin-top: 10px; font-size: 14px; line-height: 1.5; color: #8A9098; text-align: center; }
.prose blockquote { margin: 32px 0; padding: 4px 0 4px 24px; border-left: 3px solid var(--accent); font-size: 20px; line-height: 1.6; color: var(--ink); }
.prose blockquote p:last-child { margin-bottom: 0; }
.prose code { font-family: "JetBrains Mono", ui-monospace, Menlo, monospace; font-size: 0.86em; background: #F4F5F7; border: 1px solid #ECEEF2; border-radius: 6px; padding: 2px 6px; }
.prose pre { margin: 0 0 24px; padding: 18px 20px; border-radius: 14px; background: #14161A; color: #E9EBEE; overflow-x: auto; font-size: 14px; line-height: 1.6; }
.prose pre code { background: none; border: 0; padding: 0; color: inherit; font-size: inherit; }
.prose .table-wrap { margin: 0 0 26px; overflow-x: auto; border: 1px solid #ECEEF2; border-radius: 14px; }
.prose table { width: 100%; border-collapse: collapse; font-size: 15.5px; line-height: 1.5; }
.prose th, .prose td { padding: 12px 16px; text-align: left; border-bottom: 1px solid #ECEEF2; vertical-align: top; }
.prose th { background: #F7F8FA; font-weight: 650; color: var(--ink); }
.prose tr:last-child td { border-bottom: 0; }
.prose th p, .prose td p { margin: 0; }
.prose .callout { margin: 28px 0; padding: 18px 22px; border-radius: 14px; background: #F4F7FF; border: 1px solid #DCE5FB; font-size: 16.5px; line-height: 1.65; }
.prose .callout-tip { background: #F0FAF4; border-color: #CDEBD8; }
.prose .callout-warn { background: #FFF7ED; border-color: #FBDDBA; }
.prose .callout > :last-child { margin-bottom: 0; }
.prose a.cta { display: inline-block; text-decoration: none; color: #FFFFFF; background: var(--accent); padding: 13px 24px; border-radius: 12px; font-weight: 600; font-size: 16px; box-shadow: 0 6px 16px -8px var(--accent); }
.prose a.cta:hover { background: var(--accent-hover); color: #FFFFFF; }
.prose .text-center { text-align: center; }
.prose .text-right { text-align: right; }

.guides { margin: 40px 0 0; padding: 22px 24px; border-radius: 14px; border: 1px solid #ECEEF2; background: #F7F8FA; }
.guides-h { margin: 0 0 12px; font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: #9AA0A8; }
.guides ul { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.guides a { display: inline-block; padding: 8px 14px; border-radius: 999px; border: 1px solid #E4E6EB; background: #FFFFFF; font-size: 14px; font-weight: 500; color: #3D4248; text-decoration: none; }
.guides a:hover { border-color: var(--accent); color: var(--accent-text); }

.tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 40px 0 0; padding: 0; list-style: none; }
.tags li { padding: 6px 12px; border-radius: 999px; background: #F4F5F7; font-size: 13.5px; color: #5B6167; }

.cta-box { margin: 48px 0 0; padding: 32px; border-radius: 18px; background: var(--ink); color: #FFFFFF; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: center; }
.cta-box h2 { margin: 0; font-size: 24px; line-height: 1.2; letter-spacing: -0.02em; color: #FFFFFF; }
.cta-box p { margin: 8px 0 0; font-size: 15px; line-height: 1.55; color: rgba(255,255,255,0.72); }
.cta-box .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.cta-box .btn-secondary { background: transparent; color: #FFFFFF; border-color: rgba(255,255,255,0.28); }
.cta-box .btn-secondary:hover { background: rgba(255,255,255,0.08); color: #FFFFFF; }

.related { margin-top: 88px; padding-top: 48px; border-top: 1px solid #ECEEF2; }
.related h2 { margin: 0; font-size: 28px; letter-spacing: -0.03em; }
.related .grid { margin-top: 28px; }

.progress { position: fixed; top: 0; left: 0; height: 3px; width: 0; background: var(--accent); z-index: 60; transition: width .1s linear; }

/* ── 404 ── */
.nf { padding: 80px 0 40px; text-align: center; }
.nf h1 { font-size: 44px; letter-spacing: -0.03em; margin: 0; }
.nf p { color: #5B6167; font-size: 17px; margin: 14px 0 28px; }

/* ── footer ── */
.foot { margin-top: 112px; padding-top: 48px; padding-bottom: 36px; border-top: 1px solid #ECEEF2; }
.foot-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 1fr)); gap: 32px; }
.foot-about { margin: 14px 0 0; font-size: 14px; line-height: 1.6; color: #767C84; max-width: 34ch; }
.foot-h { margin: 0 0 10px; font-size: 13px; font-weight: 600; color: var(--ink); }
.foot-grid a:not(.logo) { display: block; font-size: 14px; line-height: 28px; color: #5B6167; text-decoration: none; }
.foot-grid a:not(.logo):hover { color: var(--accent-text); }
.foot-bottom { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 40px; padding-top: 20px; border-top: 1px solid #ECEEF2; font-size: 13px; color: #9AA0A8; }
.foot-bottom p { margin: 0; }

@media (max-width: 1100px) {
  .article-layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .toc { display: none; }
  .toc-mobile { display: block; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .nav-links, .hide-sm { display: none !important; }
  .menu-btn { display: flex; }
  .nav { gap: 14px; }
  .wrap { padding-left: 20px; padding-right: 20px; }
  .grid .post-card.featured { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .foot-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cta-box { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .wrap { padding-left: 16px; padding-right: 16px; }
  .grid { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .prose { font-size: 17px; }
  .prose h2 { font-size: 25px; margin-top: 40px; }
  .prose h3 { font-size: 20px; }
  .cover { border-radius: 12px; margin-top: 28px; }
  .cta-box { padding: 24px 20px; }
  .foot-grid { grid-template-columns: minmax(0, 1fr); }
}
