/* Open discussion layout with role labels and inset replies, without voting UI. */
#comments {
    --pfpc-comment-accent: var(--pfpc-user-accent, #a51d32);
    --pfpc-comment-surface: #fff;
    --pfpc-comment-soft: #f7f8fa;
    --pfpc-comment-line: #e4e7ec;
    --pfpc-comment-text: #242b38;
    --pfpc-comment-muted: #626c7c;
    --pfpc-comment-user: #285b13;
    --pfpc-comment-admin: #8d1118;
    color: var(--pfpc-comment-text);
    line-height: 1.6;
}

#comments .comments-title {
    margin: 0 0 20px;
    padding: 0 0 14px;
    border-bottom: 1px solid var(--pfpc-comment-line);
    color: var(--pfpc-comment-text);
    font-size: clamp(17px, 2vw, 21px);
    font-weight: 700;
    line-height: 1.4;
    text-wrap: pretty;
}

#comments .comment-list,
#comments .children {
    list-style: none;
    padding: 0;
    margin: 0;
}

#comments .comment-list { margin-bottom: 24px; }
#comments .comment,
#comments .pingback,
#comments .trackback { margin: 0 0 26px; padding: 0; }

#comments .comment-body {
    margin: 0;
    padding: 4px 0;
    border: 0;
    border-radius: 0;
    background: var(--pfpc-comment-surface);
    overflow-wrap: anywhere;
}

#comments .comment-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
    margin: 0;
    padding: 0;
}

#comments .comment-meta .avatar {
    float: none;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    margin: 0;
    border: 0;
    border-radius: 0;
    object-fit: cover;
}

#comments .comment-author-info { min-width: 0; flex: 1; }
#comments .comment-author {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 7px;
    color: var(--pfpc-comment-user);
    font-size: 14px;
    line-height: 1.4;
}
#comments .comment-author cite { font-style: normal; font-weight: 700; }
#comments .comment-author a { color: inherit; text-decoration: none; }
#comments .pfpc-comment-role {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 3px;
    background: #285b13;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.4;
}
#comments .pfpc-comment-admin > .comment-body .comment-author { color: var(--pfpc-comment-admin); }
#comments .pfpc-comment-admin > .comment-body .pfpc-comment-role { background: #8d1118; }
#comments .comment-metadata { margin: 2px 0 0; font-size: 12px; line-height: 1.5; }
#comments .comment-metadata a { color: var(--pfpc-comment-muted); text-decoration: none; }
#comments .comment-metadata .edit-link { margin-inline-start: 6px; }

#comments .comment-content {
    margin: 12px 0 0;
    padding: 0;
    border: 0;
    color: var(--pfpc-comment-text);
    font-size: 14px;
    line-height: 1.65;
    overflow-wrap: anywhere;
}

#comments .comment-content p { margin: 0 0 8px; }
#comments .comment-content p:last-child { margin-bottom: 0; }
#comments .comment-content img { max-width: 100%; height: auto; }
#comments .comment-content pre { max-width: 100%; overflow-x: auto; }
#comments .comment-content a { color: var(--pfpc-comment-accent); }
#comments .comment-content .reply { display: block; margin-top: 8px; font-size: 12px; }
#comments .comment-content .comment-reply-link {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 3px 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--pfpc-comment-muted);
    font-weight: 400;
    text-decoration: none;
}

#comments .comment-content .comment-reply-link:hover { color: var(--pfpc-comment-text); text-decoration: underline; }
#comments .children {
    margin: 16px 0 0 28px;
    padding: 0;
    border: 0;
}

/* Stop cumulative indentation before deep threads squeeze their content. */
#comments .children .children { margin-inline-start: 20px; }
#comments .children .children .children { margin-inline-start: 0; }
#comments .children > .comment { margin-bottom: 6px; }
#comments .children .comment-body {
    padding: 15px 18px;
    border-inline-start: 3px solid var(--pfpc-comment-line);
    background: var(--pfpc-comment-soft);
}
#comments .pfpc-comment-admin > .comment-body { border-inline-start: 3px solid var(--pfpc-comment-admin); padding-inline-start: 18px; }
#comments .comment-awaiting-moderation { flex-basis: 100%; margin: 0; color: var(--pfpc-comment-muted); font-size: 12px; }

