/*
 * xseo74 — открытая часть: главная «Система», все материалы, статьи, услуги, кейсы.
 * Стиль — чёрный матовый (решение владельца 03.10.2026: графит #1e1e1e был тусклым).
 * Почти чёрная база с зерном и мягким светом сверху, поверхности — матовый чёрный
 * со светлой кромкой, текст белый и контрастный, акцент — белый. Монохром, без глянца.
 * Шрифты системные: CSP пускает только свои файлы.
 * Собирается вместе со страницами скриптом _dev/build-blog.mjs.
 */

:root {
  color-scheme: dark;
  --bg: #0a0a0a;          /* чёрный матовый */
  --matte: #131313;       /* поверхности: карточки, панели */
  --matte-2: #0e0e0e;     /* глубже: код, подложки */
  --raise: #1c1c1c;       /* наведение */
  --line: #1f1f1f;
  --line-2: #303030;
  --edge: rgba(255, 255, 255, .06);    /* светлая кромка поверхности сверху */
  --text: #f4f4f4;
  --body: #d8d8d8;
  --muted: #a2a2a2;
  --dim: #6c6c6c;
  --mark: #ededed;        /* знак в шапке */
  --ink: #0a0a0a;         /* текст на светлом */
  --hi: #f4f4f4;          /* активное: белое на чёрном */
  /* Матовая поверхность: свет падает сверху, к низу чуть темнее. */
  --surface: linear-gradient(180deg, #161616 0%, #111111 100%);
  --shadow: 0 22px 44px rgba(0, 0, 0, .7);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --wrap: 1200px;
  --measure: 70ch;
  --radius: 14px;
  /* Матовое зерно: шум с прозрачностью, зашитой в сам рисунок. */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
  /* Мягкий свет сверху страницы — чтобы чёрный был объёмным, а не плоским. */
  --light: radial-gradient(1200px 560px at 50% -10%, rgba(255, 255, 255, .055), transparent 62%);
}

::selection { color: var(--ink); background: var(--hi); }

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--text);
  background: var(--grain), var(--light), var(--bg);
  font: 400 17px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

img { max-width: 100%; height: auto; }

a { color: var(--text); text-decoration: none; }
a:hover { color: #fff; }

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

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }
main.wrap { flex: 1 0 auto; padding-top: 18px; padding-bottom: 80px; }

.skip {
  position: absolute; left: 12px; top: -48px; z-index: 30;
  padding: 10px 14px; border-radius: 10px;
  color: var(--ink); background: var(--hi); font-weight: 600;
}
.skip:focus { top: 12px; }

/* ---------- Шапка ---------- */

.top {
  position: sticky; top: 0; z-index: 20;
  background: rgba(10, 10, 10, .78);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--edge);
}
.top__in { display: flex; align-items: center; gap: 10px; min-height: 64px; transition: min-height .25s ease; }
.top__gap { flex: 1 1 auto; }
/* При прокрутке шапка сжимается: ниже, знак меньше, фон плотнее. */
.top { transition: background .25s ease; }
.top.is-small { background: rgba(10, 10, 10, .92); }
.top.is-small .top__in { min-height: 50px; }
.top.is-small .logo__mark { width: 34px; }

