/* ==========================================================================
   Noosium 댓글 영역 스타일
   single.html → noosium/comments 패턴 전용. 충돌 최소화를 위해 style.css와
   분리해 별도 파일로 유지하며, functions.php에서 is_singular일 때만 로드한다.
   디자인 토큰(색상/반경/그림자)은 style.css :root 및 theme.json 프리셋을 재사용.
   ========================================================================== */

.noosium-comments {
	margin-top: 26px;
	margin-bottom: 22px;
	padding-top: 20px;
	border-top: 1px solid var(--wp--preset--color--border);
	scroll-margin-top: 88px;
}

/* ---- 제목 ---------------------------------------------------------------- */
.noosium-comments .wp-block-comments-title {
	margin: 0 0 12px;
	font-weight: 800;
	font-size: 1.08rem;
	letter-spacing: -0.01em;
	color: var(--wp--preset--color--contrast);
}

/* ---- 댓글 카드 목록 ------------------------------------------------------ */
.noosium-comments .wp-block-comment-template {
	margin: 0;
	padding: 0;
	list-style: none;
}

/* 대댓글(중첩) 목록 — 원댓글 아래에 └ 흐름으로 이어지는 한 단계 안쪽 행 */
.noosium-comments .wp-block-comment-template ol {
	margin: 4px 0 8px;
	padding: 0 0 0 clamp(26px, 5vw, 38px);
	list-style: none;
}

.noosium-comments .wp-block-comment-template ol > li {
	position: relative;
}

.noosium-comments .wp-block-comment-template ol > li::before {
	position: absolute;
	top: 18px;
	left: -20px;
	width: 12px;
	height: 10px;
	content: "";
	border-bottom: 2px solid #bbb5e6;
	border-left: 2px solid #bbb5e6;
	border-bottom-left-radius: 3px;
}

.noosium-comments .wp-block-comment-template ol .noosium-comment {
	margin-bottom: 0 !important;
	padding: 11px 12px;
	border-color: #e4e2f2;
	border-radius: 8px;
	background: #f8f8fc;
}

.noosium-comments .wp-block-comment-template ol .noosium-comment:hover {
	border-color: #d7d3ec;
}

.noosium-comments .wp-block-comment-template ol .wp-block-avatar img {
	width: 28px;
	height: 28px;
}

.noosium-comment {
	margin-top: 0 !important;
	margin-bottom: 8px !important;
	padding: 13px 14px;
	background: var(--wp--preset--color--base);
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 10px;
	box-shadow: none;
}

.noosium-comments .wp-block-comment-template {
	margin-top: 0;
}

.noosium-comment:hover {
	border-color: #d9dce4;
}

/* 아바타 + 본문 가로 배치 */
.noosium-comment__row {
	display: flex;
	flex-wrap: nowrap;
	gap: 10px !important;
	align-items: flex-start !important;
}

.noosium-comment .wp-block-avatar img {
	width: 32px;
	height: 32px;
	border-radius: var(--noosium-radius-pill);
	border: 1px solid var(--wp--preset--color--border);
}

.noosium-comment__body {
	min-width: 0;
	flex: 1 1 auto;
	gap: 0.18rem !important;
}

/* 이름 + 날짜 헤더 줄 */
.noosium-comment__head {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem !important;
	align-items: baseline !important;
}

.noosium-comment .wp-block-comment-author-name,
.noosium-comment .wp-block-comment-author-name a {
	font-weight: 700;
	font-size: 0.86rem;
	color: var(--wp--preset--color--contrast);
	text-decoration: none;
}

.noosium-comment .wp-block-comment-date,
.noosium-comment .wp-block-comment-date a {
	font-size: 0.72rem;
	color: var(--wp--preset--color--muted);
	text-decoration: none;
}

.noosium-comment .wp-block-comment-content {
	margin: 0.08rem 0 0;
	font-size: 0.86rem;
	line-height: 1.55;
	color: var(--wp--preset--color--contrast);
	word-break: break-word;
}

.noosium-comment .wp-block-comment-content p {
	margin: 0 0 0.5rem;
}

.noosium-comment .wp-block-comment-content p:last-child {
	margin-bottom: 0;
}

/* 답글/편집 링크 — 작은 텍스트 링크 */
.noosium-comment__actions {
	display: flex;
	flex-wrap: nowrap;
	align-items: center;
	gap: 0.65rem !important;
	margin-top: 0.08rem;
}

.noosium-comment__actions a {
	font-size: 0.74rem;
	font-weight: 600;
	color: var(--wp--preset--color--highlight);
	text-decoration: none;
}

.noosium-comment__actions a:hover {
	color: var(--wp--preset--color--highlight-hover);
	text-decoration: underline;
}

.noosium-comment-edit-button {
	appearance: none;
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	color: var(--wp--preset--color--highlight);
	font: inherit;
	font-size: 0.74rem;
	font-weight: 600;
	line-height: inherit;
	cursor: pointer;
}

.noosium-comment-edit-button:hover {
	color: var(--wp--preset--color--highlight-hover);
	text-decoration: underline;
}

.noosium-comment-delete-form {
	display: inline-flex;
	margin: 0;
}

