/**
 * Форум (bbPress) в езика на сайта.
 *
 * bbPress зарежда собствен стил (`bbp-default`), писан за светла тема: бели
 * редове, сиви шапки, тъмен текст. И всяко негово правило започва с
 * `#bbpress-forums` - ID селектор, който бие всеки клас, с какъвто и да е брой
 * класове. Затова не се надвива правило по правило, а се сваля изцяло
 * (`bbp_default_styles` във functions.php) и оформлението е тук.
 *
 * Префиксът `#bbpress-forums` е запазен и тук - не заради специфичност, а за
 * да важи оформлението и ако плъгинът някога върне стила си.
 *
 * Зарежда се САМО при `is_bbpress()`: останалите страници няма защо да го носят.
 */

/* ---------------------------------------------------------------- Рамка */

#bbpress-forums {
	/* Колоните се задават веднъж - шапката и редовете четат едни и същи. */
	--col-count: 96px;
	--col-fresh: 200px;

	display: flex;
	flex-direction: column;
	max-width: var(--maxw);
	margin-inline: auto;
	font-size: 1rem;
	line-height: 1.6;
	color: var(--fg-2);
}

/*
 * Трохите идват след формата за търсене в разметката на bbPress. Пренареждат
 * се тук, вместо да се пипа шаблонът: `order` върху flex контейнер не мести
 * нищо в DOM, тоест четецът на екран пак ги чува в логичния им ред.
 */
#bbpress-forums > .bbp-breadcrumb {
	order: -2;
	margin-bottom: 14px;
}

#bbpress-forums > .bbp-search-form {
	order: -1;
	margin-bottom: 22px;
}

/* ---------------------------------------------------------------- Списъци */

#bbpress-forums ul.bbp-forums,
#bbpress-forums ul.bbp-topics,
#bbpress-forums ul.bbp-replies,
#bbpress-forums ul.bbp-lead-topic {
	list-style: none;
	margin: 0 0 26px;
	padding: 0;
	background: linear-gradient(180deg, var(--card) 0%, var(--bg-2) 100%);
	border: 1px solid var(--border);
	border-radius: var(--r-lg);
	overflow: hidden;
	box-shadow: var(--glow-soft);
}

/* Шапката е контейнер - подложката е на вътрешния списък с колоните. */
#bbpress-forums li.bbp-header {
	padding: 0;
	background: rgba(255, 255, 255, .035);
	border-bottom: 1px solid var(--border);
}

#bbpress-forums li.bbp-header li {
	font-family: Manrope, InterSite, sans-serif;
	font-size: .72rem;
	font-weight: 700;
	letter-spacing: .06em;
	text-transform: uppercase;
	color: var(--muted);
}

/*
 * Подвалът е същата шапка, повторена под списъка. Не носи нищо и излиза като
 * празна лента, защото заглавията в него са скрити от bbPress.
 */
#bbpress-forums li.bbp-footer {
	display: none;
}

/* ---------------------------------------------------------------- Редове */

#bbpress-forums ul.forum-titles,
#bbpress-forums ul.topic-titles,
#bbpress-forums li.bbp-body > ul {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
	list-style: none;
	margin: 0;
	padding: 16px 22px;
}

#bbpress-forums li.bbp-body > ul {
	background: transparent;
	border-bottom: 1px solid var(--border);
	transition: background var(--t);
}

#bbpress-forums li.bbp-body > ul:last-child {
	border-bottom: 0;
}

#bbpress-forums li.bbp-body > ul:hover {
	background: rgba(255, 255, 255, .03);
}

/* ---------------------------------------------------------------- Колони */

#bbpress-forums li.bbp-forum-info,
#bbpress-forums li.bbp-topic-title {
	flex: 1 1 300px;
	min-width: 0;
}

#bbpress-forums li.bbp-forum-topic-count,
#bbpress-forums li.bbp-forum-reply-count,
#bbpress-forums li.bbp-topic-voice-count,
#bbpress-forums li.bbp-topic-reply-count {
	flex: 0 0 var(--col-count);
	text-align: center;
	color: var(--fg-2);
	font-size: .95rem;
	font-variant-numeric: tabular-nums;
}

#bbpress-forums li.bbp-forum-freshness,
#bbpress-forums li.bbp-topic-freshness {
	flex: 0 0 var(--col-fresh);
	text-align: right;
	font-size: .84rem;
	color: var(--muted);
}

/* ---------------------------------------------------------------- Заглавия */

#bbpress-forums .bbp-forum-title,
#bbpress-forums .bbp-topic-permalink {
	display: inline-block;
	font-family: Manrope, InterSite, sans-serif;
	font-size: 1.06rem;
	font-weight: 700;
	letter-spacing: -.015em;
	line-height: 1.35;
	color: var(--fg);
	text-decoration: none;
}

