/**
 * LQQ — 移植补充样式。
 *
 * Halo 的评论区与搜索框原本由插件 Web Component 的 shadow DOM 自带样式，
 * 移植后改由 WordPress 原生 DOM 渲染，这里按插件的视觉规格重写：
 *  - 评论区：卡片式条目 + 圆角编辑器 + 三列输入 + 右下橙色提交按钮
 *  - 搜索框：居中模态框（遮罩 + 580px 卡片 + 48px ring 输入框 + 键盘提示）
 *
 * @package LQQ
 */

/* ==========================================================================
   1. 搜索模态框（对齐 Halo PluginSearchWidget 1.7.1）
   ========================================================================== */

.lqq-search {
	position: fixed;
	inset: 0;
	z-index: 999;
	display: none;
	align-items: flex-start;
	justify-content: center;
	padding: 3em 10px;
	overflow: auto;
}

.lqq-search.is-open {
	display: flex;
}

html.lqq-search-open,
html.lqq-search-open body {
	overflow: hidden;
}

.lqq-search__layer {
	position: fixed;
	inset: 0;
	background: rgba(107, 114, 128, 0.75);
	animation: lqq-fade-in 0.15s ease-out;
}

.lqq-search__dialog {
	position: relative;
	display: flex;
	flex-direction: column;
	width: 100%;
	max-width: 580px;
	max-height: calc(100vh - 5em);
	overflow: hidden;
	background: #fff;
	border-radius: 0.4em;
	box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
	animation: lqq-fade-in-up 0.3s ease-out;
	color: #333;
}

