/* Атрибут hidden слабее правила класса с display: кнопка с .btn
   остаётся на экране, хотя код её «спрятал». В tools.css это уже
   ловили; здесь то же правило на весь сайт. */
[hidden] { display: none !important; }

:root {
  /* Системные части форм - стрелка select, галочки, полосы прокрутки - рисует
     браузер, и без color-scheme он рисует их в светлой гамме поверх тёмной
     темы. Значение переключается вместе с data-theme ниже. */
  color-scheme: light;

  /* Base palette (unchanged hues, renamed for clarity) */
  --bg: #eef1f7;
  --bg-2: #e3e9f5;
  --bg-soft: #f5f6f8;
  --surface: #ffffff;
  --border: #dde2ea;
  --text: #1c2024;
  --text-muted: #5c6670;
  --accent: #2f6fed;
  --accent-hover: #1e59d4;
  --accent-soft: rgba(47, 111, 237, 0.10);
  --code-bg: #f5f6f8;

  --shadow-sm: 0 1px 2px rgba(23, 43, 92, .06);
  --shadow-md: 0 10px 30px rgba(23, 43, 92, .10);

  --radius-sm: 4px;   /* structural: nav, inputs, tags */
  --radius-md: 8px;   /* buttons, code blocks */
  --radius-lg: 12px;  /* content cards, images */

  --maxw: 1180px;
  --readw: 760px;

  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --font-sans: "Onest", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --dot: rgba(28, 32, 36, .07);
  --glow: rgba(47, 111, 237, .16);

  --header-bg: rgba(238, 241, 247, .82);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1216;
  --bg-2: #141a24;
  --bg-soft: #1b1f26;
  --surface: #171b22;
  --border: #2a2f38;
  --text: #e6e9ee;
  --text-muted: #97a1ad;
  --accent: #5b8dff;
  --accent-hover: #7aa2ff;
  --accent-soft: rgba(91, 141, 255, 0.14);
  --code-bg: #11151b;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-md: 0 16px 40px rgba(0, 0, 0, .45);

  --dot: rgba(255, 255, 255, .06);
  --glow: rgba(91, 141, 255, .16);

  --header-bg: rgba(15, 18, 22, .82);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 18px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

::selection { background: var(--accent); color: #fff; }

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

/* Dot-grid backdrop + single glow, replaces the old blurred blob mesh */
.bg-mesh {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-color: var(--bg);
  background-image:
    radial-gradient(46% 40% at 92% 0%, var(--glow) 0%, transparent 70%),
    radial-gradient(circle at 1px 1px, var(--dot) 1px, transparent 0);
  background-size: 100% 100%, 26px 26px;
  background-position: 0 0, 0 0;
}

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

/* Generic light panel (used sparingly: placeholder + comment box) */
.glass {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

/* Blinking cursor - the one signature flourish, used twice: logo + home tagline */
.cursor {
  display: inline-block;
  width: .5em;
  margin-left: .1em;
  background: currentColor;
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .cursor { animation: none; opacity: .6; }
}

/* Header - a thin status line, not a glass panel */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.header-inner {
  display: flex; align-items: center; gap: 18px;
  padding-top: 12px; padding-bottom: 12px;
  flex-wrap: wrap;
}
.logo {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-mono); font-weight: 700; font-size: 1.15rem; color: var(--text);
}
.logo:hover { text-decoration: none; }
.logo:hover .logo-mark { border-color: var(--accent-hover); background: var(--accent); color: #fff; }

/* Mark = the shell prompt symbol plus the initial */
.logo-mark {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  background: var(--accent-soft); border: 1px solid var(--accent);
  border-radius: 8px;
  font-size: .95rem; font-weight: 700; letter-spacing: -.01em;
  color: var(--accent);
  transition: background .15s, border-color .15s, color .15s;
}
.logo-word { letter-spacing: -.01em; }
.logo .cursor { color: var(--accent); height: 1.1em; vertical-align: -.15em; }

.main-nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; font-family: var(--font-mono); }
.main-nav a {
  color: var(--text-muted); font-size: .88rem; font-weight: 500;
  padding: 7px 10px 6px; border-radius: var(--radius-sm);
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
}
.main-nav a::before { content: "/"; opacity: .45; margin-right: 1px; }
.main-nav a:hover { text-decoration: none; color: var(--text); }
.main-nav a.is-active { color: var(--accent); border-color: var(--accent); }

.search-form input {
  padding: 7px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font-size: .85rem; width: 150px;
  font-family: var(--font-mono);
}
.search-form input::placeholder { color: var(--text-muted); }
.search-form input:focus { border-color: var(--accent); outline: none; }

.theme-toggle {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  width: 36px; height: 36px; border-radius: 50%; cursor: pointer; font-size: 1rem;
  transition: border-color .15s;
}
.theme-toggle:hover { border-color: var(--accent); }
[data-theme="dark"] .theme-icon-dark { display: none; }
[data-theme="light"] .theme-icon-light,
:root:not([data-theme="dark"]) .theme-icon-light { display: none; }

/* Layout: 3/4 content + 1/4 sidebar */
.main-content { padding: 40px 20px 60px; }
.layout-with-sidebar {
  display: grid;
  grid-template-columns: 3fr 1fr;
  gap: 34px;
  align-items: start;
}
.layout-full { max-width: var(--readw); }
.sidebar { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 16px; }

.page-title { font-size: 2rem; margin: 0 0 8px; letter-spacing: -.02em; font-weight: 700; }
.page-lead { color: var(--text-muted); margin-top: 0; }
.empty { color: var(--text-muted); }

/* Section labels styled like a code comment - the recurring structural device */
.sidebar-title {
  margin: 0 0 12px; font-family: var(--font-mono); font-size: .8rem; font-weight: 500;
  color: var(--text-muted);
}
.sidebar-title::before { content: "// "; color: var(--accent); opacity: .7; }

.sidebar-card { padding: 16px 18px 20px; }
.sidebar-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.sidebar-list a { color: var(--text); font-size: .95rem; }
.sidebar-list a:hover { color: var(--accent); text-decoration: none; }
.sidebar-list .muted { color: var(--text-muted); font-size: .9rem; }

/* Home tagline (terminal-style intro line) */
.home-tagline {
  font-family: var(--font-mono); font-size: .95rem; color: var(--text-muted);
  margin: 0 0 28px;
}

/* Вводный абзац главной: что на сайте есть. Ширина по колонке текста -
   строка во всю сетку читается тяжело. */
.home-intro { max-width: 62ch; margin: 0 0 2rem; color: var(--text-muted); line-height: 1.65; }

/* Плитки разделов на главной. Тот же язык, что у карточек курсов: стеклянная
   поверхность, моноширинный «путь» акцентом, стрелка внизу. Приподнимаются
   при наведении - на них же и нажимают. */
.home-tiles {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}
.home-tile {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  padding: 1.4rem 1.5rem;
  color: inherit;
  text-decoration: none;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.home-tile:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  text-decoration: none;
  color: inherit;
}
.home-tile-path {
  font-family: var(--font-mono);
  font-size: .8rem;
  color: var(--accent);
}
.home-tile-title { font-size: 1.3rem; font-weight: 700; line-height: 1.2; }
.home-tile-text { color: var(--text-muted); line-height: 1.55; }
/* Подвал плитки прижат к низу: у карточек разной длины текста стрелки и
   счётчики иначе прыгают по вертикали. */
.home-tile-foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .8rem;
  margin-top: auto;
  padding-top: .6rem;
}
.home-tile-stat { font-family: var(--font-mono); font-size: .82rem; color: var(--text-muted); }
.home-tile-go { font-family: var(--font-mono); color: var(--accent); }

@media (max-width: 700px) {
  .home-tiles { grid-template-columns: 1fr; }
  .home-tile { padding: 1.2rem 1.2rem; }
}
.home-tagline .path { color: var(--accent); }

/* Post cards - компактная строка ленты: миниатюра слева, текст справа.
   Раньше карточка была высокой (баннер 220px + крупный заголовок под ним), и на
   экран влезало три новости вместо восьми. Полоса слева была окрашена по разделу,
   но раздел и так подписан пилюлей в карточке, а на /news/ все полосы всё равно
   одного цвета - то есть цвет ничего не сообщал. Оставлен нейтральный рельс,
   который подсвечивается акцентом при наведении. */
.post-grid { display: grid; gap: 12px; }
.post-card {
  display: grid; grid-template-columns: 210px 1fr; align-items: stretch;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform .14s ease, border-left-color .14s ease, box-shadow .14s ease;
}
.post-card:not(:has(.post-card-thumb)) { grid-template-columns: 1fr; }
.post-card:hover { transform: translateX(3px); box-shadow: var(--shadow-md); border-left-color: var(--accent); }
.post-card-thumb { display: block; height: 100%; background: var(--bg-soft); }
.post-card-thumb img { width: 100%; height: 100%; min-height: 132px; object-fit: cover; display: block; }
.post-card-body { padding: 14px 20px 16px; min-width: 0; }
.post-card-title { font-size: 1.18rem; margin: 6px 0 6px; letter-spacing: -.01em; font-weight: 700; line-height: 1.3; }
.post-card-title a { color: var(--text); }
/* Ровно две строки анонса: карточки одинаковой высоты сканируются быстрее. */
.post-card-excerpt {
  color: var(--text-muted); margin: 0; font-size: .95rem;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-meta {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  color: var(--text-muted); font-size: .78rem; font-family: var(--font-mono);
}
.pill { color: var(--text-muted); }
.pill::before { content: "#"; opacity: .5; margin-right: 2px; }
a.pill:hover { color: var(--accent); text-decoration: none; }
.post-meta time::before { content: "@ "; opacity: .5; }

.tag-list { display: flex; flex-wrap: wrap; gap: 10px; font-family: var(--font-mono); }
.tag { color: var(--text-muted); font-size: .8rem; }
.tag:hover { color: var(--accent); text-decoration: none; }

/* Placeholder (courses) */
.placeholder-card { text-align: center; padding: 60px 30px; }
.placeholder-icon { color: var(--accent); opacity: .8; margin-bottom: 8px; }
.placeholder-card .btn { margin-top: 18px; }

/* Full post */
.post-full-title { font-size: clamp(1.7rem, 1.2rem + 2vw, 2.5rem); line-height: 1.2; margin: 10px 0 0; letter-spacing: -.02em; font-weight: 800; }
.post-full-cover { width: 100%; border-radius: var(--radius-lg); margin: 24px 0; }
.post-full-tags { margin: 30px 0; }
.views { margin-left: auto; }
.views::before { content: none; }

/* Auto table of contents (Post.toc_html) - rendered `tree`-command style:
   markdown_utils._build_toc_tree emits the ├──/└──/│ connectors as literal
   text in .toc-branch spans. The connectors are deliberately muted (near
   --border) so they read as quiet structure, not content - the heading
   labels are what should draw the eye. Each row's <a> is the full line
   (connector + label, see .toc-branch/.toc-label), stretched edge-to-edge
   via negative margin so hovering/tapping anywhere on the row works, not
   just the text itself. */
.post-toc {
  background: var(--code-bg); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 14px 12px; margin: 24px 0; font-family: var(--font-mono);
  overflow-x: auto;
}
.post-toc-title {
  margin: 0 0 8px; padding: 0 10px; font-size: .85rem; font-weight: 500;
  color: var(--text-muted); text-transform: none;
}
.post-toc-title::before { content: "// "; color: var(--accent); opacity: .7; }
.post-toc .toc-tree, .post-toc .toc-tree ul { list-style: none; margin: 0; padding: 0; }
.post-toc li { font-size: .92rem; white-space: nowrap; }
.post-toc a {
  display: block; color: var(--text); padding: 5px 10px; border-radius: var(--radius-sm);
  transition: background .12s ease, color .12s ease;
}
.post-toc a:hover, .post-toc a:focus-visible {
  background: var(--accent-soft); color: var(--accent); text-decoration: none;
}
.post-toc .toc-branch { color: var(--border); white-space: pre; }
.post-toc a:hover .toc-branch, .post-toc a:focus-visible .toc-branch { color: var(--accent); opacity: .5; }

@media (max-width: 640px) {
  .post-toc li { font-size: .82rem; }
}

/* Prose: the shared typography layer for every long-form body of text on the
   site - blog posts, the dashboard preview and course lessons. It used to live
   on .post-content, which meant course lessons rendered with no content
   typography at all (their wrapper was .prose, a class that did not exist).
   Keep new rules here; .post-content below is only the post-specific size. */
.prose h2 { font-size: 1.6rem; margin-top: 2em; letter-spacing: -.01em; font-weight: 700; }
.prose h3 { font-size: 1.3rem; margin-top: 1.6em; font-weight: 700; }
.prose img { max-width: 100%; border-radius: var(--radius-md); }
.prose video { max-width: 100%; border-radius: var(--radius-md); }
.prose blockquote {
  border-left: 3px solid var(--accent); margin: 1.4em 0; padding: .2em 1.2em;
  color: var(--text-muted); background: var(--bg-soft); border-radius: 0 var(--radius-md) var(--radius-md) 0;
}
.prose table { border-collapse: collapse; width: 100%; margin: 1.4em 0; font-size: .95rem; }
.prose th, .prose td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
.prose th { background: var(--bg-soft); font-family: var(--font-mono); font-weight: 500; }

.prose code {
  font-family: var(--font-mono);
  font-size: .88em; background: var(--code-bg); padding: .15em .4em; border-radius: 4px;
  /* Inline code carries whole directives and paths (proxy_add_x_forwarded_for,
     /var/log/nginx/error.log). Without this they stay one unbreakable token and
     stick out of the text column on a narrow screen. */
  overflow-wrap: break-word;
}
/* Inside pre the block scrolls, so breaking lines there would only misrepresent
   the config. */
.prose pre code { overflow-wrap: normal; }
.prose pre {
  background: var(--code-bg); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 16px 18px; overflow-x: auto; line-height: 1.5;
}
.prose pre code { background: none; padding: 0; font-size: .88rem; }

.post-content { font-size: 1.075rem; }
.codehilite { background: var(--code-bg); border-radius: var(--radius-md); }

/* Comments */
.comments { margin-top: 50px; border-top: 1px solid var(--border); padding-top: 30px; }
.comments h2, .comments h3 {
  font-family: var(--font-mono); font-size: .95rem; font-weight: 500; color: var(--text-muted);
  text-transform: none;
}
.comments h2::before, .comments h3::before { content: "// "; color: var(--accent); opacity: .7; }
.comment {
  border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 14px 18px; margin-bottom: 12px; background: var(--surface);
}
.comment-head { display: flex; justify-content: space-between; color: var(--text-muted); font-size: .85rem; margin-bottom: 6px; font-family: var(--font-mono); }
.comment-body { color: var(--text); }
.comment-form { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.comment-form input, .comment-form textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; font-size: .95rem;
}
.comment-form input:focus, .comment-form textarea:focus { border-color: var(--accent); outline: none; }
.btn {
  display: inline-block; background: var(--accent); color: #fff; border: none;
  padding: 10px 20px; border-radius: var(--radius-md); font: inherit; font-weight: 600; cursor: pointer; align-self: flex-start;
  transition: background .15s;
}
.btn:hover { background: var(--accent-hover); color: #fff; text-decoration: none; }

/* Вторичная кнопка: то же место в ряду, но без заливки - «Назад» рядом с
   «Дальше» не должна тянуть на себя внимание. Класс использовался в уроках
   курса, дашборде и утилитах, а правила для него не существовало, и все такие
   кнопки выглядели основными. */
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.btn-ghost:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}
.form-note, .form-error { color: var(--text-muted); font-size: .85rem; margin: 0; }
/* Ответ на отправку комментария: подтверждение и просьба подождать. Раньше
   подтверждение жило отдельной страницей - теперь блок один на весь сайт, и
   сообщение показывается там же, где форма. */
.comment-note {
  margin: 0 0 14px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: .9rem;
}
.comment-note.is-ok { border-color: var(--accent); background: var(--accent-soft); }
.comment-note.is-wait { color: var(--text-muted); }
.form-error { color: #d94b4b; }

/* Pagination */
.pagination { display: flex; gap: 18px; align-items: center; justify-content: center; margin-top: 40px; font-family: var(--font-mono); font-size: .9rem; }
.pagination-info { color: var(--text-muted); }

.notice { text-align: center; padding: 40px 0; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); padding: 26px 0; color: var(--text-muted); font-size: .85rem; font-family: var(--font-mono); }

/* Просмотр картинки поверх страницы (blog/js/lightbox.js).
   Затемнение тёмное в обеих темах намеренно: под ним лежит сама страница, и
   светлая подложка на светлой теме не отделяла бы кадр от текста. */
.is-zoomable { cursor: zoom-in; }
.lb-overlay {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 28px 20px;
  background: rgba(8, 10, 14, .84);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  cursor: zoom-out;
  /* Прячем видимостью, а не display: с display: none кадр появлялся бы
     рывком - у браузера нет кадра, с которого начинать переход. */
  opacity: 0; visibility: hidden;
  transition: opacity .16s ease, visibility 0s linear .16s;
}
.lb-overlay.is-open { opacity: 1; visibility: visible; transition: opacity .16s ease; }
.lb-figure {
  margin: 0; display: flex; flex-direction: column; gap: 12px; align-items: center;
  max-width: 100%; max-height: 100%;
}
.lb-figure img {
  max-width: min(96vw, 1600px); max-height: 84vh;
  width: auto; height: auto; object-fit: contain;
  border-radius: var(--radius-md);
  background: #fff;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .55);
}
.lb-caption { color: #e6e9ee; font-size: .9rem; line-height: 1.45; text-align: center; max-width: 70ch; }
.lb-credit { display: block; margin-top: .25rem; font-size: .76rem; opacity: .68; }
.lb-credit a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.lb-close {
  position: absolute; top: 14px; right: 18px;
  width: 38px; height: 38px; line-height: 1;
  border-radius: 50%; border: 1px solid rgba(255, 255, 255, .25);
  background: rgba(0, 0, 0, .35); color: #fff;
  font-size: 1.5rem; cursor: pointer;
}
.lb-close:hover { background: rgba(255, 255, 255, .16); }

@media (prefers-reduced-motion: reduce) {
  .lb-overlay { transition: none; }
}

@media (max-width: 900px) {
  .layout-with-sidebar { grid-template-columns: 1fr; }
  .sidebar { position: static; flex-direction: row; flex-wrap: wrap; }
  .sidebar-card { flex: 1 1 220px; }
}

@media (max-width: 640px) {
  body { font-size: 17px; }
  .main-nav { order: 3; width: 100%; }
  .form-row { grid-template-columns: 1fr; }
  .post-full-title { font-size: 1.7rem; }
  .search-form input { width: 120px; }
  .logo-word { display: none; }
  /* На телефоне миниатюра уезжает наверх - две колонки по 210px там не живут. */
  .post-card { grid-template-columns: 1fr; }
  .post-card-thumb img { height: 170px; min-height: 0; }
  /* A four-column table of nginx variables cannot be squeezed into 390px, and
     without its own scroll it drags the whole page sideways. Only on phones:
     on a desktop the tables must keep stretching to the text column. */
  .prose table { display: block; width: max-content; max-width: 100%; overflow-x: auto; }
}


/* --- фильтры разделов --------------------------------------------------
   Одни правила на каталог курсов, хаб тренажёров и хаб утилит: панель у всех
   трёх одна и та же (templates/_hub_filters.html), а courses.css на страницах
   тренажёров и утилит не подключается.

   Раскладка - строка на ось: слева моноширинная подпись, справа значения.
   Кучей пилюль без подписей панель читалась как список тегов, и было не
   видно, что «Linux» из одной оси, а «С нуля» из другой. */
.hub-filters {
  position: relative;
  margin: 0 0 1.6rem;
  padding: .35rem 1.25rem .9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
/* Тонкая акцентная полоса по верхнему краю: панель - управление, а не ещё
   одна карточка со ссылками. */
.hub-filters::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent 70%);
}

.hub-filter-axis {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  align-items: start;
  gap: .6rem 1rem;
  padding: .75rem 0;
  border-bottom: 1px solid var(--border);
}
.hub-filter-axis:last-of-type { border-bottom: 0; }
.hub-filter-title {
  padding-top: .35rem;
  font-family: var(--font-mono);
  font-size: .72rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.hub-filter-options { display: flex; flex-wrap: wrap; gap: .4rem; }

/* Значение - кнопка-пилюля со своим индикатором. Родная галочка спрятана, но
   осталась в потоке фокуса: панель обязана работать с клавиатуры. */
.hub-filter-opt {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .32rem .7rem .32rem .55rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-soft);
  cursor: pointer;
  font-size: .88rem;
  line-height: 1.35;
  user-select: none;
  transition: background .15s ease, border-color .15s ease, color .15s ease,
              transform .15s ease, box-shadow .15s ease, opacity .15s ease;
}
.hub-filter-opt input {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  clip-path: inset(50%);
  overflow: hidden;
}
.hub-filter-tick {
  width: .72rem; height: .72rem;
  border: 1.5px solid var(--text-muted);
  border-radius: 50%;
  opacity: .55;
  flex: none;
  transition: background .15s ease, border-color .15s ease, opacity .15s ease;
}
.hub-filter-opt:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.hub-filter-opt:hover .hub-filter-tick { border-color: var(--accent); opacity: .9; }
.hub-filter-opt:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.hub-filter-opt:has(input:checked) {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 4px 14px var(--glow);
}
.hub-filter-opt:has(input:checked) .hub-filter-tick {
  border-color: #fff;
  opacity: 1;
  /* Точка внутри кольца: состояние видно и без цвета - на случай, когда
     акцентная заливка не различается (печать, монохром, дальтонизм). */
  background:
    radial-gradient(circle at center, #fff 0 45%, transparent 46%);
}
.hub-filter-label { white-space: nowrap; }
.hub-filter-count {
  min-width: 1.1rem;
  padding: 0 .3rem;
  border-radius: 999px;
  background: var(--border);
  font-family: var(--font-mono);
  font-size: .7rem;
  line-height: 1.4rem;
  text-align: center;
  color: var(--text-muted);
  transition: background .15s ease, color .15s ease;
}
.hub-filter-opt:has(input:checked) .hub-filter-count {
  background: rgba(255, 255, 255, .22);
  color: #fff;
}
/* Значение, которое вместе с уже выбранными ничего не даст, гаснет - но
   остаётся нажимаемым: читатель вправе передумать и снять другое. */
.hub-filter-opt.is-empty { opacity: .4; }
.hub-filter-opt.is-empty:hover { opacity: .75; }

.hub-filter-actions {
  display: flex;
  align-items: center;
  gap: .8rem;
  padding-top: .7rem;
  min-height: 1.1rem;
}
.hub-filter-found {
  font-family: var(--font-mono);
  font-size: .8rem;
  color: var(--text-muted);
}
.hub-filter-reset {
  margin-left: auto;
  padding: .25rem .7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: .78rem;
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease;
}
.hub-filter-reset:hover { color: var(--accent); border-color: var(--accent); }

/* Метки категорий на карточке. */
.hub-chips { display: flex; flex-wrap: wrap; gap: .35rem; margin: .6rem 0 0; }
.hub-chip {
  padding: .15rem .55rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-soft);
  font-size: .74rem;
  color: var(--text-muted);
}
/* «Ещё пишется» - не такая же метка, как тема курса: она про состояние, а не
   про предмет, и должна читаться первой. Пунктир - тот же приём, которым в
   программе курса помечена глава «скоро». */
.hub-chip-wip {
  border-style: dashed;
  border-color: var(--accent);
  background: transparent;
  color: var(--accent);
}

/* Переключатель «ещё пишутся» отделён от осей акцентной подписью: он работает
   наоборот - снятая галочка здесь скрывает курсы. Своей черты сверху ему не
   надо, разделитель предыдущей оси уже на месте; две подряд дали бы полосу
   в два пикселя. */
.hub-filter-switch { border-bottom: 0; }
.hub-filter-switch .hub-filter-title { color: var(--accent); opacity: .75; }

@media (max-width: 640px) {
  .hub-filters { padding: .35rem 1rem .8rem; }
  .hub-filter-axis { grid-template-columns: 1fr; gap: .35rem; padding: .65rem 0; }
  .hub-filter-title { padding-top: 0; }
  .hub-filter-actions { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  .hub-filter-opt { transition: none; }
  .hub-filter-opt:hover { transform: none; }
}

/* Курс, скрытый от читателей, но открытый сотруднику: без пометки автор правит
   страницу и не помнит, что её никто не видит. Пунктир - тот же приём, что у
   «ещё пишется», только цвет приглушённый: это не обещание, а состояние. */
.hub-chip-hidden {
  display: inline-block; padding: .05rem .45rem; border-radius: 999px;
  border: 1px dashed var(--text-muted); color: var(--text-muted);
  font-family: var(--font-mono); font-size: .72rem; letter-spacing: .04em;
}

/* ------------------------------------------------------------------ учётная
   запись читателя: вход, регистрация, «мой прогресс», настройки.

   Свой файл заводить не стал: страниц пять, все они - формы и карточки, и
   правила у них те же, что у комментариев и хабов. Отдельный CSS пришлось бы
   подключать в каждом шаблоне, а забытая строка `<link>` даёт ровно тот
   дефект, на который проект уже наступал: разметка есть, оформления нет. */
.acc-narrow { max-width: 460px; margin: 0 auto; }
.acc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 26px 24px;
}
.acc-card + .acc-card { margin-top: 20px; }
.acc-card h2 { margin: 0 0 4px; font-size: 1.15rem; }
.acc-card-lead { color: var(--text-muted); font-size: .9rem; margin: 0 0 18px; }

.acc-form { display: flex; flex-direction: column; gap: 14px; }
.acc-field { display: flex; flex-direction: column; gap: 6px; }
.acc-field label { font-size: .85rem; font-family: var(--font-mono); color: var(--text-muted); }
.acc-field input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--text);
  font: inherit; font-size: .95rem;
}
.acc-field input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.acc-field .acc-help { font-size: .8rem; color: var(--text-muted); }
.acc-field.has-error input { border-color: #d94b4b; }
.acc-field .acc-error { font-size: .82rem; color: #d94b4b; }
.acc-form .btn { align-self: stretch; text-align: center; }
.acc-alt { margin: 18px 0 0; font-size: .9rem; color: var(--text-muted); text-align: center; }
/* Возврат к прогрессу стоит НАД карточками и по левому краю: центрированная
   ссылка над формой читается как заголовок формы, а не как «назад». */
.acc-back { margin: 0 0 18px; font-size: .9rem; font-family: var(--font-mono); }
.acc-note {
  margin: 0 0 16px; padding: 10px 12px; font-size: .9rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.acc-note.is-ok { border-color: var(--accent); background: var(--accent-soft); }
.acc-note.is-bad { border-color: #d94b4b; color: #d94b4b; }

/* «Мой прогресс» */
.acc-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: baseline; justify-content: space-between; }
.acc-stats { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 24px; padding: 0; list-style: none; }
.acc-stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 10px 14px; min-width: 120px;
}
.acc-stat b { display: block; font-size: 1.4rem; line-height: 1.2; }
.acc-stat span { font-size: .8rem; color: var(--text-muted); font-family: var(--font-mono); }

.acc-list { display: flex; flex-direction: column; gap: 12px; margin: 0 0 26px; }
.acc-row {
  display: block; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 14px 16px; color: inherit;
  transition: border-color .15s ease, transform .15s ease;
}
a.acc-row:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-1px); }
.acc-row-top { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; align-items: baseline; }
.acc-row-title { font-weight: 600; }
.acc-row-meta { font-family: var(--font-mono); font-size: .82rem; color: var(--text-muted); }
/* Полоса прогресса: своя, а не <progress> - системный элемент рисуется
   браузером и в тёмной теме живёт своей жизнью (та же причина, по которой в
   main.css стоит color-scheme). */