#bbpress-forums .bbp-forum-title:hover,
#bbpress-forums .bbp-topic-permalink:hover {
	color: var(--gold-2);
}

#bbpress-forums .bbp-forum-content,
#bbpress-forums .bbp-topic-description {
	margin-top: 6px;
	color: var(--muted);
	font-size: .92rem;
	line-height: 1.55;
}

#bbpress-forums .bbp-topic-meta {
	margin-top: 5px;
	font-size: .82rem;
	color: var(--muted);
}

/* ---------------------------------------------------------------- Автори */

#bbpress-forums .bbp-author-link {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin-top: 5px;
	color: var(--muted);
	font-size: .82rem;
	text-decoration: none;
}

#bbpress-forums li.bbp-forum-freshness .bbp-author-link,
#bbpress-forums li.bbp-topic-freshness .bbp-author-link {
	justify-content: flex-end;
}

#bbpress-forums .bbp-author-link:hover {
	color: var(--fg-2);
}

#bbpress-forums .bbp-author-avatar img,
#bbpress-forums .bbp-author-link img {
	width: 20px;
	height: 20px;
	border-radius: 50%;
	border: 1px solid var(--border-hi);
	vertical-align: middle;
}

#bbpress-forums .bbp-author-name {
	color: var(--fg-2);
	font-weight: 600;
}

#bbpress-forums li.bbp-forum-freshness a,
#bbpress-forums li.bbp-topic-freshness a {
	color: var(--fg-2);
	font-weight: 600;
	text-decoration: none;
}

#bbpress-forums li.bbp-forum-freshness a:hover,
#bbpress-forums li.bbp-topic-freshness a:hover {
	color: var(--gold-2);
}

/* ---------------------------------------------------------------- Тема и отговори */

#bbpress-forums div.bbp-topic-header,
#bbpress-forums div.bbp-reply-header {
	padding: 12px 22px;
	background: rgba(255, 255, 255, .035);
	border-bottom: 1px solid var(--border);
	font-size: .84rem;
	color: var(--muted);
}

#bbpress-forums div.bbp-topic-author,
#bbpress-forums div.bbp-reply-author {
	padding: 20px 22px;
	text-align: center;
	border-right: 1px solid var(--border);
}

#bbpress-forums div.bbp-topic-author .bbp-author-avatar img,
#bbpress-forums div.bbp-reply-author .bbp-author-avatar img {
	width: 56px;
	height: 56px;
}

#bbpress-forums div.bbp-topic-content,
#bbpress-forums div.bbp-reply-content {
	padding: 22px;
	color: var(--fg-2);
	line-height: 1.75;
}

#bbpress-forums div.bbp-topic-content p,
#bbpress-forums div.bbp-reply-content p {
	margin: 0 0 1em;
}

#bbpress-forums div.bbp-topic-content p:last-child,
#bbpress-forums div.bbp-reply-content p:last-child {
	margin-bottom: 0;
}

#bbpress-forums div.bbp-topic-content ul,
#bbpress-forums div.bbp-reply-content ul,
#bbpress-forums div.bbp-topic-content ol,
#bbpress-forums div.bbp-reply-content ol {
	margin: 0 0 1em;
	padding-left: 1.3em;
}

#bbpress-forums div.bbp-topic-content li,
#bbpress-forums div.bbp-reply-content li {
	margin-bottom: .4em;
}

#bbpress-forums div.bbp-topic-content li::marker,
#bbpress-forums div.bbp-reply-content li::marker {
	color: var(--gold);
}

#bbpress-forums div.bbp-topic-content h2,
#bbpress-forums div.bbp-reply-content h2,
#bbpress-forums div.bbp-topic-content h3,
#bbpress-forums div.bbp-reply-content h3 {
	font-family: Manrope, InterSite, sans-serif;
	color: var(--fg);
	margin: 1.6em 0 .5em;
}

#bbpress-forums div.bbp-topic-content strong,
#bbpress-forums div.bbp-reply-content strong {
	color: var(--fg);
	font-weight: 600;
}

#bbpress-forums div.bbp-topic-content a,
#bbpress-forums div.bbp-reply-content a {
	color: var(--gold-2);
	text-decoration: underline;
	text-decoration-color: rgba(245, 165, 36, .45);
	text-underline-offset: 3px;
}

#bbpress-forums div.bbp-topic-content code,
#bbpress-forums div.bbp-reply-content code {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 6px;
	padding: .12em .4em;
	font-size: .88em;
	font-family: ui-monospace, "SF Mono", Menlo, monospace;
}