/* 搜索输入行：48px 高 + ring-2 */
.lqq-search__form {
	position: sticky;
	top: 0;
	z-index: 1;
	display: flex;
	align-items: center;
	height: 48px;
	margin: 12px;
	padding: 0 10px;
	background: var(--background, #fff);
	border: 1px solid var(--theme, #fb6c28);
	border-radius: 0.4em;
	box-shadow: 0 0 0 2px rgba(251, 108, 40, 0.25);
}

.lqq-search__icon {
	flex: none;
	width: 24px;
	height: 24px;
	color: var(--theme, #fb6c28);
	background: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") center / contain no-repeat;
}

.lqq-search__input {
	flex: 1 1 auto;
	min-width: 0;
	height: 100%;
	padding: 0 10px;
	font-size: 14px;
	color: inherit;
	background: transparent;
	border: 0;
	outline: none;
	box-shadow: none;
}

.lqq-search__clear {
	flex: none;
	font-size: 12px;
	color: #9ca3af;
	text-decoration: none;
	padding: 0 4px;
}

.lqq-search__clear:hover {
	color: #6b7280;
}

.lqq-search__body {
	padding: 0 12px 12px;
	overflow: auto;
}

.lqq-search__empty {
	display: flex;
	justify-content: center;
	padding: 16px 0;
	font-size: 14px;
	color: #9ca3af;
}

.lqq-search__list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.lqq-search__item {
	margin: 0;
	padding: 0;
	list-style: none;
}

.lqq-search__item > a {
	display: block;
	padding: 10px 12px;
	border-radius: 0.4em;
	text-decoration: none;
	transition: background-color 0.15s;
}

.lqq-search__item > a:hover,
.lqq-search__item.is-active > a {
	background: rgba(251, 108, 40, 0.08);
}

.lqq-search__item-title {
	display: block;
	font-size: 14px;
	font-weight: 500;
	color: #1f2937;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.lqq-search__item-title mark {
	padding: 0 2px;
	color: var(--theme, #fb6c28);
	background: rgba(251, 108, 40, 0.15);
	border-radius: 2px;
}

.lqq-search__item-meta {
	display: block;
	margin-top: 2px;
	font-size: 12px;
	color: #9ca3af;
}

.lqq-search__item-excerpt {
	display: -webkit-box;
	margin-top: 4px;
	font-size: 12px;
	line-height: 1.6;
	color: #6b7280;
	overflow: hidden;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}

/* 底部键盘提示行 */
.lqq-search__footer {
	display: flex;
	flex: none;
	flex-wrap: wrap;
	justify-content: flex-end;
	gap: 12px;
	padding: 10px 12px;
	border-top: 1px solid #e5e7eb;
}

.lqq-search__hint {
	display: flex;
	align-items: center;
	gap: 6px;
}

.lqq-search__hint kbd {
	display: inline-flex;
	justify-content: center;
	align-items: center;
	min-width: 20px;
	height: 20px;
	padding: 0 6px;
	font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
	font-size: 12px;
	color: #4b5563;
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 0.3em;
	box-shadow: 0 1px 0 #e5e7eb;
}

.lqq-search__hint span {
	font-size: 12px;
	color: #9ca3af;
}

html[data-mode="dark"] .lqq-search__dialog {
	color: #ddd;
	background: #191b1f;
}

html[data-mode="dark"] .lqq-search__item-title {
	color: #ddd;
}

html[data-mode="dark"] .lqq-search__footer {
	border-top-color: #2b2d31;
}

html[data-mode="dark"] .lqq-search__hint kbd {
	color: #c8c8c8;
	background: #232529;
	border-color: #2b2d31;
	box-shadow: none;
}

@keyframes lqq-fade-in {
	from { opacity: 0; }
	to { opacity: 1; }
}

@keyframes lqq-fade-in-up {
	from { opacity: 0; transform: translate3d(0, 12px, 0); }
	to { opacity: 1; transform: translate3d(0, 0, 0); }
}

/* ==========================================================================
   2. 评论区（对齐 Halo PluginCommentWidget 3.1.2）
   ========================================================================== */

/* 统计行：「N 条评论」 */
.joe_comment__stats {
	margin: 12px 0 4px;
	font-size: 14px;
	font-weight: 500;
}

/* 条目：卡片 */
.joe_comment__list,
.joe_comment__list .children {
	margin: 0;
	padding: 0;
	list-style: none;
}

.joe_comment__list .children {
	margin-left: 46px;
	padding-left: 14px;
	border-left: 1px solid rgba(0, 0, 0, 0.06);
}

.joe_comment__item {
	margin: 0 0 12px;
	padding: 0;
	list-style: none;
}

.joe_comment__item-body {
	display: flex;
	gap: 12px;
	padding: 16px;
	background: var(--background, #fff);
	border-radius: 8px;
	box-shadow: var(--box-shadow, 0 0 4px rgba(0, 0, 0, 0.06));
}

.joe_comment__avatar {
	flex: 0 0 auto;
}

.joe_comment__avatar img {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	display: block;
}

.joe_comment__main {
	flex: 1 1 auto;
	min-width: 0;
	width: 100%;
}

.joe_comment__meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	margin-bottom: 10px;
}

.joe_comment__author {
	font-size: 14px;
	font-weight: 500;
	color: var(--theme, #fb6c28);
}

.joe_comment__time {
	font-size: 12px;
	color: #9ca3af;
}

.joe_comment__website {
	font-size: 12px;
	color: #9ca3af;
	text-decoration: none;
}

.joe_comment__website:hover {
	color: var(--theme, #fb6c28);
}

.joe_comment__content {
	margin: 0 0 10px;
	font-size: 14px;
	line-height: 1.8;
	word-wrap: break-word;
	overflow-wrap: break-word;
}

.joe_comment__content > p:first-child {
	margin-top: 0;
}

.joe_comment__content > p:last-child {
	margin-bottom: 0;
}

.joe_comment__content img {
	max-width: 100%;
	height: auto;
	border-radius: 6px;
}

.joe_comment__moderation {
	margin: 0 0 6px;
	padding: 6px 10px;
	font-size: 13px;
	color: #b45309;
	background: rgba(251, 191, 36, 0.12);
	border-radius: 6px;
}

.joe_comment__actions {
	display: flex;
	align-items: center;
	gap: 12px;
	font-size: 13px;
}

.joe_comment__reply,
.joe_comment__edit {
	font-size: 13px;
}

.joe_comment__reply > a,
.joe_comment__edit > a {
	color: #9ca3af;
	text-decoration: none;
	transition: color 0.2s;
}

.joe_comment__reply > a:hover,
.joe_comment__edit > a:hover {
	color: var(--theme, #fb6c28);
}

/* 编辑器 / 表单 */
.joe_comment__respond {
	margin-top: 20px;
}

.joe_comment__title {
	margin: 0 0 12px;
	font-size: 15px;
	font-weight: 500;
}

.joe_comment__respond-form {
	padding: 16px;
	background: var(--background, #fff);
	border-radius: 8px;
	box-shadow: var(--box-shadow, 0 0 4px rgba(0, 0, 0, 0.06));
}

.joe_comment__respond-form p {
	margin: 0 0 10px;
}

.joe_comment__respond-form .comment-form-comment {
	margin-bottom: 10px;
}

.joe_comment__respond-form textarea {
	display: block;
	width: 100%;
	min-height: 96px;
	padding: 12px;
	font-size: 14px;
	line-height: 1.8;
	color: inherit;
	background: var(--background, #fff);
	border: 1px solid rgba(0, 0, 0, 0.1);
	border-radius: 8px;
	resize: vertical;
	outline: none;
	transition: border-color 0.2s, box-shadow 0.2s;
}

.joe_comment__respond-form textarea:focus {
	border-color: var(--theme, #fb6c28);
	box-shadow: 0 0 0 2px rgba(251, 108, 40, 0.15);
}

.joe_comment__respond-form label {
	display: none;
}

/* 昵称 / 邮箱 / 网址 三列 */
.joe_comment__respond-form .comment-form-author,
.joe_comment__respond-form .comment-form-email,
.joe_comment__respond-form .comment-form-url {
	display: inline-block;
	width: calc(33.333% - 14px);
	margin-right: 12px;
	vertical-align: top;
	box-sizing: border-box;
}

.joe_comment__respond-form .comment-form-url {
	margin-right: 0;
}

.joe_comment__respond-form input[type="text"],
.joe_comment__respond-form input[type="email"],
.joe_comment__respond-form input[type="url"] {
	width: 100%;
	height: 40px;
	padding: 0 12px;
	font-size: 14px;
	color: inherit;
	background: var(--background, #fff);
	border: 1px solid rgba(0, 0, 0, 0.1);
	border-radius: 6px;
	outline: none;
	transition: border-color 0.2s, box-shadow 0.2s;
}

.joe_comment__respond-form input[type="text"]:focus,
.joe_comment__respond-form input[type="email"]:focus,
.joe_comment__respond-form input[type="url"]:focus {
	border-color: var(--theme, #fb6c28);
	box-shadow: 0 0 0 2px rgba(251, 108, 40, 0.15);
}

.joe_comment__respond-form .comment-form-cookies-consent {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 13px;
	color: #9ca3af;
}

.joe_comment__respond-form .comment-form-cookies-consent label {
	display: inline;
}

.joe_comment__respond-form .form-submit {
	display: flex;
	justify-content: flex-end;
	margin: 4px 0 0;
}

.joe_comment__respond-submit {
	height: 44px;
	padding: 0 22px;
	font-size: 14px;
	color: #fff;
	background: var(--theme, #fb6c28);
	border: 1px solid var(--theme, #fb6c28);
	border-radius: 8px;
	cursor: pointer;
	transition: opacity 0.2s;
}

.joe_comment__respond-submit:hover {
	opacity: 0.85;
}

#cancel-comment-reply-link {
	margin-left: 10px;
	font-size: 13px;
	color: #ef4444;
	text-decoration: none;
}

/* 评论分页 */
.joe_comment__list + .page-numbers,
.comment-navigation .nav-links {
	display: flex;
	justify-content: center;
	gap: 6px;
	margin: 12px 0;
}

html[data-mode="dark"] .joe_comment__item-body,
html[data-mode="dark"] .joe_comment__respond-form {
	background: #232529;
	box-shadow: none;
}

html[data-mode="dark"] .joe_comment__respond-form textarea,
html[data-mode="dark"] .joe_comment__respond-form input[type="text"],
html[data-mode="dark"] .joe_comment__respond-form input[type="email"],
html[data-mode="dark"] .joe_comment__respond-form input[type="url"] {
	background: #191b1f;
	border-color: #2b2d31;
	color: #ddd;
}

html[data-mode="dark"] .joe_comment__list .children {
	border-left-color: rgba(255, 255, 255, 0.08);
}

@media screen and (max-width: 768px) {
	.lqq-search {
		padding: 1.5em 10px;
	}

	.joe_comment__list .children {
		margin-left: 16px;
	}

	.joe_comment__item-body {
		padding: 12px;
	}

	.joe_comment__respond-form .comment-form-author,
	.joe_comment__respond-form .comment-form-email,
	.joe_comment__respond-form .comment-form-url {
		display: block;
		width: 100%;
		margin-right: 0;
	}

	.joe_comment__avatar img {
		width: 34px;
		height: 34px;
	}
}
