/* Final theme contrast layer. Loaded after the legacy stylesheet. */
body[data-forum-theme="sky"] {
    --app-text: #142b40;
    --app-text-soft: #344f67;
    --app-muted: #566f86;
    --app-accent-strong: #286ba5;
}
body[data-forum-theme="blush"] {
    --app-text: #422432;
    --app-text-soft: #604050;
    --app-muted: #765868;
    --app-accent-strong: #a7486d;
}
body[data-forum-theme="dark"] {
    --app-text: #f4f7fb;
    --app-text-soft: #c7d0dc;
    --app-muted: #9aa8ba;
    --app-accent-strong: #aaa2f1;
}
body[data-forum-theme="forest"] {
    --app-text: #f2f8f4;
    --app-text-soft: #c4d7cc;
    --app-muted: #9cb8a8;
    --app-accent-strong: #89c3a3;
}
body[data-forum-theme="duo"] {
    --app-text: #252942;
    --app-text-soft: #494f70;
    --app-muted: #666d8e;
    --app-accent-strong: #585ea7;
}
body[data-forum-theme="esports"] {
    --app-text: #f6f8ff;
    --app-text-soft: #cbd5e8;
    --app-muted: #9eacc5;
    --app-accent-strong: #ae8cff;
}

body:is(
    [data-forum-theme="sky"],
    [data-forum-theme="blush"],
    [data-forum-theme="duo"]
) {
    color: var(--app-text) !important;
}

body:is(
    [data-forum-theme="sky"],
    [data-forum-theme="blush"],
    [data-forum-theme="duo"]
) .comm-header::before {
    background: linear-gradient(to bottom, var(--app-header) 52%, transparent) !important;
}

body:is(
    [data-forum-theme="sky"],
    [data-forum-theme="blush"],
    [data-forum-theme="duo"]
) :is(
    .comm-stat-card, .comm-welcome-card, .feed-card, .search-bar,
    .user-badge, .logout-btn, .feed-view-tabs, .modal-card,
    .message-center-card, .conversation-pane, .chat-pane, .notif-panel,
    .theme-settings-panel, .security-panel, .identity-field,
    .preference-row, .comment-section, .comment-composer, .comment-reply,
    .system-dialog-card, .share-card, .share-preview, .share-quick-actions button,
    .share-contact-list > button, .home-sidebar, .home-post-item,
    .moderation-toolbar, .moderation-list, .moderation-log-panel,
    .moderation-stat, .moderation-card, .moderation-report-item,
    .moderation-log-item, .feed-more-menu
) {
    color: var(--app-text) !important;
    border-color: var(--app-line) !important;
    background: var(--app-surface) !important;
    box-shadow: var(--app-shadow);
}

body:is(
    [data-forum-theme="sky"],
    [data-forum-theme="blush"],
    [data-forum-theme="duo"]
) :is(
    .comm-stat-card.accent, .comm-welcome-card, .preference-row:has(input:checked),
    .conversation-item.active, .feed-view-tabs button.active,
    .cat-btn.active, .cat-radio.selected, .theme-option.selected,
    .notif-item.unread
) {
    border-color: color-mix(in srgb, var(--app-accent) 34%, transparent) !important;
    background: var(--app-accent-soft) !important;
}

body:is(
    [data-forum-theme="sky"],
    [data-forum-theme="blush"],
    [data-forum-theme="duo"]
) :is(
    .feed-card:hover, .comm-stat-card:hover, .search-bar:hover,
    .conversation-item:hover, .share-contact-list > button:hover,
    .home-post-item:hover, .theme-option:hover, .cat-btn:hover,
    .cat-radio:hover, .secondary-action-btn:hover, .notif-item:hover
) {
    color: var(--app-text) !important;
    border-color: var(--app-line-strong) !important;
    background: var(--app-surface-raised) !important;
}

