/*
 * Comments look: the parent's .hmf-comments markup in the crypto language of the course pages
 * (FAQ cards, gold bar heading, pill buttons). Overrides parent classes only; loads wherever the
 * parent prints comments (pages and directory records). Roles use --hmf-* so dark mode follows.
 */

/* Section: readable column, centered like the FAQ block. */
.hmf-comments {
	--hc-cm-width: 57.5rem;
	inline-size: 100%;
	max-inline-size: calc(var(--hc-cm-width) + 2rem);
	margin-inline: auto;
	margin-block: 56px;
	padding: 0 16px;
	border: 0;
}

/* Title: section-heading look, gold bar above. */
.hmf-comments__header {
	margin-block-end: 28px;
	text-align: center;
}

.hmf-comments__title {
	font-size: 30px;
	font-weight: 900;
	line-height: 1.65;
	color: var(--hmf-text);
	text-wrap: balance;
}

.hmf-comments__title::before {
	content: "";
	display: block;
	inline-size: 44px;
	block-size: 5px;
	margin: 0 auto 16px;
	border-radius: 8px;
	background: var(--hc-gold);
}

/* Thread */
.hmf-comment-list {
	gap: 16px;
}

.hmf-comment-list .children {
	gap: 12px;
	margin-block-start: 12px;
	padding-inline-start: 14px;
	border-inline-start: 3px solid var(--hc-gold);
	border-radius: 2px;
}

/* Card */
.hmf-comment__body {
	gap: 12px;
	padding: 18px 18px 14px;
	border: 1px solid var(--hmf-border);
	border-radius: 20px;
	background: var(--hmf-surface);
	box-shadow: 0 12px 24px -22px rgb(15 16 29 / 0.5);
}

.hmf-comment-list .children .hmf-comment__body {
	background: var(--hmf-canvas);
	box-shadow: none;
}

.hmf-comment__body:target,
.hmf-comment:target > .hmf-comment__body {
	border-color: var(--hc-gold);
	outline: 3px solid var(--hc-blue);
	outline-offset: 2px;
}

.hmf-comment--pending > .hmf-comment__body {
	border-inline-start-width: 4px;
	border-inline-start-color: var(--hc-blue);
}

/* Author row: gold initial avatar, name, date. */
.hmf-comment__header {
	gap: 12px;
}

.hc-avatar {
	display: flex;
	flex: none;
	align-items: center;
	justify-content: center;
	inline-size: 48px;
	block-size: 48px;
	border-radius: 50%;
	background: var(--hc-gold-gradient);
	color: var(--hc-ink);
	font-size: 20px;
	font-weight: 900;
	line-height: 1;
}

.hmf-comment__author {
	font-size: 16px;
	font-weight: 800;
	line-height: 1.7;
}

.hmf-comment__permalink {
	font-size: 13px;
	line-height: 1.7;
	color: var(--hmf-muted);
}

.hmf-comment__content {
	color: var(--hmf-text);
	font-size: 16px;
	line-height: 2;
}

/* Reply: outlined pill, gold on hover. */
.hmf-comment__reply a,
.hmf-comment__edit a {
	min-block-size: 40px;
	padding-inline: 18px;
	border: 1px solid var(--hmf-border);
	border-radius: 99px;
	font-size: 14px;
	font-weight: 800;
}

.hmf-comment__reply a:hover,
.hmf-comment__edit a:hover {
	border-color: var(--hc-gold);
	background: var(--hc-gold-soft);
	color: var(--hc-ink);
}

.hmf-comment__reply a:focus-visible,
.hmf-comment__edit a:focus-visible {
	outline: 3px solid var(--hc-blue);
	outline-offset: 2px;
}

/* Form: a card of its own. */
.comment-respond {
	margin-block-start: 32px;
	padding: 22px 18px;
	border: 1px solid var(--hmf-border);
	border-radius: 20px;
	background: var(--hmf-surface);
	box-shadow: 0 24px 50px -36px rgb(15 16 29 / 0.45);
}

.hmf-comment-form__title {
	margin-block-end: 18px;
	font-size: 22px;
	font-weight: 900;
	line-height: 1.7;
}

.hmf-comment-form__cancel a {
	color: var(--hc-blue-deep);
}

.hmf-comment-form {
	gap: 16px;
}

.hmf-comment-form .hmf-field {
	margin: 0;
}

.hmf-comment-form label {
	font-size: 15px;
	font-weight: 800;
}

.hmf-comment-form .hmf-input {
	border-radius: 14px;
}

.hmf-comment-form .hmf-input:focus-visible {
	outline: 3px solid var(--hc-blue);
	outline-offset: 2px;
}

