/* Стили движка. Цвета, шрифты, радиусы и отступы — CSS-переменные дизайна
   (Engine\Design::cssVars, выводятся в <style> каждой страницы).
   Правило: любая комбинация вариантов должна выдерживать любой контент —
   длинные слова и URL, картинки любых размеров, широкие таблицы, пустые блоки. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.62 var(--font-body);
  letter-spacing: -.004em;
  overflow-wrap: break-word;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
:is(a, button, input, summary):focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 45%, transparent);
  outline-offset: 3px;
}
img, video, iframe, svg { max-width: 100%; }
img { height: auto; display: block; }
h1, h2, h3, h4 { font-family: var(--font-heading); line-height: 1.2; letter-spacing: -.018em; margin: 0 0 .5em; overflow-wrap: anywhere; }
.muted, .empty { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.wrap { width: 100%; max-width: var(--width); margin: 0 auto; padding: 0 16px; }

/* ---- Карточная поверхность (стили карточек: border | shadow | flat) ---- */
.card, .widget, .page-head, .menu__panel {
  background: var(--surface);
  border-radius: var(--radius);
}
.cards-border :is(.card, .widget, .page-head) { border: 1px solid var(--border); }
.cards-shadow :is(.card, .widget, .page-head) { box-shadow: 0 1px 2px rgb(0 0 0 / .06), 0 4px 16px rgb(0 0 0 / .06); }
.cards-flat :is(.card, .widget, .page-head) { box-shadow: none; }

/* ---- Иконки разделов и партнёров ---- */
.icon {
  flex: none; display: inline-grid; place-items: center; overflow: hidden;
  border-radius: 50%; color: #fff; font-weight: 700; line-height: 1;
  width: 36px; height: 36px; font-size: 15px; background: var(--muted);
}
.icon img { width: 100%; height: 100%; object-fit: cover; }
.icon--s { width: 28px; height: 28px; font-size: 13px; }
.icon--l { width: 56px; height: 56px; font-size: 24px; }
.icon--emoji { background: color-mix(in srgb, var(--primary) 12%, var(--surface)); color: var(--text); font-size: 18px; }
.icon--l.icon--emoji { font-size: 30px; }
.icon--plain { background: color-mix(in srgb, var(--primary) 12%, var(--surface)); color: var(--primary); }

.badge {
  margin-left: auto; flex: none; padding: 2px 8px; border-radius: 999px;
  font-size: 12px; color: var(--muted); background: color-mix(in srgb, var(--muted) 12%, var(--surface));
}
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 9px 18px;
  border-radius: max(6px, calc(var(--radius) * .7)); background: var(--primary); color: var(--on-primary);
  font-weight: 600; line-height: 1.2;
}
.button:hover { text-decoration: none; filter: brightness(1.08); }
.button--small { padding: 7px 14px; font-size: 14px; }

/* ---- Шапка ----
   Как на vc.ru: монограмма и название, поиск, кнопки справа. В каркасе без левого меню
   разделы — второй строкой. Однострочная шапка (bar, accent) закреплена сверху. */
body { --header-h: 0px; }
.shell-three { --header-h: 72px; }
.shell-split { --header-h: 108px; }
.header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 82%, transparent);
  box-shadow: 0 1px 0 rgb(0 0 0 / .015), 0 8px 24px rgb(0 0 0 / .025);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
}
.header__inner { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; min-height: 72px; padding-top: 10px; padding-bottom: 10px; }
/* Порядок в шапке не зависит от порядка в разметке: меню → логотип → слоган → инструменты → разделы. */
.header__inner > .menu { order: 0; }
.header__inner > .logo, .header__brand { order: 1; }
.header__inner > .header__tagline { order: 2; }
.header__inner > .header__tools { order: 4; margin-left: auto; }
.header__inner > .topnav { order: 5; flex-basis: 100%; margin: 0 -2px; padding-top: 10px; border-top: 1px solid var(--border); }