body:is(
    [data-forum-theme="sky"],
    [data-forum-theme="blush"],
    [data-forum-theme="duo"]
) :is(
    .form-input, .form-textarea, .conversation-search input,
    .moderation-search input, .search-bar input, .chat-compose,
    .chat-input-row, .comment-input-row input, .comment-reply-row input
) {
    color: var(--app-text) !important;
    border-color: var(--app-line) !important;
    background: var(--app-surface-muted) !important;
}

body:is(
    [data-forum-theme="sky"],
    [data-forum-theme="blush"],
    [data-forum-theme="duo"]
) :is(
    .modal-header, .feed-footer, .notif-header, .chat-conversation-header,
    .chat-compose, .chat-input-row, .comment-section, .moderation-section-title
) {
    border-color: var(--app-line) !important;
}

body:is(
    [data-forum-theme="sky"],
    [data-forum-theme="blush"],
    [data-forum-theme="duo"]
) :is(
    .modal-close, .notif-header button, .theme-settings-head button,
    .chat-header-actions button, .chat-mobile-back, .conversation-search button
) {
    color: var(--app-text-soft) !important;
    border-color: var(--app-line) !important;
    background: var(--app-surface-muted) !important;
}

body:is(
    [data-forum-theme="sky"],
    [data-forum-theme="blush"],
    [data-forum-theme="duo"]
) :is(
    .conversation-avatar, .chat-peer-avatar, .home-avatar-lg
) {
    color: #fff !important;
}

body:is(
    [data-forum-theme="sky"],
    [data-forum-theme="blush"],
    [data-forum-theme="duo"]
) :is(
    .submit-btn, .fab-post, .comment-send-btn, .chat-send-btn,
    .moderation-tabs button.active, .chat-msg.mine .chat-bubble
) {
    color: var(--app-on-accent) !important;
}

body:is(
    [data-forum-theme="sky"],
    [data-forum-theme="blush"],
    [data-forum-theme="duo"]
) :is(
    .feed-more-menu, .conversation-pane, .chat-pane
) {
    background-image: none !important;
}

@media (max-width: 768px) {
    body:is(
        [data-forum-theme="sky"],
        [data-forum-theme="blush"],
        [data-forum-theme="duo"]
    ) :is(.comm-header-right, .conversation-pane, .chat-pane) {
        color: var(--app-text) !important;
        border-color: var(--app-line) !important;
        background: var(--app-surface) !important;
    }
}

body[data-forum-theme] :is(
    .comm-site-name, .welcome-text, .stat-num, .feed-name, .feed-title,
    .modal-title, .conversation-name-row strong, .conversation-head h2,
    .chat-peer-meta strong, .shared-post-copy strong, .share-preview strong,
    .share-contact-list strong, .home-posts-header span, .home-post-author,
    .moderation-header h1, .moderation-stat strong, .moderation-card h2,
    .moderation-section-title, .identity-field strong, .preference-copy strong
    , .home-nickname, .security-panel summary, .security-session-row strong,
    .conversation-empty strong, .chat-pane-empty strong, .chat-empty-state strong
) {
    color: var(--app-text) !important;
}

body[data-forum-theme] :is(
    .feed-body, .comment-body, .comment-name, .notif-item, .notif-from,
    .chat-bubble, .conversation-preview, .shared-post-copy > span,
    .share-preview p, .home-gender-orientation, .home-motto, .home-photo-title,
    .home-post-item .feed-body, .gb-info-row, .moderation-card > p,
    .moderation-report-item p, .moderation-log-item p, .form-input, .form-textarea
    , .security-session-row span, .comment-reply-copy, .notif-line
) {
    color: var(--app-text-soft) !important;
}