.hmf-comment-form .hmf-field__help {
	font-size: 13px;
	line-height: 1.8;
}

.hmf-form-submit {
	margin: 0;
}

.hmf-form-submit .hmf-button {
	inline-size: 100%;
	min-block-size: 52px;
	border-radius: 99px;
	font-size: 16px;
	font-weight: 800;
}

@media (width >= 48rem) {

	.hmf-comments {
		margin-block: 72px;
		padding: 0 24px;
	}

	.hmf-comments__title {
		font-size: 38px;
	}

	.hmf-comment-list .children {
		padding-inline-start: 24px;
	}

	.hmf-comment__body {
		padding: 22px 24px 18px;
	}

	.comment-respond {
		padding: 32px;
	}

	/* Comment text spans the card; name, email and website share a row. */
	.hmf-comment-form {
		display: grid;
		grid-template-columns: repeat(3, minmax(0, 1fr));
		align-items: start;
		column-gap: 16px;
	}

	.hmf-comment-form > * {
		grid-column: 1 / -1;
	}

	.hmf-comment-form > .hmf-field:has(#author, #email, #url) {
		grid-column: auto;
	}

	.hmf-form-submit .hmf-button {
		inline-size: auto;
		min-inline-size: 220px;
	}
}

/* Directory records: a row of comment cards, the form in a dialog. */
.hmf-comments--compact {
	max-inline-size: none;
	padding: 0;
	margin-block: 40px;
}

.hmf-comments--compact .hmf-comments__header {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	text-align: start;
}

.hmf-comments--compact .hmf-comments__title {
	font-size: 26px;
}

.hmf-comments--compact .hmf-comments__title::before {
	margin-inline: 0;
	margin-block-end: 12px;
}

.hmf-comments__write {
	min-block-size: 48px;
	border-radius: 99px;
	font-weight: 800;
}

.hmf-comments__viewport {
	margin-inline: -16px;
	padding: 4px 16px 20px;
	overflow-x: auto;
	overscroll-behavior-x: contain;
	scroll-snap-type: x mandatory;
	scroll-padding-inline: 16px;
	scrollbar-width: none;
}

.hmf-comments__viewport::-webkit-scrollbar {
	display: none;
}

.hmf-comments__viewport:focus-visible {
	outline: 3px solid var(--hc-blue);
	outline-offset: -3px;
	border-radius: 20px;
}

.hmf-comment-list--row {
	flex-direction: row;
	align-items: stretch;
	gap: 16px;
}

.hmf-comment-list--row > .hmf-comment {
	flex: 0 0 calc(100% - 40px);
	scroll-snap-align: start;
}

.hmf-comment-list--row .hmf-comment__body {
	block-size: 100%;
	background: var(--hmf-surface);
	box-shadow: 0 12px 24px -22px rgb(15 16 29 / 0.5);
}

.hmf-comments__dots {
	display: flex;
	justify-content: center;
	gap: 0;
}

.hmf-comments__dot {
	inline-size: 24px;
	block-size: 24px;
	padding: 0;
	border: 0;
	background: none;
	cursor: pointer;
}

.hmf-comments__dot::before {
	content: "";
	display: block;
	inline-size: 10px;
	block-size: 10px;
	margin: auto;
	border-radius: 99px;
	background: var(--hc-line-2);
	transition: inline-size 0.2s, background-color 0.2s;
}

.hmf-comments__dot[aria-current]::before {
	inline-size: 26px;
	background: var(--hc-ink);
}

.hmf-comments__dot:focus-visible {
	outline: 3px solid var(--hc-blue);
	border-radius: 99px;
}

/* The form lives in the dialog: no card of its own. */
.hmf-comment-dialog {
	inline-size: min(40rem, calc(100% - 24px));
	border-radius: 20px;
}

.hmf-comment-dialog .hmf-dialog__title {
	font-size: 22px;
	font-weight: 900;
}

.hmf-comment-dialog .comment-respond {
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	box-shadow: none;
}

@media (width >= 48rem) {

	.hmf-comments--compact .hmf-comments__title {
		font-size: 30px;
	}

	.hmf-comments--compact {
		padding: 0;
	}

	.hmf-comment-list--row > .hmf-comment {
		flex-basis: calc((100% - 16px) / 2);
	}
}

@media (width >= 64rem) {

	.hmf-comment-list--row > .hmf-comment {
		flex-basis: calc((100% - 32px) / 3);
	}
}

@media (prefers-reduced-motion: reduce) {

	.hmf-comments__dot::before {
		transition: none;
	}
}
