/**
 * Right-side comments drawer for article chrome singles.
 * Uses Iola tokens; styles theme/Kadence comments only inside the drawer.
 */

body.has-iola-comments-drawer {
	--iola-comments-drawer-width: min(420px, 100vw);
	--iola-comments-drawer-z: 80;
	--iola-comments-drawer-pad: 1.25rem;
	--iola-text: var(--iola-text, #0d0d0d);
	--iola-text-muted: color-mix(in srgb, #0d0d0d 72%, #fff 28%);
	--iola-border-soft: color-mix(in srgb, #0d0d0d 10%, #fff 90%);
	--iola-bg: #fff;
	--iola-bg-tone: #f5f5f5;
	--iola-font-ui: var(--global-body-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);
	--iola-font-display: var(--global-heading-font-family, Georgia, "Times New Roman", serif);
}

body.has-iola-comments-drawer.is-iola-comments-drawer-open {
	overflow: hidden;
}

/* Hide outer shell still sitting in the page flow — not nested drawer content. */
body.has-iola-comments-drawer .comments-section:not(.is-iola-comments-drawer-mounted),
body.has-iola-comments-drawer #comments:not(.is-iola-comments-drawer-mounted) {
	display: none !important;
}

.iola-comments-drawer[hidden] {
	display: none !important;
}

.iola-comments-drawer {
	position: fixed;
	inset: 0;
	z-index: var(--iola-comments-drawer-z);
	pointer-events: none;
	visibility: hidden;
	/* Keep visibility until slide-out finishes */
	transition: visibility 0s linear 0.28s;
}

.iola-comments-drawer.is-open {
	pointer-events: auto;
	visibility: visible;
	transition-delay: 0s;
}

.iola-comments-drawer__overlay {
	position: absolute;
	inset: 0;
	background: color-mix(in srgb, #000 40%, transparent);
	opacity: 0;
	transition: opacity 0.28s ease;
}

.iola-comments-drawer.is-open .iola-comments-drawer__overlay {
	opacity: 1;
}

.iola-comments-drawer__panel {
	position: absolute;
	top: var(--wp-admin--admin-bar--height, 0px);
	right: 0;
	bottom: 0;
	display: flex;
	flex-direction: column;
	box-sizing: border-box;
	width: var(--iola-comments-drawer-width);
	max-width: 100%;
	height: auto;
	margin: 0;
	padding: 0;
	background: var(--iola-bg);
	box-shadow: -8px 0 28px color-mix(in srgb, #000 12%, transparent);
	transform: translate3d(100%, 0, 0);
	transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
	will-change: transform;
	outline: none;
}

.iola-comments-drawer.is-open .iola-comments-drawer__panel {
	transform: translate3d(0, 0, 0);
}

@media (prefers-reduced-motion: reduce) {
	.iola-comments-drawer,
	.iola-comments-drawer__overlay,
	.iola-comments-drawer__panel {
		transition: none !important;
	}
}

.iola-comments-drawer__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	flex-shrink: 0;
	padding: 1rem var(--iola-comments-drawer-pad) 0.875rem;
	border-bottom: 1px solid var(--iola-border-soft);
	background: var(--iola-bg);
}

.iola-comments-drawer__title {
	margin: 0;
	font-family: var(--iola-font-ui);
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.06em;
	line-height: 1.3;
	text-transform: uppercase;
	color: var(--iola-text-muted);
}

.iola-comments-drawer__close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.25rem;
	height: 2.25rem;
	margin: 0;
	padding: 0;
	border: 1px solid var(--iola-border-soft);
	border-radius: 50%;
	background: var(--iola-bg);
	color: var(--iola-text);
	font-size: 1.5rem;
	line-height: 1;
	cursor: pointer;
}

.iola-comments-drawer__close:hover,
.iola-comments-drawer__close:focus-visible {
	background: var(--iola-text);
	border-color: var(--iola-text);
	color: var(--iola-bg);
	outline: none;
}

.iola-comments-drawer__body {
	flex: 1 1 auto;
	overflow: auto;
	padding: 1.25rem var(--iola-comments-drawer-pad) 2rem;
	-webkit-overflow-scrolling: touch;
	font-family: var(--iola-font-ui);
	color: var(--iola-text);
}

/*
 * Force-show everything inside the drawer body.
 * Higher specificity than legacy hide rules that targeted .wp-block-comments.
 */
body.has-iola-comments-drawer .iola-comments-drawer__body .comments-section,
body.has-iola-comments-drawer .iola-comments-drawer__body .wp-block-comments,
body.has-iola-comments-drawer .iola-comments-drawer__body #comments,
body.has-iola-comments-drawer .iola-comments-drawer__body #respond,
body.has-iola-comments-drawer .iola-comments-drawer__body .comment-respond,
body.has-iola-comments-drawer .iola-comments-drawer__body .kb-v-lg-hidden,
body.has-iola-comments-drawer .iola-comments-drawer__body .kb-v-md-hidden,
body.has-iola-comments-drawer .iola-comments-drawer__body .kb-v-sm-hidden {
	display: block !important;
	visibility: visible !important;
	height: auto !important;
	max-height: none !important;
	width: 100% !important;
	max-width: 100% !important;
	overflow: visible !important;
	opacity: 1 !important;
}

body.has-iola-comments-drawer .iola-comments-drawer__body .kb-row-layout-wrap,
body.has-iola-comments-drawer .iola-comments-drawer__body .kt-row-column-wrap,
body.has-iola-comments-drawer .iola-comments-drawer__body .wp-block-kadence-column,
body.has-iola-comments-drawer .iola-comments-drawer__body .kt-inside-inner-col {
	display: block !important;
	width: 100% !important;
	max-width: 100% !important;
	margin: 0 !important;
	padding: 0 !important;
	min-height: 0 !important;
	height: auto !important;
}

/* —— Form —— */
.iola-comments-drawer__body .comment-reply-title,
.iola-comments-drawer__body .wp-block-post-comments-form .comment-reply-title {
	margin: 0 0 1rem !important;
	padding: 0;
	border: 0;
	font-family: var(--iola-font-ui) !important;
	font-size: 0.75rem !important;
	font-weight: 600 !important;
	letter-spacing: 0.06em;
	line-height: 1.3 !important;
	text-transform: uppercase;
	color: var(--iola-text-muted) !important;
}

.iola-comments-drawer__body .comment-reply-title small {
	display: block;
	margin-top: 0.35rem;
	font-size: 0.75rem;
	font-weight: 500;
	letter-spacing: 0;
	text-transform: none;
}

.iola-comments-drawer__body .logged-in-as,
.iola-comments-drawer__body .comment-notes,
.iola-comments-drawer__body .must-log-in {
	margin: 0 0 1rem;
	font-size: 0.8125rem;
	line-height: 1.45;
	color: var(--iola-text-muted);
}

.iola-comments-drawer__body .logged-in-as a,
.iola-comments-drawer__body .must-log-in a {
	color: var(--global-palette1, #0d0d0d);
	text-underline-offset: 0.12em;
}

.iola-comments-drawer__body .comment-form p {
	margin: 0 0 0.875rem;
}

.iola-comments-drawer__body .comment-form label,
.iola-comments-drawer__body .comment-form .float-label {
	font-family: var(--iola-font-ui);
	font-size: 0.75rem;
	font-weight: 500;
	color: var(--iola-text-muted);
}

.iola-comments-drawer__body .comment-form textarea,
.iola-comments-drawer__body .comment-form input[type="text"],
.iola-comments-drawer__body .comment-form input[type="email"],
.iola-comments-drawer__body .comment-form input[type="url"] {
	box-sizing: border-box;
	width: 100%;
	max-width: 100%;
	margin: 0;
	padding: 0.75rem 0.875rem;
	border: 1px solid var(--iola-border-soft);
	border-radius: 2px;
	background: var(--iola-bg);
	color: var(--iola-text);
	font-family: var(--iola-font-ui);
	font-size: 0.9375rem;
	line-height: 1.45;
	resize: vertical;
}

.iola-comments-drawer__body .comment-form textarea {
	min-height: 8rem;
}

.iola-comments-drawer__body .comment-form textarea:focus,
.iola-comments-drawer__body .comment-form input[type="text"]:focus,
.iola-comments-drawer__body .comment-form input[type="email"]:focus,
.iola-comments-drawer__body .comment-form input[type="url"]:focus {
	border-color: color-mix(in srgb, var(--global-palette1, #0d0d0d) 55%, #fff);
	outline: 2px solid color-mix(in srgb, var(--global-palette1, #0d0d0d) 25%, transparent);
	outline-offset: 1px;
}

.iola-comments-drawer__body .comment-form .form-submit {
	margin: 1rem 0 0;
}

.iola-comments-drawer__body .comment-form input[type="submit"],
.iola-comments-drawer__body .comment-form .submit {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: auto;
	min-height: 2.5rem;
	margin: 0;
	padding: 0.625rem 1.25rem;
	border: 0;
	border-radius: 2px;
	background: var(--global-palette1, #0d0d0d) !important;
	color: var(--global-palette9, #fff) !important;
	font-family: var(--iola-font-ui);
	font-size: 0.8125rem;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	cursor: pointer;
}

.iola-comments-drawer__body .comment-form input[type="submit"]:hover,
.iola-comments-drawer__body .comment-form .submit:hover {
	filter: brightness(0.92);
}

/* —— Comment list (block + classic) —— */
.iola-comments-drawer__body .wp-block-comments-title,
.iola-comments-drawer__body .comments-title {
	margin: 0 0 1rem;
	font-family: var(--iola-font-ui);
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--iola-text-muted);
}

.iola-comments-drawer__body .wp-block-comment-template,
.iola-comments-drawer__body .comment-list,
.iola-comments-drawer__body ol.commentlist {
	margin: 0 0 1.75rem !important;
	padding: 0 !important;
	list-style: none !important;
}

.iola-comments-drawer__body .wp-block-comment,
.iola-comments-drawer__body .comment-list > .comment,
.iola-comments-drawer__body .commentlist > .comment {
	margin: 0 0 1rem;
	padding: 0 0 1rem;
	border-bottom: 1px solid var(--iola-border-soft);
	list-style: none !important;
}

.iola-comments-drawer__body .wp-block-comment:last-child,
.iola-comments-drawer__body .comment-list > .comment:last-child {
	margin-bottom: 0;
	border-bottom: 0;
}

.iola-comments-drawer__body .wp-block-comment .wp-block-avatar img,
.iola-comments-drawer__body .comment-author .avatar {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	object-fit: cover;
}

.iola-comments-drawer__body .wp-block-comment-author-name,
.iola-comments-drawer__body .comment-author .fn {
	font-family: var(--iola-font-ui);
	font-size: 0.875rem;
	font-weight: 600;
	color: var(--iola-text);
}

.iola-comments-drawer__body .wp-block-comment-author-name a,
.iola-comments-drawer__body .comment-author .fn a {
	color: inherit;
	text-decoration: none;
}

.iola-comments-drawer__body .wp-block-comment-date,
.iola-comments-drawer__body .comment-metadata,
.iola-comments-drawer__body .comment-meta {
	font-family: var(--iola-font-ui);
	font-size: 0.75rem;
	color: var(--iola-text-muted);
}

.iola-comments-drawer__body .wp-block-comment-date a,
.iola-comments-drawer__body .comment-metadata a {
	color: inherit;
	text-decoration: none;
}

.iola-comments-drawer__body .wp-block-comment-content,
.iola-comments-drawer__body .comment-content {
	margin-top: 0.5rem;
	font-family: var(--iola-font-display);
	font-size: 0.9375rem;
	line-height: 1.5;
	color: var(--iola-text);
}

.iola-comments-drawer__body .wp-block-comment-content p,
.iola-comments-drawer__body .comment-content p {
	margin: 0 0 0.5rem;
}

.iola-comments-drawer__body .wp-block-comment-content p:last-child,
.iola-comments-drawer__body .comment-content p:last-child {
	margin-bottom: 0;
}

.iola-comments-drawer__body .wp-block-comment-reply-link,
.iola-comments-drawer__body .reply,
.iola-comments-drawer__body .comment-reply-link {
	font-family: var(--iola-font-ui);
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.iola-comments-drawer__body .comment-reply-link {
	color: var(--global-palette1, #0d0d0d);
	text-decoration: none;
}

.iola-comments-drawer__body .comment-reply-link:hover,
.iola-comments-drawer__body .comment-reply-link:focus-visible {
	text-decoration: underline;
	text-underline-offset: 0.12em;
}

.iola-comments-drawer__body .children,
.iola-comments-drawer__body .wp-block-comment .children {
	margin: 0.75rem 0 0;
	padding: 0 0 0 0.875rem;
	border-left: 2px solid var(--iola-border-soft);
	list-style: none;
}

/* —— Policy band under the form —— */
.iola-comments-drawer__body .wp-block-kadence-advancedheading {
	margin: 1.5rem 0 0.5rem !important;
	font-family: var(--iola-font-ui) !important;
	font-size: 0.75rem !important;
	font-weight: 600 !important;
	letter-spacing: 0.05em;
	line-height: 1.35 !important;
	text-transform: uppercase;
	color: var(--iola-text-muted) !important;
}

.iola-comments-drawer__body p.wp-block-kadence-advancedheading {
	margin: 0 !important;
	padding: 0.875rem 1rem;
	background: var(--iola-bg-tone);
	font-size: 0.8125rem !important;
	font-weight: 400 !important;
	letter-spacing: 0 !important;
	line-height: 1.45 !important;
	text-transform: none !important;
	color: var(--iola-text-muted) !important;
}

.iola-comments-drawer__body p.wp-block-kadence-advancedheading a {
	color: var(--global-palette1, #0d0d0d);
}

/* Share-strip comment control */
.iola-sticky-shares__btn--comments {
	position: relative;
}

.iola-sticky-shares__count {
	position: absolute;
	top: -0.2rem;
	right: -0.2rem;
	min-width: 1.1rem;
	height: 1.1rem;
	padding: 0 0.25rem;
	border-radius: 999px;
	background: var(--global-palette1, #1a1a1a);
	color: var(--global-palette9, #fff);
	font-family: var(--iola-font-ui);
	font-size: 0.625rem;
	font-weight: 600;
	line-height: 1.1rem;
	text-align: center;
}

@media (max-width: 640px) {
	body.has-iola-comments-drawer {
		--iola-comments-drawer-width: 100vw;
	}
}