#bbpress-forums div.bbp-topic-content blockquote,
#bbpress-forums div.bbp-reply-content blockquote {
	margin: 1.2em 0;
	padding: 2px 0 2px 18px;
	border-left: 3px solid var(--gold);
	color: var(--muted);
}

#bbpress-forums .bbp-admin-links {
	font-size: .8rem;
	color: var(--muted);
}

#bbpress-forums .bbp-admin-links a {
	color: var(--muted);
	text-decoration: none;
}

#bbpress-forums .bbp-admin-links a:hover {
	color: var(--gold-2);
}

/* Залепените теми се различават по акцент, не по крещящ фон. */
#bbpress-forums li.bbp-body > ul.sticky,
#bbpress-forums li.bbp-body > ul.super-sticky {
	background: rgba(245, 165, 36, .05);
	box-shadow: inset 3px 0 0 0 var(--gold);
}

/* ---------------------------------------------------------------- Трохи */

#bbpress-forums div.bbp-breadcrumb {
	font-size: .88rem;
	color: var(--muted);
}

#bbpress-forums div.bbp-breadcrumb a {
	color: var(--fg-2);
	text-decoration: none;
}

#bbpress-forums div.bbp-breadcrumb a:hover {
	color: var(--gold-2);
}

#bbpress-forums .bbp-breadcrumb-sep {
	margin-inline: 6px;
	opacity: .5;
}

/* ---------------------------------------------------------------- Форми */

#bbpress-forums fieldset.bbp-form {
	background: linear-gradient(180deg, var(--card) 0%, var(--bg-2) 100%);
	border: 1px solid var(--border);
	border-radius: var(--r-lg);
	padding: 24px;
	margin-bottom: 26px;
}

#bbpress-forums fieldset.bbp-form legend {
	font-family: Manrope, InterSite, sans-serif;
	font-weight: 800;
	font-size: 1.1rem;
	color: var(--fg);
	padding-inline: 8px;
}

#bbpress-forums fieldset.bbp-form label {
	display: inline-block;
	margin-bottom: 6px;
	color: var(--fg-2);
	font-size: .92rem;
	font-weight: 600;
}

#bbpress-forums fieldset.bbp-form p {
	margin: 0 0 16px;
}

#bbpress-forums input[type="text"],
#bbpress-forums input[type="email"],
#bbpress-forums input[type="url"],
#bbpress-forums input[type="password"],
#bbpress-forums input[type="search"],
#bbpress-forums select,
#bbpress-forums textarea {
	width: 100%;
	background: var(--bg);
	border: 1px solid var(--border-hi);
	border-radius: var(--r-sm);
	color: var(--fg);
	font-family: inherit;
	font-size: 1rem;
	padding: 12px 14px;
	transition: border-color var(--t), box-shadow var(--t);
}

#bbpress-forums textarea {
	min-height: 180px;
	line-height: 1.65;
	resize: vertical;
}

#bbpress-forums input:focus,
#bbpress-forums select:focus,
#bbpress-forums textarea:focus {
	outline: none;
	border-color: var(--gold);
	box-shadow: 0 0 0 3px rgba(245, 165, 36, .16);
}

#bbpress-forums input::placeholder,
#bbpress-forums textarea::placeholder {
	color: var(--muted);
}

#bbpress-forums button,
#bbpress-forums input[type="submit"],
#bbpress-forums a.button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: auto;
	min-height: 48px;
	padding: 0 26px;
	border: 0;
	border-radius: var(--r-sm);
	background: linear-gradient(145deg, var(--gold-2), var(--gold));
	color: #1a1205;
	font-family: Manrope, InterSite, sans-serif;
	font-size: .97rem;
	font-weight: 700;
	text-decoration: none;
	cursor: pointer;
	box-shadow: 0 10px 30px -14px rgba(245, 165, 36, .7);
	transition: transform var(--t), box-shadow var(--t);
}

#bbpress-forums button:hover,
#bbpress-forums input[type="submit"]:hover,
#bbpress-forums a.button:hover {
	transform: translateY(-2px);
	box-shadow: 0 16px 40px -14px rgba(245, 165, 36, .85);
}

#bbpress-forums .bbp-submit-wrapper {
	text-align: right;
}

/* Редакторът се отваря в Text таб - тъмната кутия отдолу е самото поле. */
#bbpress-forums .wp-editor-container {
	border: 1px solid var(--border-hi);
	border-radius: var(--r-sm);
	overflow: hidden;
}

#bbpress-forums .wp-editor-container textarea {
	border: 0;
	border-radius: 0;
}

