.wp-block-post-comments-form {
    border-top: 1px solid #ECEDEC;
    padding-top: 30px; /* The spacing should be 40px, the remaining 10px is provided by the line-height of comment-reply-title */

    .comment-reply-title {
        margin: 0;
    }
}

.comment-form {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    width: 100%;
    font-size: 14px;
    line-height: 26px;
    margin-top: 24px; /* The spacing should be 40px, the remaining is provided by the line-height of comment-reply-title */

    > p {
        grid-column: 1 / -1;
        position: relative;
        margin: 0;
    }
}

/* Container positioning */
.comment-form-author, 
.comment-form-email, 
.comment-form-url, 
.comment-form-comment {
    position: relative;
    margin: 0;
}

/* Base Input & Textarea styles */
.comment-form-author input,
.comment-form-email input,
.comment-form-url input,
.comment-form-comment textarea {
    width: 100%;
    padding: 15px;
}

/* Floating Label styling */
.comment-form-author label,
.comment-form-email label,
.comment-form-url label,
.comment-form-comment label {
    position: absolute;
    left: 15px;
    top: 15px;
    color: var(--wp--preset--color--text-primary);
    padding: 0 5px;
    background: #fff;
    transition: 0.2s ease all;
    pointer-events: none;
    font-size: 14px;
    font-weight: 400;
    line-height: 26px;
    display: block;
}

/* The Float Effect: Triggers on focus or when input isn't empty */
.comment-form-author input:focus ~ label,
.comment-form-author input:not(:placeholder-shown) ~ label,
.comment-form-email input:focus ~ label,
.comment-form-email input:not(:placeholder-shown) ~ label,
.comment-form-url input:focus ~ label,
.comment-form-url input:not(:placeholder-shown) ~ label,
.comment-form-comment textarea:focus ~ label,
.comment-form-comment textarea:not(:placeholder-shown) ~ label {
    top: -10px;
    left: 15px;
    font-size: 12px;
    color: var(--wp--preset--color--text-secondary);
    line-height: 20px;
}

.wp-block-post-comments-form .comment-form-cookies-consent {
    gap: 10px;
    align-items: center;
    font-size: 14px;
    line-height: 26px;
    color: var(--wp--preset--color--text-primary);
    grid-column: 1 / -1;
}

.wp-block-post-comments-form .comment-form-cookies-consent #wp-comment-cookies-consent {
    margin: 0;
    appearance: auto;
    width: 18px !important;
    height: 18px !important;
    min-width: 18px; /* Prevents shrinking */
    min-height: 18px;
    cursor: pointer;
}

/* md: Minimum width – 768px */
@media (width >= 48rem) {
    .comment-form {
        grid-template-columns: 1fr 1fr; /* Switch to 2 columns */

        /* Author and Email sit side-by-side */
        .comment-form-author,
        .comment-form-email {
            grid-column: span 1;
        }

        /* URL and Comment span the whole row */
        .comment-form-url,
        .comment-form-comment,
        .comment-notes,
        .form-submit {
            grid-column: span 2;
        }
    }

    .wp-block-post-comments-form .comment-form-cookies-consent {
        line-height: 18px; /* Same as the height of the checkbox */
    }
}