.logo { display: inline-flex; align-items: center; color: var(--mark); transition: color .2s ease, opacity .2s ease; }
.logo:hover { color: #fff; }
.logo__mark { display: block; width: 44px; height: auto; transition: width .25s ease; }

/* Разделы — компактной группой справа. */
.nav { display: flex; align-items: center; gap: 0; margin-left: auto; }
.nav a {
  padding: 6px 11px; border-radius: 999px;
  color: var(--muted); font-size: 14px; font-weight: 500; white-space: nowrap;
  transition: color .15s ease, background .15s ease;
}
.nav a:hover { color: var(--text); background: var(--raise); }
.nav a[aria-current="page"] { color: var(--ink); background: var(--hi); font-weight: 600; }

.menu { display: none; margin-left: 2px; position: relative; }
.menu summary {
  list-style: none; cursor: pointer;
  display: grid; place-content: center; gap: 4px;
  width: 42px; height: 42px; border-radius: 10px; border: 1px solid var(--line-2);
}
.menu summary::-webkit-details-marker { display: none; }
.menu summary span { display: block; width: 18px; height: 2px; border-radius: 2px; background: var(--text); transition: transform .2s ease, opacity .2s ease; }
.menu[open] summary span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.menu[open] summary span:nth-child(2) { opacity: 0; }
.menu[open] summary span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
.menu__panel {
  position: absolute; right: 0; top: calc(100% + 10px);
  width: min(300px, calc(100vw - 32px));
  display: grid; gap: 2px; padding: 8px;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 14px;
  box-shadow: var(--shadow), inset 0 1px 0 var(--edge);
}
.menu__panel a { padding: 11px 12px; border-radius: 10px; color: var(--text); font-weight: 500; }
.menu__panel a:hover { background: var(--raise); }
.menu__panel a[aria-current="page"] { color: var(--ink); background: var(--hi); }
.menu__panel a:last-child { margin-top: 4px; border-top: 1px solid var(--line); border-radius: 0 0 10px 10px; color: var(--muted); }

/* ---------- Вход в кабинет (главная, справа) ---------- */

.login { position: relative; margin-left: auto; }
.login__btn {
  list-style: none; cursor: pointer;
  display: grid; place-items: center;
  width: 42px; height: 42px; border-radius: 50%;
  color: var(--text); border: 1px solid var(--line-2); background: var(--surface);
  box-shadow: inset 0 1px 0 var(--edge);
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.login__btn::-webkit-details-marker { display: none; }
.login__btn svg { width: 20px; height: 20px; }
.login__btn:hover, .login[open] .login__btn { color: var(--ink); border-color: var(--hi); background: var(--hi); }
.login__panel {
  position: absolute; right: 0; top: calc(100% + 12px);
  width: min(320px, calc(100vw - 32px));
  padding: 18px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--line-2);
  box-shadow: var(--shadow), inset 0 1px 0 var(--edge);
}
.login__title { margin: 0 0 14px; font-size: 16px; font-weight: 700; }
.login__panel label { display: block; margin: 0 0 6px; color: var(--muted); font-size: 13px; }
.login__panel input {
  width: 100%; margin: 0 0 12px; padding: 11px 13px;
  color: var(--text); background: var(--matte-2);
  border: 1px solid var(--line-2); border-radius: 10px;
  font: inherit; font-size: 15px;
}
.login__panel input:focus-visible { outline: 2px solid var(--hi); outline-offset: 1px; border-color: transparent; }
.login__panel button {
  width: 100%; min-height: 44px; margin-top: 2px;
  color: var(--ink); background: var(--hi);
  border: 0; border-radius: 10px;
  font: inherit; font-weight: 700; cursor: pointer;
  transition: filter .15s ease;
}
.login__panel button:hover { filter: brightness(1.08); }
.login__err {
  margin: 0 0 12px; padding: 9px 12px; border-radius: 10px;
  color: #f0b5a3; background: #2a1a17; border: 1px solid #5c3127; font-size: 14px;
}
.login__note { margin: 12px 0 0; color: var(--dim); font-size: 12.5px; }

/* ---------- Хлебные крошки ---------- */

.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0 28px; font-size: 13.5px; color: var(--muted); }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--text); }
.crumbs span[aria-hidden] { opacity: .5; }

/* ---------- Статья ---------- */

.chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--surface);
  color: var(--text); font-size: 13px; font-weight: 600; letter-spacing: .02em;
}
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .7; }
a.chip:hover { color: var(--ink); background: var(--hi); border-color: var(--hi); }