.logo { display: inline-flex; align-items: center; gap: 11px; min-width: 0; color: var(--text); font: 800 1.38rem/1.15 var(--font-heading); letter-spacing: -.025em; }
.logo:hover { text-decoration: none; }
.logo__text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logo__mark { flex: none; width: 36px; height: 36px; font-family: var(--font-heading); }
.logo__image { object-fit: contain; }
.logo__bg { fill: var(--primary); }
.logo__txt { fill: var(--on-primary); }
.header__tagline { color: var(--muted); font-size: 14px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.header__tools { display: flex; align-items: center; gap: 6px; }
.icon-button {
  display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 50%;
  color: var(--text); background: transparent;
  transition: color .18s, background-color .18s, transform .18s;
}
.icon-button:hover { background: color-mix(in srgb, var(--muted) 14%, transparent); text-decoration: none; transform: translateY(-1px); }
.icon-button--search { display: none; }
.ico { width: 20px; height: 20px; flex: none; }

.search { position: relative; display: flex; align-items: center; }
.search > .ico { position: absolute; left: 12px; color: var(--muted); pointer-events: none; }
.search__input {
  width: 100%; height: 44px; padding: 0 16px 0 42px; border: 1px solid transparent; border-radius: 999px;
  font: inherit; font-size: 15px; color: var(--text); background: color-mix(in srgb, var(--muted) 12%, var(--surface));
  outline: none; transition: border-color .18s, background-color .18s, box-shadow .18s;
}
.search__input:focus { border-color: color-mix(in srgb, var(--primary) 55%, var(--border)); background: var(--surface); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 10%, transparent); }
.search__input::placeholder { color: var(--muted); }
.search--header { width: clamp(180px, 22vw, 300px); }
.search--page { gap: 10px; margin-top: 14px; }
.search--page .search__input { height: 46px; font-size: 16px; }

.header--centered .header__inner { justify-content: center; }
.header--centered .header__brand { display: flex; flex-direction: column; align-items: center; text-align: center; min-width: 0; max-width: 100%; padding: 8px 0; flex: 1; }
.header--centered .logo { font-size: 1.8rem; max-width: 100%; }
.header--centered .logo__mark { width: 40px; height: 40px; }
.header--centered .topnav { justify-content: center; }
/* На широком экране инструменты справа, бренд — строго по центру. */
@media (min-width: 861px) {
  .header--centered .header__inner { position: relative; }
  .header--centered .header__tools { position: absolute; right: 16px; top: 22px; }
}

.header--accent { background: color-mix(in srgb, var(--primary) 96%, transparent); border-bottom: 0; }
.header--accent :is(.logo, .topnav__item, .icon-button) { color: var(--on-primary); }
.header--accent .logo__bg { fill: var(--on-primary); }
.header--accent .logo__txt { fill: var(--primary); }
.header--accent .header__tagline { color: color-mix(in srgb, var(--on-primary) 75%, transparent); }
.header--accent .menu__toggle span { background: var(--on-primary); }
.header--accent .topnav { border-top-color: color-mix(in srgb, var(--on-primary) 25%, transparent); }
.header--accent .search__input { background: color-mix(in srgb, var(--on-primary) 18%, transparent); color: var(--on-primary); }
.header--accent .search__input::placeholder, .header--accent .search > .ico { color: color-mix(in srgb, var(--on-primary) 75%, transparent); }
.header--accent .search__input:focus { background: var(--surface); color: var(--text); }
.header--accent .icon-button:hover { background: color-mix(in srgb, var(--on-primary) 15%, transparent); }

/* Роли цветов монограммы (View::logoArt): буквы без фона, контур, второй тон, внутреннее кольцо. */
.logo__ink { fill: var(--primary); }
.logo__line { fill: none; stroke: var(--primary); }
.logo__shade { fill: var(--text); fill-opacity: .26; }
.logo__ring { fill: none; stroke: var(--on-primary); }
.header--accent .logo__ink { fill: var(--on-primary); }
.header--accent .logo__line { stroke: var(--on-primary); }
.header--accent .logo__ring { stroke: var(--primary); }
.header--accent .logo__shade { fill: var(--primary); fill-opacity: .2; }