#bbpress-forums .quicktags-toolbar {
	background: var(--surface);
	border-bottom: 1px solid var(--border);
	padding: 6px;
}

#bbpress-forums .quicktags-toolbar input.button {
	min-height: 30px;
	padding: 0 10px;
	font-size: .8rem;
	background: var(--card-hi);
	color: var(--fg-2);
	box-shadow: none;
}

#bbpress-forums .quicktags-toolbar input.button:hover {
	transform: none;
	background: var(--border-hi);
	box-shadow: none;
}

/* ---------------------------------------------------------------- Търсене */

#bbpress-forums .bbp-search-form form > div,
#bbpress-forums .bbp-search-form form > p {
	display: flex;
	gap: 10px;
	margin: 0;
}

#bbpress-forums .bbp-search-form input[type="text"] {
	flex: 1 1 auto;
	min-width: 0;
}

#bbpress-forums .bbp-search-form input[type="submit"] {
	flex: 0 0 auto;
}

/* ---------------------------------------------------------------- Пагинация */

#bbpress-forums .bbp-pagination {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 18px;
	color: var(--muted);
	font-size: .88rem;
}

#bbpress-forums .bbp-pagination-links a,
#bbpress-forums .bbp-pagination-links span {
	display: inline-grid;
	place-items: center;
	min-width: 40px;
	height: 40px;
	padding-inline: 10px;
	margin-left: 5px;
	border: 1px solid var(--border);
	border-radius: var(--r-sm);
	background: var(--surface);
	color: var(--fg-2);
	font-weight: 600;
	text-decoration: none;
	transition: border-color var(--t), color var(--t);
}

#bbpress-forums .bbp-pagination-links a:hover {
	border-color: var(--gold);
	color: var(--gold-2);
}

#bbpress-forums .bbp-pagination-links span.current {
	background: linear-gradient(145deg, var(--gold-2), var(--gold));
	border-color: transparent;
	color: #1a1205;
}

/* ---------------------------------------------------------------- Съобщения */

#bbpress-forums div.bbp-template-notice {
	background: var(--surface);
	border: 1px solid var(--border);
	border-left: 3px solid var(--gold);
	border-radius: var(--r-sm);
	padding: 14px 18px;
	margin-bottom: 20px;
	color: var(--fg-2);
	font-size: .94rem;
}

#bbpress-forums div.bbp-template-notice.error,
#bbpress-forums div.bbp-template-notice.warning {
	border-left-color: var(--rose);
	color: var(--rose);
}

#bbpress-forums div.bbp-template-notice p {
	margin: 0;
}

#bbpress-forums div.bbp-template-notice a {
	color: inherit;
}

/* ---------------------------------------------------------------- Шапка на страницата */

.hero--compact h1 {
	font-size: clamp(1.9rem, 4.4vw, 3rem);
}

/* ---------------------------------------------------------------- Тесни екрани */

@media (max-width: 860px) {
	#bbpress-forums {
		--col-fresh: 150px;
	}
}

@media (max-width: 720px) {
	#bbpress-forums ul.forum-titles,
	#bbpress-forums ul.topic-titles,
	#bbpress-forums li.bbp-body > ul {
		padding: 16px 18px;
		gap: 8px;
	}

	/*
	 * Шапката и броячите падат. На телефон колона от три цифри отнема място,
	 * което заглавието използва по-добре; броят тема/отговори остава в реда с
	 * метаданните.
	 */
	#bbpress-forums li.bbp-header,
	#bbpress-forums li.bbp-forum-topic-count,
	#bbpress-forums li.bbp-forum-reply-count,
	#bbpress-forums li.bbp-topic-voice-count,
	#bbpress-forums li.bbp-topic-reply-count {
		display: none;
	}

	#bbpress-forums li.bbp-forum-freshness,
	#bbpress-forums li.bbp-topic-freshness {
		flex: 1 1 100%;
		text-align: left;
	}

	#bbpress-forums li.bbp-forum-freshness .bbp-author-link,
	#bbpress-forums li.bbp-topic-freshness .bbp-author-link {
		justify-content: flex-start;
	}

	#bbpress-forums div.bbp-topic-author,
	#bbpress-forums div.bbp-reply-author {
		display: flex;
		align-items: center;
		gap: 10px;
		border-right: 0;
		border-bottom: 1px solid var(--border);
		text-align: left;
	}

	#bbpress-forums div.bbp-topic-author .bbp-author-avatar img,
	#bbpress-forums div.bbp-reply-author .bbp-author-avatar img {
		width: 36px;
		height: 36px;
	}

	#bbpress-forums .bbp-submit-wrapper input[type="submit"] {
		width: 100%;
	}
}