.post__head { max-width: 900px; margin-bottom: 36px; }
.post__head .chip { margin-bottom: 18px; }
.post__head h1 {
  margin: 0;
  font-size: clamp(30px, 4.6vw, 50px); line-height: 1.12; font-weight: 700; letter-spacing: -.022em;
  text-wrap: balance;
}
.post__lead { margin: 18px 0 0; max-width: 64ch; color: var(--muted); font-size: 19px; line-height: 1.6; }
.post__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 18px 0 0; color: var(--muted); font-size: 14px; }
.post__meta span[aria-hidden] { opacity: .5; }

.post__grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; }
.post--toc .post__grid { align-items: start; }
.post__empty { color: var(--muted); }

.toc--side { display: none; }
.toc p, .toc summary {
  margin: 0 0 10px; color: var(--muted);
  font-size: 12.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
}
.toc ol { margin: 0; padding: 0; list-style: none; counter-reset: toc; display: grid; gap: 2px; }
.toc li { counter-increment: toc; }
.toc a {
  display: grid; grid-template-columns: 26px 1fr; gap: 6px;
  padding: 7px 10px; border-radius: 10px;
  color: var(--muted); font-size: 14.5px; line-height: 1.4;
  transition: color .15s ease, background .15s ease;
}
.toc a::before { content: counter(toc, decimal-leading-zero); font-variant-numeric: tabular-nums; font-size: 12.5px; padding-top: 1px; opacity: .55; }
.toc a:hover { color: var(--text); background: var(--raise); }
.toc a.is-on { color: var(--text); background: var(--matte); box-shadow: inset 2px 0 0 var(--hi); }
.toc a.is-on::before { opacity: 1; }

.toc--inline {
  padding: 14px 16px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: inset 0 1px 0 var(--edge);
}
.toc--inline summary { margin: 0; cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.toc--inline summary::-webkit-details-marker { display: none; }
.toc--inline summary::after {
  content: ""; width: 8px; height: 8px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg) translateY(-2px); transition: transform .2s ease;
}
.toc--inline[open] summary::after { transform: rotate(-135deg) translateY(-2px); }
.toc--inline ol { margin-top: 12px; }

@media (min-width: 1100px) {
  .post--toc .post__grid { grid-template-columns: minmax(0, 1fr) 280px; gap: 72px; }
  .toc--inline { display: none; }
  .toc--side { display: block; position: sticky; top: 92px; max-height: calc(100vh - 120px); overflow: auto; padding-bottom: 12px; }
}

/* ---------- Текст статьи ---------- */

/* overflow-wrap: anywhere — в статьях встречаются длинные строки без пробелов
   (формулы Excel вида =СУММЕСЛИ('Семантика'!A:A;…)); на телефоне они распирали страницу вбок. */
.prose { max-width: var(--measure); color: var(--body); font-size: 18.5px; line-height: 1.75; overflow-wrap: anywhere; }
.prose > :first-child { margin-top: 0; }
.prose p { margin: 0 0 1.05em; }
.prose h2 {
  margin: 2.1em 0 .75em; scroll-margin-top: 92px;
  color: var(--text); font-size: clamp(23px, 2.6vw, 29px); line-height: 1.25; font-weight: 700; letter-spacing: -.012em;
  text-wrap: balance;
}
.prose h2 + h2 { margin-top: .6em; font-size: clamp(20px, 2.2vw, 23px); color: var(--muted); }
.prose ul, .prose ol { margin: 0 0 1.2em; padding: 0; list-style: none; display: grid; gap: .55em; }
.prose li { position: relative; padding-left: 1.55em; }
.prose ul > li::before {
  content: ""; position: absolute; left: .3em; top: .74em;
  width: 6px; height: 6px; border-radius: 1px; background: var(--muted); transform: rotate(45deg);
}
.prose ol > li { padding-left: 2em; }
/* Номер — из value пункта: авторский, список может начинаться не с единицы. */
.prose ol > li::before {
  content: attr(value); position: absolute; left: 0; top: .12em;
  min-width: 1.45em; height: 1.45em; border-radius: 6px;
  display: grid; place-items: center;
  font-size: .78em; font-weight: 700; color: var(--ink); background: var(--hi);
}
.prose li b { display: block; color: var(--text); font-weight: 650; }
.prose li span { display: block; margin-top: .15em; }
.prose figure { margin: 1.9em 0; }
.prose figure img {
  display: block; margin: 0 auto;
  border-radius: 12px; border: 1px solid var(--line-2); background: var(--matte);
}
.prose a { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--dim); }
.prose a:hover { text-decoration-color: currentColor; }
.prose .cards { margin: 1.6em 0; max-width: none; }
/* Хаб: главное — карточки, им вся ширина; редкий текст остаётся в читаемой колонке. */
.prose--wide { max-width: none; }
.prose--wide > :not(.cards) { max-width: var(--measure); }