#comments .comment-respond {
    margin: 22px 0 0;
    padding: 0;
    padding-inline-start: 64px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

#comments .comment-reply-title {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 12px;
    margin: 0 0 10px;
    color: var(--pfpc-comment-text);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.5;
}
#comments #cancel-comment-reply-link { display: inline-block; padding: 0; color: var(--pfpc-comment-muted); font-size: 11px; font-weight: 400; }
/* Keep the normal heading accessible; reveal it when native reply controls activate. */
#comments .comment-reply-title:has(#cancel-comment-reply-link[style*="display:none"]),
#comments .comment-reply-title:has(#cancel-comment-reply-link[style*="display: none"]) {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}
#comments .comment-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; margin: 0; }
#comments .comment-form > * { grid-column: 1 / -1; min-width: 0; }
#comments .comment-form .comment-form-author { grid-column: 1; }
#comments .comment-form .comment-form-email { grid-column: 2; }
#comments .comment-form-comment { position: relative; }
#comments .pfpc-comment-form-avatar {
    position: absolute;
    inset-inline-start: -64px;
    top: 0;
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}
#comments .pfpc-comment-form-avatar img { display: block; width: 100%; height: 100%; margin: 0; border-radius: inherit; object-fit: cover; }
#comments #respond[hidden],
#comments .pfpc-comment-compose[hidden],
#comments .pfpc-comment-start[hidden] { display: none; }
#comments .pfpc-comment-compose { margin-top: 18px; }
#comments .pfpc-comment-start:focus-visible { outline: 2px solid var(--pfpc-comment-accent); outline-offset: 3px; }
#comments .pfpc-comment-compose [role="status"] { margin: 8px 0 0; font-size: 12px; color: var(--pfpc-comment-muted); }
#comments .pfpc-comment-compose [role="status"]:empty { display: none; }
#comments .comment-form p { margin: 0; }
#comments .logged-in-as,
#comments .comment-notes,
#comments .comment-form-cookies-consent { color: var(--pfpc-comment-muted); font-size: 11px; line-height: 1.5; }
#comments .logged-in-as a { color: inherit; }
#comments .comment-form input:not([type="checkbox"]):not([type="submit"]):not([type="hidden"]),
#comments .comment-form textarea {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    display: block;
    margin: 0;
    padding: 10px 12px;
    border: 1px solid var(--pfpc-comment-line);
    border-radius: 4px;
    background: var(--pfpc-comment-soft);
    color: var(--pfpc-comment-text);
    caret-color: var(--pfpc-comment-accent);
    font: inherit;
    font-size: 14px;
    line-height: 1.4;
    min-height: 40px;
    box-shadow: inset 0 1px 2px rgb(36 43 56 / 3%);
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

#comments .comment-form textarea { height: 112px; min-height: 112px; padding: 14px; resize: vertical; }
#comments .comment-form input::placeholder,
#comments .comment-form textarea::placeholder { color: var(--pfpc-comment-muted); opacity: 1; }
#comments .comment-form-cookies-consent { display: flex; align-items: flex-start; gap: 8px; }
#comments .comment-form-cookies-consent input { flex-shrink: 0; margin: 4px 0 0; }
#comments .comment-form .form-submit { margin: 4px 0 0; }
/* Reserve the documented flexible-widget height before Cloudflare initializes. */
#comments .pfpc-comment-turnstile { min-height: 65px; margin: 0 0 10px; }
#comments .pfpc-comment-turnstile iframe { display: block; }
#comments .comment-form .submit {
    min-height: 44px;
    margin: 0;
    padding: 10px 20px;
    border: 1px solid var(--pfpc-comment-accent);
    border-radius: 4px;
    background: var(--pfpc-comment-accent);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 2px 5px rgb(36 43 56 / 12%);
    cursor: pointer;
}

