/* Блог (/blog, /blog/<адрес>) — статические страницы из web/blog/*.md, разметка — web/seo/pages.tsx.
   Дизайн — как у приложения, «Холст»: белый лист для чтения на сером, светло-синий акцент, шрифт Golos Text,
   шаг отступов — 4 px. Цвета — те же, что в web/src/index.css; тема — как выбрана на сайте (/theme.js ставит
   data-theme), иначе как на устройстве. Файл отдаётся как есть, без сборки. */

@font-face {
  font-family: 'Golos Text Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 400 900;
  src: url(/fonts/golos-text-cyrillic-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Golos Text Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 400 900;
  src: url(/fonts/golos-text-latin-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --logo: url(/blog/logo.webp);
  --bg: #eef0f3;
  --surface: #ffffff;
  --surface-2: #eff1f4;
  --line: rgba(20, 26, 36, 0.08);
  --line-strong: rgba(20, 26, 36, 0.14);
  --text: #161a21;
  --text-2: #3e4550;
  --text-3: #666d78;
  --accent: #3a74bd;
  --accent-hover: #3166a8;
  --accent-ink: #2b5f9e;
  --accent-soft: #e3edf9;
  --accent-soft-ink: #19385e;
  --accent-line: #9fbde3;
  --on-accent: #ffffff;
  --press: rgba(20, 26, 36, 0.06);
  --sheet: 0 1px 2px rgba(20, 26, 36, 0.06), 0 1px 1px rgba(20, 26, 36, 0.03);
  color-scheme: light;

  --ui: 'Golos Text Variable', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* Тёмная тема: выбрана на сайте (data-theme) или, без выбора, на устройстве. Значения повторены дважды:
   в CSS нельзя сослаться на набор переменных. */
:root[data-theme='dark'] {
  --logo: url(/blog/logo-dark.webp);
  --bg: #0e1013;
  --surface: #1a1d21;
  --surface-2: #24282e;
  --line: rgba(226, 232, 242, 0.08);
  --line-strong: rgba(226, 232, 242, 0.14);
  --text: #e7e9ed;
  --text-2: #b4bac3;
  --text-3: #8a909a;
  --accent: #6fa3e3;
  --accent-hover: #86b2ea;
  --accent-ink: #8db8ee;
  --accent-soft: #1e2b3b;
  --accent-soft-ink: #cfe0f6;
  --accent-line: #3e6290;
  --on-accent: #0c1622;
  --press: rgba(226, 232, 242, 0.08);
  --sheet: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --logo: url(/blog/logo-dark.webp);
    --bg: #0e1013;
    --surface: #1a1d21;
    --surface-2: #24282e;
    --line: rgba(226, 232, 242, 0.08);
    --line-strong: rgba(226, 232, 242, 0.14);
    --text: #e7e9ed;
    --text-2: #b4bac3;
    --text-3: #8a909a;
    --accent: #6fa3e3;
    --accent-hover: #86b2ea;
    --accent-ink: #8db8ee;
    --accent-soft: #1e2b3b;
    --accent-soft-ink: #cfe0f6;
    --accent-line: #3e6290;
    --on-accent: #0c1622;
    --press: rgba(226, 232, 242, 0.08);
    --sheet: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    color-scheme: dark;
  }
}

/* --- основа --- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--ui);
  font-size: 16px;
  line-height: 24px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
p,
ul,
ol,
figure {
  margin: 0;
}

a {
  color: var(--accent-ink);
  text-underline-offset: 3px;
}

a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 8px;
}

.wrap {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  padding: 0 16px;
}

main.wrap {
  flex: 1;
  padding-top: 8px;
  padding-bottom: 64px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 20px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 150ms var(--ease);
}

.button:hover {
  background: var(--accent-hover);
}

.button.small {
  height: 36px;
  padding: 0 14px;
  font-size: 14px;
}

/* --- шапка --- */

.top-row {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 72px;
}

.brand {
  display: block;
  margin: -4px;
  padding: 4px;
  border-radius: 10px;
}

.brand:hover {
  background: var(--press);
}

.logo {
  display: block;
  height: 40px;
  aspect-ratio: 480 / 249;
  background: var(--logo) left center / contain no-repeat;
}

.top-blog {
  color: var(--text-2);
  font-weight: 500;
  text-decoration: none;
}

.top-blog:hover {
  color: var(--text);
}

.top-cta {
  margin-left: auto;
}

/* --- список статей --- */

.blog-head {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 24px 0 32px;
}

.blog-head h1 {
  font-size: 36px;
  line-height: 44px;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.blog-head p {
  max-width: 600px;
  color: var(--text-2);
  font-size: 17px;
  line-height: 26px;
}

.cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0;
  list-style: none;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--sheet);
  color: var(--text-2);
  text-decoration: none;
  transition: border-color 150ms var(--ease);
}

.card:hover {
  border-color: var(--accent-line);
}

.card h2,
.card h3 {
  color: var(--text);
  font-size: 20px;
  line-height: 28px;
  font-weight: 600;
}

.card:hover h2,
.card:hover h3 {
  color: var(--accent-ink);
}

.meta {
  color: var(--text-3);
  font-size: 14px;
  line-height: 20px;
}

.draft {
  align-self: flex-start;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 13px;
  line-height: 20px;
}

.empty {
  color: var(--text-3);
}

/* --- статья --- */

.crumbs {
  display: flex;
  gap: 8px;
  padding: 8px 0 16px;
  color: var(--text-3);
  font-size: 14px;
  line-height: 20px;
}

.crumbs a {
  color: var(--text-3);
  text-decoration: none;
}

.crumbs a:hover {
  color: var(--text);
  text-decoration: underline;
}

.sheet {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--sheet);
}

