/*
 * ASC Comments frontend renderer.
 * Every selector is scoped to .asc-comments.
 */

.asc-comments {
	--asc-comments-accent: var(--asd-primary, var(--primary-color, var(--madara-main-color, #eb3349)));
	--asc-comments-surface: var(--asd-surface, #fff);
	--asc-comments-surface-soft: var(--asd-surface-soft, #f7f7f8);
	--asc-comments-text: var(--asd-text, #333);
	--asc-comments-heading: var(--asd-heading, #222);
	--asc-comments-muted: var(--asd-muted, #666);
	--asc-comments-border: var(--asd-border, #e5e5e5);
	--asc-comments-indent: clamp(16px, 2.5vw, 28px);
	box-sizing: border-box;
	width: 100%;
	min-width: 0;
	max-width: 100%;
	overflow: hidden;
	color: var(--asc-comments-text);
}

body.text-ui-light .asc-comments {
	--asc-comments-surface: var(--asd-surface, #262626);
	--asc-comments-surface-soft: var(--asd-surface-soft, #2c2c2c);
	--asc-comments-text: var(--asd-text, #ccc);
	--asc-comments-heading: var(--asd-heading, #fff);
	--asc-comments-muted: var(--asd-muted, #bdbdbd);
	--asc-comments-border: var(--asd-border, #383838);
}

.asc-comments,
.asc-comments *,
.asc-comments *::before,
.asc-comments *::after {
	box-sizing: border-box;
}

.asc-comments__header {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	min-width: 0;
	margin: 0 0 18px;
	padding: 0 0 12px;
	border-bottom: 1px solid var(--asc-comments-border);
}

.asc-comments__title {
	min-width: 0;
	margin: 0;
	color: var(--asc-comments-heading);
	font-size: clamp(18px, 2vw, 22px);
	font-weight: 700;
	line-height: 1.25;
	letter-spacing: .01em;
	overflow-wrap: anywhere;
}

.asc-comments__count {
	flex: 0 0 auto;
	color: var(--asc-comments-muted);
	font-size: 11px;
	font-weight: 600;
	letter-spacing: .045em;
	text-transform: uppercase;
}

.asc-comments__list,
.asc-comments__children {
	min-width: 0;
	max-width: 100%;
	margin: 0;
	padding: 0;
	list-style: none;
}

.asc-comments__children {
	margin-top: 12px;
}

.asc-comments__item {
	min-width: 0;
	max-width: 100%;
	margin: 0;
}

.asc-comments__item + .asc-comments__item {
	margin-top: 14px;
}

.asc-comments__item--depth-1,
.asc-comments__item--depth-2 {
	margin-inline-start: var(--asc-comments-indent);
}

.asc-comments__item--depth-capped {
	margin-inline-start: 0;
}

.asc-comments__card {
	display: grid;
	grid-template-columns: 44px minmax(0, 1fr);
	gap: 12px;
	min-width: 0;
	max-width: 100%;
	padding: 15px 16px;
	border: 1px solid var(--asc-comments-border);
	border-radius: 10px;
	background: var(--asc-comments-surface);
}

.asc-comments__avatar {
	width: 44px;
	min-width: 0;
	height: 44px;
	overflow: hidden;
	border-radius: 50%;
	background: var(--asc-comments-surface-soft);
}

.asc-comments__avatar img {
	display: block;
	width: 44px;
	max-width: 100%;
	height: 44px;
	border-radius: inherit;
}

.asc-comments__main,
.asc-comments__meta,
.asc-comments__content,
.asc-comments__actions {
	min-width: 0;
	max-width: 100%;
}

.asc-comments__meta {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 3px 10px;
	margin: 1px 0 8px;
}

.asc-comments__author {
	margin: 0;
	color: var(--asc-comments-heading);
	font-size: 14px;
	font-weight: 700;
	line-height: 1.35;
	overflow-wrap: anywhere;
}

.asc-comments__timestamp,
.asc-comments__permalink {
	color: var(--asc-comments-muted);
	font-size: 11px;
	font-weight: 600;
	line-height: 1.35;
	letter-spacing: .035em;
	text-decoration: none;
	text-transform: uppercase;
}

.asc-comments__permalink:hover,
.asc-comments__permalink:focus {
	color: var(--asc-comments-accent);
	text-decoration: none;
}

.asc-comments__content {
	color: var(--asc-comments-text);
	font-size: 14px;
	line-height: 1.7;
	overflow-wrap: anywhere;
	word-break: break-word;
}

.asc-comments__content > :first-child {
	margin-top: 0;
}

.asc-comments__content > :last-child {
	margin-bottom: 0;
}

.asc-comments__content a {
	color: var(--asc-comments-accent);
	overflow-wrap: anywhere;
	word-break: break-word;
}

.asc-comments__content img,
.asc-comments__content video {
	max-width: 100%;
	height: auto;
}

.asc-comments__content pre,
.asc-comments__content code {
	max-width: 100%;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
	word-break: break-word;
}

.asc-comments__content table {
	display: block;
	max-width: 100%;
	overflow-x: auto;
}

.asc-comments__spoiler {
	display: inline;
	min-width: 0;
}

.asc-comments__spoiler-summary {
	display: inline-flex;
	align-items: center;
	min-width: 0;
	margin: 0;
	padding: 0;
	list-style: none;
	cursor: pointer;
	touch-action: manipulation;
	vertical-align: baseline;
}

.asc-comments__spoiler-summary::-webkit-details-marker {
	display: none;
}

.asc-comments__spoiler-summary::marker {
	content: '';
	font-size: 0;
}

.asc-comments__spoiler-summary:focus-visible {
	border-radius: 3px;
	outline: 2px solid var(--asc-comments-accent);
	outline-offset: 2px;
}

.asc-comments__spoiler-mask {
	display: inline-block;
	width: clamp(56px, 18vw, 132px);
	max-width: 100%;
	min-height: 1.05em;
	border-radius: 3px;
	background: var(--asc-comments-muted);
	opacity: .78;
	vertical-align: -.1em;
}

.asc-comments__spoiler[open] .asc-comments__spoiler-mask {
	opacity: .42;
}

.asc-comments__spoiler-content {
	color: var(--asc-comments-text);
	overflow-wrap: anywhere;
	word-break: break-word;
}

.asc-comments #respond {
	min-width: 0;
	max-width: 100%;
	margin: 0 0 20px;
	padding: 16px;
	border: 1px solid var(--asc-comments-border);
	border-radius: 10px;
	background: var(--asc-comments-surface);
}

.asc-comments .comment-reply-title,
.asc-comments__form-title {
	margin: 0 0 12px;
	color: var(--asc-comments-heading);
	font-size: 16px;
	font-weight: 700;
	line-height: 1.3;
}

.asc-comments__form,
.asc-comments__comment-field,
.asc-comments .comment-form-author,
.asc-comments .comment-form-email,
.asc-comments .comment-form-url,
.asc-comments .comment-form-cookies-consent,
.asc-comments .form-submit {
	min-width: 0;
	max-width: 100%;
}

.asc-comments__comment-field,
.asc-comments .comment-form-author,
.asc-comments .comment-form-email,
.asc-comments .comment-form-url,
.asc-comments .comment-form-cookies-consent {
	margin: 0 0 12px;
}

.asc-comments__comment-field > label,
.asc-comments .comment-form-author > label,
.asc-comments .comment-form-email > label,
.asc-comments .comment-form-url > label {
	display: block;
	margin: 0 0 6px;
	color: var(--asc-comments-heading);
	font-size: 12px;
	font-weight: 700;
}

.asc-comments__editor {
	display: block;
	min-width: 0;
	max-width: 100%;
}

.asc-comments__toolbar {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 0 0 8px;
}

.asc-comments__format-button {
	min-width: 30px;
	min-height: 30px;
	padding: 4px 9px;
	border: 1px solid var(--asc-comments-border);
	border-radius: 5px;
	background: var(--asc-comments-surface-soft);
	color: var(--asc-comments-heading);
	font: inherit;
	font-size: 12px;
	font-weight: 700;
	line-height: 1;
	cursor: pointer;
}

.asc-comments__format-button:hover,
.asc-comments__format-button:focus-visible {
	border-color: var(--asc-comments-accent);
	background: var(--asc-comments-accent);
	color: var(--asc-comments-surface);
}

.asc-comments__editor textarea,
.asc-comments .comment-form-author input,
.asc-comments .comment-form-email input,
.asc-comments .comment-form-url input {
	display: block;
	width: 100%;
	max-width: 100%;
	padding: 10px 11px;
	border: 1px solid var(--asc-comments-border);
	border-radius: 6px;
	background: var(--asc-comments-surface-soft);
	color: var(--asc-comments-text);
	font: inherit;
	font-size: 14px;
	line-height: 1.5;
}

.asc-comments__editor textarea {
	min-height: 140px;
	resize: vertical;
}

.asc-comments__editor textarea:focus,
.asc-comments .comment-form-author input:focus,
.asc-comments .comment-form-email input:focus,
.asc-comments .comment-form-url input:focus {
	border-color: var(--asc-comments-accent);
	outline: 2px solid var(--asc-comments-accent);
	outline-offset: 1px;
}

.asc-comments .form-submit {
	margin: 14px 0 0;
}

.asc-comments__submit {
	min-height: 34px;
	padding: 8px 14px;
	border: 1px solid var(--asc-comments-accent);
	border-radius: 5px;
	background: var(--asc-comments-accent);
	color: var(--asc-comments-surface);
	font: inherit;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: .035em;
	text-transform: uppercase;
	cursor: pointer;
}

.asc-comments__submit:hover,
.asc-comments__submit:focus-visible {
	filter: brightness(.92);
}

.asc-comments__submit:disabled {
	cursor: progress;
	opacity: .7;
}

.asc-comments__submission-status {
	display: block;
	min-width: 0;
	margin-top: 10px;
	padding: 9px 10px;
	border: 1px solid var(--asc-comments-border);
	border-radius: 6px;
	background: var(--asc-comments-surface-soft);
	color: var(--asc-comments-muted);
	font-size: 13px;
	line-height: 1.45;
	overflow-wrap: anywhere;
	word-break: break-word;
}

.asc-comments__submission-status[hidden] {
	display: none;
}

.asc-comments__submission-status[data-asc-comments-state="loading"] {
	border-color: var(--asc-comments-border);
	color: var(--asc-comments-muted);
}

.asc-comments__submission-status[data-asc-comments-state="success"],
.asc-comments__submission-status[data-asc-comments-state="pending"] {
	border-color: var(--asc-comments-accent);
	color: var(--asc-comments-heading);
}

.asc-comments__submission-status[data-asc-comments-state="error"] {
	border-color: var(--asc-comments-accent);
	color: var(--asc-comments-accent);
}

.asc-comments__screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.asc-comments__actions {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-top: 12px;
}

.asc-comments__reply-trigger {
	display: inline-flex;
	align-items: center;
	min-height: 22px;
	padding: 0;
	border: 0;
	background: transparent;
	color: var(--asc-comments-accent);
	font: inherit;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .045em;
	text-transform: uppercase;
	cursor: pointer;
}

.asc-comments__reply-trigger:hover,
.asc-comments__reply-trigger:focus-visible {
	color: var(--asc-comments-heading);
	outline: none;
	text-decoration: underline;
}

.asc-comments__reply-composer {
	min-width: 0;
	max-width: 100%;
	margin: 12px 0 0;
	padding: 13px;
	border: 1px solid var(--asc-comments-border);
	border-radius: 8px;
	background: var(--asc-comments-surface-soft);
}

.asc-comments__reply-composer-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	min-width: 0;
	margin: 0 0 11px;
}

.asc-comments__reply-composer-title {
	min-width: 0;
	color: var(--asc-comments-heading);
	font-size: 13px;
	font-weight: 700;
	line-height: 1.3;
	overflow-wrap: anywhere;
}

.asc-comments__reply-cancel {
	min-height: 28px;
	padding: 4px 8px;
	border: 1px solid var(--asc-comments-border);
	border-radius: 5px;
	background: var(--asc-comments-surface);
	color: var(--asc-comments-muted);
	font: inherit;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .035em;
	text-transform: uppercase;
	cursor: pointer;
}

.asc-comments__reply-cancel:hover,
.asc-comments__reply-cancel:focus-visible {
	border-color: var(--asc-comments-accent);
	color: var(--asc-comments-accent);
	outline: none;
}

.asc-comments__reply-composer .asc-comments__form {
	margin: 0;
}

.asc-comments__reply-composer .asc-comments__editor textarea {
	min-height: 110px;
}

.asc-comments__empty {
	margin: 0;
	padding: 16px;
	border: 1px solid var(--asc-comments-border);
	border-radius: 10px;
	background: var(--asc-comments-surface);
	color: var(--asc-comments-muted);
	font-size: 14px;
	line-height: 1.6;
}

@media (max-width: 600px) {
	.asc-comments__header {
		align-items: flex-start;
		flex-direction: column;
		gap: 4px;
	}

	.asc-comments__item--depth-2,
	.asc-comments__item--depth-capped {
		margin-inline-start: 0;
	}

	.asc-comments__card {
		grid-template-columns: 36px minmax(0, 1fr);
		gap: 10px;
		padding: 13px;
	}

	.asc-comments__avatar,
	.asc-comments__avatar img {
		width: 36px;
		height: 36px;
	}

	.asc-comments__content {
		font-size: 13px;
		line-height: 1.65;
	}

	.asc-comments #respond {
		padding: 13px;
	}

	.asc-comments__spoiler-mask {
		width: clamp(48px, 24vw, 104px);
	}
}
