/* neiro-hub.ru: один файл стилей, без фреймворков. Сначала телефон, потом шире. */
:root {
  --accent: #2563EB;
  --accent-dark: #1d4ed8;
  --text: #111827;
  --muted: #4b5563;
  --faint: #6b7280;
  --line: #e5e7eb;
  --soft: #f3f6fc;
  --bg: #ffffff;
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; }
a { color: var(--accent); }
a:hover { color: var(--accent-dark); }
:focus-visible { outline: 3px solid rgba(37, 99, 235, .45); outline-offset: 2px; border-radius: 4px; }

.wrap { max-width: 720px; margin: 0 auto; padding: 0 20px; }

/* Шапка */
.top { border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 650; }
.brand:hover { color: var(--text); }
.brand-mark {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; letter-spacing: .02em;
}
.nav { display: flex; gap: 18px; font-size: 15px; }
.nav a { color: var(--muted); text-decoration: none; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--accent); }

/* Первый экран */
.hero { padding: 40px 0 28px; }
.avatar {
  width: 96px; height: 96px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 36px; font-weight: 700; letter-spacing: .02em;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.hero h1 { font-size: 34px; line-height: 1.15; margin: 22px 0 6px; letter-spacing: -.01em; }
.hero .sub { margin: 0; color: var(--accent); font-weight: 600; font-size: 18px; }
.hero .promise { font-size: 20px; line-height: 1.5; margin: 16px 0 26px; color: var(--text); }
.actions { display: flex; flex-direction: column; gap: 10px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 12px 22px; border-radius: 12px;
  font-size: 16px; font-weight: 600; text-decoration: none;
  border: 2px solid var(--accent);
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }
.btn-ghost { background: #fff; color: var(--accent); }
.btn-ghost:hover { background: var(--soft); }

/* Разделы главной */
.section { padding: 28px 0; border-top: 1px solid var(--line); }
.section h2 { font-size: 24px; line-height: 1.25; margin: 0 0 14px; letter-spacing: -.005em; }
.section p { margin: 0 0 14px; }
.section p:last-child { margin-bottom: 0; }
.caption { color: var(--muted); font-size: 15px; margin: -6px 0 16px !important; }

.card {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--text); text-decoration: none; font-weight: 600; background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.card + .card { margin-top: 10px; }
.card:hover { border-color: var(--accent); color: var(--text); box-shadow: 0 2px 10px rgba(37, 99, 235, .08); }
.card .arrow { color: var(--accent); flex: none; font-size: 22px; line-height: 1; }

.links { list-style: none; margin: 0; padding: 0; }
.links li { padding: 6px 0; }
.links a { font-weight: 600; }

/* Список статей */
.posts { list-style: none; margin: 0; padding: 0; }
.post { border-bottom: 1px solid var(--line); }
.post:last-child { border-bottom: 0; }
.post a { display: flex; gap: 14px; align-items: center; padding: 14px 0; color: var(--text); text-decoration: none; }
.post a:hover .post-title { color: var(--accent); }
.post-thumb {
  flex: none; width: 76px; height: 76px; border-radius: 12px; object-fit: cover;
  background: var(--soft);
}
.post-meta { font-size: 13px; color: var(--faint); margin-bottom: 2px; }
.post-title { font-weight: 600; line-height: 1.35; }
.post-desc { color: var(--muted); font-size: 15px; line-height: 1.45; margin-top: 4px; }
.post-desc { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.page-head { padding: 32px 0 8px; }
.page-head h1 { font-size: 30px; line-height: 1.2; margin: 0 0 10px; }

/* Подвал */
.foot { border-top: 1px solid var(--line); margin-top: 32px; padding: 24px 0 40px; color: var(--faint); font-size: 14px; }
.foot p { margin: 0 0 6px; }

/* Страница статьи */
.article { padding: 24px 0 8px; }
.cover {
  width: 100%; height: 220px; object-fit: cover; border-radius: var(--radius);
  display: block; background: var(--soft);
}
.badge {
  display: inline-block; font-size: 12px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase;
  color: var(--accent); background: var(--soft); border-radius: 6px; padding: 3px 8px;
}
.article-meta { display: flex; align-items: center; gap: 10px; margin: 18px 0 8px; color: var(--faint); font-size: 14px; }
.article h1.title { font-size: 28px; line-height: 1.2; margin: 0 0 10px; letter-spacing: -.01em; }
.lead { color: var(--muted); margin: 0 0 18px; }

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin: 20px 0 8px; position: sticky; top: 0; background: #fff; z-index: 5; }
.tabs button {
  font: inherit; font-size: 15px; font-weight: 600; color: var(--muted);
  background: none; border: 0; border-bottom: 3px solid transparent;
  padding: 10px 14px; cursor: pointer; margin-bottom: -1px;
}
.tabs button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.tab-panel[hidden] { display: none; }
.tab-title { font-size: 14px; color: var(--faint); text-transform: uppercase; letter-spacing: .04em; margin: 28px 0 0; }
.js .tab-title { display: none; }

/* Текст статьи (HTML из старой базы, классы старого сайта) */
.article-content { overflow-wrap: break-word; }
.article-content h1, .article-content h2, .article-content h3,
.article-content h4, .article-content h5, .article-content h6 {
  line-height: 1.3; margin: 1.4em 0 .5em; scroll-margin-top: 64px; color: var(--text);
}
.article-content h1 { font-size: 26px; }
.article-content h2 { font-size: 23px; }
.article-content h3 { font-size: 20px; }
.article-content h4 { font-size: 18px; }
.article-content h5, .article-content h6 { font-size: 17px; }
.article-content p { margin: .6em 0; }
.article-content ul, .article-content ol { padding-left: 1.4em; margin: .6em 0; }
.article-content li { margin: .3em 0; }
.article-content ol li::marker { color: var(--accent); font-weight: 600; }
.article-content blockquote {
  margin: 1em 0; padding: .6em 1em; border-left: 4px solid var(--accent);
  background: var(--soft); border-radius: 0 8px 8px 0; color: #1f2937;
}
.article-content .table-scroll { overflow-x: auto; }
.article-content table { width: 100%; border-collapse: collapse; margin: 1em 0; font-size: 15px; }
.article-content th, .article-content td { border: 1px solid var(--line); padding: .5em .6em; text-align: left; vertical-align: top; }
.article-content th { background: var(--soft); }
.article-content tbody tr:nth-child(even) { background: #fafbfd; }
.article-content code { font-family: var(--mono); font-size: .9em; background: #f3f4f6; padding: .15em .35em; border-radius: 4px; }
.article-content pre {
  font-family: var(--mono); font-size: 14px; line-height: 1.5;
  background: #f6f8fa; border: 1px solid var(--line); padding: 1em; border-radius: 10px;
  white-space: pre-wrap; word-break: break-word; overflow-x: auto;
}
.article-content pre code { background: none; padding: 0; }
/* блоки, у которых в тексте статьи задан тёмный фон: делаем текст светлым */
.article-content [style*="#151515"], .article-content [style*="#2d2d2d"] { color: #f3f4f6; border: 0; }
.article-content [style*="#151515"] *, .article-content [style*="#2d2d2d"] * { color: inherit; }
.article-content hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }
.article-content img { border-radius: 10px; margin: 1em 0; cursor: zoom-in; display: inline-block; }
.article-content a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }

.article-content ul.fancy-list, .article-content ol.fancy-list { list-style: none; padding-left: 0; }
.article-content .fancy-list li { position: relative; padding-left: 1.5em; margin: .5em 0; }
.article-content .fancy-list li::before {
  content: ""; position: absolute; left: .2em; top: .62em;
  width: .6em; height: .6em; border-radius: 50%; background: var(--accent);
}

.article-content details { margin: 1em 0; }
.article-content details > summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.article-content details.quote, .article-content div.quote {
  background: var(--soft); border-left: 4px solid var(--accent); border-radius: 0 8px 8px 0;
}
.article-content details.quote > summary { padding: .6em 1em; list-style: none; user-select: none; }
.article-content details.quote > summary::-webkit-details-marker { display: none; }
.article-content details.quote > summary::before { content: "▸ "; }
.article-content details.quote[open] > summary::before { content: "▾ "; }
.article-content details.quote blockquote, .article-content div.quote blockquote {
  margin: 0; padding: .3em 1em 1em; border: 0; background: transparent;
}
.article-content details.quote:not([open]) blockquote { display: none; }

.article-content .toc {
  background: var(--soft); border: 1px solid var(--line); border-radius: 10px;
  padding: .8em 1em; margin: 1em 0; font-size: 15px;
}
.article-content .toc:empty { display: none; }
.article-content .toc ul { list-style: none; padding: 0; margin: 0; }
.article-content .toc li { margin: .25em 0; }
.article-content .toc li.level-2 { margin-left: 0; }
.article-content .toc li.level-3 { margin-left: 1em; }
.article-content .toc li.level-4 { margin-left: 2em; }
.article-content .toc li.level-5, .article-content .toc li.level-6 { margin-left: 3em; }

/* карусель картинок: без JS листается пальцем, с JS появляются стрелки */
.article-content .carousel, .article-content .carousel-track {
  display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory;
  align-items: center; padding-bottom: 6px; margin: 1em 0;
}
.article-content .carousel.is-ready { display: block; position: relative; overflow: visible; padding: 0; }
.article-content .carousel-track { margin: 0; scrollbar-width: thin; }
.article-content .carousel > img, .article-content .carousel-track > img {
  flex: 0 0 100%; max-width: 100%; height: auto; object-fit: contain;
  scroll-snap-align: center; margin: 0;
}
.article-content .carousel button.prev, .article-content .carousel button.next {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; border-radius: 50%; border: 0;
  background: rgba(17, 24, 39, .55); color: #fff; font-size: 22px; line-height: 1;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.article-content .carousel button.prev { left: 8px; }
.article-content .carousel button.next { right: 8px; }

/* просмотр картинки на весь экран */
.lightbox {
  position: fixed; inset: 0; z-index: 50; background: rgba(17, 24, 39, .88);
  display: flex; align-items: center; justify-content: center; padding: 16px; cursor: zoom-out;
}
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; }

.notfound { padding: 64px 0; text-align: center; }
.notfound h1 { font-size: 28px; margin: 0 0 12px; }

@media (min-width: 640px) {
  body { font-size: 18px; }
  .hero { padding: 64px 0 40px; }
  .avatar { width: 112px; height: 112px; font-size: 40px; }
  .hero h1 { font-size: 44px; }
  .hero .promise { font-size: 22px; }
  .actions { flex-direction: row; }
  .section { padding: 36px 0; }
  .section h2 { font-size: 26px; }
  .post-thumb { width: 96px; height: 96px; }
  .cover { height: 320px; }
  .article h1.title { font-size: 36px; }
}

.h-link { color: inherit; text-decoration: none; }
.h-link:hover { color: var(--accent); }
