/* YAN Comments — self-contained, theme agnostic.
   Colours are derived from the theme's own text colour, so the section
   follows the site's light/dark state instead of the operating system's. */

.yanc {
	--yanc-accent: #0b6bcb;
	--yanc-muted: rgba(128, 128, 128, 0.95);
	--yanc-line: rgba(128, 128, 128, 0.30);
	--yanc-card: rgba(128, 128, 128, 0.10);
	--yanc-strong: rgba(128, 128, 128, 0.18);
	--yanc-radius: 10px;

	max-width: 780px;
	margin: 48px auto;
	color: inherit;
	font-size: 15px;
	line-height: 1.6;
	-webkit-text-size-adjust: 100%;
}

@supports (color: color-mix(in srgb, currentColor 50%, transparent)) {
	.yanc {
		--yanc-muted: color-mix(in srgb, currentColor 62%, transparent);
		--yanc-line: color-mix(in srgb, currentColor 18%, transparent);
		--yanc-card: color-mix(in srgb, currentColor 6%, transparent);
		--yanc-strong: color-mix(in srgb, currentColor 14%, transparent);
	}
}

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

.yanc button { font: inherit; cursor: pointer; }

.yanc [hidden] { display: none !important; }

.yanc .screen-reader-text {
	position: absolute !important;
	width: 1px; height: 1px;
	padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0 0 0 0);
	white-space: nowrap; border: 0;
}

/* ---------- header ---------- */

.yanc-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	flex-wrap: wrap;
	padding-bottom: 14px;
	border-bottom: 2px solid var(--yanc-line);
	margin-bottom: 22px;
}

.yanc-title {
	margin: 0;
	font-size: 20px;
	font-weight: 700;
	letter-spacing: -0.01em;
	color: inherit;
	display: flex;
	align-items: center;
	gap: 10px;
}

.yanc-count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 26px;
	height: 22px;
	padding: 0 8px;
	border-radius: 11px;
	background: var(--yanc-accent);
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	line-height: 1;
}

.yanc-sort { display: flex; gap: 2px; background: var(--yanc-card); border-radius: 999px; padding: 3px; }

.yanc-sort-btn {
	border: 0;
	background: transparent;
	color: var(--yanc-muted);
	padding: 6px 14px;
	border-radius: 999px;
	font-size: 13px;
	font-weight: 600;
	transition: background .15s, color .15s;
}

.yanc-sort-btn:hover { color: inherit; }

.yanc-sort-btn.is-active {
	background: var(--yanc-strong);
	color: inherit;
}

/* ---------- form ---------- */

.yanc-form {
	background: transparent;
	border: 1px solid var(--yanc-line);
	border-radius: var(--yanc-radius);
	padding: 16px;
	margin-bottom: 28px;
	scroll-margin-top: 90px;
}

.yanc-replying {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	font-size: 13px;
	color: var(--yanc-muted);
	background: var(--yanc-card);
	border-radius: 8px;
	padding: 7px 12px;
	margin-bottom: 12px;
}

.yanc-replying strong { color: inherit; }

.yanc-cancel {
	border: 0;
	background: none;
	color: var(--yanc-accent);
	font-size: 13px;
	font-weight: 600;
	padding: 0;
}

.yanc-field { position: relative; }

.yanc-form textarea {
	width: 100%;
	min-height: 92px;
	resize: vertical;
	padding: 12px 14px;
	border: 1px solid var(--yanc-line);
	border-radius: 8px;
	background: var(--yanc-card);
	color: inherit;
	font: inherit;
	line-height: 1.55;
}

.yanc-form textarea::placeholder,
.yanc-form input::placeholder { color: var(--yanc-muted); opacity: 1; }

.yanc-form textarea:focus,
.yanc-form input[type="text"]:focus,
.yanc-form input[type="email"]:focus {
	outline: none;
	border-color: var(--yanc-accent);
	box-shadow: 0 0 0 3px rgba(11, 107, 203, .18);
}

.yanc-counter {
	position: absolute;
	right: 10px;
	bottom: 8px;
	font-size: 11px;
	color: var(--yanc-muted);
	opacity: 0;
	transition: opacity .15s;
	pointer-events: none;
}

.yanc-form.is-typing .yanc-counter { opacity: .85; }
.yanc-counter.is-near { color: #d97706; }

.yanc-form-bottom {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 14px;
	flex-wrap: wrap;
	margin-top: 12px;
}

.yanc-identity { flex: 1 1 300px; min-width: 0; }

.yanc-inputs { display: flex; gap: 8px; flex-wrap: wrap; }

.yanc-inputs input {
	flex: 1 1 150px;
	min-width: 0;
	padding: 9px 12px;
	border: 1px solid var(--yanc-line);
	border-radius: 8px;
	background: var(--yanc-card);
	color: inherit;
	font: inherit;
	font-size: 14px;
}

.yanc-signed { margin: 0 0 8px; font-size: 13px; color: var(--yanc-muted); }

.yanc-anon {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin-top: 10px;
	font-size: 13px;
	color: var(--yanc-muted);
	cursor: pointer;
	user-select: none;
}

.yanc-anon input { accent-color: var(--yanc-accent); width: 15px; height: 15px; margin: 0; }
.yanc-anon:hover { color: inherit; }

.yanc-anon-note { margin: 6px 0 0; font-size: 12px; color: var(--yanc-accent); }

.yanc-form.is-anon .yanc-inputs input { opacity: .5; }

.yanc-submit {
	border: 0;
	background: var(--yanc-accent);
	color: #fff;
	font-weight: 600;
	font-size: 14px;
	padding: 11px 22px;
	border-radius: 8px;
	transition: filter .15s, opacity .15s;
	white-space: nowrap;
}

.yanc-submit:hover { filter: brightness(1.08); }
.yanc-submit[disabled] { opacity: .55; cursor: default; }

.yanc-status {
	margin: 12px 0 0;
	padding: 9px 12px;
	border-radius: 8px;
	font-size: 13px;
	background: var(--yanc-card);
	color: inherit;
}

.yanc-status.is-error {
	background: rgba(220, 38, 38, .12);
	color: #e5484d;
}

.yanc-hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px; height: 1px;
	overflow: hidden;
}

