/*
 * Two columns (core/post-comments-form): "Leave a Reply" after an accent circle with a pencil, the notes beside it, Name | Email side by side,
 * Website, Comment and the cookies consent, 60px framed fields and a 220x55 button. Core's form box steps
 * aside (display: contents) so its paragraphs are items of the respond box's flex row. Colour and type of the texts are
 * the block's settings (the reply title's are theme.json's h3); one column under 37.5rem. Loaded only on pages where a form uses the style
 * (inc/rt-block-styles.php).
 */
.is-style-comment-form {
	--rt-comment-form-gap: 1.875rem;
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 0 3.5625rem;
}

.is-style-comment-form .comment-respond {
	display: contents;
}

.is-style-comment-form .comment-form {
	display: contents;
}

.is-style-comment-form .comment-form > * {
	flex: 1 1 100%;
	order: 2;
	margin: var(--rt-comment-form-gap) 0 0;
}

/* The title and the notes share the first row; an empty full-width item ends it, so the fields always start below */
.is-style-comment-form .comment-form::before {
	content: "";
	flex: 1 1 100%;
	order: 1;
}

.is-style-comment-form .comment-reply-title {
	--rt-comment-form-badge: 2.75rem;
	position: relative;
	flex: none;
	align-content: center;
	min-height: var(--rt-comment-form-badge);
	margin: 0;
	padding-inline-start: calc(var(--rt-comment-form-badge) + 0.875rem);
}

/* The title's badge, like the share and related titles' core/icon circles: the accent circle and the pencil in the
   text colour on accent; the form prints the title itself, so it has no block to hold an icon */
.is-style-comment-form .comment-reply-title::before,
.is-style-comment-form .comment-reply-title::after {
	content: "";
	position: absolute;
	inset-block-start: 50%;
	translate: 0 -50%;
}

.is-style-comment-form .comment-reply-title::before {
	inset-inline-start: 0;
	width: var(--rt-comment-form-badge);
	aspect-ratio: 1;
	border-radius: 50%;
	background-color: var(--wp--preset--color--accent);
}

.is-style-comment-form .comment-reply-title::after {
	inset-inline-start: calc(var(--rt-comment-form-badge) / 4);
	width: calc(var(--rt-comment-form-badge) / 2);
	aspect-ratio: 1;
	background-color: var(--wp--preset--color--on-accent);
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM5.92 19H5v-.92l9.06-9.06.92.92L5.92 19zM20.71 5.63l-2.34-2.34a1 1 0 0 0-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83a1 1 0 0 0 0-1.41z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.is-style-comment-form .comment-reply-title small {
	display: block;
}

.is-style-comment-form .comment-notes,
.is-style-comment-form .logged-in-as {
	flex: 1 1 18rem;
	order: 0;
	margin: 0 0 0 1.1875rem;
}

.is-style-comment-form .comment-form-author,
.is-style-comment-form .comment-form-email {
	flex: 1 1 calc(50% - 1.78125rem);
}

.is-style-comment-form label {
	display: block;
	padding-bottom: 1.0625rem;
}

.is-style-comment-form .required {
	color: inherit;
}

.is-style-comment-form :is(input[type="text"], input[type="email"], input[type="url"], textarea) {
	box-sizing: border-box;
	display: block;
	width: 100%;
	height: 3.75rem;
	margin: 0;
	padding: 0 1.25rem;
	border: 1px solid var(--wp--custom--post-content--field);
	border-radius: 0;
	background-color: var(--wp--preset--color--base);
	color: var(--wp--preset--color--contrast);
	font: inherit;
	appearance: none;
}

.is-style-comment-form .comment-form-comment textarea {
	height: 10.5rem;
	padding-block: 1.0625rem;
	resize: vertical;
}

/* Focus: a 2px dark frame drawn inside, so the field does not move; invalid after the visitor typed: a dashed frame */
.is-style-comment-form :is(input, textarea):focus-visible {
	border-color: var(--wp--preset--color--contrast);
	outline: 0;
	box-shadow: inset 0 0 0 1px var(--wp--preset--color--contrast);
}

.is-style-comment-form :is(input, textarea):user-invalid {
	border-style: dashed;
	border-color: var(--wp--custom--post-content--error);
}

.is-style-comment-form .comment-form-cookies-consent {
	display: flex;
	align-items: flex-start;
	gap: 0.625rem;
}

.is-style-comment-form .comment-form-cookies-consent input {
	flex: none;
	width: 1rem;
	height: 1rem;
	margin: 0.25em 0 0;
	accent-color: var(--wp--preset--color--contrast);
}

.is-style-comment-form .comment-form-cookies-consent label {
	padding: 0;
}

/* The button's colours, frame and type are theme.json's (Styles > Blocks > Comments Form > Button); the box is 220x55 */
.is-style-comment-form .form-submit .wp-element-button {
	min-width: 13.75rem;
	margin: 0;
	cursor: pointer;
}

/* Phones: one column, the notes under the title */
@media (max-width: 37.5rem) {
	.is-style-comment-form {
		--rt-comment-form-gap: 1.25rem;
	}

	.is-style-comment-form :is(.comment-notes, .logged-in-as, .comment-form-author, .comment-form-email) {
		flex-basis: 100%;
		margin-inline-start: 0;
	}

	.is-style-comment-form :is(.comment-notes, .logged-in-as) {
		margin-top: var(--wp--preset--spacing--20);
	}
}
