/* ============================================================
   novocodo.ru — стили каталога инструкций
   Темы: тёмная (по умолчанию) и светлая ([data-theme="light"])
   ============================================================ */

:root {
	color-scheme: dark;
	--bg: #090C1D;
	--panel: #10142B;
	--panel-2: #151A36;
	--panel-3: #1C2247;
	--border: #232A52;
	--border-soft: #1B2144;
	--text: #EDEFFD;
	--muted: #8E94BE;
	--accent: #7C6CFF;
	--accent-strong: #9C8BFF;
	--accent-soft: rgba(124, 108, 255, 0.14);
	--code-bg: #0B0F24;
	--code-text: #C9D4FF;
	--header-bg: rgba(9, 12, 29, 0.82);
	--glow-1: rgba(124, 108, 255, 0.16);
	--glow-2: rgba(124, 108, 255, 0.10);
	--radius: 16px;
}

[data-theme="light"] {
	color-scheme: light;
	--bg: #EEF0FA;
	--panel: #FFFFFF;
	--panel-2: #F5F6FC;
	--panel-3: #EBEDF9;
	--border: #E0E3F3;
	--border-soft: #E9EBF7;
	--text: #191C36;
	--muted: #666C92;
	--accent: #6C5CE7;
	--accent-strong: #6C5CE7;
	--accent-soft: rgba(108, 92, 231, 0.12);
	--code-bg: #171A33;
	--code-text: #DCE2FF;
	--header-bg: rgba(255, 255, 255, 0.85);
	--glow-1: rgba(108, 92, 231, 0.12);
	--glow-2: rgba(108, 92, 231, 0.06);
}

/* ---------- Базовые стили ---------- */

* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}

html {
	scroll-behavior: smooth;
}

body {
	font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
	font-size: 16px;
	line-height: 1.5;
	color: var(--text);
	background:
		radial-gradient(900px 480px at 88% -8%, var(--glow-1), transparent 70%),
		radial-gradient(720px 420px at -8% 12%, var(--glow-2), transparent 70%),
		var(--bg);
	background-attachment: fixed;
	min-height: 100vh;
}

a {
	color: inherit;
}

button {
	font-family: inherit;
}

svg {
	display: block;
	flex: none;
}

/* ---------- Шапка сайта ---------- */

.site-header {
	position: sticky;
	top: 0;
	z-index: 50;
	background: var(--header-bg);
	backdrop-filter: blur(14px);
	-webkit-backdrop-filter: blur(14px);
	border-bottom: 1px solid var(--border);
}

.header-inner {
	max-width: 1320px;
	margin: 0 auto;
	padding: 14px 20px;
	display: flex;
	align-items: center;
	gap: 18px;
}

.brand {
	display: flex;
	align-items: center;
	gap: 12px;
	text-decoration: none;
	flex: none;
}

