/*
 * Pikabu-стиль комментариев для шаблона wxxx.
 * Область действия: .wxxx-comments (обёртка из оверрайда prmedia:tc.complex).
 */

.wxxx-comments {
	--wxxx-cm-text: #18191a;
	--wxxx-cm-text-light: #9aa0a6;
	--wxxx-cm-line: #e4e7ea;
	--wxxx-cm-bg-soft: #f2f3f5;
	--wxxx-cm-indent: 18px;
	--wxxx-cm-content-indent: 28px; /* кнопка ветки + отступ */
	color: var(--wxxx-cm-text);
	font-size: 15px;
	line-height: 1.5;
}

/* шапка «Комментарии N» */
.wxxx-comments .wxxx-cm-header {
	display: flex;
	align-items: baseline;
	margin: 28px 0 16px;
}

.wxxx-comments .wxxx-cm-title {
	font-size: 22px;
	font-weight: 700;
	line-height: 1.2;
}

.wxxx-comments .wxxx-cm-count {
	margin-left: 10px;
	padding: 1px 10px;
	border-radius: 12px;
	background: var(--wxxx-cm-bg-soft);
	color: var(--wxxx-cm-text-light);
	font-size: 14px;
	font-weight: 700;
}

.wxxx-comments .ptc-list_empty .ptc-list--empty {
	display: block;
}

.wxxx-comments .ptc-list--empty {
	display: none;
}

.wxxx-comments .wxxx-cm-empty {
	margin: 8px 0 20px;
	padding: 28px 16px;
	border: 1px dashed var(--wxxx-cm-line);
	border-radius: 8px;
	color: var(--wxxx-cm-text-light);
	text-align: center;
}

/* список */
.wxxx-comments .ptc-list_v2 .ptc-list-items {
	margin-top: 18px;
}

.wxxx-comments .ptc-item {
	position: relative;
	margin: 0;
	padding: 10px 8px;
	background-repeat: no-repeat;
	background-size: 1px 100%;
	transition: opacity .25s;
}

.wxxx-comments .ptc-item_hidden {
	opacity: 0;
	visibility: hidden;
}

.wxxx-comments .wxxx-cm-hidden {
	display: none !important;
}

/* вертикальные линии веток: по одной на каждый уровень вложенности */
.wxxx-comments .ptc-item_level-1 {
	padding-left: calc(var(--wxxx-cm-indent) * 1 + 8px);
	background-image: linear-gradient(var(--wxxx-cm-line), var(--wxxx-cm-line));
	background-position: 16px 0;
}

.wxxx-comments .ptc-item_level-2 {
	padding-left: calc(var(--wxxx-cm-indent) * 2 + 8px);
	background-image: linear-gradient(var(--wxxx-cm-line), var(--wxxx-cm-line)), linear-gradient(var(--wxxx-cm-line), var(--wxxx-cm-line));
	background-position: 16px 0, 34px 0;
}

.wxxx-comments .ptc-item_level-3 {
	padding-left: calc(var(--wxxx-cm-indent) * 3 + 8px);
	background-image: linear-gradient(var(--wxxx-cm-line), var(--wxxx-cm-line)), linear-gradient(var(--wxxx-cm-line), var(--wxxx-cm-line)), linear-gradient(var(--wxxx-cm-line), var(--wxxx-cm-line));
	background-position: 16px 0, 34px 0, 52px 0;
}

.wxxx-comments .ptc-item_level-4 {
	padding-left: calc(var(--wxxx-cm-indent) * 4 + 8px);
	background-image: linear-gradient(var(--wxxx-cm-line), var(--wxxx-cm-line)), linear-gradient(var(--wxxx-cm-line), var(--wxxx-cm-line)), linear-gradient(var(--wxxx-cm-line), var(--wxxx-cm-line)), linear-gradient(var(--wxxx-cm-line), var(--wxxx-cm-line));
	background-position: 16px 0, 34px 0, 52px 0, 70px 0;
}

.wxxx-comments .ptc-item_level-5,
.wxxx-comments .ptc-item_level-6 {
	padding-left: calc(var(--wxxx-cm-indent) * 5 + 8px);
	background-image: linear-gradient(var(--wxxx-cm-line), var(--wxxx-cm-line)), linear-gradient(var(--wxxx-cm-line), var(--wxxx-cm-line)), linear-gradient(var(--wxxx-cm-line), var(--wxxx-cm-line)), linear-gradient(var(--wxxx-cm-line), var(--wxxx-cm-line)), linear-gradient(var(--wxxx-cm-line), var(--wxxx-cm-line));
	background-position: 16px 0, 34px 0, 52px 0, 70px 0, 88px 0;
}

/* строка комментария */
.wxxx-comments .ptc-item-container {
	display: block;
}

.wxxx-comments .wxxx-cm-row {
	display: flex;
	align-items: flex-start;
}

/* кнопка сворачивания ветки */
.wxxx-comments .wxxx-cm-toggle {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 20px;
	height: 20px;
	margin: 2px 8px 0 0;
	padding: 0;
	border: none;
	border-radius: 50%;
	background: var(--wxxx-cm-bg-soft);
	cursor: pointer;
	outline: none;
	transition: background .15s;
}