/* Словесные логотипы: первая буква или точка — цветом акцента; капитель в рамке. */
.logo__first, .logo__dot { color: var(--primary); }
.header--accent :is(.logo__first, .logo__dot) { color: color-mix(in srgb, var(--on-primary) 65%, var(--primary)); }
.logo--wordmark { font-weight: 900; letter-spacing: -.035em; }
.logo--dot { font-weight: 850; }
.logo--caps { font-size: 1.02rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.logo--caps .logo__text { padding: 5px 11px 4px; border: 2px solid currentColor; border-radius: min(var(--radius), 8px); }
.logo__mark--underline { overflow: visible; }

/* Газетная шапка: строка слогана, крупное название по центру, двойная линия.
   Высокая, поэтому не закреплена — колонки прилипают к самому верху. */
.header--masthead {
  position: relative; background: var(--surface); box-shadow: none;
  border-bottom: 4px double color-mix(in srgb, var(--text) 70%, transparent);
  -webkit-backdrop-filter: none; backdrop-filter: none;
}
.header-masthead { --header-h: 0px; }
.masthead__strip { border-bottom: 1px solid var(--border); color: var(--muted); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; }
.masthead__strip .wrap { display: flex; justify-content: center; padding-top: 7px; padding-bottom: 7px; }
.masthead__tagline { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.header--masthead .header__inner { justify-content: center; min-height: 100px; }
.header--masthead .header__brand { display: flex; flex: 1; justify-content: center; min-width: 0; }
.header--masthead .logo { font-size: clamp(1.9rem, 3.2vw, 2.7rem); letter-spacing: -.03em; }
.header--masthead .logo--caps { font-size: clamp(1.2rem, 1.8vw, 1.5rem); }
.header--masthead .logo__mark { width: 48px; height: 48px; }
.header--masthead .topnav { justify-content: center; }
@media (min-width: 861px) {
  .header--masthead .header__inner { position: relative; }
  .header--masthead .header__tools { position: absolute; right: 16px; top: 28px; }
}

/* Лента: цветная полоса сверху, название и слоган в две строки, разделы — вкладками с подчёркиванием. */
.header--ribbon { border-top: 4px solid var(--primary); }
.header-ribbon.shell-three { --header-h: 78px; }
.header-ribbon.shell-split { --header-h: 114px; }
.header--ribbon .header__brand { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; min-width: 0; }
.header--ribbon .header__brand > .header__tagline { padding-left: 47px; font-size: 13px; }
.header--ribbon .header__brand > .logo:not(:has(.logo__mark)) + .header__tagline { padding-left: 0; }
.header--ribbon .topnav__item { border-radius: 0; border-bottom: 2px solid transparent; }
.header--ribbon .topnav__item:hover { background: transparent; }
.header--ribbon .topnav__item[aria-current="page"] { background: transparent; border-bottom-color: var(--primary); }

/* «Остров»: шапка — скруглённая панель с тенью, отделённая от краёв окна. */
.header--floating {
  padding-top: 12px; background: transparent; border-bottom: 0; box-shadow: none;
  -webkit-backdrop-filter: none; backdrop-filter: none; pointer-events: none;
}
.header--floating .header__inner {
  pointer-events: auto; padding-left: 20px; padding-right: 20px;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  border: 1px solid color-mix(in srgb, var(--border) 85%, transparent);
  border-radius: max(14px, var(--radius));
  box-shadow: 0 10px 30px rgb(0 0 0 / .07);
  -webkit-backdrop-filter: blur(14px) saturate(140%); backdrop-filter: blur(14px) saturate(140%);
}
.header-floating.shell-three { --header-h: 86px; }
.header-floating.shell-split { --header-h: 122px; }

/* Градиент: заливка акцентом с переходом и мягким бликом; цвета текста — как у «Цветной». */
.header--gradient {
  background:
    radial-gradient(circle at 88% -60%, color-mix(in srgb, var(--on-primary) 24%, transparent), transparent 55%),
    linear-gradient(115deg, var(--primary), color-mix(in srgb, var(--primary) 62%, var(--text)));
}

@media (max-width: 860px) {
  body.header-masthead { --header-h: 64px; }
  .header--masthead { position: sticky; }
  .masthead__strip { display: none; }
  .header--masthead .header__inner { justify-content: flex-start; min-height: 64px; }
  .header--masthead .header__brand { justify-content: flex-start; }
  .header--masthead .logo { font-size: 1.3rem; }
  .header--masthead .logo__mark { width: 30px; height: 30px; }
  .header--ribbon .header__brand > .header__tagline { display: none; }
  body.header-ribbon { --header-h: 68px; }
  .header--floating { padding: 8px 8px 0; }
  .header--floating .header__inner { padding-left: 12px; padding-right: 12px; min-height: 58px; }
  body.header-floating { --header-h: 70px; }
  .logo--caps { font-size: .9rem; letter-spacing: .1em; }
}

/* Строка разделов (когда нет левого меню). */
.topnav { display: flex; gap: 4px 6px; min-width: 0; overflow-x: auto; scrollbar-width: none; white-space: nowrap; }
.topnav::-webkit-scrollbar { display: none; }
.topnav__item {
  position: relative; padding: 5px 10px; border-radius: 999px;
  color: var(--muted); font-size: 15px; font-weight: 600;
  transition: color .18s, background-color .18s;
}
.topnav__item:hover { color: var(--primary); background: color-mix(in srgb, var(--primary) 7%, transparent); text-decoration: none; }
.topnav__item[aria-current="page"] { color: var(--primary); background: color-mix(in srgb, var(--primary) 11%, var(--surface)); }
.header--accent .topnav__item[aria-current="page"] { color: var(--on-primary); background: color-mix(in srgb, var(--on-primary) 18%, transparent); }

/* Мобильное меню. */
.menu { display: none; position: static; }
.menu__toggle { list-style: none; cursor: pointer; display: grid; gap: 4px; padding: 8px; margin-left: -8px; }
.menu__toggle::-webkit-details-marker { display: none; }
.menu__toggle span { display: block; width: 20px; height: 2px; border-radius: 2px; background: var(--text); }
.menu__panel {
  position: absolute; left: 8px; right: 8px; top: calc(100% + 6px); max-height: 75vh; overflow-y: auto;
  padding: 12px; box-shadow: 0 10px 30px rgb(0 0 0 / .18); border: 1px solid var(--border);
}

/* ---- Каркас ----
   Лента всегда между двумя колонками (как на vc.ru/DTF):
   three — меню | лента | виджеты; split — виджеты | лента | виджеты (меню в шапке).
   Колонки расставлены по областям сетки, порядок в разметке не важен. */
.shell { display: grid; gap: 22px; align-items: start; padding-top: 24px; padding-bottom: 48px;
  grid-template-columns: minmax(0, 1fr); grid-template-areas: "main" "right" "left"; }
.shell > * { min-width: 0; }
.shell__main { grid-area: main; }
.shell__nav { grid-area: nav; }
.shell__aside { grid-area: right; display: flex; flex-direction: column; gap: 16px; }
/* Колонка может прокручиваться — виджеты не должны сжиматься по высоте. */
.shell__aside > * { flex-shrink: 0; }
.shell__aside--left { grid-area: left; }
/* В split лента между двумя колонками — не даём ей стать слишком узкой. */
.shell-split .wrap, .shell-three .wrap { max-width: max(var(--width), 1260px); }

@media (min-width: 1101px) {
  .shell-three .shell { grid-template-columns: 220px minmax(0, 1fr) 260px; grid-template-areas: "nav main right"; }
  .shell-split .shell { grid-template-columns: 230px minmax(0, 1fr) 250px; grid-template-areas: "left main right"; }
  /* Колонки «липкие»: при длинной ленте по бокам не остаётся пустоты. Если колонка
     выше экрана — у неё своя прокрутка (поля — чтобы не обрезались тени карточек). */
  .shell__nav, .shell__aside {
    position: sticky; top: calc(var(--header-h) + 14px); max-height: calc(100vh - var(--header-h) - 28px); overflow-y: auto; scrollbar-width: thin;
  }
  .shell__aside { padding: 4px; margin: -4px; }
  .shell__aside .toc--side { position: static; max-height: none; }
}
@media (min-width: 861px) and (max-width: 1100px) {
  .shell { grid-template-columns: minmax(0, 1fr) 280px; grid-template-areas: "main right" "main left"; grid-template-rows: auto 1fr; }
}
@media (max-width: 1100px) {
  .shell__nav { display: none; }
  .menu { display: block; }
}
@media (max-width: 860px) {
  body { --header-h: 64px; }
  .topnav { display: none; }
  .menu { display: block; }
  .header__tagline { display: none; }
  .search--header { display: none; }
  .icon-button--search { display: inline-grid; }
  .header__inner { flex-wrap: nowrap; min-height: 64px; gap: 8px; }
  .logo__mark { width: 30px; height: 30px; }
  .header--centered .header__inner { flex-wrap: nowrap; justify-content: flex-start; }
  .header--centered .header__brand { align-items: flex-start; padding: 0; }
  .header--centered .logo { font-size: 1.3rem; }
}
@media (max-width: 560px) { .icon-button--rss { display: none; } }

/* ---- Левое меню ---- */
.nav { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.nav__item { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 7px 10px; border-radius: max(8px, calc(var(--radius) * .7)); color: var(--text); font-weight: 550; transition: color .18s, background-color .18s; }
.nav__item:hover { color: var(--primary); background: color-mix(in srgb, var(--primary) 7%, var(--surface)); text-decoration: none; }
.nav__item[aria-current="page"] { color: var(--primary); background: color-mix(in srgb, var(--primary) 11%, var(--surface)); font-weight: 700; }
.menu__panel .nav__item:hover { background: color-mix(in srgb, var(--primary) 8%, var(--surface)); }
.nav__label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav__heading { margin: 18px 10px 6px; font-size: 13px; color: var(--muted); }
.nav--small .nav__item { font-weight: 400; font-size: 15px; }

/* ---- Заголовок страницы ---- */
.page-head { padding: var(--pad); margin-bottom: var(--gap); }
.page-head--with-icon { display: flex; align-items: center; gap: 16px; }
.page-head__body { min-width: 0; }
.page-head__title { font-size: 1.6rem; margin: 0; }
.page-head__text { margin: 6px 0 0; color: var(--muted); }
.section-title { font-size: 1.25rem; margin: 28px 0 12px; }

/* ---- Лента ---- */
.feed { display: grid; gap: var(--gap); }
.feed--tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.feed--magazine { display: grid; gap: var(--gap); }
.feed--magazine-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.feed--magazine-tiles > .card--partner { grid-column: 1 / -1; }
.feed--tiles > .card--tile-wide { grid-column: 1 / -1; }
@media (max-width: 560px) {
  .feed--tiles, .feed--magazine-tiles { grid-template-columns: minmax(0, 1fr); }
}
.empty { padding: 32px; text-align: center; }

/* ---- Карточка ---- */
.card {
  padding: var(--pad); min-width: 0; display: flex; flex-direction: column; gap: 11px;
  transform: translateZ(0);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.cards-border .card { box-shadow: 0 1px 2px rgb(0 0 0 / .018); }
@media (hover: hover) and (pointer: fine) {
  .card:hover {
    z-index: 1; transform: translateY(-2px);
    border-color: color-mix(in srgb, var(--primary) 24%, var(--border));
    box-shadow: 0 10px 28px rgb(0 0 0 / .08), 0 2px 6px rgb(0 0 0 / .04);
  }
}
.card__head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.card__source { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.card__source-name { color: var(--text); font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card__date { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card__title { font-size: clamp(1.25rem, 1.15rem + .28vw, 1.42rem); line-height: 1.2; margin: 0; }
.card__title a { color: var(--text); }
.card__title a:hover { color: var(--primary); text-decoration: none; }
.card__title--large { font-size: clamp(1.7rem, 1.42rem + .75vw, 2.05rem); line-height: 1.14; }
.card__title--small { font-size: clamp(1.05rem, 1rem + .15vw, 1.15rem); line-height: 1.25; }
.card__excerpt { margin: 0; color: color-mix(in srgb, var(--text) 85%, var(--muted)); }
/* Длинное описание: в HTML целиком, на экране — 3 строки; «Показать полностью» добавляет site.js. */
.js-clamp { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; }
.js-clamp.is-expanded { display: block; -webkit-line-clamp: unset; line-clamp: none; overflow: visible; }
/* Оформленное описание (списки, заголовки) построчно не обрезать — сворачиваем по высоте с затуханием. */
.js-clamp--rich {
  display: block; -webkit-line-clamp: unset; line-clamp: none; max-height: 7.2em;
  -webkit-mask-image: linear-gradient(#000 65%, transparent); mask-image: linear-gradient(#000 65%, transparent);
}
.js-clamp--rich.is-expanded { max-height: none; -webkit-mask-image: none; mask-image: none; }

/* Описание из Markdown: в карточке и во вступлении статьи. Заголовки описания
   в разметке h3–h5 (H1 страницы — только заголовок статьи), а выглядят как H1–H3. */
.rich > :first-child { margin-top: 0; }
.rich > :last-child { margin-bottom: 0; }
.rich p, .rich ul, .rich ol, .rich blockquote { margin: 0 0 .6em; }
.rich ul, .rich ol { padding-left: 1.3em; }
.rich li + li { margin-top: .2em; }
.rich h3, .rich h4, .rich h5 { margin: .8em 0 .35em; color: var(--text); line-height: 1.3; }
.rich h3 { font-size: 1.3em; }
.rich h4 { font-size: 1.15em; }
.rich h5 { font-size: 1.02em; }
.rich a { text-decoration: underline; text-underline-offset: 2px; overflow-wrap: anywhere; }
.rich blockquote { padding-left: 12px; border-left: 3px solid var(--primary); color: var(--muted); }
.rich code { font-size: .9em; padding: 1px 5px; border-radius: 4px; background: color-mix(in srgb, var(--muted) 12%, var(--surface)); }
.rich hr { border: 0; border-top: 1px solid var(--border); margin: .8em 0; }
.more-toggle {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; margin-top: -4px; padding: 0;
  border: 0; background: none; font: inherit; font-size: 14px; font-weight: 600; color: var(--primary); cursor: pointer;
}
.more-toggle:hover { text-decoration: underline; }
.more-toggle::after {
  content: ''; width: 6px; height: 6px; margin: -3px 0 0 4px; border: solid currentColor; border-width: 0 2px 2px 0;
  transform: rotate(45deg); transition: transform .15s;
}
.more-toggle[aria-expanded="true"]::after { margin-top: 3px; transform: rotate(-135deg); }
.card__cover { display: block; border-radius: max(6px, calc(var(--radius) * .72)); overflow: hidden; background: color-mix(in srgb, var(--muted) 10%, var(--surface)); }
.card__cover img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; transition: transform .35s ease; }
@media (hover: hover) and (pointer: fine) { .card:hover .card__cover img, .card:hover .card__thumb img { transform: scale(1.018); } }
.card__foot { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 2px; color: var(--muted); font-size: 14px; }
.card__more { margin-left: auto; font-weight: 600; }
.card--partner .card__title a::after { content: ' ↗'; color: var(--muted); font-weight: 400; }

/* Компактная карточка: текст + миниатюра. Описание вынесено в отдельную область,
   чтобы после раскрытия занимать всю ширину под верхним рядом, а не оставаться
   в узкой колонке высотой во всю статью. */
.card--compact {
  display: grid; grid-template-columns: minmax(0, 1fr) 180px;
  grid-template-areas: "body thumb" "excerpt thumb" "tags thumb";
  align-items: start; gap: 8px var(--pad);
}
.card__body { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.card--compact .card__body { grid-area: body; }
.card__excerpt-wrap { grid-area: excerpt; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.card--compact > .tags { grid-area: tags; }
.card__thumb { grid-area: thumb; width: 180px; border-radius: max(6px, calc(var(--radius) * .72)); overflow: hidden; }
.card__thumb img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; transition: transform .35s ease; }
.card--compact.has-expanded-excerpt {
  grid-template-areas: "body thumb" "excerpt excerpt" "tags tags";
}
@media (max-width: 560px) {
  .card--compact { grid-template-columns: minmax(0, 1fr) 96px; }
  .card__thumb { width: 96px; }
  .card--compact .card__excerpt { display: none; }
}

/* Плитка. */
.card--tile { gap: 8px; }
.card__cover--tile { margin: calc(var(--pad) * -1) calc(var(--pad) * -1) 4px; border-radius: var(--radius) var(--radius) 0 0; }
.cards-border .card__cover--tile { margin-top: calc(var(--pad) * -1 - 1px); }
.card__cover--empty {
  display: grid; place-items: center; aspect-ratio: 16 / 9;
  background: radial-gradient(circle at 30% 20%, color-mix(in srgb, var(--primary) 22%, var(--surface)), color-mix(in srgb, var(--primary) 6%, var(--surface)) 70%);
}
.card__cover--empty .icon { box-shadow: 0 6px 20px rgb(0 0 0 / .12); }
.card--tile .tags {
  margin-top: auto; flex-wrap: nowrap; overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent);
}
.card--tile .tags li { flex: none; }
/* Плитки стоят рядами — длинный заголовок не должен растягивать ряд: максимум 3 строки. */
.card--tile .card__title {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden;
}

/* ---- Теги ---- */
.tags { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  display: inline-block; max-width: 100%; padding: 3px 10px; border-radius: 999px; font-size: 13px;
  color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, var(--surface));
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: top;
}
.tag:hover { text-decoration: none; background: color-mix(in srgb, var(--primary) 18%, var(--surface)); }

/* ---- Статья ---- */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; margin: 0 0 10px 4px; font-size: 14px; color: var(--muted); }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--primary); }
.crumbs__sep { width: 14px; height: 14px; }

.article { padding: clamp(18px, 3.2vw, 36px); gap: 16px; }
.article__title { font-size: clamp(1.6rem, 1.1rem + 1.6vw, 2.3rem); line-height: 1.18; margin: 6px 0 0; letter-spacing: -.015em; }
.article__lead { margin: 0; font-size: 1.2rem; line-height: 1.55; color: color-mix(in srgb, var(--text) 85%, var(--muted)); }
.article__meta { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0; color: var(--muted); font-size: 14px; }
.article__meta span { display: inline-flex; align-items: center; gap: 6px; }
.article__meta .ico { width: 16px; height: 16px; }
.article__cover { width: 100%; max-height: 70vh; object-fit: cover; border-radius: max(4px, calc(var(--radius) * .7)); }
.article .tags { margin-top: 6px; }

.share { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 16px; margin-top: 4px; border-top: 1px solid var(--border); }
.share__label { margin-right: 6px; color: var(--muted); font-size: 14px; }
.share__button {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; min-width: 40px; padding: 0 10px; justify-content: center;
  border: 0; border-radius: 999px; font: inherit; font-size: 14px; cursor: pointer;
  color: var(--text); background: color-mix(in srgb, var(--muted) 12%, var(--surface));
}
.share__button:hover { text-decoration: none; color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, var(--surface)); }
.share__copy { padding: 0 14px; }
.share__copy.is-copied { color: var(--primary); }

.category-card { flex-direction: row; align-items: center; gap: 14px; margin-top: var(--gap); color: var(--text); }
.category-card:hover { text-decoration: none; }
.category-card__body { display: grid; min-width: 0; }
.category-card__label { color: var(--muted); font-size: 13px; }
.category-card__name { font: 700 1.15rem/1.3 var(--font-heading); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.category-card__more { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; color: var(--primary); font-weight: 600; font-size: 14px; white-space: nowrap; }
.category-card__more .ico { width: 16px; height: 16px; }
@media (max-width: 560px) { .category-card__more { display: none; } }

/* Полоса прогресса чтения и кнопка «наверх» (site.js). */
.progress { position: fixed; top: 0; left: 0; z-index: 30; height: 3px; width: 100%; background: var(--primary); transform-origin: 0 50%; transform: scaleX(0); pointer-events: none; }
.to-top {
  position: fixed; right: 20px; bottom: 20px; z-index: 30; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  color: var(--on-primary); background: var(--primary); box-shadow: 0 4px 14px rgb(0 0 0 / .2);
  opacity: 0; transform: translateY(10px); pointer-events: none; transition: opacity .2s, transform .2s;
}
.to-top.is-visible { opacity: 1; transform: none; pointer-events: auto; }
.to-top .ico { width: 22px; height: 22px; }

.prose { font-size: 1.1rem; line-height: 1.75; min-width: 0; }
.prose p, .prose ul, .prose ol { margin: 0 0 1.05em; }
.prose > :first-child { margin-top: 0; }
.prose h2 { font-size: 1.5rem; margin: 1.6em 0 .6em; }
.prose h3 { font-size: 1.2rem; margin: 1.4em 0 .5em; }
.prose a { text-decoration: underline; text-underline-offset: 2px; overflow-wrap: anywhere; }
.prose img, .prose video { border-radius: max(4px, calc(var(--radius) * .7)); margin: 1.5em auto; }
.prose .article-media { margin: 1.7em 0; }
.prose .article-media img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; margin: 0; }
.prose iframe { display: block; width: 100%; aspect-ratio: 16 / 9; height: auto; border: 0; margin: 1.5em 0; }
.prose blockquote { margin: 1.5em 0; padding: 4px 0 4px 18px; border-left: 3px solid var(--primary); color: var(--muted); }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose pre { overflow-x: auto; padding: 14px; border-radius: max(4px, calc(var(--radius) * .7)); background: color-mix(in srgb, var(--muted) 10%, var(--surface)); font-size: .9em; }
.prose code { font-size: .9em; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 2em 0; }
.table-wrap { overflow-x: auto; margin: 1.5em 0; }
.prose table { border-collapse: collapse; width: max-content; min-width: 100%; font-size: .95em; line-height: 1.5; }
/* Ячейки не сжимаются в столбик: широкая таблица прокручивается внутри .table-wrap. */
.prose th, .prose td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; vertical-align: top; max-width: 32ch; }
.prose th { white-space: nowrap; }
.prose th { background: color-mix(in srgb, var(--muted) 8%, var(--surface)); }

/* ---- Оглавление ---- */
.toc details > summary { cursor: pointer; list-style: none; font-weight: 700; font-family: var(--font-heading); }
.toc details > summary::-webkit-details-marker { display: none; }
.toc details > summary::after { content: '▾'; margin-left: 6px; color: var(--muted); }
.toc details:not([open]) > summary::after { content: '▸'; }
.toc__list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 4px; font-size: 15px; }
.toc__item a { display: block; padding: 3px 0 3px 10px; border-left: 2px solid var(--border); color: var(--muted); }
.toc__item a:hover, .toc__item a.is-active { color: var(--primary); border-left-color: var(--primary); text-decoration: none; }
.toc__item--h3 a { padding-left: 24px; font-size: 14px; }
.toc--inline, .toc--mobile { padding: 14px 16px; border-radius: max(6px, calc(var(--radius) * .7)); background: color-mix(in srgb, var(--primary) 6%, var(--surface)); }
.toc--side { position: sticky; top: calc(var(--header-h) + 16px); max-height: calc(100vh - var(--header-h) - 32px); overflow-y: auto; }
.toc--mobile { display: none; }
@media (max-width: 860px) {
  .toc--side { display: none; }
  .toc--mobile { display: block; }
}

