/* ebegunov.ru — блог. Подключается после uikit.min.css */
/* Палитра — как на главной и в админке: тёмная, мятный акцент, Montserrat (светлой темы у блога нет) */
:root {
  --ink: #f2f3f5;
  --ink-2: #c4c7cf;
  --muted: #9598a3;
  --line: rgba(255,255,255,.09);
  --bg: #101116;
  --paper: #1c1e25;
  --accent: #2fe3a6;
  --accent-hover: #1fcf95;
  --accent-ink: #55f0bd;
  --accent-soft: rgba(47,227,166,.12);
  --on-accent: #06140f;
  --code-bg: #0b0c10;
  --code-ink: #d8e1ea;
  --warn-bg: rgba(240,168,78,.13);
  --warn-line: #f0a84e;
  --mark: rgba(240,200,78,.35);
  --dots: rgba(255,255,255,.07);
  --glow: #2fe3a6;
  --glow-op: .09;
  --font: "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
  --wrap: 1180px;
  color-scheme: dark;
}

html { background: var(--bg); }
body {
  font-family: var(--font); color: var(--ink); background: transparent;
  font-size: 16.5px; line-height: 1.6; -webkit-font-smoothing: antialiased;
}
::selection { background: var(--accent); color: var(--on-accent); }

/* Фон «C», как в админке: сетка из точек и одно неподвижное слабое пятно — только в верхней части страницы,
   при прокрутке уходит вместе с ней, под текстом статьи фон ровный */