.acc-bar { height: 6px; border-radius: 3px; background: var(--accent-soft); margin-top: 10px; overflow: hidden; }
.acc-bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.acc-row-last { margin: 8px 0 0; font-size: .85rem; color: var(--text-muted); }

.acc-section-title { margin: 0 0 12px; font-size: 1.05rem; }
.acc-empty { color: var(--text-muted); margin: 0 0 26px; }

.acc-danger { border-color: #d94b4b33; }
.acc-danger h2 { color: #d94b4b; }
.acc-inline { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.acc-checkbox { display: flex; gap: 8px; align-items: flex-start; font-size: .9rem; }
.acc-checkbox input { margin-top: 3px; }

/* Шапка: вход или имя. Моноширинный, как остальные служебные подписи. */
.acc-nav { display: flex; align-items: center; gap: 10px; font-family: var(--font-mono); font-size: .85rem; }
.acc-nav a { color: var(--text-muted); }
.acc-nav a:hover { color: var(--accent); text-decoration: none; }
.acc-nav a.is-me { color: var(--text); }
/* «Выйти» - это POST-форма (выход по ссылке уводит одним чужим <img>), но
   выглядеть она должна как соседняя ссылка «настройки», а не как кнопка
   действия: рядом с ними обеими нет ничего важнее. */
.acc-linkbtn {
  background: none; border: none; padding: 0; cursor: pointer;
  font: inherit; color: var(--text-muted);
}
.acc-linkbtn:hover { color: var(--accent); }
.comment-badge { color: var(--accent); margin-left: 4px; font-size: .8rem; }

@media (max-width: 640px) {
  .acc-stat { flex: 1 1 40%; min-width: 0; }
  .acc-nav .acc-nav-label { display: none; }
}