.brand-badge {
	width: 42px;
	height: 42px;
	border-radius: 12px;
	display: grid;
	place-items: center;
	color: #fff;
	background: linear-gradient(135deg, #9C8BFF 0%, #6C5CE7 100%);
	box-shadow: 0 10px 24px rgba(108, 92, 231, 0.4);
}

.brand-text {
	display: grid;
	line-height: 1.2;
}

.brand-name {
	font-weight: 800;
	font-size: 17px;
	letter-spacing: -0.01em;
}

.brand-tagline {
	font-size: 11px;
	color: var(--muted);
	margin-top: 3px;
}

.search {
	flex: 1;
	min-width: 0;
	max-width: 520px;
	margin: 0 auto;
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 16px;
	border-radius: 999px;
	background: var(--panel-2);
	border: 1px solid var(--border);
	color: var(--muted);
	transition: border-color 0.15s, background 0.15s;
}

.search:focus-within {
	border-color: var(--accent);
	color: var(--accent-strong);
}

.search input {
	flex: 1;
	min-width: 0;
	border: 0;
	outline: none;
	background: transparent;
	color: var(--text);
	font: inherit;
	font-size: 14px;
}

.search input::placeholder {
	color: var(--muted);
}

.header-nav {
	display: flex;
	align-items: center;
	gap: 8px;
	flex: none;
	margin-left: auto;
}

.nav-btn {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 9px 14px;
	border-radius: 10px;
	border: 0;
	background: transparent;
	color: var(--muted);
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
	transition: color 0.15s, background 0.15s;
	white-space: nowrap;
}

.nav-btn:hover {
	color: var(--text);
	background: var(--panel-2);
}

.nav-btn.is-active {
	color: var(--text);
	background: var(--accent-soft);
}

.theme-toggle {
	width: 38px;
	height: 38px;
	border-radius: 50%;
	display: grid;
	place-items: center;
	background: var(--panel-2);
	border: 1px solid var(--border);
	color: var(--muted);
	cursor: pointer;
	transition: color 0.15s, border-color 0.15s;
}

.theme-toggle:hover {
	color: var(--accent-strong);
	border-color: var(--accent);
}

/* Иконки переключателя темы: показываем одну по активной теме */
.icon-theme-sun {
	display: none;
}

[data-theme="light"] .icon-theme-sun {
	display: block;
}

[data-theme="light"] .icon-theme-moon {
	display: none;
}

/* ---------- Каркас страницы ---------- */

.page {
	max-width: 1320px;
	margin: 0 auto;
	padding: 24px 20px 56px;
}

.layout {
	display: grid;
	grid-template-columns: 300px minmax(0, 1fr);
	gap: 20px;
	align-items: start;
}

.panel {
	background: var(--panel);
	border: 1px solid var(--border);
	border-radius: var(--radius);
}

/* ---------- Сайдбар ---------- */

.sidebar {
	display: grid;
	gap: 16px;
	position: sticky;
	top: 92px;
}

.sidebar-filters {
	padding: 14px 10px 10px;
}

.sidebar-title {
	display: flex;
	align-items: center;
	gap: 9px;
	font-size: 14px;
	font-weight: 700;
	color: var(--text);
	padding: 4px 8px 12px;
}

.sidebar-title svg {
	color: var(--accent-strong);
}

.filter-list {
	display: grid;
	gap: 4px;
	max-height: 52vh;
	overflow-y: auto;
	padding-right: 2px;
}

.filter-item {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	padding: 9px 10px;
	border-radius: 10px;
	border: 0;
	background: transparent;
	color: var(--muted);
	font-size: 14px;
	font-weight: 500;
	text-align: left;
	cursor: pointer;
	transition: background 0.15s, color 0.15s;
}

.filter-item:hover {
	background: var(--panel-2);
	color: var(--text);
}

.filter-item.is-active {
	background: linear-gradient(120deg, #8E7BFF, #6C5CE7);
	color: #fff;
}

.filter-item.is-active .filter-count {
	background: rgba(255, 255, 255, 0.22);
	color: #fff;
}

.filter-item.is-active .filter-icon {
	background: rgba(255, 255, 255, 0.18);
	color: #fff;
}

.filter-icon {
	width: 28px;
	height: 28px;
	border-radius: 8px;
	background: var(--panel-3);
	display: grid;
	place-items: center;
	color: var(--accent-strong);
	flex: none;
}

.filter-icon svg {
	width: 15px;
	height: 15px;
}

.filter-label {
	flex: 1;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.filter-count {
	font-size: 12px;
	font-weight: 700;
	background: var(--panel-3);
	border-radius: 7px;
	padding: 2px 8px;
	color: var(--muted);
	flex: none;
}

/* Цветной бейдж стека (буква/логотип) */
.stack-badge {
	display: inline-grid;
	place-items: center;
	border-radius: 9px;
	font-weight: 800;
	flex: none;
	letter-spacing: 0.02em;
}

.filter-item .stack-badge {
	width: 28px;
	height: 28px;
	font-size: 10px;
}

.stack-card .stack-badge {
	width: 40px;
	height: 40px;
	font-size: 13px;
	border-radius: 11px;
}

.result-card .stack-badge {
	width: 30px;
	height: 30px;
	font-size: 11px;
}

.sidebar-total {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 18px;
}

.sidebar-total-icon {
	width: 46px;
	height: 46px;
	border-radius: 13px;
	display: grid;
	place-items: center;
	background: var(--accent-soft);
	color: var(--accent-strong);
	flex: none;
}

.sidebar-total-info {
	display: grid;
	line-height: 1.25;
}

.sidebar-total-label {
	font-size: 13px;
	color: var(--muted);
}

.sidebar-total-value {
	font-size: 28px;
	font-weight: 800;
	letter-spacing: -0.02em;
}

.sidebar-motto {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 2px 8px;
	color: var(--muted);
	font-size: 12.5px;
}

.sidebar-motto svg {
	color: var(--accent);
}

/* ---------- Контентная колонка ---------- */

.content {
	padding: 30px 30px 36px;
}

.content-title {
	font-size: 30px;
	font-weight: 800;
	letter-spacing: -0.02em;
	line-height: 1.2;
}

.content-subtitle {
	margin-top: 10px;
	max-width: 660px;
	color: var(--muted);
	line-height: 1.6;
	font-size: 15px;
}

.content-meta {
	margin-top: 14px;
	color: var(--accent-strong);
	font-size: 14px;
	font-weight: 600;
}

/* ---------- Таймлайн: год → стеки ---------- */

.year-group {
	display: grid;
	grid-template-columns: 190px 36px minmax(0, 1fr);
	margin-top: 30px;
}

.year-group:first-of-type {
	margin-top: 26px;
}

.year-rail {
	display: flex;
	align-items: flex-start;
	justify-content: flex-end;
	padding-top: 8px;
	position: relative;
	z-index: 1;
}

.year-badge {
	width: 100%;
	max-width: 150px;
	display: grid;
	justify-items: start;
	gap: 3px;
	padding: 14px 18px;
	border-radius: 16px;
	color: #fff;
	background: linear-gradient(135deg, #9C8BFF 0%, #6C5CE7 100%);
	box-shadow: 0 16px 34px rgba(108, 92, 231, 0.35);
}

.year-badge-icon svg {
	width: 17px;
	height: 17px;
	opacity: 0.9;
}

.year-badge-year {
	font-size: 26px;
	font-weight: 800;
	letter-spacing: -0.02em;
}

.year-badge-count {
	font-size: 12px;
	opacity: 0.85;
}

/* Вертикальная линия между бейджами годов */
.year-connector {
	position: relative;
}

.year-connector::before {
	content: '';
	position: absolute;
	left: 50%;
	top: -44px;
	bottom: -44px;
	width: 2px;
	transform: translateX(-50%);
	background: linear-gradient(180deg, transparent, rgba(124, 108, 255, 0.45) 14%, rgba(124, 108, 255, 0.45) 86%, transparent);
}

.year-group:first-of-type .year-connector::before {
	top: 0;
}

.year-group:last-of-type .year-connector::before {
	bottom: auto;
	height: 55%;
}

.year-stacks {
	display: grid;
	gap: 12px;
	min-width: 0;
}

/* Горизонтальные соединители линии к карточкам стеков */
.stack-card {
	position: relative;
}

.stack-card::before {
	content: '';
	position: absolute;
	left: -36px;
	top: 41px;
	width: 36px;
	height: 2px;
	background: rgba(124, 108, 255, 0.4);
}

/* ---------- Карточка стека ---------- */

.stack-card {
	background: var(--panel-2);
	border: 1px solid var(--border);
	border-radius: 14px;
	padding: 12px 14px;
}

.stack-card-head {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 0;
}

.stack-card-titles {
	display: grid;
	line-height: 1.3;
	min-width: 0;
}

.stack-name {
	font-weight: 700;
	font-size: 16px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.stack-version {
	font-size: 12px;
	color: var(--muted);
}

.stack-count {
	margin-left: auto;
	min-width: 28px;
	text-align: center;
	padding: 3px 8px;
	border-radius: 8px;
	background: var(--panel-3);
	border: 1px solid var(--border);
	font-size: 12px;
	font-weight: 700;
	color: var(--muted);
	flex: none;
}

.stack-card-list {
	display: grid;
}

.article-link {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 8px;
	border-radius: 10px;
	border-top: 1px solid var(--border-soft);
	color: var(--text);
	text-decoration: none;
	font-size: 14px;
	font-weight: 500;
	transition: background 0.15s;
}

.article-link:hover {
	background: var(--panel-3);
}

.type-icon {
	width: 26px;
	height: 26px;
	border-radius: 8px;
	display: grid;
	place-items: center;
	background: var(--panel-3);
	color: var(--muted);
	flex: none;
}

.type-icon svg {
	width: 14px;
	height: 14px;
}

.type-icon-video {
	color: var(--accent-strong);
	background: var(--accent-soft);
}

/* Иконка типа «Дата выхода» — календарь */
.type-icon-release {
	color: var(--accent-strong);
	background: var(--accent-soft);
}

.article-link-title {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.article-chevron {
	margin-left: auto;
	color: var(--muted);
	display: grid;
	place-items: center;
	transition: color 0.15s, transform 0.15s;
}

.article-chevron svg {
	width: 14px;
	height: 14px;
}

.article-link:hover .article-chevron {
	color: var(--accent-strong);
	transform: translateX(2px);
}

.show-more {
	width: 100%;
	border: 0;
	border-top: 1px solid var(--border-soft);
	background: none;
	color: var(--accent-strong);
	font-size: 13px;
	font-weight: 600;
	padding: 10px 8px;
	cursor: pointer;
	transition: color 0.15s;
}

.show-more:hover {
	color: var(--text);
}

/* ---------- Результаты поиска ---------- */

.results-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
	gap: 12px;
	margin-top: 24px;
}

.result-card {
	display: grid;
	gap: 10px;
	align-content: start;
	padding: 16px;
	background: var(--panel-2);
	border: 1px solid var(--border);
	border-radius: 14px;
	text-decoration: none;
	color: var(--text);
	transition: transform 0.15s, border-color 0.15s;
}

.result-card:hover {
	border-color: var(--accent);
	transform: translateY(-2px);
}

.result-card-top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
}

.result-card-title {
	font-weight: 600;
	font-size: 15px;
	line-height: 1.4;
}

.result-card-meta {
	color: var(--muted);
	font-size: 12.5px;
}

/* Пагинация результатов поиска */
.pager {
	display: flex;
	gap: 6px;
	justify-content: center;
	flex-wrap: wrap;
	margin-top: 26px;
}

.pager-btn {
	min-width: 34px;
	height: 34px;
	padding: 0 10px;
	border-radius: 9px;
	border: 1px solid var(--border);
	background: var(--panel-2);
	color: var(--muted);
	font-size: 13px;
	font-weight: 700;
	cursor: pointer;
	transition: border-color 0.15s, color 0.15s;
}

.pager-btn:hover:not(:disabled) {
	border-color: var(--accent);
	color: var(--text);
}

.pager-btn.is-active {
	background: linear-gradient(120deg, #8E7BFF, #6C5CE7);
	border-color: transparent;
	color: #fff;
	cursor: default;
}

.pager-btn:disabled {
	opacity: 0.35;
	cursor: default;
}

/* ---------- Пустой результат ---------- */

.empty {
	text-align: center;
	padding: 64px 24px;
	color: var(--muted);
}

.empty-title,
.empty h2 {
	color: var(--text);
	font-size: 22px;
	font-weight: 800;
	margin-bottom: 10px;
}

.empty-text,
.empty p {
	font-size: 14.5px;
	line-height: 1.6;
	margin-bottom: 18px;
}

.btn {
	display: inline-block;
	padding: 10px 20px;
	border: 0;
	border-radius: 10px;
	background: linear-gradient(120deg, #8E7BFF, #6C5CE7);
	color: #fff;
	font-size: 14px;
	font-weight: 700;
	text-decoration: none;
	cursor: pointer;
	transition: filter 0.15s;
}

.btn:hover {
	filter: brightness(1.1);
}

.noscript {
	max-width: 1320px;
	margin: 16px auto;
	padding: 14px 20px;
	color: var(--muted);
	font-size: 14px;
}

.noscript a {
	color: var(--accent-strong);
}

/* ---------- Страница статьи ---------- */

.page:has(.article) {
	max-width: 960px;
}

.article {
	padding: 30px 34px;
}

.breadcrumbs {
	display: flex;
	align-items: center;
	gap: 8px;
	color: var(--muted);
	font-size: 13px;
	margin-bottom: 20px;
	flex-wrap: wrap;
}

.breadcrumbs svg {
	width: 12px;
	height: 12px;
}

.breadcrumbs a {
	color: var(--muted);
	text-decoration: none;
	transition: color 0.15s;
}

.breadcrumbs a:hover {
	color: var(--accent-strong);
}

.chips {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
	margin-bottom: 16px;
}

.chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 5px 12px;
	border-radius: 999px;
	background: var(--panel-2);
	border: 1px solid var(--border);
	color: var(--muted);
	font-size: 12.5px;
	font-weight: 600;
}

.chip svg {
	width: 13px;
	height: 13px;
}

.chip-stack {
	font-weight: 700;
}

.article-title {
	font-size: 30px;
	font-weight: 800;
	letter-spacing: -0.02em;
	line-height: 1.2;
}

.article-nav {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
	margin-top: 34px;
	padding-top: 22px;
	border-top: 1px solid var(--border);
}

.article-nav-link {
	display: grid;
	gap: 5px;
	padding: 14px 16px;
	background: var(--panel-2);
	border: 1px solid var(--border);
	border-radius: 12px;
	text-decoration: none;
	transition: border-color 0.15s;
}

.article-nav-link:hover {
	border-color: var(--accent);
}

.article-nav-link.is-next {
	text-align: right;
}

.article-nav-link.is-next .article-nav-label {
	justify-content: flex-end;
}

.article-nav-label {
	display: flex;
	align-items: center;
	gap: 6px;
	color: var(--muted);
	font-size: 12px;
	font-weight: 600;
}

.article-nav-label svg {
	width: 12px;
	height: 12px;
}

.article-nav-title {
	color: var(--text);
	font-size: 14px;
	font-weight: 600;
	line-height: 1.4;
}

/* ---------- Типографика статьи (Markdown) ---------- */

.article-body {
	margin-top: 22px;
	font-size: 15.5px;
	line-height: 1.75;
}

.article-body h1,
.article-body h2,
.article-body h3,
.article-body h4 {
	letter-spacing: -0.01em;
	line-height: 1.3;
	margin: 26px 0 12px;
}

.article-body h1 {
	font-size: 24px;
}

.article-body h2 {
	font-size: 21px;
}

.article-body h3 {
	font-size: 17.5px;
}

.article-body h4 {
	font-size: 15.5px;
}

.article-body > :first-child {
	margin-top: 0;
}

.article-body p {
	margin: 12px 0;
}

.article-body ul,
.article-body ol {
	margin: 12px 0;
	padding-left: 24px;
}

.article-body li {
	margin: 6px 0;
}

.article-body a {
	color: var(--accent-strong);
	text-decoration: underline;
	text-decoration-color: rgba(124, 108, 255, 0.4);
	text-underline-offset: 3px;
}

.article-body a:hover {
	text-decoration-color: currentColor;
}

.article-body strong {
	font-weight: 700;
}

.article-body code {
	font-family: ui-monospace, 'Cascadia Code', Consolas, 'Courier New', monospace;
	font-size: 13.5px;
	background: var(--panel-3);
	border: 1px solid var(--border);
	border-radius: 6px;
	padding: 2px 6px;
	color: var(--accent-strong);
	white-space: nowrap;
}

.article-body pre {
	background: var(--code-bg);
	border: 1px solid var(--border);
	border-radius: 12px;
	padding: 16px 18px;
	margin: 16px 0;
	overflow-x: auto;
}

.article-body pre code {
	display: block;
	background: none;
	border: 0;
	padding: 0;
	color: var(--code-text);
	font-size: 13.5px;
	line-height: 1.65;
	white-space: pre;
}

.article-body blockquote {
	margin: 16px 0;
	padding: 12px 18px;
	border-left: 3px solid var(--accent);
	border-radius: 0 12px 12px 0;
	background: var(--accent-soft);
	color: var(--text);
}

.article-body blockquote p {
	margin: 0;
}

.article-body hr {
	border: 0;
	border-top: 1px solid var(--border);
	margin: 24px 0;
}

.article-body img {
	max-width: 100%;
	border-radius: 12px;
	margin: 14px 0;
}

.article-body table {
	width: 100%;
	border-collapse: collapse;
	margin: 16px 0;
	font-size: 14px;
}

.article-body th,
.article-body td {
	border: 1px solid var(--border);
	padding: 8px 12px;
	text-align: left;
	vertical-align: top;
}

.article-body th {
	background: var(--panel-2);
	font-weight: 700;
}

.article-body table code {
	white-space: nowrap;
}

/* ---------- Адаптивность ---------- */

@media (max-width: 1020px) {
	.layout {
		grid-template-columns: 1fr;
	}

	.sidebar {
		position: static;
	}

	.filter-list {
		max-height: none;
		display: flex;
		flex-wrap: wrap;
		gap: 6px;
	}

	.filter-item {
		width: auto;
		border: 1px solid var(--border);
		background: var(--panel-2);
	}

	.filter-item.is-active {
		border-color: transparent;
	}

	.year-group {
		grid-template-columns: 1fr;
	}

	.year-connector {
		display: none;
	}

	.stack-card::before {
		display: none;
	}

	.year-badge {
		max-width: none;
		margin-bottom: 4px;
	}
}

@media (max-width: 720px) {
	.header-inner {
		flex-wrap: wrap;
		gap: 12px;
	}

	.search {
		order: 3;
		flex-basis: 100%;
		max-width: none;
	}

	.nav-btn span {
		display: none;
	}

	.nav-btn {
		padding: 9px 11px;
	}

	.content,
	.article {
		padding: 22px 18px;
	}

	.content-title,
	.article-title {
		font-size: 24px;
	}

	.article-nav {
		grid-template-columns: 1fr;
	}

	.article-nav-link.is-next {
		text-align: left;
	}

	.article-nav-link.is-next .article-nav-label {
		justify-content: flex-start;
	}
}