/* QtHelper Theme — стили. Mobile-first: базовые правила для узкого экрана,
   десктоп — через media query поверх. Палитры — CSS-переменные на [data-theme]. */

/* ---------- Палитры (ТЗ 2.7) ---------- */

:root,
html[data-theme="dark"] {
	--bg: #0d1117;
	--bg-card: #161b22;
	--bg-raised: #1c2129;
	--border: #21262d;
	--border-strong: #30363d;
	--text: #e6edf3;
	--text-2: #8b949e;
	--text-3: #6e7681;
	--accent: #41cd52;
	--accent-soft: rgba(65, 205, 82, 0.12);
	--accent-border: rgba(65, 205, 82, 0.45);
	--accent-text: #56d364;
	--shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
	color-scheme: dark;
}

html[data-theme="light"] {
	--bg: #f6f8fa;
	--bg-card: #ffffff;
	--bg-raised: #eef1f4;
	--border: #d8dee4;
	--border-strong: #c8d1da;
	--text: #1f2328;
	--text-2: #59636e;
	--text-3: #818b98;
	--accent: #41cd52;
	--accent-soft: rgba(45, 164, 78, 0.10);
	--accent-border: rgba(45, 164, 78, 0.45);
	--accent-text: #1a7f37;
	--shadow: 0 8px 28px rgba(140, 149, 159, 0.25);
	color-scheme: light;
}

/* Блоки кода — намеренно тёмные в обеих палитрах (практика технических блогов). */
:root {
	--code-bg: #0d1117;
	--code-head: #161b22;
	--code-border: #30363d;
	--code-text: #e6edf3;
	--mono: ui-monospace, "JetBrains Mono", "Cascadia Code", Consolas, "Liberation Mono", monospace;
	--sans: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--radius: 12px;
	--radius-s: 8px;
	--header-h: 60px;
}

/* ---------- База ---------- */

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font-family: var(--sans);
	font-size: 16px;
	line-height: 1.65;
	transition: background 0.25s ease, color 0.25s ease;
	-webkit-text-size-adjust: 100%;
}

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

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

.qth-mono { font-family: var(--mono); font-size: 0.82em; letter-spacing: 0.01em; }