/* Подзаголовок, жирный, код, таблица, выноска — разметка статей из _dev/content. */
.prose h3 {
  margin: 1.75em 0 .55em; scroll-margin-top: 92px;
  color: var(--text); font-size: clamp(19px, 2vw, 21px); line-height: 1.32; font-weight: 650;
  text-wrap: balance;
}
.prose h2 + h3 { margin-top: .5em; }
.prose h4 {
  margin: 1.5em 0 .45em; scroll-margin-top: 92px;
  color: var(--text); font-size: 17px; line-height: 1.38; font-weight: 650;
  text-wrap: balance;
}
.prose h3 + h4 { margin-top: .4em; }
.prose strong { color: var(--text); font-weight: 650; }
.prose code {
  font-family: ui-monospace, "Cascadia Mono", Consolas, Menlo, monospace;
  font-size: .84em; padding: .1em .38em; border-radius: 6px;
  background: var(--matte); border: 1px solid var(--line); color: var(--text);
}
/* Длинная строка кода (букмарклеты — одна строка в тысячи знаков) листается
   внутри блока, а не растягивает страницу. */
.prose pre {
  margin: 1.4em 0; padding: 16px 18px; overflow-x: auto; overflow-wrap: normal;
  background: var(--matte-2); border: 1px solid var(--line); border-radius: 12px;
  font-size: 14px; line-height: 1.6;
}
.prose pre code { padding: 0; border: 0; background: none; font-size: inherit; white-space: pre; }
.prose .table {
  margin: 1.5em 0; overflow-x: auto;
  border: 1px solid var(--line-2); border-radius: 12px; background: var(--matte);
}
.prose table { width: 100%; border-collapse: collapse; font-size: .88em; line-height: 1.55; overflow-wrap: normal; }
.prose th, .prose td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line-2); }
.prose th { color: var(--ink); font-weight: 700; background: var(--hi); }
.prose td + td { border-left: 1px solid var(--line-2); }
.prose tbody tr:last-child td { border-bottom: 0; }
.prose .note {
  margin: 1.5em 0; padding: 14px 18px;
  border-left: 3px solid var(--hi); border-radius: 0 12px 12px 0;
  background: var(--surface);
}
.prose .note > :last-child { margin-bottom: 0; }
/* Видео Rutube: плеер 16:9 в матовой рамке, ниже — подпись-ссылка. */
.prose .video { margin: 1.8em 0; }
.video__frame { position: relative; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 14px; border: 1px solid var(--line-2); background: #000; }
.video__frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.prose .video figcaption { margin-top: 8px; text-align: center; font-size: 13.5px; color: var(--muted); }
/* Схема-инфографика: своя тёмная карточка (svg), по клику — крупно (webp). */
.prose .infographic { margin: 2em 0; }
.prose .infographic a { display: block; text-decoration: none; }
.prose .infographic img { width: 100%; max-width: 640px; border-radius: 14px; border: 1px solid var(--line-2); background: #111; }
.prose .infographic a:hover img { border-color: #4a4a4a; }
.prose .infographic figcaption { margin-top: 8px; text-align: center; font-size: 13.5px; color: var(--muted); }

/* ---------- Карточки ---------- */

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 16px; }
.card {
  display: flex; flex-direction: column; min-width: 0;
  overflow: hidden; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 var(--edge);
  color: var(--text);
  transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease;
}
.card:hover { color: var(--text); transform: translateY(-3px); border-color: #3a3a3a; box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .09); }
.prose .card { text-decoration: none; }
/* Картинки — чёрно-белые и контрастные под матовый стиль; на наведении проявляется цвет. */
.card__img {
  display: block; width: 100%; height: auto; aspect-ratio: 16 / 10;
  object-fit: cover; background: var(--matte-2);
  border-bottom: 1px solid var(--line);
  filter: grayscale(1) contrast(1.14) brightness(.96);
  transition: filter .45s ease;
}
.card__img--top { object-position: center top; }
.card:hover .card__img { filter: none; }
.card__img--none { display: grid; place-items: center; filter: none; background: radial-gradient(circle at 50% 40%, #1a1a1a, var(--matte-2)); }
.card__mark { width: 34%; max-width: 92px; color: #2a2a2a; transition: color .3s ease; }
.card:hover .card__mark { color: #5a5a5a; }
.card__body { display: grid; align-content: start; gap: 7px; padding: 15px 16px 17px; flex: 1 1 auto; }
.card__sec { color: var(--dim); font-size: 11.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.card__title { color: var(--text); font-size: 16.5px; line-height: 1.35; font-weight: 650; letter-spacing: -.005em; overflow-wrap: anywhere; }
.card__desc {
  color: var(--muted); font-size: 14px; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.card__meta { margin-top: auto; padding-top: 4px; color: var(--dim); font-size: 12.5px; }

.more { margin-top: 64px; }
.more h2 { margin: 0 0 18px; font-size: 24px; letter-spacing: -.01em; }

/* ---------- Все материалы ---------- */

.blog-head { max-width: 900px; margin-bottom: 20px; }
.blog-head h1 { margin: 0; font-size: clamp(34px, 5vw, 56px); line-height: 1.08; font-weight: 700; letter-spacing: -.028em; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 26px; }
.filter {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--line-2); color: var(--body); font-size: 14.5px; font-weight: 600;
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.filter span { font-size: 12.5px; opacity: .7; font-variant-numeric: tabular-nums; }
.filter:hover { color: var(--text); border-color: #555; background: var(--raise); }
.filter.is-on { color: var(--ink); background: var(--hi); border-color: var(--hi); }

.blog-sec { margin-top: 56px; scroll-margin-top: 90px; }
.blog-sec[hidden] { display: none; }
.blog-sec__head { display: grid; gap: 6px; margin-bottom: 20px; padding-left: 16px; border-left: 2px solid var(--hi); }
.blog-sec__head h2 { margin: 0; font-size: clamp(24px, 3vw, 32px); letter-spacing: -.02em; }
.blog-sec__head p { margin: 0; max-width: 70ch; color: var(--muted); }

.blog-sec__head h2 a, .shelf__title h2 a { color: inherit; }
.blog-sec__head h2 a:hover, .shelf__title h2 a:hover { color: #fff; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 6px; text-decoration-color: var(--dim); }

/* ---------- Страница раздела ---------- */

.sec-hero { position: relative; max-width: 900px; margin-bottom: 8px; padding-top: 8px; }
.sec-hero__n {
  display: block; margin-bottom: 6px;
  font-size: clamp(56px, 8vw, 104px); line-height: .9; font-weight: 700; letter-spacing: -.05em;
  color: transparent; -webkit-text-stroke: 1px rgba(255, 255, 255, .3);
}
.sec-hero h1 { margin: 0; font-size: clamp(38px, 6vw, 72px); line-height: 1.02; font-weight: 700; letter-spacing: -.035em; text-wrap: balance; }
.sec-hero__meta { margin: 16px 0 0; color: var(--dim); font-size: 14px; font-variant-numeric: tabular-nums; }

.sec-group { margin-top: 56px; scroll-margin-top: 90px; }
.sec-group__head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 18px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.sec-group__head h2 { margin: 0; font-size: clamp(22px, 2.6vw, 28px); letter-spacing: -.015em; }
.sec-group__head span { color: var(--dim); font-size: 14px; font-variant-numeric: tabular-nums; }

.sec-more { margin-top: 88px; }
.sec-more__title { margin: 0 0 14px; color: var(--muted); font-size: 12.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }

/* ---------- Главная «Система» ---------- */

.home { padding-top: 8px; }
/* overflow: hidden — водяной знак не должен распирать страницу вбок: мобильный Chrome
   растягивает по нему ширину, даже когда body обрезает переполнение. */
.home-hero { position: relative; isolation: isolate; overflow: hidden; padding: clamp(40px, 7vw, 96px) 0 24px; }
/* Знак — водяным, крупно, справа: матовый, чуть светлее чёрного фона. */
.home-hero__mark {
  position: absolute; right: 0; top: 8%;
  width: min(48vw, 580px); height: auto;
  color: #161616; pointer-events: none; z-index: -1;
  /* Верхняя кромка знака ловит свет, нижняя уходит в тень — матовый предмет, а не плоская заливка. */
  filter: drop-shadow(0 -1px 0 rgba(255, 255, 255, .09)) drop-shadow(0 2px 1px rgba(0, 0, 0, .7));
}
.home-hero h1 {
  margin: 0 0 clamp(28px, 4vw, 48px);
  font-size: clamp(64px, 13vw, 172px); line-height: .92; font-weight: 700; letter-spacing: -.045em;
}
.home-index { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); max-width: 980px; }
.home-index li { border-bottom: 1px solid var(--line); }
.home-index a {
  display: grid; grid-template-columns: 56px minmax(0, 1fr) auto 32px; align-items: center; gap: 12px;
  padding: 18px 8px; color: var(--muted);
  transition: color .2s ease, background .2s ease, padding .25s ease;
}
.home-index a:hover { color: var(--text); background: var(--surface); padding-left: 18px; }
.home-index__n { font-size: 14px; font-variant-numeric: tabular-nums; color: var(--dim); letter-spacing: .06em; }
.home-index__t { font-size: clamp(20px, 2.6vw, 30px); line-height: 1.2; font-weight: 600; letter-spacing: -.015em; color: var(--text); }
.home-index__c { font-size: 14px; font-variant-numeric: tabular-nums; color: var(--muted); }
.home-index__go { display: grid; place-items: center; color: var(--dim); transition: transform .25s ease, color .2s ease; }
.home-index__go svg { width: 22px; height: 22px; }
.home-index a:hover .home-index__go { color: var(--text); transform: translateX(4px); }

/* Полка раздела: заголовок с номером и ряд карточек, который листается вбок. */
.shelf { margin-top: clamp(56px, 7vw, 88px); scroll-margin-top: 80px; }
.shelf__head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: end; gap: 6px 18px; margin-bottom: 20px; }
.shelf__n { font-size: clamp(40px, 5vw, 64px); line-height: .9; font-weight: 700; letter-spacing: -.04em; color: transparent; -webkit-text-stroke: 1px rgba(255, 255, 255, .3); }
.shelf__title h2 { margin: 0; font-size: clamp(24px, 3vw, 34px); line-height: 1.15; letter-spacing: -.02em; }
.shelf__title p { margin: 6px 0 0; max-width: 64ch; color: var(--muted); font-size: 15px; }
.shelf__tools { display: flex; align-items: center; gap: 8px; }
.shelf__all { margin-right: 6px; color: var(--muted); font-size: 14px; font-weight: 600; white-space: nowrap; }
.shelf__all:hover { color: var(--text); }
.shelf__btn {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  color: var(--text); background: var(--surface); border: 1px solid var(--line-2); cursor: pointer;
  transition: background .15s ease, opacity .15s ease, border-color .15s ease;
}
.shelf__btn svg { width: 18px; height: 18px; }
.shelf__btn:hover { color: var(--ink); background: var(--hi); border-color: var(--hi); }
.shelf__btn:disabled { opacity: .3; cursor: default; }
.shelf__row {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 23%); gap: 16px;
  overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory;
  padding: 4px 2px 14px; margin: -4px -2px 0;
  scrollbar-width: thin; scrollbar-color: var(--line-2) transparent;
}
.shelf__row > .card { scroll-snap-align: start; }
.shelf__row::-webkit-scrollbar { height: 6px; }
.shelf__row::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 6px; }

.sign {
  margin: 0; padding: 30px 16px 40px; text-align: center;
  color: var(--dim); font-size: 12.5px; letter-spacing: .14em; text-transform: lowercase;
}

/* ---------- Узкие экраны ---------- */

@media (max-width: 980px) {
  .nav { display: none; }
  /* Разделы спрятаны — меню само прижимается вправо. */
  .menu { display: block; margin-left: auto; }
}

@media (max-width: 720px) {
  /* Номер полки — строкой над названием, а не колонкой слева. */
  .shelf__head { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .shelf__n { font-size: 30px; }
  .shelf__tools { margin-top: 6px; }
  .shelf__btn { display: none; }
  .shelf__row { grid-auto-columns: 74%; }
}

@media (max-width: 560px) {
  .wrap { padding: 0 16px; }
  body { font-size: 16px; }
  .prose { font-size: 17.5px; line-height: 1.72; }
  .prose pre { padding: 13px 14px; font-size: 13px; }
  .prose .note { padding: 12px 14px; }
  /* Таблица на телефоне — стопка карточек: строка = карточка, у значения — подпись
     столбца (data-label). Шапка таблицы остаётся для читалок, глазу не видна. */
  .prose .table { overflow: visible; border: 0; border-radius: 0; background: none; }
  .prose table, .prose tbody, .prose tr, .prose td { display: block; width: 100%; }
  .prose thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .prose tr { margin: 0 0 10px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface); overflow: hidden; }
  .prose td, .prose tbody tr:last-child td { padding: 9px 13px; border: 0; border-bottom: 1px solid var(--line-2); }
  .prose td + td { border-left: 0; }
  .prose td:last-child, .prose tbody tr:last-child td:last-child { border-bottom: 0; }
  .prose td::before { content: attr(data-label); display: block; margin-bottom: 1px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
  .prose td:first-child { color: var(--ink); font-weight: 700; background: var(--hi); }
  .prose td:first-child::before, .prose td[data-label=""]::before { display: none; }
  .post__lead { font-size: 17.5px; }
  .crumbs { margin-bottom: 20px; }
  .home-index a { grid-template-columns: 34px minmax(0, 1fr) auto; padding: 15px 4px; }
  .home-index a:hover { padding-left: 10px; }
  .home-index__go { display: none; }
  .home-hero__mark { width: 62vw; top: 3%; right: 0; }

  /* Лента на телефоне — строками: картинка слева, заголовок справа. Иначе карточки
     с картинкой во всю ширину — это километр прокрутки. */
  .blog-sec .cards, .sec-group .cards, .more .cards, .prose--wide .cards { gap: 10px; }
  .blog-sec .card, .sec-group .card, .more .card, .prose--wide .card { flex-direction: row; align-items: stretch; }
  .blog-sec .card__img, .sec-group .card__img, .more .card__img, .prose--wide .card__img {
    flex: 0 0 104px; width: 104px; aspect-ratio: auto; min-height: 84px; align-self: stretch;
    border-bottom: 0; border-right: 1px solid var(--line);
  }
  .blog-sec .card__body, .sec-group .card__body, .more .card__body, .prose--wide .card__body { padding: 11px 14px 12px; gap: 4px; }
  .blog-sec .card__title, .sec-group .card__title, .more .card__title, .prose--wide .card__title { font-size: 15.5px; }
  .blog-sec .card__desc, .sec-group .card__desc { -webkit-line-clamp: 2; font-size: 13px; }
  .card:hover { transform: none; }
}

@media (hover: none) {
  /* На сенсоре наведения нет — картинкам сразу цвет, но приглушённый. */
  .card__img { filter: grayscale(.35) brightness(.95); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