#comments a:focus-visible,
#comments input:focus-visible,
#comments textarea:focus-visible { outline: 2px solid var(--pfpc-comment-accent); outline-offset: 3px; }
#comments .comment-navigation { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; margin: 16px 0; font-size: 13px; }
#comments .no-comments { color: var(--pfpc-comment-muted); font-size: 13px; }

/* WordPress moves #respond into the thread while replying to a comment. */
#comments .comment-list .comment-respond {
    margin: 14px 0 20px 28px;
}

#comments .comment-form textarea:focus,
#comments .comment-form input:not([type="submit"]):not([type="checkbox"]):not([type="hidden"]):focus {
    border-color: var(--pfpc-comment-accent);
    outline: 0;
    box-shadow: 0 0 0 3px rgba(98, 108, 124, 0.12);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--pfpc-comment-accent) 14%, transparent);
}

@media (prefers-reduced-motion: reduce) {
    #comments .comment-form textarea,
    #comments .comment-form input { transition: none; }
}

@media (forced-colors: active) {
    #comments .comment-form textarea:focus,
    #comments .comment-form input:not([type="submit"]):not([type="checkbox"]):not([type="hidden"]):focus {
        outline: 2px solid Highlight;
        outline-offset: 2px;
    }
}

#comments .comment-form .submit:hover { background: var(--pfpc-user-accent-dark, var(--pfpc-comment-accent)); border-color: var(--pfpc-user-accent-dark, var(--pfpc-comment-accent)); }
#comments .comment-form .submit:focus-visible { outline-color: var(--pfpc-comment-accent); }
#comments #cancel-comment-reply-link:focus-visible { outline-color: var(--pfpc-comment-muted); }

/* Follow the existing desktop light/dark switch rather than OS preference. */
@media (min-width: 1170px) {
    html:not(.pfpc-light-mode) body.pfpc-desktop-chrome #comments {
        --pfpc-comment-surface: #242424;
        --pfpc-comment-soft: #2b2b2b;
        --pfpc-comment-line: #424242;
        --pfpc-comment-text: #f1eeee;
        --pfpc-comment-muted: #b9b5bd;
        --pfpc-comment-user: #abd79b;
        --pfpc-comment-admin: #ffb4be;
    }
    html:not(.pfpc-light-mode) body.pfpc-desktop-chrome #comments .comment-content a { color: #ffb4be; }
    html:not(.pfpc-light-mode) body.pfpc-desktop-chrome #comments .comment-content .comment-reply-link { color: var(--pfpc-comment-muted); }
}

@media (max-width: 600px) {
    #comments .comments-title { margin-bottom: 14px; font-size: 17px; }
    #comments .comment-body { padding: 4px 0; }
    #comments .children { margin-inline-start: 12px; }
    #comments .children .children { margin-inline-start: 10px; }
    #comments .children .children .children { margin-inline-start: 0; }
    #comments .children .comment-body { padding: 12px; }
    #comments .pfpc-comment-admin > .comment-body { padding-inline-start: 12px; }
    #comments .comment-respond { padding: 0; padding-inline-start: 48px; }
    #comments .comment-form { grid-template-columns: minmax(0, 1fr); }
    #comments .comment-form .comment-form-author,
    #comments .comment-form .comment-form-email { grid-column: 1 / -1; }
    #comments .pfpc-comment-form-avatar { inset-inline-start: -48px; width: 36px; height: 36px; }
    #comments .comment-form input:not([type="checkbox"]):not([type="submit"]):not([type="hidden"]),
    #comments .comment-form textarea { font-size: 16px; }
    #comments .pfpc-comment-turnstile { margin-inline-start: -48px; width: calc(100% + 48px); }
    #comments .comment-form .submit { width: auto; }
    #comments .comment-list .comment-respond { margin-inline-start: 12px; }
}
