/**
 * Comment reply notification opt-in.
 *
 * Scoped defaults remain easy for themes to override.
 */

.mtt-crn-comment-opt-in {
	display: grid;
	gap: 0.25rem;
	margin-block: 1em;
}

.mtt-crn-comment-opt-in__label {
	display: grid;
	grid-template-columns: var(--mtt-crn-size, 24px) minmax(0, 1fr);
	align-items: flex-start;
	gap: 0.75rem;
	min-block-size: var(--mtt-crn-size, 24px);
	font: inherit;
	line-height: 1.5;
	cursor: pointer;
}

.mtt-crn-comment-opt-in__input {
	position: relative;
	box-sizing: border-box;
	inline-size: var(--mtt-crn-size, 24px);
	block-size: var(--mtt-crn-size, 24px);
	margin: 0;
	inset-block-start: max(0px, calc((1.5em - var(--mtt-crn-size, 24px)) / 2));
	font: inherit;
	cursor: pointer;
}

/* Center against the first text line, including when the label wraps. */
.mtt-crn-comment-opt-in__label > span {
	padding-block-start: max(0px, calc((var(--mtt-crn-size, 24px) - 1.5em) / 2));
}

.mtt-crn-comment-opt-in__help {
	display: block;
	margin-inline-start: calc(var(--mtt-crn-size, 24px) + 0.75rem);
	font-size: 0.875em;
	line-height: 1.5;
}

/* Keep specificity low so a theme can refine the control without !important. */
.mtt-crn-comment-opt-in--styled :where(.mtt-crn-comment-opt-in__input) {
	display: grid;
	place-content: center;
	padding: 0;
	color: inherit;
	appearance: none;
	background: transparent;
	border: 2px solid currentcolor;
	border-radius: 4px;
	box-shadow: none;
}

.mtt-crn-comment-opt-in--styled :where(.mtt-crn-comment-opt-in__input)::before {
	inline-size: 6px;
	block-size: 11px;
	margin-block-start: -3px;
	content: "";
	border: solid var(--mtt-crn-checkmark, #fff);
	border-width: 0 3px 3px 0;
	transform: rotate(45deg) scale(0);
}

.mtt-crn-comment-opt-in--styled :where(.mtt-crn-comment-opt-in__input):checked {
	background: var(--mtt-crn-accent, #1e1e1e);
}

.mtt-crn-comment-opt-in--styled :where(.mtt-crn-comment-opt-in__input):checked::before {
	transform: rotate(45deg) scale(1);
}

.mtt-crn-comment-opt-in__input:focus-visible {
	outline: 2px solid currentcolor;
	outline-offset: 4px;
}

@media (forced-colors: active) {
	.mtt-crn-comment-opt-in--styled :where(.mtt-crn-comment-opt-in__input) {
		appearance: auto;
		background: revert;
		border: revert;
	}

	.mtt-crn-comment-opt-in--styled :where(.mtt-crn-comment-opt-in__input):checked {
		background: revert;
	}

	.mtt-crn-comment-opt-in--styled :where(.mtt-crn-comment-opt-in__input)::before {
		content: none;
	}
}