.noosium-comment-delete-form button {
	appearance: none;
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	color: #b45353;
	font: inherit;
	font-size: 0.74rem;
	font-weight: 600;
	line-height: inherit;
	cursor: pointer;
}

.noosium-comment-delete-form button:hover {
	color: #8f3030;
	text-decoration: underline;
}

/* ---- 페이지네이션 -------------------------------------------------------- */
.noosium-comments .wp-block-comments-pagination {
	margin: 12px 0;
	font-size: 0.8rem;
}

.noosium-comments .wp-block-comments-pagination a {
	color: var(--wp--preset--color--highlight);
	text-decoration: none;
}

.noosium-comments .wp-block-comments-pagination a:hover {
	text-decoration: underline;
}

/* ==========================================================================
   비로그인 사용자용 로그인 CTA
   ========================================================================== */
.noosium-comment-login {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin: 14px 0 0;
	padding: 14px 16px;
	text-align: left;
	background: var(--wp--preset--color--highlight-soft);
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 10px;
}

.noosium-comment-login__text {
	margin: 0;
	font-size: 0.86rem;
	color: var(--wp--preset--color--contrast);
}

.noosium-comment-login__btn {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.58rem 1.05rem;
	font-size: 0.84rem;
	font-weight: 700;
	color: #ffffff;
	text-decoration: none;
	background: var(--wp--preset--color--highlight);
	border-radius: var(--noosium-radius-pill);
	box-shadow: var(--noosium-shadow-glow);
	transition: background-color 0.15s ease, transform 0.15s ease;
}

.noosium-comment-login__btn:hover {
	background: var(--wp--preset--color--highlight-hover);
	transform: translateY(-1px);
	color: #ffffff;
	text-decoration: none;
}

.noosium-comment-login__btn svg {
	width: 18px;
	height: 18px;
}

/* ==========================================================================
   로그인 사용자용 댓글 작성 폼
   ========================================================================== */
.noosium-comments .wp-block-post-comments-form {
	margin: 14px 0 0;
	padding: 16px;
	background: var(--wp--preset--color--base);
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 10px;
	box-shadow: none;
}

/* 블록 래퍼 안쪽의 #respond는 카드 중첩을 피하려고 투명 컨테이너로 둔다.
   (post-comments-form 블록이 없는 예외 경로에서만 자체 카드 역할) */
.noosium-comments .comment-respond {
	margin: 0;
}

/* 답글은 게시물 댓글 폼과 분리된 독립 인라인 컴포넌트다. 선택한 댓글의
   카드 바로 아래에 삽입하므로 기존 댓글 폼은 항상 하단에 그대로 남는다. */
.noosium-inline-reply-item {
	margin: 0;
	padding: 0;
	list-style: none;
}

.noosium-inline-reply-form {
	position: relative;
	margin: 6px 0 8px;
	padding: 12px;
	border: 1px solid #dcd8f2;
	border-radius: 8px;
	background: #faf9ff;
}

.noosium-inline-reply-item > .noosium-inline-reply-form::before {
	position: absolute;
	top: 17px;
	left: -20px;
	width: 12px;
	height: 10px;
	content: "";
	border-bottom: 2px solid var(--wp--preset--color--highlight);
	border-left: 2px solid var(--wp--preset--color--highlight);
	border-bottom-left-radius: 3px;
}

.noosium-inline-reply-form__title {
	margin: 0 0 8px;
	color: var(--wp--preset--color--contrast);
	font-size: 0.88rem;
	font-weight: 800;
}

.noosium-inline-reply-form textarea {
	min-height: 68px;
	background: var(--wp--preset--color--base);
}

.noosium-inline-reply-form__footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-top: 8px;
}

.noosium-inline-reply-form__identity {
	color: var(--wp--preset--color--muted);
	font-size: 0.76rem;
}

.noosium-inline-reply-form__controls {
	display: inline-flex;
	align-items: center;
	gap: 7px;
}

.noosium-inline-reply-form__controls button {
	appearance: none;
	padding: 0.48rem 0.85rem;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: var(--noosium-radius-pill);
	background: var(--wp--preset--color--base);
	color: var(--wp--preset--color--muted);
	font: inherit;
	font-size: 0.76rem;
	font-weight: 700;
	cursor: pointer;
}

.noosium-inline-reply-form__controls button[type="submit"] {
	border-color: var(--wp--preset--color--highlight);
	background: var(--wp--preset--color--highlight);
	color: #fff;
}

.noosium-inline-reply-form__status {
	margin: 7px 0 0;
	color: #b45353;
	font-size: 0.74rem;
}

.noosium-comment-edit-form {
	margin: 6px 0 2px;
	padding: 10px;
	border: 1px solid #dcd8f2;
	border-radius: 8px;
	background: #faf9ff;
}

.noosium-comment-edit-form textarea {
	min-height: 74px;
	background: var(--wp--preset--color--base);
}

.noosium-comment-edit-form__actions {
	display: flex;
	justify-content: flex-end;
	gap: 7px;
	margin-top: 8px;
}