.wxxx-comments .wxxx-cm-toggle:hover {
	background: #e6e9ed;
}

.wxxx-comments .wxxx-cm-toggle-bar {
	display: block;
	position: relative;
	width: 8px;
	height: 2px;
	background: var(--wxxx-cm-text-light);
}

.wxxx-comments .wxxx-cm-collapsed .wxxx-cm-toggle-bar::after {
	content: "";
	position: absolute;
	left: 3px;
	top: -3px;
	width: 2px;
	height: 8px;
	background: inherit;
}

.wxxx-comments .wxxx-cm-collapsed .wxxx-cm-toggle {
	background: #e6e9ed;
}

/* содержимое */
.wxxx-comments .ptc-item-content {
	flex: 1 1 auto;
	min-width: 0;
}

.wxxx-comments .ptc-item-head {
	display: flex;
	align-items: baseline;
	flex-wrap: wrap;
	margin-bottom: 2px;
}

.wxxx-comments .ptc-item-head-user {
	margin-right: 8px;
	font-weight: 700;
	color: var(--wxxx-cm-text);
	word-break: break-word;
}

.wxxx-comments .ptc-item-head-date {
	color: var(--wxxx-cm-text-light);
	font-size: 13px;
}

.wxxx-comments .ptc-item-head-controls {
	margin-left: auto;
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

.wxxx-comments .ptc-item-publish-btn,
.wxxx-comments .ptc-item-delete-btn {
	width: 26px;
	height: 26px;
	padding: 0;
	border: none;
	border-radius: 4px;
	background: none;
	color: var(--wxxx-cm-text-light);
	font-size: 15px;
	cursor: pointer;
	outline: none;
}

.wxxx-comments .ptc-item-publish-btn:hover {
	color: #4e9f28;
}

.wxxx-comments .ptc-item-delete-btn:hover {
	color: var(--wxxx-red);
}

/* текст комментария */
.wxxx-comments .ptc-item-body {
	margin: 2px 0 6px;
}

.wxxx-comments .ptc-item-text {
	line-height: 1.5;
	word-wrap: break-word;
}

.wxxx-comments .ptc-item-text .smile {
	vertical-align: middle;
}

.wxxx-comments .ptc-item-text img {
	max-width: 100%;
	height: auto;
}

.wxxx-comments .ptc-item-text p {
	margin: 0 0 .5em;
}

.wxxx-comments .ptc-item-text p:last-child {
	margin-bottom: 0;
}

.wxxx-comments .ptc-item-edited {
	margin-top: 4px;
	color: var(--wxxx-cm-text-light);
	font-size: 12px;
	font-style: italic;
}

/* удалённый комментарий */
.wxxx-comments .ptc-item-replaced {
	padding: 10px 0;
}

.wxxx-comments .ptc-item-replaced-text {
	color: var(--wxxx-cm-text-light);
	font-style: italic;
}

/* строка действий: рейтинг, ответить, редактировать */
.wxxx-comments .wxxx-cm-actions {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 4px 14px;
	margin-top: 4px;
}

.wxxx-comments .wxxx-cm-vote {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 3px 8px;
	border-radius: 16px;
	background: var(--wxxx-cm-bg-soft);
}

.wxxx-comments .ptc-item-vote-btn {
	display: inline-flex;
	align-items: center;
	padding: 0;
	border: none;
	background: none;
	cursor: pointer;
	outline: none;
}

.wxxx-comments .wxxx-cm-arrow {
	display: inline-block;
	width: 0;
	height: 0;
	border-left: 5px solid transparent;
	border-right: 5px solid transparent;
	border-bottom: 7px solid #aeb4bb;
	transition: border-color .15s;
}

.wxxx-comments .wxxx-cm-arrow_down {
	border-bottom: none;
	border-top: 7px solid #aeb4bb;
}

.wxxx-comments .ptc-item-vote-btn-up:hover .wxxx-cm-arrow_up {
	border-bottom-color: #4e9f28;
}

.wxxx-comments .ptc-item-vote-btn-down:hover .wxxx-cm-arrow_down {
	border-top-color: var(--wxxx-red);
}

.wxxx-comments .wxxx-cm-rating {
	min-width: 16px;
	text-align: center;
	font-size: 13px;
	font-weight: 700;
	color: var(--wxxx-cm-text-light);
}

.wxxx-comments .wxxx-cm-rating_plus {
	color: #4e9f28;
}

.wxxx-comments .wxxx-cm-rating_minus {
	color: var(--wxxx-red);
}

/* уже проголосовали / голосование недоступно */
.wxxx-comments .ptc-item_no-vote .ptc-item-vote-btn {
	cursor: default;
}

.wxxx-comments .ptc-item_no-vote .wxxx-cm-arrow {
	opacity: .45;
}

/* подсветка своего голоса */
.wxxx-comments .wxxx-cm-vote_my-up .wxxx-cm-arrow_up {
	border-bottom-color: #4e9f28;
	opacity: 1;
}

.wxxx-comments .wxxx-cm-vote_my-down .wxxx-cm-arrow_down {
	border-top-color: var(--wxxx-red);
	opacity: 1;
}

/* ссылки «ответить» / «редактировать» */
.wxxx-comments .ptc-item-reply-btn,
.wxxx-comments .ptc-item-edit-btn {
	padding: 0;
	border: none;
	background: none;
	color: #6f757c;
	font-size: 13px;
	cursor: pointer;
	outline: none;
	transition: color .15s;
}

.wxxx-comments .ptc-item-reply-btn:hover,
.wxxx-comments .ptc-item-edit-btn:hover {
	color: var(--wxxx-cm-text);
}

.wxxx-comments .ptc-item-edit-btn {
	color: var(--wxxx-cm-text-light);
}

.wxxx-comments .ptc-item_with-form .ptc-item-reply-btn {
	display: none;
}

.wxxx-comments .ptc-item_edit .ptc-item-edit-btn {
	display: none;
}

/* «раскрыть ветку» у свёрнутого комментария */
.wxxx-comments .wxxx-cm-branch {
	display: none;
	padding: 0;
	border: none;
	background: none;
	color: #6f757c;
	font-size: 13px;
	text-decoration: underline;
	cursor: pointer;
	outline: none;
}

.wxxx-comments .wxxx-cm-branch:hover {
	color: var(--wxxx-cm-text);
}

.wxxx-comments .wxxx-cm-collapsed .ptc-item-body,
.wxxx-comments .wxxx-cm-collapsed .ptc-item-head-controls,
.wxxx-comments .wxxx-cm-collapsed .wxxx-cm-actions > :not(.wxxx-cm-branch) {
	display: none;
}

.wxxx-comments .wxxx-cm-collapsed .wxxx-cm-branch {
	display: inline-block;
}

.wxxx-comments .wxxx-cm-collapsed .ptc-item-head-user {
	color: var(--wxxx-cm-text-light);
}

/* режим редактирования: текст скрывается, форму модуль вставляет внутрь */
.wxxx-comments .ptc-item_edit .ptc-item-body,
.wxxx-comments .ptc-item_edit .wxxx-cm-actions {
	display: none;
}

/* форма ответа внутри комментария */
.wxxx-comments .ptc-item > .ptc-form-form {
	margin: 10px 0 6px var(--wxxx-cm-content-indent);
}

.wxxx-comments .ptc-item > .ptc-form-form.ptc-form-form_hidden {
	margin: 0;
}

/* форма: открытие/закрытие */
.wxxx-comments .ptc-form-form {
	opacity: 1;
	visibility: visible;
	transition: opacity .25s, visibility .25s;
}

.wxxx-comments .ptc-form-form_hidden {
	opacity: 0;
	visibility: hidden;
}

/* на модерации */
.wxxx-comments .ptc-item_pending .ptc-item-container {
	padding-left: 8px;
	border-left: 3px solid #f0c96b;
}

.wxxx-comments .ptc-item_pending .ptc-item-head::after {
	content: "на проверке";
	margin-left: 8px;
	padding: 1px 8px;
	border-radius: 10px;
	background: #fdf3dc;
	color: #b58a2e;
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .3px;
}

/* кнопка «показать ещё» (бесконечная прокрутка): скрыта, пока работает автодозагрузка */
.wxxx-comments .ptc-list-more {
	display: none;
	margin: 20px auto 8px;
	min-width: 260px;
	padding: 10px 24px;
	border: 1px solid var(--wxxx-cm-line);
	border-radius: 8px;
	background: #fff;
	color: #6f757c;
	font-size: 14px;
	cursor: pointer;
	outline: none;
	transition: border-color .15s, color .15s;
}

.wxxx-comments .ptc-list-more:hover {
	border-color: var(--wxxx-red);
	color: var(--wxxx-red);
}

.wxxx-comments .ptc-list-pagenav_hidden {
	display: none;
}

/* мобильные */
@media (max-width: 640px) {
	.wxxx-comments {
		--wxxx-cm-indent: 12px;
		--wxxx-cm-content-indent: 26px;
		font-size: 14px;
	}

	.wxxx-comments .wxxx-cm-title {
		font-size: 19px;
	}

	.wxxx-comments .wxxx-cm-toggle {
		width: 18px;
		height: 18px;
		margin-top: 2px;
	}

	.wxxx-comments .ptc-item_level-1 {
		background-position: 14px 0;
	}

	.wxxx-comments .ptc-item_level-2 {
		background-position: 14px 0, 26px 0;
	}

	.wxxx-comments .ptc-item_level-3 {
		background-position: 14px 0, 26px 0, 38px 0;
	}

	.wxxx-comments .ptc-item_level-4 {
		background-position: 14px 0, 26px 0, 38px 0, 50px 0;
	}

	.wxxx-comments .ptc-item_level-5,
	.wxxx-comments .ptc-item_level-6 {
		background-position: 14px 0, 26px 0, 38px 0, 50px 0, 62px 0;
	}

	.wxxx-comments .ptc-item {
		padding-top: 8px;
		padding-bottom: 8px;
	}

	.wxxx-comments .ptc-item > .ptc-form-form {
		margin-left: 0;
	}
}