::selection { background: var(--accent-soft); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

.screen-reader-text {
	position: absolute !important;
	width: 1px; height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
}

.skip-link:focus {
	position: fixed !important;
	top: 8px; left: 8px;
	width: auto; height: auto;
	clip: auto;
	z-index: 100001;
	background: var(--bg-card);
	color: var(--text);
	padding: 8px 14px;
	border-radius: var(--radius-s);
	border: 1px solid var(--accent-border);
}

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

.site-header {
	position: sticky;
	top: 0;
	z-index: 9000;
	background: color-mix(in srgb, var(--bg) 88%, transparent);
	backdrop-filter: blur(8px);
	border-bottom: 1px solid var(--border);
}

.site-header__inner {
	max-width: var(--layout-max, 1200px);
	margin: 0 auto;
	min-height: var(--header-h);
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 0 16px;
}

.site-logo {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	color: var(--text);
	font-family: var(--mono);
	font-size: 17px;
	font-weight: 600;
	flex-shrink: 0;
}
.site-logo:hover { text-decoration: none; }
.site-logo__mark, .site-logo__img { display: block; border-radius: 7px; }
.site-logo__dot { color: var(--accent); margin: 0 1px; }

.site-nav { display: none; min-width: 0; flex: 1; }

.site-nav__list {
	display: flex;
	align-items: center;
	gap: 2px;
	list-style: none;
	margin: 0;
	padding: 0;
	flex-wrap: nowrap;
}

/* Обрезка списка — только до первого расчёта и на время измерений,
   иначе overflow:hidden прячет раскрытый выпадающий список «Ещё». */
.site-nav__list:not(.is-ready),
.site-nav__list.is-measuring { overflow: hidden; }

/* Закреплённые пункты «Последние/Популярные» + отступ перед остальным меню. */
.site-nav__pinned > a { color: var(--text); font-weight: 600; }
.site-nav__pinned--last { margin-right: 22px; position: relative; }
.site-nav__pinned--last::after {
	content: "";
	position: absolute;
	right: -12px;
	top: 50%;
	transform: translateY(-50%);
	height: 18px;
	border-right: 1px solid var(--border-strong);
}

.site-nav__list > .menu-item { position: relative; }

.site-nav__list > .menu-item > a,
.site-nav__more {
	display: inline-block;
	padding: 8px 12px;
	color: var(--text-2);
	font-size: 14.5px;
	border-radius: var(--radius-s);
	background: none;
	border: 0;
	font-family: inherit;
	cursor: pointer;
	white-space: nowrap;
}

.site-nav__list > .menu-item > a:hover,
.site-nav__list > .menu-item > a:focus,
.site-nav__more:hover,
.site-nav__more:focus {
	color: var(--text);
	background: var(--bg-raised);
	text-decoration: none;
}

.sub-menu {
	display: none;
	position: absolute;
	top: 100%;
	right: 0;
	min-width: 260px;
	max-height: 70vh;
	overflow-y: auto;
	background: var(--bg-card);
	border: 1px solid var(--border-strong);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	list-style: none;
	margin: 6px 0 0;
	padding: 6px;
}

.menu-item-has-children.is-open > .sub-menu,
.menu-item-has-children:focus-within > .sub-menu { display: block; }

.sub-menu a {
	display: flex;
	justify-content: space-between;
	gap: 12px;
	padding: 7px 10px;
	color: var(--text-2);
	font-size: 14px;
	border-radius: var(--radius-s);
}
.sub-menu a:hover, .sub-menu a:focus { color: var(--text); background: var(--bg-raised); text-decoration: none; }
.sub-menu__count { color: var(--text-3); font-family: var(--mono); font-size: 12px; }

.site-header__actions {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-left: auto;
}

/* Поиск: свёрнут в кнопку-лупу, по клику разворачивается поле ввода. */
.header-search { position: relative; display: flex; align-items: center; }
.header-search__field {
	width: 0;
	padding: 7px 0;
	opacity: 0;
	background: var(--bg-raised);
	border: 1px solid var(--border);
	border-radius: var(--radius-s);
	color: var(--text);
	font-family: inherit;
	font-size: 14px;
	transition: width 0.22s ease, opacity 0.15s ease, padding 0.22s ease;
	pointer-events: none;
}
.header-search.is-open .header-search__field {
	width: min(240px, 45vw);
	padding: 7px 12px;
	margin-right: 6px;
	opacity: 1;
	pointer-events: auto;
}
.header-search__field:focus { outline: none; border-color: var(--accent-border); }
.header-search__toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px; height: 36px;
	flex-shrink: 0;
	background: var(--bg-raised);
	border: 1px solid var(--border);
	border-radius: var(--radius-s);
	color: var(--text-2);
	cursor: pointer;
	line-height: 0;
}
.header-search__toggle:hover { color: var(--text); border-color: var(--border-strong); }
.header-search.is-open .header-search__toggle { color: var(--accent-text); border-color: var(--accent-border); }

.theme-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px; height: 36px;
	background: var(--bg-raised);
	border: 1px solid var(--border);
	border-radius: var(--radius-s);
	color: var(--text-2);
	cursor: pointer;
}
.theme-toggle:hover { color: var(--text); border-color: var(--border-strong); }
html[data-theme="dark"] .theme-toggle__moon { display: none; }
html[data-theme="light"] .theme-toggle__sun { display: none; }

.nav-burger {
	display: inline-flex;
	flex-direction: column;
	justify-content: center;
	gap: 4px;
	width: 36px; height: 36px;
	padding: 8px;
	background: var(--bg-raised);
	border: 1px solid var(--border);
	border-radius: var(--radius-s);
	cursor: pointer;
}
.nav-burger span { display: block; height: 2px; background: var(--text-2); border-radius: 1px; }

@media (min-width: 900px) {
	.site-nav { display: block; }
	.nav-burger { display: none; }
}

/* Мобильное меню: панель под шапкой. */
@media (max-width: 899.98px) {
	.site-nav.is-open {
		display: block;
		position: fixed;
		top: var(--header-h);
		left: 0; right: 0;
		bottom: 0;
		background: var(--bg);
		overflow-y: auto;
		padding: 12px 16px 32px;
		z-index: 8999;
	}
	.site-nav.is-open .site-nav__list { flex-direction: column; align-items: stretch; }
	.site-nav.is-open .site-nav__list > .menu-item > a,
	.site-nav.is-open .site-nav__more { display: block; width: 100%; text-align: left; padding: 12px; font-size: 16px; }
	.site-nav.is-open .sub-menu {
		position: static;
		display: block;
		box-shadow: none;
		border: 0;
		background: none;
		max-height: none;
		padding-left: 12px;
	}
	.site-nav.is-open .sub-menu a { padding: 10px 12px; font-size: 15px; }
}