.noosium-comment-edit-form__actions button {
	appearance: none;
	padding: 0.48rem 0.85rem;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: var(--noosium-radius-pill);
	background: var(--wp--preset--color--base);
	color: var(--wp--preset--color--muted);
	font: inherit;
	font-size: 0.76rem;
	font-weight: 700;
	cursor: pointer;
}

.noosium-comment-edit-form__actions button[type="submit"] {
	border-color: var(--wp--preset--color--highlight);
	background: var(--wp--preset--color--highlight);
	color: #fff;
}

.noosium-comment-edit-form__status {
	margin: 7px 0 0;
	color: #b45353;
	font-size: 0.74rem;
}

.noosium-comments > .comment-respond {
	margin-top: 14px;
	padding: 16px;
	background: var(--wp--preset--color--base);
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 10px;
	box-shadow: none;
}

.noosium-comments .comment-reply-title {
	margin-top: 0;
	margin-bottom: 10px;
	font-weight: 800;
	font-size: 0.98rem;
	color: var(--wp--preset--color--contrast);
}

.noosium-comments .logged-in-as {
	margin-bottom: 10px;
	font-size: 0.78rem;
	color: var(--wp--preset--color--muted);
}

.noosium-comments .noosium-comment-account {
	display: block;
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
}

.noosium-comment-account__identity {
	min-width: 0;
	color: var(--wp--preset--color--muted);
}

.noosium-comment-account__identity strong {
	color: var(--wp--preset--color--contrast);
}

.noosium-comments .logged-in-as a {
	color: var(--wp--preset--color--highlight);
	text-decoration: none;
}

.noosium-comments .comment-form-comment label {
	display: block;
	margin-bottom: 0.3rem;
	font-size: 0.78rem;
	font-weight: 600;
	color: var(--wp--preset--color--contrast);
}

.noosium-comments #commentform {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	gap: 8px 12px;
}

.noosium-comments #commentform .comment-form-comment {
	grid-row: 1;
	grid-column: 1 / -1;
	margin: 0;
}

.noosium-comments #commentform .noosium-comment-account {
	align-self: center;
	grid-row: 2;
	grid-column: 1;
}

.noosium-comments #commentform .form-submit {
	align-self: center;
	grid-row: 2;
	grid-column: 2;
	margin: 0;
}

.noosium-comments textarea,
.noosium-comments input[type="text"],
.noosium-comments input[type="email"],
.noosium-comments input[type="url"] {
	width: 100%;
	padding: 0.66rem 0.78rem;
	font: inherit;
	font-size: 0.86rem;
	color: var(--wp--preset--color--contrast);
	background: var(--wp--preset--color--page-bg);
	border: 1px solid var(--wp--preset--color--border);
	border-radius: var(--noosium-radius-sm);
	box-sizing: border-box;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.noosium-comments textarea:focus,
.noosium-comments input[type="text"]:focus,
.noosium-comments input[type="email"]:focus,
.noosium-comments input[type="url"]:focus {
	outline: none;
	border-color: var(--wp--preset--color--highlight);
	box-shadow: 0 0 0 3px rgba(103, 87, 232, 0.15);
	background: var(--wp--preset--color--base);
}

.noosium-comments textarea {
	min-height: 78px;
	resize: vertical;
}

.noosium-comments .form-submit {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 8px;
	margin-top: 10px;
	margin-bottom: 0;
}

#cancel-comment-reply-link,
.noosium-comments #cancel-comment-reply-link {
	display: none !important;
}

.noosium-comments .form-submit .submit,
.noosium-comments .wp-block-post-comments-form .wp-element-button {
	padding: 0.58rem 1.2rem;
	font-size: 0.84rem;
	font-weight: 700;
	color: #ffffff;
	background: var(--wp--preset--color--highlight);
	border: none;
	border-radius: var(--noosium-radius-pill);
	cursor: pointer;
	box-shadow: var(--noosium-shadow-glow);
	transition: background-color 0.15s ease, transform 0.15s ease;
}

.noosium-comments .form-submit .submit:hover,
.noosium-comments .wp-block-post-comments-form .wp-element-button:hover {
	background: var(--wp--preset--color--highlight-hover);
	transform: translateY(-1px);
}

/* ---- 반응형 -------------------------------------------------------------- */
@media (max-width: 600px) {
	.noosium-comment {
		padding: 12px;
	}

	.noosium-comments .wp-block-comment-template ol {
		padding-left: 26px;
	}

	.noosium-comment-login {
		align-items: stretch;
		flex-direction: column;
	}

	.noosium-comment-login__btn {
		justify-content: center;
	}

	.noosium-comments .comment-respond,
	.noosium-comments .wp-block-post-comments-form,
	.noosium-comment-login {
		padding: 13px;
	}

	.noosium-comments li.depth-1 > .noosium-inline-reply-form {
		margin-left: 26px;
		padding: 10px;
	}

	.noosium-inline-reply-form__footer {
		align-items: flex-start;
	}

	.noosium-comments textarea,
	.noosium-comments input[type="text"],
	.noosium-comments input[type="email"],
	.noosium-comments input[type="url"] {
		font-size: 16px;
	}
}