body[data-forum-theme] :is(
    .welcome-sub, .stat-label, .feed-time, .feed-action, .feed-result-summary,
    .form-label, .char-count, .draft-status, .privacy-help,
    .preference-copy small, .preference-state, .comment-time, .chat-meta,
    .chat-pane-empty, .chat-peer-meta span, .conversation-name-row time,
    .conversation-loading, .conversation-empty, .share-quick-actions small,
    .share-divider, .share-contact-list small, .home-stat-item span:last-child,
    .home-post-time, .gb-people-tags, .moderation-header p,
    .moderation-stat span, .moderation-author, .moderation-last-reason,
    .moderation-report-item span, .moderation-report-item time,
    .moderation-log-item span, .moderation-log-item time,
    .moderation-log-empty, .panel-empty, .notif-meta, #image-viewer-counter,
    .notif-action, .notif-msg, .chat-compose-tools, .chat-empty-state,
    .shared-post-card.unavailable, .form-submit-hint, .comment-key-hint,
    .comment-empty, .inline-state, .feed-empty
) {
    color: var(--app-muted) !important;
}
body[data-forum-theme] :is(
    .home-stat-num, .conversation-eyebrow, .shared-post-symbol,
    .shared-post-copy small, .share-preview-label, .share-contact-list i,
    .moderation-back, .moderation-search button, .chat-compose-tools button
) {
    color: var(--app-accent-strong) !important;
}

body[data-forum-theme] :is(
    .cat-btn, .cat-radio, .feed-cat-badge, .secondary-action-btn, .theme-option
) {
    color: var(--app-text-soft) !important;
}
body[data-forum-theme] :is(
    .logout-btn, .user-badge, .search-clear, .notif-header button,
    .modal-close, .chat-header-actions button, .chat-mobile-back,
    .conversation-search button, .feed-menu-action, .mod-btn
    , .moderation-tabs button, .comment-anon-control
) {
    color: var(--app-text-soft) !important;
}

body:is(
    [data-forum-theme="sky"],
    [data-forum-theme="blush"],
    [data-forum-theme="duo"]
) .page-title {
    color: var(--app-text) !important;
    background: none !important;
    -webkit-background-clip: border-box !important;
    -webkit-text-fill-color: currentColor !important;
}

body:is(
    [data-forum-theme="sky"],
    [data-forum-theme="blush"],
    [data-forum-theme="duo"]
) :is(.back-btn, #month-filter, .post-title, .article-content, .article-content strong, .photo-remark-short) {
    color: var(--app-text) !important;
}

body:is(
    [data-forum-theme="sky"],
    [data-forum-theme="blush"],
    [data-forum-theme="duo"]
) :is(.post-date, .post-excerpt, .article-meta, .photo-date) {
    color: var(--app-muted) !important;
}
body[data-forum-theme] :is(
    .logout-btn:hover, .user-badge:hover, .search-clear:hover,
    .notif-header button:hover, .modal-close:hover,
    .chat-header-actions button:hover, .conversation-search button:hover,
    .feed-menu-action:hover, .mod-btn:hover
) {
    color: var(--app-text) !important;
}
body[data-forum-theme] :is(
    .cat-btn.active, .cat-radio.selected, .feed-view-tabs button.active,
    .theme-option.selected
) {
    color: var(--app-text) !important;
}
body[data-forum-theme] :is(
    .search-bar input, .conversation-search input, .form-input, .form-textarea
)::placeholder {
    color: color-mix(in srgb, var(--app-muted) 82%, transparent) !important;
    opacity: 1;
}
body[data-forum-theme] .preference-row:has(input:checked) .preference-state,
body[data-forum-theme] .toggle-wrap:has(.toggle-switch input:checked) .anon-hint {
    color: var(--app-accent-strong) !important;
}

body[data-forum-theme="sky"] :is(.feed-action.liked, .admin-del, .moderation-inline-badge.hidden),
body[data-forum-theme="blush"] :is(.feed-action.liked, .admin-del, .moderation-inline-badge.hidden),
body[data-forum-theme="duo"] :is(.feed-action.liked, .admin-del, .moderation-inline-badge.hidden) {
    color: #a83248 !important;
}
body[data-forum-theme="sky"] :is(.feed-action.bookmarked, .moderation-inline-badge.reported),
body[data-forum-theme="blush"] :is(.feed-action.bookmarked, .moderation-inline-badge.reported),
body[data-forum-theme="duo"] :is(.feed-action.bookmarked, .moderation-inline-badge.reported) {
    color: #855600 !important;
}
