/**
 * Q&A: тёмная тема в стиле сайта (--fp-* переменные как на главной и в архивах).
 * Подключается для qa-page-template.php и qa-archive-template.php.
 */

/* Переменные темы для Q&A страниц */
body.qa-template-page,
body.qa-archive-page {
	--fp-bg: #161618;
	--fp-bg-soft: #1e1e21;
	--fp-bg-card: #252529;
	--fp-border: rgba(255, 255, 255, 0.06);
	--fp-text: #e4e4e7;
	--fp-text-muted: #a1a1aa;
	--fp-text-dim: #71717a;
	--fp-accent: #818cf8;
	--fp-accent-soft: rgba(129, 140, 248, 0.15);
	--fp-btn: #2d2d32;
	--fp-btn-hover: #3f3f46;
	--fp-radius: 10px;
	--fp-radius-sm: 6px;
}

body.qa-template-page,
body.qa-archive-page {
	background: var(--fp-bg) !important;
	color: var(--fp-text);
}

/* Контент на всю ширину */
body.qa-template-page .site-content.container,
body.qa-archive-page .site-content.container {
	max-width: 100%;
	padding-left: 0;
	padding-right: 0;
}

/* ========== Одна страница Q&A (qa-page-template.php) ========== */

.qa-page {
	max-width: 100%;
	margin: 0;
	padding: 40px 32px 60px;
	background: var(--fp-bg) !important;
	color: var(--fp-text);
	font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	border-radius: 0;
	box-shadow: none;
}

/* Заголовок и автор вопроса */
.qa-question {
	margin-bottom: 24px;
	padding-bottom: 16px;
	border-bottom: 1px solid var(--fp-border);
}

.qa-question h1 {
	font-size: 32px;
	font-weight: 700;
	margin: 0 0 8px;
	line-height: 1.25;
	color: var(--fp-text);
	display: inline-block;
	background: var(--fp-accent-soft);
	border-radius: 14px;
	padding: 8px 16px;
}

.qa-question p {
	margin: 0;
	font-size: 15px;
	color: var(--fp-text-muted);
}

.qa-question p strong {
	font-weight: 600;
	color: var(--fp-text);
}

.qa-question-description {
	margin-top: 12px;
	font-size: 16px;
	line-height: 1.6;
	color: var(--fp-text-muted);
}

/* Бейдж «Вопрос читателя» / «Спрашивает» */
.qa-question-description-label {
	display: inline-flex;
	align-items: center;
	padding: 3px 10px;
	border-radius: 999px;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	background: var(--fp-accent);
	color: #fff;
}

.qa-question-description-text {
	display: inline;
}

/* Краткий ответ — блок в стиле карточки */
.qa-short-answer {
	margin-bottom: 32px;
}

.qa-short-answer h2 {
	font-size: 18px;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--fp-text-muted);
	margin: 0 0 8px;
}

.qa-short-answer .short-answer {
	background: var(--fp-bg-card);
	border: 1px solid var(--fp-border);
	border-radius: var(--fp-radius);
	padding: 18px 20px;
	border-left: 4px solid var(--fp-accent);
	font-size: 16px;
	line-height: 1.6;
	font-weight: 500;
	color: var(--fp-text);
}

.qa-short-answer blockquote {
	border-left: 4px solid var(--fp-accent);
	padding-left: 16px;
	margin-top: 10px;
	margin-bottom: 10px;
	font-style: italic;
	color: var(--fp-text-muted);
	font-size: 16px;
}

/* Автор ответа с аватаром */
.answer-author {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	margin-top: 10px;
}

.answer-author p {
	margin: 0;
	font-size: 20px;
	font-weight: 600;
	color: var(--fp-text);
}

.answer-author-avatar {
	width: 40px;
	height: 40px;
	border-radius: 999px;
	overflow: hidden;
	flex-shrink: 0;
	background: var(--fp-bg-soft);
}

.answer-author-avatar img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transform: scale(1.2);
	transform-origin: center;
}

/* Развёрнутый ответ */
.qa-full-answer {
	margin-bottom: 40px;
}

.qa-full-answer h2 {
	font-size: 22px;
	margin: 26px 0 6px;
	color: var(--fp-text);
	position: relative;
	padding-left: 14px;
}