/* ---------- list ---------- */

.yanc-list { display: flex; flex-direction: column; gap: 22px; }

.yanc-list.is-loading { opacity: .45; transition: opacity .15s; }

.yanc-empty,
.yanc-closed {
	margin: 8px 0;
	padding: 26px;
	text-align: center;
	color: var(--yanc-muted);
	background: var(--yanc-card);
	border-radius: var(--yanc-radius);
	font-size: 14px;
}

.yanc-closed { margin: 0 0 24px; padding: 14px; }

.yanc-item { display: flex; gap: 12px; scroll-margin-top: 90px; }

.yanc-item.is-new { animation: yanc-pop .45s ease; }

@keyframes yanc-pop {
	from { opacity: 0; transform: translateY(6px); }
	to { opacity: 1; transform: none; }
}

.yanc-avatar {
	flex: 0 0 auto;
	width: 38px;
	height: 38px;
	border-radius: 50%;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 15px;
	font-weight: 700;
	color: #fff;
	background: hsl(var(--yanc-hue, 210) 55% 45%);
	user-select: none;
}

.yanc-avatar.is-anon { background: var(--yanc-strong); color: var(--yanc-muted); }
.yanc-avatar svg { width: 22px; height: 22px; fill: currentColor; }

.yanc-body { flex: 1 1 auto; min-width: 0; }

.yanc-meta {
	display: flex;
	align-items: center;
	gap: 7px;
	flex-wrap: wrap;
	font-size: 13px;
	color: var(--yanc-muted);
	margin-bottom: 3px;
}

.yanc-author { font-weight: 700; color: inherit; font-size: 14px; }
.yanc-dot { opacity: .6; }
.yanc-time { white-space: nowrap; }

.yanc-tag {
	display: inline-block;
	padding: 1px 7px;
	border-radius: 999px;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: .01em;
	line-height: 1.6;
}

.yanc-tag-anon { background: var(--yanc-card); color: var(--yanc-muted); border: 1px solid var(--yanc-line); }
.yanc-tag-author { background: var(--yanc-accent); color: #fff; }
.yanc-tag-pending { background: rgba(217, 119, 6, .18); color: #d97706; }

.yanc-text { word-wrap: break-word; overflow-wrap: anywhere; }
.yanc-text p { margin: 0 0 8px; font-size: inherit; line-height: inherit; }
.yanc-text p:last-child { margin-bottom: 0; }
.yanc-text a { color: var(--yanc-accent); }

.yanc-actions { display: flex; align-items: center; gap: 4px; margin-top: 6px; }

.yanc-like,
.yanc-reply {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	border: 0;
	background: none;
	color: var(--yanc-muted);
	font-size: 13px;
	font-weight: 600;
	padding: 5px 9px;
	border-radius: 7px;
	transition: background .15s, color .15s;
}

.yanc-like:hover,
.yanc-reply:hover { background: var(--yanc-card); color: inherit; }

.yanc-ico { width: 16px; height: 16px; fill: currentColor; }
.yanc-like-count:empty { display: none; }

.yanc-like.is-liked { color: var(--yanc-accent); }
.yanc-like.is-busy { opacity: .5; pointer-events: none; }

.yanc-children { margin-top: 18px; display: flex; flex-direction: column; gap: 18px; }

.yanc-children .yanc-item {
	padding-left: 14px;
	border-left: 2px solid var(--yanc-line);
}

.yanc-children .yanc-avatar { width: 30px; height: 30px; font-size: 13px; }
.yanc-children .yanc-avatar svg { width: 18px; height: 18px; }

/* ---------- load more ---------- */

.yanc-more-wrap { margin-top: 26px; text-align: center; }

.yanc-more {
	border: 1px solid var(--yanc-line);
	background: var(--yanc-card);
	color: inherit;
	font-size: 14px;
	font-weight: 600;
	padding: 10px 24px;
	border-radius: 999px;
	transition: border-color .15s, color .15s;
}

.yanc-more:hover { border-color: var(--yanc-accent); color: var(--yanc-accent); }
.yanc-more[disabled] { opacity: .5; cursor: default; }

/* ---------- small screens ---------- */

@media (max-width: 600px) {
	.yanc { margin: 32px auto; }
	.yanc-head { gap: 10px; }
	.yanc-title { font-size: 18px; }
	.yanc-form { padding: 13px; }
	.yanc-submit { width: 100%; }
	.yanc-form-bottom { align-items: stretch; }
	.yanc-inputs { flex-direction: column; }
	.yanc-inputs input { flex: 1 1 auto; width: 100%; }
	.yanc-children .yanc-item { padding-left: 10px; }
	.yanc-avatar { width: 32px; height: 32px; font-size: 14px; }
	.yanc-list { gap: 20px; }
}

@media (max-width: 480px) {
	.yanc-head { flex-direction: column; align-items: stretch; }
	.yanc-sort { justify-content: space-between; }
	.yanc-sort-btn { flex: 1 1 0; padding: 6px 8px; }
}