html { overflow-x: hidden; }
body { position: relative; }
body::before, body::after { content: ""; position: absolute; z-index: -1; pointer-events: none; }
body::before { left: 0; right: 0; top: 0; height: 100vh; background-image: radial-gradient(var(--dots) 1px, transparent 1.3px); background-size: 24px 24px;
  -webkit-mask-image: linear-gradient(180deg, #000 0, #000 30%, transparent 100%); mask-image: linear-gradient(180deg, #000 0, #000 30%, transparent 100%); }
body::after { width: 620px; height: 620px; top: -300px; left: 12%; border-radius: 50%; background: var(--glow); opacity: var(--glow-op); filter: blur(130px); }
h1, h2, h3, h4 { font-family: var(--font); color: var(--ink); }
a { color: var(--accent); }
a:hover { color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }

/* ---------- Шапка ---------- */
.site-head { background: color-mix(in srgb, var(--paper) 72%, transparent); border-bottom: 1px solid var(--line); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.site-head .wrap { display: flex; align-items: center; gap: 24px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.brand:hover { color: var(--ink); text-decoration: none; }
.brand img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.brand b { font-weight: 600; font-size: 16px; display: block; line-height: 1.2; }
.brand small { color: var(--muted); font-size: 13px; }
.site-nav { margin-left: auto; display: flex; gap: 4px; }
.site-nav a {
  color: var(--ink-2); padding: 8px 12px; border-radius: 6px; font-size: 15px; text-decoration: none;
}
.site-nav a:hover { background: var(--bg); color: var(--ink); }
.site-nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }

/* ---------- Хлебные крошки ---------- */
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 28px 0 0; font-size: 14px; color: var(--muted); }
.crumbs li + li::before { content: "/"; margin-right: 6px; color: var(--line); }
.crumbs a { color: var(--ink-2); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }

/* ---------- Заголовки страниц ---------- */
.page-title { font-size: clamp(32px, 4.4vw, 48px); line-height: 1.12; font-weight: 700; letter-spacing: -0.02em; margin: 16px 0 12px; max-width: 22ch; }
.page-lead { color: var(--ink-2); font-size: 19px; max-width: 62ch; margin: 0 0 32px; }

/* ---------- Разделы (кластеры) ---------- */
.clusters { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 48px; padding: 0; list-style: none; }
.clusters a {
  display: inline-flex; align-items: baseline; gap: 8px; padding: 8px 14px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--paper);
  color: var(--ink); text-decoration: none; font-weight: 500;
}
.clusters a:hover { border-color: var(--accent); color: var(--accent); }
.clusters a span { color: var(--muted); font-size: 13px; font-weight: 400; }

/* ---------- Список статей ---------- */
.feed { list-style: none; margin: 0 0 64px; padding: 0; border-top: 1px solid var(--line); }
.feed > li { border-bottom: 1px solid var(--line); }
.feed a.item {
  display: grid; grid-template-columns: 140px 1fr; gap: 24px; padding: 24px 0;
  color: inherit; text-decoration: none;
}
.feed time { color: var(--muted); font-size: 14px; padding-top: 4px; }
.feed .item-section { display: block; color: var(--accent); font-size: 14px; margin-top: 2px; }
.feed h2, .feed h3 { font-size: 22px; line-height: 1.3; font-weight: 600; margin: 0 0 6px; }
.feed a.item:hover h2, .feed a.item:hover h3 { color: var(--accent); }
.feed p { margin: 0; color: var(--ink-2); max-width: 70ch; }
.feed .read { color: var(--muted); font-size: 14px; margin-top: 8px; display: block; }
.section-heading { font-size: 15px; font-weight: 600; color: var(--muted); margin: 0 0 12px; }

.pager { display: flex; gap: 6px; margin: -32px 0 64px; }
.pager a, .pager span { min-width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 6px; border: 1px solid var(--line); color: var(--ink); text-decoration: none; background: var(--paper); padding: 0 12px; }
.pager span[aria-current] { background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 600; }

/* ---------- Статья ---------- */
.article-head { max-width: 780px; }
.article-meta { display: flex; flex-wrap: wrap; gap: 6px 22px; color: var(--muted); font-size: 14px; margin: 0 0 40px; }
.article-grid { display: grid; grid-template-columns: minmax(0, 760px) 260px; gap: 80px; align-items: start; margin-bottom: 72px; }

.prose { max-width: 720px; }
.prose > * + * { margin-top: 1.1em; }
.prose p, .prose li { color: var(--ink); }
.prose h2 { font-size: 28px; line-height: 1.25; font-weight: 700; letter-spacing: -0.01em; margin: 2em 0 0.6em; scroll-margin-top: 24px; position: relative; }
.prose h3 { font-size: 21px; line-height: 1.3; font-weight: 600; margin: 1.6em 0 0.5em; scroll-margin-top: 24px; position: relative; }
.prose .anchor {
  position: absolute; left: -1.1em; width: 1em; color: var(--muted); text-decoration: none;
  opacity: 0; transition: opacity .15s;
}
.prose h2:hover .anchor, .prose h3:hover .anchor, .prose .anchor:focus { opacity: 1; }
.prose code { font-family: var(--mono); font-size: 0.88em; background: var(--accent-soft); color: var(--accent-ink); padding: 1px 5px; border-radius: 4px; }
.prose pre {
  font-family: var(--mono); font-size: 14px; line-height: 1.6; background: var(--code-bg); color: var(--code-ink);
  padding: 18px 20px; border-radius: 8px; overflow-x: auto; border: 0; margin: 1.3em 0;
}
.prose pre code { background: none; color: inherit; padding: 0; font-size: inherit; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: .35em; }
.prose blockquote { border-left: 3px solid var(--accent); margin-left: 0; padding: 4px 0 4px 20px; color: var(--ink-2); font-style: normal; font-size: 1em; }
.callout { background: var(--warn-bg); border-left: 3px solid var(--warn-line); padding: 14px 18px; border-radius: 0 8px 8px 0; }
.callout strong { display: block; margin-bottom: 2px; }
.prose table { width: 100%; border-collapse: collapse; font-size: 15px; }
.prose th, .prose td { border-bottom: 1px solid var(--line); padding: 10px 12px; text-align: left; }
.prose th { font-weight: 600; }
.table-scroll { overflow-x: auto; }

/* Навигация по статье */
.toc { position: sticky; top: 24px; font-size: 14px; }
.toc-title { font-weight: 600; margin: 0 0 10px; font-size: 15px; }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.toc ol ol { border: 0; }
.toc a { display: block; padding: 5px 0 5px 14px; margin-left: -1px; border-left: 2px solid transparent; color: var(--ink-2); text-decoration: none; line-height: 1.4; }
.toc ol ol a, .toc a.toc-sub { padding-left: 28px; color: var(--muted); font-size: 13.5px; }
.toc a:hover { color: var(--ink); }
.toc .uk-active > a { color: var(--accent); border-left-color: var(--accent); }
.toc-mobile { display: none; }

.article-foot { border-top: 1px solid var(--line); padding-top: 28px; margin-top: 48px; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.article-foot a { display: block; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); text-decoration: none; color: var(--ink); }
.article-foot a:hover { border-color: var(--accent); }
.article-foot small { display: block; color: var(--muted); font-size: 13px; margin-bottom: 4px; }
.article-foot .next { text-align: right; }

/* ---------- Подвал ---------- */
.site-foot { border-top: 1px solid var(--line); background: var(--paper); color: var(--muted); font-size: 14px; }
.site-foot .wrap { display: flex; flex-wrap: wrap; gap: 12px 24px; padding-top: 24px; padding-bottom: 24px; }
.site-foot a { color: var(--ink-2); }
.site-foot .spacer { margin-left: auto; }

/* ---------- Адаптив ---------- */
@media (max-width: 1000px) {
  .article-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .toc-aside { display: none; }
  .toc-mobile { display: block; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); padding: 12px 16px; margin-bottom: 32px; }
  .toc-mobile summary { cursor: pointer; font-weight: 600; }
  .toc-mobile .toc { position: static; margin-top: 10px; }
}
@media (max-width: 680px) {
  body { font-size: 16px; }
  .site-head .wrap { flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; gap: 8px; }
  .site-nav { margin-left: -12px; width: 100%; }
  .brand small { display: none; }
  .feed a.item { grid-template-columns: 1fr; gap: 6px; }
  .feed .item-section { display: inline; margin-left: 10px; }
  .prose .anchor { display: none; }
  .article-foot { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

/* ---------- Дополнения для динамической версии ---------- */
.article-grid.no-toc { grid-template-columns: minmax(0, 760px); }
.article-foot .next:only-child { grid-column: 2; }
.prose h4 { font-size: 18px; font-weight: 600; margin: 1.4em 0 0.4em; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }
.prose blockquote footer { color: var(--muted); font-size: 15px; margin-top: 6px; }
.prose mark { background: var(--mark); color: inherit; padding: 0 2px; border-radius: 2px; }
.pager .gap { border: 0; background: none; min-width: 20px; padding: 0; }
.empty-note { color: var(--ink-2); margin: 0 0 64px; }
.error-actions { margin: 0 0 72px; }
.error-btn {
  display: inline-flex; align-items: center; height: 42px; padding: 0 20px; border-radius: 999px;
  background: var(--accent); color: var(--on-accent); text-decoration: none; font-weight: 600;
}
.error-btn:hover { background: var(--accent-hover); color: var(--on-accent); text-decoration: none; }
.preview-bar {
  margin: 20px 0 0; padding: 10px 14px; border-radius: 8px; font-size: 14px;
  background: var(--warn-bg); border-left: 3px solid var(--warn-line); color: var(--ink);
}
.preview-bar a { margin-left: 8px; }
@media (max-width: 680px) {
  .article-foot .next:only-child { grid-column: auto; }
}

/* Оглавление едет вместе с контентом: колонка растягивается на высоту статьи, блок внутри — sticky */
.toc-aside { align-self: stretch; }
.toc-aside .toc { position: sticky; top: 24px; max-height: calc(100vh - 48px); overflow-y: auto; }

/* Подвал прижат к низу окна на коротких страницах */
body { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
body > main.wrap { flex: 1 0 auto; width: 100%; box-sizing: border-box; }
.site-head, .site-foot { flex-shrink: 0; }

/* ---------- Карточка автора после статьи (профиль с главной) ---------- */
.prose > .author-card { margin-top: 48px; }
.author-card {
  display: flex; align-items: center; gap: 16px 24px; flex-wrap: wrap;
  padding: 18px 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--paper);
}
.author-main { display: flex; align-items: center; gap: 16px; flex: 1 1 260px; min-width: 0; color: var(--ink); text-decoration: none; }
.author-main:hover { color: var(--ink); text-decoration: none; }
.author-main:hover .author-name { color: var(--accent); }
.author-avatar { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; flex: none; border: 2px solid var(--line); }
.author-info { display: flex; flex-direction: column; min-width: 0; }
.author-name { font-size: 19px; font-weight: 700; line-height: 1.25; color: var(--ink); }
.author-role { color: var(--muted); font-size: 14px; margin-top: 2px; }
.author-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.author-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 18px; border-radius: 999px;
  background: var(--accent); color: var(--on-accent); font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap;
}
.author-btn:hover { background: var(--accent-hover); color: var(--on-accent); text-decoration: none; }
.author-icon {
  width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px;
  border: 1px solid var(--line); color: var(--ink-2); background: var(--bg);
}
.author-icon:hover { color: var(--accent); border-color: var(--accent); }
@media (max-width: 680px) {
  .author-card { padding: 16px; }
  .author-avatar { width: 52px; height: 52px; }
  .author-name { font-size: 17px; }
  .author-actions { gap: 8px; }
  .author-btn { padding: 0 12px; font-size: 13px; gap: 6px; }
}
@media print { .author-card { display: none; } }

/* ---------- Документы о персональных данных ---------- */
.legal-title { max-width: 26ch; }
.legal h2 { font-size: 22px; margin-top: 1.6em; }
.legal-actions { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 40px !important; padding-top: 20px; border-top: 1px solid var(--line); font-size: 15px; }
.site-foot a[hidden] { display: none; }

/* ---------- Картинки статьи (блок «Картинка», EditorJs::image) и просмотр во весь экран (blog.js) ---------- */
.prose .post-image { margin: 1.6em 0; }
.prose .post-image img { display: block; max-width: 100%; height: auto; border-radius: 14px; cursor: zoom-in; }
.prose .post-image.wide img { width: 100%; }
.prose .post-image figcaption { margin-top: 10px; color: var(--muted, #8a8f9b); font-size: 14px; text-align: center; }
.lb-open { overflow: hidden; }
.lightbox { position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center; padding: 48px 64px; background: rgba(5, 6, 9, .92); }
.lightbox[hidden] { display: none; }
.lightbox figure { margin: 0; display: grid; gap: 10px; justify-items: center; max-width: 100%; max-height: 100%; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 140px); object-fit: contain; border-radius: 8px; box-shadow: 0 20px 60px rgba(0, 0, 0, .6); }
.lightbox figcaption { display: flex; gap: 14px; color: #c4c7cf; font-size: 14px; }
.lightbox .lb-count { color: #8a8f9b; font-variant-numeric: tabular-nums; }
.lb-close, .lb-nav { position: absolute; border: 0; background: rgba(255, 255, 255, .1); color: #fff; cursor: pointer; line-height: 1; }
.lb-close { top: 14px; right: 14px; width: 42px; height: 42px; border-radius: 50%; font-size: 28px; }
.lb-nav { top: 50%; width: 48px; height: 64px; margin-top: -32px; border-radius: 12px; font-size: 34px; }
.lb-prev { left: 10px; }
.lb-next { right: 10px; }
.lb-close:hover, .lb-nav:hover { background: rgba(255, 255, 255, .2); }
@media (max-width: 640px) { .lightbox { padding: 56px 8px 24px; } .lb-nav { display: none; } }