.qa-full-answer h2::before {
	content: "";
	position: absolute;
	left: 0;
	top: 50%;
	width: 4px;
	height: 70%;
	border-radius: 999px;
	background: var(--fp-accent);
	transform: translateY(-50%);
}

.qa-full-answer p,
.qa-full-answer .qa-section-text {
	margin: 0 0 4px;
	font-size: 16px;
	line-height: 1.7;
	color: var(--fp-text-muted);
}

.qa-full-answer .qa-section-text {
	margin-bottom: 1em;
}

/* Блок «что почитать дальше» */
.qa-related-articles {
	margin-top: 40px;
	padding-top: 24px;
	padding: 20px;
	border-top: 1px solid var(--fp-border);
	background: var(--fp-bg-soft);
	border-radius: var(--fp-radius);
}

.qa-related-articles > h2 {
	font-size: 20px;
	margin: 0 0 18px;
	color: var(--fp-text);
}

.articles-list {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 20px;
}

/* Карточка статьи */
.article-card {
	background: var(--fp-bg-card);
	border: 1px solid var(--fp-border);
	border-radius: var(--fp-radius);
	padding: 14px 14px 16px;
	display: flex;
	flex-direction: column;
	height: 100%;
	transition: transform 0.15s ease-out, box-shadow 0.15s ease-out;
}

.article-card:hover {
	transform: translateY(-3px);
	box-shadow: 0 14px 30px rgba(0, 0, 0, 0.2);
}

.article-thumbnail {
	margin-bottom: 10px;
}

.article-thumbnail img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 14px;
	object-fit: cover;
}

.article-card a {
	text-decoration: none;
	color: inherit;
}

.article-card h3 {
	font-size: 16px;
	line-height: 1.4;
	margin: 0 0 6px;
	color: var(--fp-text);
}

.article-card a:hover h3 {
	color: var(--fp-accent);
}

.article-card p {
	margin: 0;
	font-size: 14px;
	line-height: 1.5;
	color: var(--fp-text-muted);
}

.article-card-content {
	margin-bottom: 12px;
}

.article-card-footer {
	margin-top: auto;
}

.article-card-cta {
	display: block;
	text-align: center;
	padding: 8px 12px;
	border-radius: 999px;
	font-size: 13px;
	font-weight: 600;
	text-decoration: none;
	background: var(--fp-accent);
	color: #fff !important;
	transition: background 0.2s ease, transform 0.15s ease;
}

.article-card-cta:hover {
	background: #6366f1;
	transform: translateY(-1px);
	color: #fff !important;
}

/* Ссылки на странице Q&A */
.qa-page a {
	color: var(--fp-accent);
}

.qa-page a:hover {
	color: #a5b4fc;
}

/* CTA-секция */
.cta-section {
	margin-top: 40px;
	padding: 24px 20px;
	border-radius: var(--fp-radius);
	background: var(--fp-bg-card);
	border: 1px solid var(--fp-border);
}

.cta-section a {
	color: var(--fp-accent);
}

.cta-section a.button,
.cta-section .btn,
.cta-section .wp-block-button__link {
	display: inline-block;
	background: var(--fp-accent);
	color: #fff !important;
	padding: 10px 22px;
	border-radius: 999px;
	font-weight: 600;
	text-decoration: none;
}

.cta-section a.button:hover,
.cta-section .btn:hover,
.cta-section .wp-block-button__link:hover {
	background: #6366f1;
	color: #fff !important;
}

/* О проекте */
.about-project {
	margin-top: 32px;
	padding: 20px;
	border-radius: var(--fp-radius);
	background: var(--fp-bg-card);
	border: 1px solid var(--fp-border);
	font-size: 15px;
	line-height: 1.6;
	color: var(--fp-text-muted);
}

.about-project-header {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 10px;
}

.about-project-header h2 {
	margin: 0;
	font-size: 32px;
	font-weight: 700;
	color: var(--fp-text);
}

.about-project-logo {
	width: 44px;
	height: 44px;
	border-radius: 999px;
	overflow: hidden;
	flex-shrink: 0;
	background: var(--fp-bg-soft);
}

.about-project-logo img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transform: scale(1.2);
	transform-origin: center;
}

/* Блок доната (обложка с затемнением) */
.qa-donate-block .wp-block-cover__background {
	background-color: rgba(0, 0, 0, 0.5);
}