/* ---- Виджеты ---- */
.widget { padding: clamp(16px, var(--pad), 20px); }
.shell__aside .widget {
  background: color-mix(in srgb, var(--surface) 84%, var(--bg));
  border-color: color-mix(in srgb, var(--border) 78%, transparent);
  box-shadow: none;
}
.cards-shadow .shell__aside .widget { box-shadow: 0 4px 16px rgb(0 0 0 / .035); }
.cards-flat .shell__aside .widget {
  padding-inline: 4px; border: 0; border-top: 1px solid var(--border); border-radius: 0; background: transparent;
}
.widget__title { font-size: .82rem; line-height: 1.3; letter-spacing: .055em; text-transform: uppercase; color: var(--muted); margin: 0 0 14px; }
.widget__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 13px; }
.widget__item { display: grid; gap: 2px; min-width: 0; }
.widget__link { color: var(--text); font-size: 15px; font-weight: 560; line-height: 1.38; overflow-wrap: anywhere; }
.widget__link:hover { color: var(--primary); text-decoration: none; }
.widget__link[aria-current="page"] { color: var(--primary); font-weight: 700; }
.widget__meta { color: var(--muted); font-size: 13px; }
.widget__partner { display: flex; align-items: center; gap: 10px; min-width: 0; }
.widget__partner-body { display: grid; gap: 2px; min-width: 0; }
.widget__count { margin-left: auto; color: var(--muted); font-size: 13px; }