/* ---------- Каркас страниц ---------- */

.layout {
	max-width: var(--layout-max, 1200px);
	margin: 0 auto;
	padding: 24px 16px 56px;
}

.layout--page .entry, .layout--page .single-head { max-width: 760px; margin-left: auto; margin-right: auto; }
/* Страницы-витрины: сетке статей отдаётся вся ширина макета. */
.layout--page-wide .entry, .layout--page-wide .single-head { max-width: none; }

.section-head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 16px;
	margin: 40px 0 16px;
}
.section-head__title { margin: 0; font-size: 22px; }
.section-head__more { color: var(--text-2); white-space: nowrap; }
.section-head__more:hover { color: var(--accent-text); }

/* ---------- Хиро ---------- */

.hero { padding: 28px 0 8px; max-width: 720px; }
.hero__label {
	display: inline-block;
	padding: 4px 10px;
	background: var(--accent-soft);
	border: 1px solid var(--accent-border);
	border-radius: 999px;
	color: var(--accent-text);
	font-size: 12.5px;
}
.hero__title { margin: 14px 0 10px; font-size: clamp(26px, 5vw, 38px); line-height: 1.2; }
.hero__text { margin: 0; color: var(--text-2); font-size: 17px; }

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

.post-grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 700px) {
	.post-grid--2 { grid-template-columns: 1fr 1fr; }
	.post-grid--3 { grid-template-columns: repeat(3, 1fr); }
	.post-grid--4 { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1100px) {
	.post-grid--4 { grid-template-columns: repeat(4, 1fr); }
}

.post-card {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 18px;
	background: var(--bg-card);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	transition: border-color 0.15s ease, box-shadow 0.2s ease, transform 0.2s ease;
}
.post-card:hover {
	border-color: var(--border-strong);
	box-shadow: var(--shadow);
	transform: translateY(-2px);
}

.qth-badge {
	align-self: flex-start;
	display: inline-block;
	padding: 2px 9px;
	background: var(--accent-soft);
	border: 1px solid var(--accent-border);
	border-radius: 999px;
	color: var(--accent-text);
	font-family: var(--mono);
	font-size: 12px;
}
.qth-badge:hover { text-decoration: none; background: var(--accent-border); color: var(--text); }

.post-card__title { margin: 0; font-size: 17.5px; line-height: 1.35; }
.post-card__title a { color: var(--text); }
.post-card__title a:hover { color: var(--accent-text); text-decoration: none; }
.post-card__excerpt { margin: 0; color: var(--text-2); font-size: 14.5px; flex-grow: 1; }
.post-card__meta { color: var(--text-3); font-size: 12px; }
.qth-meta__updated { color: var(--accent-text); }

/* ---------- Популярные ---------- */

.popular-list {
	list-style: none;
	margin: 0;
	padding: 8px;
	background: var(--bg-card);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	display: grid;
	gap: 2px;
}
.popular-list__item {
	display: flex;
	gap: 14px;
	align-items: baseline;
	padding: 10px 12px;
	border-radius: var(--radius-s);
}
.popular-list__item:hover { background: var(--bg-raised); }
.popular-list__rank { color: var(--accent-text); font-size: 15px; min-width: 1.4em; text-align: right; }
.popular-list__link { color: var(--text); font-size: 15.5px; }
.popular-list__meta { display: block; color: var(--text-3); font-size: 12px; margin-top: 2px; }

/* ---------- Рубрики-плашки ---------- */

.cat-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.cat-chip {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 6px 12px;
	background: var(--bg-card);
	border: 1px solid var(--border);
	border-radius: 999px;
	color: var(--text-2);
	font-size: 13.5px;
	transition: border-color 0.15s ease, color 0.15s ease;
}
.cat-chip:hover { border-color: var(--accent-border); color: var(--text); text-decoration: none; }
.cat-chip__count {
	background: var(--bg-raised);
	border-radius: 999px;
	padding: 1px 8px;
	font-size: 12px;
	color: var(--text-3);
	font-family: var(--mono);
}

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

.single-head { margin-bottom: 20px; }
.single-title { margin: 10px 0 12px; font-size: clamp(24px, 4.5vw, 34px); line-height: 1.25; }
.single-meta { display: flex; flex-wrap: wrap; gap: 14px; color: var(--text-3); font-size: 12.5px; }

.qth-crumbs, .qth-seo-breadcrumbs { color: var(--text-3); font-size: 13px; margin-bottom: 12px; }
.qth-crumbs a, .qth-seo-breadcrumbs a { color: var(--text-2); }
.qth-crumbs__sep { color: var(--text-3); margin: 0 2px; }

.single-grid { display: grid; grid-template-columns: 1fr; gap: 28px; }
@media (min-width: 1000px) {
	.single-grid { grid-template-columns: 260px minmax(0, 760px); }
	.single-grid--no-toc { grid-template-columns: minmax(0, 760px); }
}

.single-aside { min-width: 0; }
@media (min-width: 1000px) {
	.single-aside > * { position: static; }
	.single-aside { align-self: start; position: sticky; top: calc(var(--header-h) + 16px); max-height: calc(100vh - var(--header-h) - 32px); overflow-y: auto; }
}

/* Оглавление */
.toc {
	background: var(--bg-card);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	overflow: hidden;
}
.toc__head {
	display: flex;
	justify-content: space-between;
	align-items: center;
	width: 100%;
	padding: 12px 16px;
	background: none;
	border: 0;
	color: var(--text);
	font: 600 14px var(--sans);
	cursor: pointer;
}
.toc__chevron { transition: transform 0.2s ease; color: var(--text-3); }
.toc__list { list-style: none; margin: 0; padding: 4px 8px 12px; }
.toc__item--l3 { padding-left: 14px; }
.toc__item--l4 { padding-left: 28px; }
.toc__link {
	display: block;
	padding: 5px 10px;
	border-left: 2px solid transparent;
	color: var(--text-2);
	font-size: 13.5px;
	line-height: 1.45;
	border-radius: 0 var(--radius-s) var(--radius-s) 0;
}
.toc__link:hover { color: var(--text); text-decoration: none; background: var(--bg-raised); }
.toc__link.is-active {
	color: var(--accent-text);
	border-left-color: var(--accent);
	background: var(--accent-soft);
}

/* На мобильном — аккордеон в начале статьи. */
@media (max-width: 999.98px) {
	.toc__body { display: none; }
	.toc.is-open .toc__body { display: block; }
	.toc.is-open .toc__chevron { transform: rotate(180deg); }
}
@media (min-width: 1000px) {
	.toc__head { cursor: default; pointer-events: none; }
	.toc__chevron { display: none; }
}

/* Типографика контента */
.entry-content {
	font-size: 16.5px;
	line-height: 1.75;
	overflow-wrap: break-word;
}
.entry-content h2, .entry-content h3, .entry-content h4 {
	margin: 1.8em 0 0.6em;
	line-height: 1.3;
	scroll-margin-top: calc(var(--header-h) + 16px);
}
.entry-content h2 { font-size: 24px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.entry-content h3 { font-size: 20px; }
.entry-content h4 { font-size: 17px; }
.entry-content p { margin: 0 0 1.1em; }
.entry-content ul, .entry-content ol { padding-left: 1.4em; }
.entry-content li { margin-bottom: 0.35em; }
.entry-content img { border-radius: var(--radius-s); }
.entry-content blockquote {
	margin: 1.2em 0;
	padding: 10px 18px;
	border-left: 3px solid var(--accent);
	background: var(--bg-card);
	border-radius: 0 var(--radius-s) var(--radius-s) 0;
	color: var(--text-2);
}
.entry-content table { border-collapse: collapse; width: 100%; margin: 1.2em 0; font-size: 15px; }
.entry-content th, .entry-content td { border: 1px solid var(--border-strong); padding: 8px 12px; text-align: left; }
.entry-content th { background: var(--bg-card); }

/* Инлайн-код */
.entry-content :not(pre) > code {
	font-family: var(--mono);
	font-size: 0.88em;
	background: var(--bg-raised);
	border: 1px solid var(--border);
	border-radius: 5px;
	padding: 0.12em 0.4em;
	white-space: nowrap;
}

/* ---------- Блоки кода (карточка с шапкой) ---------- */

.code-card {
	margin: 1.4em 0;
	background: var(--code-bg);
	border: 1px solid var(--code-border);
	border-radius: var(--radius);
	overflow: hidden;
}
.code-card__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 8px 8px 8px 16px;
	background: var(--code-head);
	border-bottom: 1px solid var(--code-border);
}
.code-card__label { color: #8b949e; font-family: var(--mono); font-size: 12px; }
.code-card__copy {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 5px 10px;
	background: none;
	border: 1px solid var(--code-border);
	border-radius: 6px;
	color: #8b949e;
	font: 12px var(--mono);
	cursor: pointer;
}
.code-card__copy:hover { color: #e6edf3; border-color: #6e7681; }
.code-card__copy.is-done { color: #41cd52; border-color: rgba(65, 205, 82, 0.45); }

.code-card pre {
	margin: 0;
	padding: 14px 16px;
	overflow-x: auto;
	background: none;
}
.code-card code {
	font-family: var(--mono);
	font-size: 13.5px;
	line-height: 1.6;
	color: var(--code-text);
	background: none;
	white-space: pre;
}

/* Одинокие pre вне карточки (до инициализации JS) — не «прыгают». */
.entry-content pre {
	background: var(--code-bg);
	color: var(--code-text);
	padding: 14px 16px;
	border-radius: var(--radius);
	overflow-x: auto;
}

/* Подсветка Prism — приглушённый GitHub Dark в обеих палитрах. */
.token.comment, .token.prolog, .token.cdata { color: #8b949e; }
.token.punctuation { color: #c9d1d9; }
.token.keyword, .token.atrule { color: #ff7b72; }
.token.class-name, .token.maybe-class-name, .token.namespace { color: #ffa657; }
.token.function { color: #d2a8ff; }
.token.string, .token.char, .token.attr-value, .token.regex { color: #a5d6ff; }
.token.number, .token.boolean, .token.constant { color: #79c0ff; }
.token.property, .token.tag, .token.symbol, .token.selector { color: #7ee787; }
.token.operator, .token.entity, .token.url { color: #c9d1d9; }
.token.variable, .token.builtin { color: #ffa657; }
.token.important, .token.bold { font-weight: 600; }
.token.italic { font-style: italic; }

/* ---------- Виджеты сайдбара ---------- */

.single-aside .widget {
	margin-top: 20px;
	background: var(--bg-card);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 14px 16px;
}
.single-aside .widget-title,
.single-aside .widget h1,
.single-aside .widget h2,
.single-aside .widget h3 {
	margin: 0 0 10px;
	font-size: 14px;
	font-weight: 600;
	color: var(--text-2);
	line-height: 1.4;
}

/* Блочный виджет, в котором только заголовок (блок «Заголовок» добавлен
   отдельным виджетом): не карточка, а подпись к следующей карточке. */
.single-aside .widget_block:has(> h1:only-child),
.single-aside .widget_block:has(> h2:only-child),
.single-aside .widget_block:has(> h3:only-child),
.single-aside .widget_block:has(> .wp-block-heading:only-child) {
	background: none;
	border: 0;
	padding: 0 4px;
	margin: 24px 0 -12px;
}
.single-aside .widget ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.single-aside .widget li { font-size: 13.5px; line-height: 1.45; }
.single-aside .widget a { color: var(--text-2); }
.single-aside .widget a:hover { color: var(--accent-text); text-decoration: none; }
.single-aside .widget .post-date { display: block; color: var(--text-3); font-family: var(--mono); font-size: 11.5px; }

/* Облако меток/рубрик в виджетах: одинаковые плашки вместо разнокалиберного
   шрифта (размер, назначенный WP инлайном, намеренно перебивается). */
.single-aside .widget .wp-block-tag-cloud,
.single-aside .widget .tagcloud {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}
.single-aside .widget .wp-block-tag-cloud a,
.single-aside .widget .tagcloud a {
	font-size: 12.5px !important;
	display: inline-block;
	padding: 3px 10px;
	background: var(--bg-raised);
	border: 1px solid var(--border);
	border-radius: 999px;
	color: var(--text-2);
}
.single-aside .widget .wp-block-tag-cloud a:hover,
.single-aside .widget .tagcloud a:hover {
	border-color: var(--accent-border);
	color: var(--text);
	text-decoration: none;
}
.single-aside .widget .tag-link-count { color: var(--text-3); font-size: 11px; }

/* Список [qth_popular_list] в виджетах. */
.popular-widget { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.popular-widget li { font-size: 13.5px; line-height: 1.45; }
.popular-widget a { color: var(--text-2); }
.popular-widget a:hover { color: var(--accent-text); text-decoration: none; }
.popular-widget__views { display: block; color: var(--text-3); font-size: 11.5px; }

/* ---------- Предыдущая / следующая статья ---------- */

.post-nav {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
	margin-top: 40px;
}
@media (max-width: 640px) { .post-nav { grid-template-columns: 1fr; } }
.post-nav__card {
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 14px 16px;
	background: var(--bg-card);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	color: var(--text);
}
.post-nav__card:hover { border-color: var(--accent-border); text-decoration: none; }
.post-nav__card--next { text-align: right; }
.post-nav__label { color: var(--text-3); font-size: 11.5px; }
.post-nav__title { font-size: 14.5px; line-height: 1.4; }

/* ---------- Похожие статьи ---------- */

.related { margin-top: 48px; }
.related__title { font-size: 20px; margin-bottom: 14px; }
.related__grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 700px) { .related__grid { grid-template-columns: 1fr 1fr; } }
.related__card {
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 14px 16px;
	background: var(--bg-card);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	color: var(--text);
}
.related__card:hover { border-color: var(--accent-border); text-decoration: none; }
.related__cat { color: var(--accent-text); font-size: 11.5px; }
.related__name { font-size: 15px; line-height: 1.4; }

/* ---------- Партнёрские блоки ---------- */

.partners { margin-top: 20px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.partners__title { margin: 0 0 10px; font-size: 14px; color: var(--text-2); font-weight: 600; }
.partners__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.partners__link { display: flex; gap: 10px; padding: 8px; border-radius: var(--radius-s); color: var(--text); }
.partners__link:hover { background: var(--bg-raised); text-decoration: none; }
.partners__icon { color: var(--text-3); flex-shrink: 0; margin-top: 2px; }
.partners__icon img { width: 20px; height: 20px; border-radius: 4px; }
.partners__name { display: block; font-size: 14px; }
.partners__desc { display: block; color: var(--text-3); font-size: 12.5px; }
.partners__ad {
	font-size: 10px;
	color: var(--text-3);
	border: 1px solid var(--border-strong);
	border-radius: 4px;
	padding: 1px 5px;
	vertical-align: 2px;
	margin-left: 6px;
	text-transform: lowercase;
}

.partner-banner { margin-top: 20px; max-width: 500px; }
.partner-banner a { display: block; }
.partner-banner img {
	width: 100%;
	max-width: 500px;
	aspect-ratio: 5 / 4;
	object-fit: cover;
	border-radius: var(--radius);
	border: 1px solid var(--border);
	display: block;
}

/* ---------- Архивы ---------- */

.archive-head { margin: 8px 0 24px; max-width: 760px; }
.archive-head__title { display: flex; align-items: center; gap: 12px; font-size: clamp(24px, 4.5vw, 32px); margin: 8px 0; }
.archive-head__count {
	font-size: 14px;
	color: var(--accent-text);
	background: var(--accent-soft);
	border: 1px solid var(--accent-border);
	padding: 2px 10px;
	border-radius: 999px;
}
.archive-head__desc { color: var(--text-2); }

.nothing-found { max-width: 620px; color: var(--text-2); display: grid; gap: 16px; }
.nothing-found__search, .error-404__search { display: flex; gap: 8px; }
.nothing-found__search input, .error-404__search input {
	flex: 1;
	padding: 10px 14px;
	background: var(--bg-card);
	border: 1px solid var(--border-strong);
	border-radius: var(--radius-s);
	color: var(--text);
	font: inherit;
}
.nothing-found__search button, .error-404__search button {
	padding: 10px 18px;
	background: var(--accent);
	color: #0d1117;
	border: 0;
	border-radius: var(--radius-s);
	font: 600 14px var(--sans);
	cursor: pointer;
}
.nothing-found__search button:hover, .error-404__search button:hover { filter: brightness(1.1); }

/* Пагинация */
.navigation.pagination { margin-top: 32px; }
/* the_posts_pagination оборачивает номера в .nav-links > .screen-reader-text + h2 */
.navigation.pagination .screen-reader-text { position: absolute; clip: rect(1px,1px,1px,1px); }
.navigation.pagination .nav-links { display: flex; flex-wrap: wrap; gap: 6px; }
.navigation.pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 38px;
	height: 38px;
	padding: 0 8px;
	background: var(--bg-card);
	border: 1px solid var(--border);
	border-radius: var(--radius-s);
	color: var(--text-2);
	font-family: var(--mono);
	font-size: 14px;
}
.navigation.pagination .page-numbers:hover { border-color: var(--accent-border); color: var(--text); text-decoration: none; }
.navigation.pagination .page-numbers.current {
	background: var(--accent);
	border-color: var(--accent);
	color: #0d1117;
	font-weight: 600;
}
.navigation.pagination .page-numbers.dots { border: 0; background: none; }

/* ---------- 404 ---------- */

.error-404 { max-width: 620px; margin: 40px auto; display: grid; gap: 14px; }
.error-404__code { font-size: 64px; color: var(--accent); margin: 0; line-height: 1; }
.error-404__title { margin: 0; }
.error-404__text { color: var(--text-2); margin: 0; }
.error-404__subtitle { font-size: 17px; margin: 18px 0 0; }

/* ---------- Формы контента (Formidable и т.п.) ---------- */

.entry-content input[type="text"],
.entry-content input[type="email"],
.entry-content input[type="url"],
.entry-content textarea,
.entry-content select {
	width: 100%;
	padding: 10px 14px;
	background: var(--bg-card);
	border: 1px solid var(--border-strong);
	border-radius: var(--radius-s);
	color: var(--text);
	font: inherit;
}
.entry-content input:focus, .entry-content textarea:focus { outline: none; border-color: var(--accent-border); }
.entry-content input[type="submit"], .entry-content button[type="submit"] {
	padding: 10px 22px;
	background: var(--accent);
	color: #0d1117;
	border: 0;
	border-radius: var(--radius-s);
	font: 600 15px var(--sans);
	cursor: pointer;
}

/* ---------- Комментарии ---------- */

.comments { margin-top: 48px; border-top: 1px solid var(--border); padding-top: 24px; }
.comments__title { font-size: 20px; }
.comments__list { list-style: none; margin: 0; padding: 0; }
.comments__list .comment { margin-bottom: 14px; }
.comments__list .comment-body {
	background: var(--bg-card);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 14px 16px;
	font-size: 15px;
}
.comments__list .children { list-style: none; padding-left: 24px; margin-top: 14px; }
.comments__list .comment-author { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.comments__list .avatar { border-radius: 50%; }
.comments__list .comment-metadata { font-family: var(--mono); font-size: 11.5px; }
.comments__list .comment-metadata a { color: var(--text-3); }
.comments__list .reply a { font-size: 13px; }
.comments__closed { color: var(--text-3); }
.comment-form label { display: block; font-size: 14px; color: var(--text-2); margin-bottom: 4px; }
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
	width: 100%;
	max-width: 640px;
	padding: 10px 14px;
	background: var(--bg-card);
	border: 1px solid var(--border-strong);
	border-radius: var(--radius-s);
	color: var(--text);
	font: inherit;
}
.comment-form input:focus, .comment-form textarea:focus { outline: none; border-color: var(--accent-border); }
.comment-form .submit {
	padding: 10px 22px;
	background: var(--accent);
	color: #0d1117;
	border: 0;
	border-radius: var(--radius-s);
	font: 600 15px var(--sans);
	cursor: pointer;
}

/* ---------- Футер ---------- */

.site-footer { border-top: 1px solid var(--border); margin-top: 48px; background: var(--bg-card); }
.site-footer__inner {
	max-width: var(--layout-max, 1200px);
	margin: 0 auto;
	padding: 36px 16px;
	display: grid;
	gap: 28px;
	grid-template-columns: 1fr;
}
@media (min-width: 700px) { .site-footer__inner { grid-template-columns: 3fr 2fr; } }
.site-footer__custom { color: var(--text-2); font-size: 14px; }
.site-footer__custom a { color: var(--text-2); }
.site-footer__custom a:hover { color: var(--accent-text); }
.site-footer__about p { color: var(--text-2); font-size: 14px; }
.site-footer__note { font-size: 12.5px !important; color: var(--text-3) !important; }
.site-footer__title { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); margin: 0 0 10px; }
.site-footer__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.site-footer__list a { color: var(--text-2); font-size: 14px; }
.site-footer__list a:hover { color: var(--accent-text); }
.site-footer__bottom {
	border-top: 1px solid var(--border);
	padding: 14px 16px;
	text-align: center;
	color: var(--text-3);
	font-size: 12px;
}

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