.qa-donate-block p {
	max-width: 640px;
	margin: 0 auto 16px;
	color: #f9fafb;
	font-size: 24px;
	line-height: 1.6;
}

.qa-donate-block .wp-block-button__link {
	border-radius: 999px;
	padding: 10px 26px;
	font-size: 15px;
	font-weight: 600;
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.qa-donate-title {
	margin: 0 0 6px;
	text-align: center;
	font-size: 24px;
	font-weight: 700;
	color: #f9fafb;
}

.qa-donate-subtitle {
	max-width: 640px;
	margin: 0 auto 18px;
	text-align: center;
	font-size: 15px;
	line-height: 1.6;
	color: #e5e7eb;
}

/* Адаптив одной страницы Q&A */
@media (max-width: 900px) {
	.qa-page {
		padding: 24px 18px 28px;
	}

	.qa-question h1 {
		font-size: 26px;
	}

	.articles-list {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 640px) {
	.qa-page {
		padding: 24px 16px 32px;
	}

	.articles-list {
		grid-template-columns: 1fr;
	}
}

/* ========== Архив Q&A (qa-archive-template.php) ========== */

body.qa-archive-page .qa-section-container {
	width: 100%;
	max-width: 1200px;
	margin: 0 auto;
	padding: 40px 24px 60px;
}

body.qa-archive-page .qa-section-title {
	text-align: center;
	font-size: 2rem;
	font-weight: 700;
	margin-bottom: 2rem;
	color: var(--fp-text);
}

body.qa-archive-page .qa-questions-list {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 1.5rem;
}

@media (min-width: 900px) {
	body.qa-archive-page .qa-questions-list {
		grid-template-columns: repeat(4, 1fr);
	}
}

@media (max-width: 600px) {
	body.qa-archive-page .qa-questions-list {
		grid-template-columns: 1fr;
	}
}

body.qa-archive-page .qa-question-card {
	border: 1px solid var(--fp-border);
	border-radius: var(--fp-radius);
	padding: 1.25rem;
	background: var(--fp-bg-card);
	transition: transform 0.2s ease, box-shadow 0.2s ease;
	text-align: center;
}

body.qa-archive-page .qa-question-card:hover {
	transform: translateY(-4px);
	box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
}

body.qa-archive-page .qa-question-title {
	font-size: 1.1rem;
	font-weight: 600;
	margin-bottom: 0.5rem;
	line-height: 1.35;
}

body.qa-archive-page .qa-question-title a,
body.qa-archive-page .qa-question-link {
	text-decoration: none;
	color: var(--fp-text);
}

body.qa-archive-page .qa-question-title a:hover,
body.qa-archive-page .qa-question-link:hover {
	color: var(--fp-accent);
}

body.qa-archive-page .qa-question-excerpt {
	font-size: 0.9375rem;
	color: var(--fp-text-muted);
	line-height: 1.5;
	margin-bottom: 1rem;
}

body.qa-archive-page .qa-read-more-link {
	display: inline-block;
	padding: 0.5rem 1rem;
	border-radius: var(--fp-radius-sm);
	font-size: 0.9rem;
	font-weight: 600;
	text-decoration: none;
	background: var(--fp-accent);
	color: #fff !important;
	transition: background 0.2s;
}

body.qa-archive-page .qa-read-more-link:hover {
	background: #6366f1;
	color: #fff !important;
}

body.qa-archive-page .qa-pagination-container {
	margin-top: 2rem;
}

body.qa-archive-page .qa-pagination .page-numbers,
body.qa-archive-page .qa-pagination .nav-links a,
body.qa-archive-page .qa-pagination .nav-links span {
	display: inline-block;
	padding: 0.4em 0.8em;
	margin-right: 0.25em;
	background: var(--fp-btn);
	color: var(--fp-text);
	text-decoration: none;
	border-radius: var(--fp-radius-sm);
	border: 1px solid var(--fp-border);
}

body.qa-archive-page .qa-pagination a:hover {
	background: var(--fp-btn-hover);
	color: var(--fp-text);
}

body.qa-archive-page .qa-pagination .current {
	background: var(--fp-accent);
	border-color: var(--fp-accent);
	color: #fff;
}