/* ---- Пагинация ---- */
.pagination { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 20px; }
.pagination__link { padding: 6px 12px; border-radius: max(6px, calc(var(--radius) * .7)); background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.pagination__link:hover { border-color: var(--primary); text-decoration: none; }
.pagination__link.is-current { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.pagination__gap { padding: 6px 4px; color: var(--muted); }

.related { margin-top: 8px; }
.error-page { align-items: center; text-align: center; padding: 48px 24px; }
.error-page__code { font: 800 4rem/1 var(--font-heading); color: var(--primary); margin: 0; }

/* ---- Подвал ---- */
.footer { border-top: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: 14px; }
.footer a { color: var(--muted); }
.footer a:hover { color: var(--primary); }
.footer__inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 28px; padding-top: 20px; padding-bottom: 20px; }
.footer__copy { margin: 0; }
.footer__links, .footer__list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.footer__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 24px; padding-top: 28px; padding-bottom: 20px; }
.footer__col { min-width: 0; }
.footer__brand { margin: 0 0 6px; color: var(--text); font: 700 1.1rem/1.3 var(--font-heading); }
.footer__text { margin: 0; }
.footer__heading { margin: 0 0 8px; color: var(--text); font-weight: 600; }
.footer__list { flex-direction: column; }
.footer__bottom { padding-top: 14px; padding-bottom: 20px; border-top: 1px solid var(--border); }

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