.post {
  display: flex;
  flex-direction: column;
  gap: 32px;
  padding: 48px 56px 56px;
}

.post-head {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.post-head h1 {
  font-size: 36px;
  line-height: 44px;
  font-weight: 600;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

/* Текст статьи: строка ~70 знаков, ритм — от абзаца; заголовок ближе к своему тексту, чем к предыдущему. */
.prose {
  color: var(--text-2);
  font-size: 17px;
  line-height: 28px;
}

.prose > * + * {
  margin-top: 16px;
}

.prose h2 {
  margin-top: 40px;
  color: var(--text);
  font-size: 24px;
  line-height: 32px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.prose h3 {
  margin-top: 32px;
  color: var(--text);
  font-size: 19px;
  line-height: 28px;
  font-weight: 600;
}

.prose h2 + *,
.prose h3 + * {
  margin-top: 8px;
}

.prose strong {
  color: var(--text);
  font-weight: 600;
}

.prose ul,
.prose ol {
  padding-left: 24px;
}

.prose li + li {
  margin-top: 6px;
}

.prose li > ul,
.prose li > ol {
  margin-top: 6px;
}

.prose blockquote {
  margin-left: 0;
  margin-right: 0;
  padding: 4px 0 4px 20px;
  border-left: 3px solid var(--accent-line);
  color: var(--text-2);
}

.prose code {
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--surface-2);
  font-family: var(--mono);
  font-size: 0.88em;
}

.prose pre {
  overflow-x: auto;
  padding: 16px 20px;
  border-radius: 12px;
  background: var(--surface-2);
  font-size: 15px;
  line-height: 22px;
}

.prose pre code {
  padding: 0;
  background: none;
  font-size: inherit;
}

.prose img {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.prose hr {
  height: 1px;
  margin: 40px 0;
  border: 0;
  background: var(--line-strong);
}

.table {
  overflow-x: auto;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  line-height: 22px;
}

.prose th,
.prose td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-strong);
  text-align: left;
  vertical-align: top;
}

.prose th {
  color: var(--text);
  font-weight: 600;
}

/* Готовый запрос из статьи: «Открыть в чате» кладёт его в поле нового чата. */
.prompt {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 20px;
  border: 1px solid var(--accent-line);
  border-radius: 12px;
  background: var(--accent-soft);
}

.prompt figcaption {
  color: var(--accent-soft-ink);
  font-size: 13px;
  line-height: 20px;
  font-weight: 500;
}

.prompt-text {
  color: var(--text);
  white-space: pre-wrap;
}

.prompt-open {
  align-self: flex-start;
  font-size: 15px;
  font-weight: 500;
}

/* Призыв в конце статьи — тихий лист на сером, одна кнопка. */
.cta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 24px;
  border-radius: 12px;
  background: var(--surface-2);
}

.cta h2 {
  font-size: 19px;
  line-height: 28px;
  font-weight: 600;
}

.cta p {
  color: var(--text-2);
}

.cta .button {
  margin-top: 8px;
}

.more {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-top: 48px;
}

.more > h2 {
  font-size: 24px;
  line-height: 32px;
  font-weight: 600;
}

/* --- подвал --- */

.foot {
  padding: 24px 0 32px;
  border-top: 1px solid var(--line);
  color: var(--text-3);
  font-size: 13px;
  line-height: 20px;
}

.foot-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
}

.foot-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
}

.foot-links a {
  color: var(--text-3);
  text-decoration: none;
}

.foot-links a:hover {
  color: var(--text-2);
  text-decoration: underline;
}

/* --- телефон --- */

@media (max-width: 640px) {
  .top-row {
    height: 64px;
    gap: 12px;
  }

  .logo {
    height: 32px;
  }

  .blog-head {
    padding: 16px 0 24px;
  }

  .blog-head h1,
  .post-head h1 {
    font-size: 28px;
    line-height: 36px;
  }

  .post {
    gap: 24px;
    padding: 28px 20px 32px;
  }

  .prose {
    font-size: 16px;
    line-height: 26px;
  }

  .prose h2 {
    margin-top: 32px;
    font-size: 21px;
    line-height: 28px;
  }

  .card {
    padding: 20px;
  }
}
