/* ═══════════════════════════════════════════════
   Dark theme token overrides.
   Applied when <html data-theme="dark"> is set.
   Set by JS/theme.js + preferences.html toggle.
   ═══════════════════════════════════════════════ */

html[data-theme="dark"] {
  /* ── Warm, neutral dark — no purple cast.
     The palette is a darkened mirror of the paper/ink light theme:
     instead of cream→ink, we go ink→warm-cream. Hues stay in the
     orange/brown family so the salmon accent (--accent-2) still
     reads as the same colour and doodles tint nicely. */

  /* Background gradient — very dark warm-brown */
  --bg-1: #1a1612;
  --bg-2: #181410;
  --bg-3: #1d1814;
  --bg-4: #1a1612;

  /* ── Glass surfaces ──
     Hue locked to a clear warm-brown so the user never perceives
     a blue/purple cast. RGB channels: R > G > B. */
  --surface-nav:     rgba(22, 17, 13, 0.92);
  --surface-card:    #2a221c;
  --surface-sidebar: rgba(28, 22, 16, 0.88);
  --surface-widget:  rgba(28, 22, 16, 0.85);
  --surface-menu:    rgba(20, 15, 10, 0.97);
  --surface-modal:   rgba(20, 15, 10, 0.97);
  --surface-input:   #241d17;
  --surface-footer:  rgba(15, 12, 9, 0.75);

  /* ── Borders ── */
  --border-glass:   rgba(255, 240, 220, 0.08);
  --border-nav:     rgba(255, 240, 220, 0.06);
  --border-subtle:  #2e2820;
  --border-divider: rgba(255, 240, 220, 0.07);
  --border-footer:  rgba(255, 240, 220, 0.10);

  /* ── Text ── warm cream tones, no purple cast */
  --text-light:     #6b5d52;
  --text-mid:       #a89a8a;
  --text-mid-light: #a89a8a;
  --text-dark:      #d4c5b3;
  --charcoal:       #f0e4cf;

  /* ── Accent ── warm tan/copper instead of violet */
  --accent:      #d6a273;
  --accent-warm: #d6a273;

  /* ── Semantic ── */
  --color-danger:  #e05555;
  --color-rose:    #d48898;
  --color-success: #4ade80;

  /* ── Misc ── */
  --pil-active: #2e2820;

  /* ── Ink palette inversion ──
     Many pages (about, docs/*, edit-profile, login/register, etc.)
     style text with --ink / --ink-soft / --ink-mid / --ink-light,
     which were tuned for dark text on cream paper. In dark mode we
     remap them to warm-cream tones so that text is actually readable
     instead of dark-on-dark. */
  --ink:       #f0e4cf;   /* primary headings */
  --ink-soft:  #d4c5b3;   /* body emphasis */
  --ink-mid:   #b8a89a;   /* body text */
  --ink-light: #7a6c5e;   /* eyebrows, hints, captions */

  /* ── Paper palette inversion ──
     Some surfaces use --paper / --paper-soft directly. Map to the
     same warm-dark surfaces so they don't paint cream on top of
     the dark background. */
  --paper:      #1a1612;
  --paper-soft: #221d18;
  --paper-2:    #1d1814;
  --paper-3:    #221d18;

  /* ── Lines / dividers ── */
  --line:      rgba(255, 240, 220, 0.10);
  --line-soft: rgba(255, 240, 220, 0.06);

  /* ── Coming-soon page tokens ── */
  --cs-eyebrow:    #d6a273;
  --cs-title:      #f0e4cf;
  --cs-lead:       #a89a8a;
  --cs-card-bg:    rgba(255, 240, 220, 0.04);
  --cs-card-title: #f0e4cf;
  --cs-card-desc:  #7a6c5e;
  --cs-back-bg:    rgba(255, 240, 220, 0.07);
  --cs-back-color: #f0e4cf;
}

/* ══════════════════════════════════════════════════════
   Specific element overrides (hardcoded values in CSS
   that don't pick up the :root tokens automatically)
   ══════════════════════════════════════════════════════ */

html[data-theme="dark"] body {
  color: var(--text-mid);
}

/* ─────────────────────────────────────
   NAVBAR  — covers every page's .top-info
   (page-specific CSS files still have
    hardcoded rgba(255,255,255) here)
   ───────────────────────────────────── */
html[data-theme="dark"] .top-info {
  background: var(--surface-nav) !important;
  border-top-color:    var(--border-nav) !important;
  border-bottom-color: var(--border-nav) !important;
}

html[data-theme="dark"] .logo,
html[data-theme="dark"] .nav-link,
html[data-theme="dark"] .main-menu-trigger {
  color: var(--charcoal);
}

html[data-theme="dark"] .nav-link:hover,
html[data-theme="dark"] .main-menu-trigger:hover {
  background: rgba(255, 255, 255, 0.06);
}

html[data-theme="dark"] .mmenu-item {
  color: var(--text-mid);
}

html[data-theme="dark"] .mmenu-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--charcoal);
}

/* Sign out — reddish so it's visually distinct */
html[data-theme="dark"] .mmenu-item--login {
  color: #e07070 !important;
  background: rgba(220, 80, 80, 0.08) !important;
}

html[data-theme="dark"] .mmenu-item--login:hover {
  background: rgba(220, 80, 80, 0.16) !important;
  color: #f08080 !important;
}

html[data-theme="dark"] .mmenu-divider {
  background: rgba(255, 255, 255, 0.07);
}

/* ── Post cards (main feed) ── */
html[data-theme="dark"] .post-card {
  background: var(--surface-card) !important;
  border-color: var(--border-glass) !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

html[data-theme="dark"] .post-title a {
  color: var(--text-dark);
}

html[data-theme="dark"] .post-preview {
  color: var(--text-mid);
}

html[data-theme="dark"] .post-actions {
  border-top-color: var(--border-subtle);
}

html[data-theme="dark"] .post-menu-down {
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

html[data-theme="dark"] .post-menu-down li button {
  color: var(--text-dark);
}

html[data-theme="dark"] .post-menu-down li button:hover {
  background: rgba(255, 255, 255, 0.06);
}

/* ── Sidebar ── */
html[data-theme="dark"] .sidebar-item {
  color: var(--text-dark);
}

html[data-theme="dark"] .sidebar-item:hover,
html[data-theme="dark"] .sidebar-item.active {
  background: rgba(255, 255, 255, 0.06);
  color: var(--charcoal);
}

html[data-theme="dark"] .sidebar-create-post-button {
  /* Solid warm-dark pill with cream content — matches the light
     theme's intent (high-contrast solid CTA), no awkward
     tan+black+white mix. */
  background: #2a221c !important;
  color: var(--charcoal) !important;
  border: 1px solid var(--border-glass) !important;
}
html[data-theme="dark"] .sidebar-create-post-button .icon {
  color: var(--charcoal) !important;
}

html[data-theme="dark"] .asidebar-divider {
  background: rgba(255, 255, 255, 0.06);
}

html[data-theme="dark"] .sidebar-create-post-button:hover {
  background: var(--accent-2) !important;
  color: #fff !important;
  border-color: var(--accent-2) !important;
}
html[data-theme="dark"] .sidebar-create-post-button:hover .icon {
  color: #fff !important;
}

html[data-theme="dark"] .sidebar-more {
  color: #6b5d52;
}

html[data-theme="dark"] .sidebar-more:hover {
  color: #b8a89a;
}

/* ── Filter icon buttons (sort/filter toggles above feed) ── */
html[data-theme="dark"] .button-icon {
  background: rgba(30, 27, 44, 0.80) !important;
  border-color: var(--border-glass) !important;
  color: var(--text-dark);
}

html[data-theme="dark"] .button-icon:hover,
html[data-theme="dark"] .button-icon.active {
  background: var(--charcoal) !important;
  color: #fff;
}

/* ── Feed title + action stats ── */
html[data-theme="dark"] .feed-title {
  color: var(--charcoal);
}

html[data-theme="dark"] .post-actions-item {
  color: var(--text-mid);
}

html[data-theme="dark"] .post-actions-item:hover {
  background: rgba(255, 255, 255, 0.05) !important;
  color: var(--text-dark);
}

html[data-theme="dark"] .action-stat {
  color: var(--text-mid);
}

/* ── Sidebar topic count badges ── */
html[data-theme="dark"] .topic-count {
  background: rgba(255, 255, 255, 0.07) !important;
  color: var(--text-mid) !important;
}

/* ── Right sidebar stat numbers ── */
html[data-theme="dark"] .stat-value {
  color: var(--charcoal) !important;
}

html[data-theme="dark"] .statistic-title {
  color: var(--text-mid) !important;
}

html[data-theme="dark"] .statistic-row {
  border-bottom-color: var(--border-subtle) !important;
}

/* ── Filters / search ── */
html[data-theme="dark"] .search-input {
  background: var(--surface-input);
  border-color: var(--border-subtle);
  color: var(--text-dark);
}

html[data-theme="dark"] .search-input::placeholder {
  color: var(--text-light);
}

html[data-theme="dark"] .search-clear {
  background: var(--border-subtle);
  color: var(--text-mid);
}

html[data-theme="dark"] .pill {
  background: var(--surface-input);
  border-color: var(--border-subtle);
  color: var(--text-dark);
}

html[data-theme="dark"] .lang-pill {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-subtle);
  color: var(--text-dark);
}

html[data-theme="dark"] .filter-select {
  background: var(--surface-input);
  border-color: var(--border-subtle);
  color: var(--text-dark);
}

/* ── Tags ── */
html[data-theme="dark"] .tag-lang {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-mid);
}

html[data-theme="dark"] .tag-topic {
  background: rgba(214, 162, 115, 0.18);
  color: var(--accent);
}

/* ── Modal ── */
html[data-theme="dark"] .del-modal {
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
}

html[data-theme="dark"] .del-title {
  color: var(--charcoal);
}

html[data-theme="dark"] .del-desc {
  color: var(--text-mid);
}

html[data-theme="dark"] .del-btn--cancel {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-dark);
}

html[data-theme="dark"] .del-btn--cancel:hover {
  background: rgba(255, 255, 255, 0.13);
}

/* ── Spinner ── */
html[data-theme="dark"] .spinner {
  border-color: var(--border-subtle);
  border-top-color: var(--accent);
}

/* ── Toast ── */
html[data-theme="dark"] .toast {
  background: #2d2a42;
  color: #ede9f8;
}

/* ── Footer ── */
html[data-theme="dark"] .footer_logo p,
html[data-theme="dark"] .footer_links h3 {
  color: var(--charcoal);
}

html[data-theme="dark"] .footer_links a {
  color: var(--text-mid);
}

html[data-theme="dark"] .footer_links a:hover {
  color: var(--charcoal);
}

html[data-theme="dark"] .footer_footer,
html[data-theme="dark"] .footer_social a {
  color: var(--text-light);
}

html[data-theme="dark"] .footer_footer {
  border-top-color: var(--border-divider);
}

html[data-theme="dark"] .footer {
  background: var(--surface-footer) !important;
  border-top-color: var(--border-footer) !important;
}

html[data-theme="dark"] .footer_subtitle {
  color: var(--text-light);
}

/* ── Button (floating create post) ── */
html[data-theme="dark"] .button_create_post_button,
html[data-theme="dark"] .create-post {
  background: var(--accent);
}

/* ── Widget ── */
/* ══════════════════════════════════════════════════════
   Right-sidebar widgets — the inline <style> on main.html
   forces a cream `rgba(255,250,240,0.65)` background that
   beats this stylesheet in the cascade. Use !important
   so dark mode actually applies (and matches the post-card
   surface). The .support widget keeps its salmon tint —
   the accent reads correctly on warm-dark too.
   ══════════════════════════════════════════════════════ */
html[data-theme="dark"] .widget,
html[data-theme="dark"] .widget.support.ai,
html[data-theme="dark"] .widget.guidelines,
html[data-theme="dark"] .widget.statistic {
  background: var(--surface-card) !important;
  border-color: var(--border-glass) !important;
}
html[data-theme="dark"] .widget.support {
  background: rgba(214, 83, 60, 0.10) !important;
  border-color: rgba(214, 83, 60, 0.30) !important;
}

html[data-theme="dark"] .widget-title {
  color: var(--charcoal);
}

html[data-theme="dark"] .widget-subtitle,
html[data-theme="dark"] .widget-list li {
  color: var(--text-mid);
}

html[data-theme="dark"] .statistic-row {
  border-bottom-color: var(--border-subtle);
}

/* ─────────────────────────────────────
   CONTACTS PAGE
   ───────────────────────────────────── */
html[data-theme="dark"] .contact-block {
  background: rgba(30, 27, 44, 0.72);
  border-color: var(--border-glass);
}

html[data-theme="dark"] .contact-block:hover {
  background: rgba(35, 32, 52, 0.90);
}

html[data-theme="dark"] .contact-block-label {
  color: var(--text-light);
}

html[data-theme="dark"] .email-address {
  color: var(--charcoal);
}

html[data-theme="dark"] .contact-block-note {
  color: var(--text-mid);
}

html[data-theme="dark"] .contact-cta {
  color: var(--accent);
}

html[data-theme="dark"] .social-card {
  background: rgba(30, 27, 44, 0.65);
  border-color: var(--border-glass);
}

html[data-theme="dark"] .social-card:hover {
  background: rgba(35, 32, 52, 0.90);
}

html[data-theme="dark"] .social-card-name {
  color: var(--charcoal);
}

html[data-theme="dark"] .social-card-handle {
  color: var(--text-mid);
}

html[data-theme="dark"] .hero-title,
html[data-theme="dark"] .hero-desc,
html[data-theme="dark"] .hero-eyebrow {
  color: var(--charcoal);
}

html[data-theme="dark"] .note-inner {
  background: rgba(30, 27, 44, 0.65);
  border-color: var(--border-glass);
}

/* ─────────────────────────────────────
   ABOUT PAGE
   ───────────────────────────────────── */
html[data-theme="dark"] .hero-meta-item {
  background: rgba(30, 27, 44, 0.65);
  border-color: var(--border-glass);
  color: var(--text-mid);
}

html[data-theme="dark"] .tiktok-card {
  background: rgba(30, 27, 44, 0.80);
  border-color: var(--border-glass);
}

html[data-theme="dark"] .tiktok-msg,
html[data-theme="dark"] .tiktok-text {
  color: var(--text-dark);
}

html[data-theme="dark"] .tiktok-user {
  color: var(--text-mid);
}

html[data-theme="dark"] .value-row {
  background: rgba(30, 27, 44, 0.55);
  border-color: var(--border-glass);
}

html[data-theme="dark"] .value-row:hover {
  background: rgba(35, 32, 52, 0.80);
}

html[data-theme="dark"] .doc-link {
  background: rgba(30, 27, 44, 0.65);
  border-color: var(--border-glass);
}

html[data-theme="dark"] .doc-link:hover {
  background: rgba(35, 32, 52, 0.90);
}

html[data-theme="dark"] .origin-lead,
html[data-theme="dark"] .origin-text-col p {
  color: var(--text-mid);
}

/* ─────────────────────────────────────
   UPDATES PAGE
   ───────────────────────────────────── */
html[data-theme="dark"] .entry-body {
  background: rgba(30, 27, 44, 0.65);
  border-color: var(--border-glass);
}

html[data-theme="dark"] .entry-body:hover {
  background: rgba(35, 32, 52, 0.88);
}

html[data-theme="dark"] .entry-title {
  color: var(--charcoal);
}

html[data-theme="dark"] .entry-lead {
  color: var(--text-mid);
}

html[data-theme="dark"] .entry-detail {
  background: rgba(30, 27, 44, 0.55);
  border-color: var(--border-glass);
}

html[data-theme="dark"] .entry-detail[open] {
  background: rgba(35, 32, 52, 0.80);
}

html[data-theme="dark"] .entry-detail summary {
  color: var(--text-dark);
}

html[data-theme="dark"] .entry-detail-body {
  color: var(--text-mid);
  border-top-color: var(--border-divider);
}

html[data-theme="dark"] .timeline::before {
  background: var(--border-subtle);
}

html[data-theme="dark"] .entry-dot {
  border-color: var(--border-subtle);
  background: var(--surface-card);
}

/* ─────────────────────────────────────
   PROFILE PAGE
   ───────────────────────────────────── */
html[data-theme="dark"] .profile-card {
  background: rgba(30, 27, 44, 0.72) !important;
  border-color: rgba(214, 162, 115, 0.25) !important;
  box-shadow:
    0 0 32px rgba(214, 162, 115, 0.18),
    0 8px 32px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.06) !important;
}

html[data-theme="dark"] .profile-name {
  color: var(--charcoal);
}

html[data-theme="dark"] .profile-handle,
html[data-theme="dark"] .profile-meta {
  color: var(--text-mid);
}

html[data-theme="dark"] .btn-edit {
  background: rgba(255, 255, 255, 0.07);
  border-color: var(--border-glass);
  color: var(--charcoal);
}

html[data-theme="dark"] .btn-edit:hover {
  background: rgba(255, 255, 255, 0.12);
}

html[data-theme="dark"] .stat-block {
  background: rgba(30, 27, 44, 0.65) !important;
  border-color: var(--border-glass) !important;
}

html[data-theme="dark"] .stat-num {
  color: var(--charcoal);
}

html[data-theme="dark"] .stat-desc {
  color: var(--text-mid);
}

/* action cards — base (keeps border, color variants override bg) */
html[data-theme="dark"] .action-card {
  border-color: var(--border-glass) !important;
}

/* Purple variant: Browse Stories, AI Helper */
html[data-theme="dark"] .action-card--purple {
  background: rgba(145, 115, 185, 0.16) !important;
  border-color: rgba(214, 162, 115, 0.28) !important;
}

html[data-theme="dark"] .action-card--purple:hover {
  background: rgba(145, 115, 185, 0.26) !important;
}

/* Featured card: Share Something */
html[data-theme="dark"] .action-card--featured {
  background: linear-gradient(135deg, rgba(110, 85, 155, 0.70), rgba(40, 32, 68, 0.90)) !important;
  border-color: rgba(214, 162, 115, 0.35) !important;
}

html[data-theme="dark"] .action-card--featured:hover {
  background: linear-gradient(135deg, rgba(130, 100, 175, 0.80), rgba(50, 38, 80, 0.95)) !important;
}

/* Peach variant: Edit Profile */
html[data-theme="dark"] .action-card--peach {
  background: rgba(200, 148, 110, 0.14) !important;
  border-color: rgba(210, 165, 130, 0.26) !important;
}

html[data-theme="dark"] .action-card--peach:hover {
  background: rgba(200, 148, 110, 0.24) !important;
}

/* Generic fallback (cards without a color variant) */
html[data-theme="dark"] .action-card:not([class*="action-card--"]) {
  background: rgba(30, 27, 44, 0.65) !important;
}

html[data-theme="dark"] .action-title {
  color: var(--charcoal);
}

html[data-theme="dark"] .action-desc {
  color: var(--text-mid);
}

html[data-theme="dark"] .action-icon {
  background: rgba(255, 255, 255, 0.10) !important;
  color: var(--charcoal);
}

html[data-theme="dark"] .action-arrow {
  color: rgba(255, 255, 255, 0.28);
}

html[data-theme="dark"] .anon-note {
  background: rgba(18, 15, 28, 0.96);
  border-color: var(--border-glass);
  color: var(--text-mid);
}

/* btn-signout stays solid red in dark mode */
html[data-theme="dark"] .btn-signout {
  background: #b03030 !important;
  color: #ffffff !important;
  border: none !important;
}

html[data-theme="dark"] .btn-signout:hover {
  background: #c0392b !important;
  box-shadow: 0 6px 20px rgba(192, 57, 43, 0.40) !important;
}

html[data-theme="dark"] .hero-note {
  color: var(--text-mid);
}

html[data-theme="dark"] .stats-label,
html[data-theme="dark"] .actions-label {
  color: var(--text-light);
}

/* ─────────────────────────────────────
   EDIT PROFILE PAGE
   ───────────────────────────────────── */
html[data-theme="dark"] .edit-card {
  background: rgba(30, 27, 44, 0.72) !important;
  border-color: var(--border-glass) !important;
}

/* input-prefix-wrap: the wrapper around "@username" field has hardcoded white bg */
html[data-theme="dark"] .input-prefix-wrap {
  background: var(--surface-input) !important;
  border-color: var(--border-subtle) !important;
}

html[data-theme="dark"] .input-prefix-wrap:focus-within {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px rgba(184, 166, 212, 0.18) !important;
}

html[data-theme="dark"] .input-prefix {
  color: var(--text-light) !important;
}

html[data-theme="dark"] .card-divider {
  background: var(--border-subtle) !important;
}

html[data-theme="dark"] .field-hint {
  color: var(--text-light) !important;
}

html[data-theme="dark"] .btn-ghost {
  border-color: var(--border-glass) !important;
  color: var(--text-mid) !important;
}

html[data-theme="dark"] .btn-ghost:hover {
  background: rgba(255, 255, 255, 0.05) !important;
  color: var(--text-dark) !important;
}

html[data-theme="dark"] .btn-upload {
  background: rgba(255, 255, 255, 0.07) !important;
  border-color: var(--border-glass) !important;
  color: var(--charcoal);
}

html[data-theme="dark"] .btn-upload:hover {
  background: rgba(255, 255, 255, 0.12) !important;
}

html[data-theme="dark"] .edit-title {
  color: var(--charcoal);
}

html[data-theme="dark"] .edit-sub {
  color: var(--text-mid);
}

html[data-theme="dark"] .card-desc {
  color: var(--text-mid);
}

/* ─────────────────────────────────────
   POST PAGE
   ───────────────────────────────────── */

/* post-screen.css hardcodes background: #ffffff on .post-card */
html[data-theme="dark"] .post-page .post-card,
html[data-theme="dark"] .post-card {
  background: var(--surface-card) !important;
  border-color: var(--border-glass) !important;
}

html[data-theme="dark"] .options-dropdown {
  background: var(--surface-menu) !important;
  border-color: var(--border-glass) !important;
}

html[data-theme="dark"] .options-item {
  color: var(--text-dark);
}

html[data-theme="dark"] .options-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

html[data-theme="dark"] .options-divider {
  background: var(--border-divider);
}

html[data-theme="dark"] .post-body p {
  color: var(--text-mid);
}

html[data-theme="dark"] .comment-card {
  background: rgba(30, 27, 44, 0.65) !important;
  border-color: var(--border-glass) !important;
}

html[data-theme="dark"] .comment-card--reply {
  background: rgba(25, 22, 38, 0.55) !important;
}

html[data-theme="dark"] .comment-input,
html[data-theme="dark"] .compose-textarea {
  background: var(--surface-input) !important;
  border-color: var(--border-subtle) !important;
  color: var(--text-dark) !important;
}

html[data-theme="dark"] .media-upload-btn {
  background: rgba(255, 255, 255, 0.07) !important;
  border-color: var(--border-glass) !important;
  color: var(--text-mid);
}

html[data-theme="dark"] .back-link {
  color: var(--text-mid);
}

html[data-theme="dark"] .back-link:hover {
  color: var(--charcoal);
}

html[data-theme="dark"] .heart-btn {
  color: var(--text-mid);
}

/* post-screen.css hardcodes compose-card background */
html[data-theme="dark"] .compose-card {
  background: rgba(30, 27, 44, 0.72) !important;
  border-color: var(--border-glass) !important;
}

html[data-theme="dark"] .post-title {
  color: var(--charcoal);
}

html[data-theme="dark"] .post-author-name {
  color: var(--text-dark);
}

html[data-theme="dark"] .post-time {
  color: var(--text-light);
}

/* ─────────────────────────────────────
   STARTUP / LOGIN / REGISTER PAGES
   ───────────────────────────────────── */
html[data-theme="dark"] .auth-card,
html[data-theme="dark"] .login-card,
html[data-theme="dark"] .register-card,
html[data-theme="dark"] .form-card {
  background: rgba(30, 27, 44, 0.80) !important;
  border-color: var(--border-glass) !important;
}

html[data-theme="dark"] input[type="text"],
html[data-theme="dark"] input[type="email"],
html[data-theme="dark"] input[type="password"],
html[data-theme="dark"] textarea,
html[data-theme="dark"] select {
  background: var(--surface-input) !important;
  border-color: var(--border-subtle) !important;
  color: var(--text-dark) !important;
}

html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder {
  color: var(--text-light) !important;
}

/* ─────────────────────────────────────
   CREATE POST PAGE
   ───────────────────────────────────── */
html[data-theme="dark"] .card {
  background: rgba(30, 27, 44, 0.72) !important;
  border-color: var(--border-glass) !important;
}

html[data-theme="dark"] .card:focus-within {
  border-color: var(--accent) !important;
}

html[data-theme="dark"] .lang-strip {
  background: rgba(30, 27, 44, 0.65) !important;
  border-color: var(--border-glass) !important;
}

html[data-theme="dark"] .title-input,
html[data-theme="dark"] .content-area {
  background: transparent !important;
  color: var(--charcoal) !important;
}

html[data-theme="dark"] .title-input::placeholder,
html[data-theme="dark"] .content-area::placeholder {
  color: var(--text-light) !important;
}

html[data-theme="dark"] .mode-card {
  background: rgba(30, 27, 44, 0.65) !important;
  border-color: var(--border-glass) !important;
}

html[data-theme="dark"] .mode-card:hover {
  background: rgba(35, 32, 52, 0.90) !important;
}

html[data-theme="dark"] .mode-card.is-selected {
  border-color: var(--accent) !important;
}

html[data-theme="dark"] .field-label {
  color: var(--accent);
}

html[data-theme="dark"] .media-upload-area {
  background: rgba(30, 27, 44, 0.55) !important;
  border-color: var(--border-subtle) !important;
}

html[data-theme="dark"] .btn-cancel {
  background: rgba(255, 255, 255, 0.07) !important;
  border-color: var(--border-glass) !important;
  color: var(--text-dark);
}

html[data-theme="dark"] .rich-editor .ql-toolbar.ql-snow {
  background: rgba(30, 27, 44, 0.80) !important;
  border-color: var(--border-subtle) !important;
}

html[data-theme="dark"] .rich-editor .ql-container.ql-snow {
  background: transparent !important;
  border-color: var(--border-subtle) !important;
}

html[data-theme="dark"] .rich-editor .ql-editor {
  color: var(--text-dark) !important;
}

html[data-theme="dark"] .rich-editor .ql-toolbar.ql-snow .ql-stroke {
  stroke: var(--text-mid);
}

html[data-theme="dark"] .rich-editor .ql-toolbar.ql-snow .ql-fill {
  fill: var(--text-mid);
}

/* ─────────────────────────────────────
   MODERATION ERROR BLOCK (all pages)
   ───────────────────────────────────── */
html[data-theme="dark"] .mod-error {
  color: #f87171 !important;
}

html[data-theme="dark"] .mod-warn,
html[data-theme="dark"] .mod-ban {
  color: rgba(255,255,255,0.40) !important;
}

/* ─────────────────────────────────────
   AI CHAT PAGE
   ───────────────────────────────────── */
html[data-theme="dark"] .chat-bubble--ai {
  background: rgba(30, 27, 44, 0.80) !important;
  border-color: var(--border-glass) !important;
  color: var(--text-dark);
}

html[data-theme="dark"] .chat-input-wrap,
html[data-theme="dark"] .chat-box {
  background: var(--surface-nav) !important;
  border-color: var(--border-nav) !important;
}

/* Chat sidebar */
html[data-theme="dark"] .chat-sidebar {
  background: rgba(20, 17, 30, 0.85) !important;
  border-right-color: var(--border-glass) !important;
}

html[data-theme="dark"] .sidebar-top-area {
  border-bottom-color: var(--border-glass) !important;
}

html[data-theme="dark"] .chat-history-item {
  color: var(--text-mid);
}

html[data-theme="dark"] .chat-history-item:hover {
  background: rgba(255, 255, 255, 0.07) !important;
  color: var(--charcoal);
}

html[data-theme="dark"] .chat-history-item.active {
  background: rgba(255, 255, 255, 0.10) !important;
  color: var(--charcoal);
}

html[data-theme="dark"] .sidebar-empty {
  color: var(--text-light) !important;
}

/* Background words in welcome screen — use light opacity in dark mode */
html[data-theme="dark"] .wb-row {
  color: rgba(255, 255, 255, 0.045) !important;
}

/* Author badge in dark theme */
html[data-theme="dark"] .comment-author-badge {
  color: #c4b5fd !important;
  background: rgba(167, 139, 250, 0.14) !important;
  border-color: rgba(167, 139, 250, 0.30) !important;
}
html[data-theme="dark"] .comment-card--author {
  border-left-color: rgba(167, 139, 250, 0.45) !important;
  background: rgba(167, 139, 250, 0.04) !important;
}

/* ══════════════════════════════════════════════════════
   Startup page (paper + doodle redesign) — dark overrides
   Dark = night-paper: deep warm-charcoal bg, cream ink
   ══════════════════════════════════════════════════════ */
html[data-theme="dark"] body {
  background: #1a1612 !important;
  color: #ede1c8 !important;
}

html[data-theme="dark"] .top-info {
  background: rgba(26, 22, 18, 0.82) !important;
  border-bottom-color: rgba(237, 225, 200, 0.12) !important;
}

html[data-theme="dark"] .logo,
html[data-theme="dark"] .title,
html[data-theme="dark"] .card-section-title,
html[data-theme="dark"] .subtitle,
html[data-theme="dark"] .feature-body h3,
html[data-theme="dark"] .join-title,
html[data-theme="dark"] .footer_logo p,
html[data-theme="dark"] .footer_links h3,
html[data-theme="dark"] .quote-text { color: #ede1c8 !important; }

html[data-theme="dark"] .title em,
html[data-theme="dark"] .subtitle em,
html[data-theme="dark"] .subtitle em::after,
html[data-theme="dark"] .card-section-title em,
html[data-theme="dark"] .join-title em,
html[data-theme="dark"] .quote-text em,
html[data-theme="dark"] .logo::after { color: #e8a87c !important; }

html[data-theme="dark"] .nav-link { color: rgba(237,225,200,0.7) !important; }
html[data-theme="dark"] .nav-link:hover { color: #ede1c8 !important; }
html[data-theme="dark"] .nav-link::after { background: #ede1c8 !important; }
html[data-theme="dark"] .nav-link--stack:last-child {
  background: #ede1c8 !important;
  color: #1a1612 !important;
}
html[data-theme="dark"] .nav-link--stack:last-child:hover {
  background: #e8a87c !important;
  color: #1a1612 !important;
}

html[data-theme="dark"] .hero-meta,
html[data-theme="dark"] .section-eyebrow,
html[data-theme="dark"] .feature-num,
html[data-theme="dark"] .feature-body p,
html[data-theme="dark"] .subtitle-2,
html[data-theme="dark"] .join-description,
html[data-theme="dark"] .quote-cite,
html[data-theme="dark"] .footer_subtitle,
html[data-theme="dark"] .footer_links a,
html[data-theme="dark"] .footer_footer,
html[data-theme="dark"] .scroll-cue { color: rgba(237,225,200,0.6) !important; }

html[data-theme="dark"] .feature-list { border-top-color: rgba(237,225,200,0.18) !important; }
html[data-theme="dark"] .feature-row { border-bottom-color: rgba(237,225,200,0.18) !important; }
html[data-theme="dark"] .feature-row::before { background: rgba(237,225,200,0.05) !important; }
html[data-theme="dark"] .feature-row:hover .feature-body h3 { color: #e8a87c !important; }

html[data-theme="dark"] .feature-tag {
  border-color: rgba(237,225,200,0.18) !important;
  color: rgba(237,225,200,0.55) !important;
  background: rgba(237,225,200,0.03) !important;
}
html[data-theme="dark"] .feature-row:hover .feature-tag {
  border-color: rgba(232,168,124,0.55) !important;
  color: #e8a87c !important;
  background: rgba(232,168,124,0.06) !important;
}

html[data-theme="dark"] .scroll-cue-line::after { background: #e8a87c !important; }

html[data-theme="dark"] .join-bottom { border-top-color: rgba(237,225,200,0.18) !important; }

html[data-theme="dark"] .button_start_1,
html[data-theme="dark"] .join-register {
  background: #ede1c8 !important;
  color: #1a1612 !important;
  box-shadow: 4px 4px 0 0 #e8a87c !important;
}
html[data-theme="dark"] .button_start_1:hover,
html[data-theme="dark"] .join-register:hover {
  background: #f7eed5 !important;
  box-shadow: 6px 6px 0 0 #e8a87c !important;
}

html[data-theme="dark"] .button_start_2 {
  color: #ede1c8 !important;
  border-color: rgba(237,225,200,0.45) !important;
  background: transparent !important;
}
html[data-theme="dark"] .button_start_2:hover {
  background: #ede1c8 !important;
  color: #1a1612 !important;
  border-color: #ede1c8 !important;
}

/* Stamp band inverts in dark — paper bar over ink page */
html[data-theme="dark"] .stamp-band {
  background: #ede1c8 !important;
  color: #1a1612 !important;
  border-top-color: #ede1c8 !important;
  border-bottom-color: #ede1c8 !important;
}
html[data-theme="dark"] .stamp-track .stamp-sep { color: #d6533c !important; }

/* Quote band */
html[data-theme="dark"] .quote-band {
  background: rgba(237,225,200,0.04) !important;
  border-top-color: rgba(237,225,200,0.10) !important;
  border-bottom-color: rgba(237,225,200,0.10) !important;
}

/* Doodles glow in cream */
html[data-theme="dark"] .doodle { color: #ede1c8 !important; }
html[data-theme="dark"] .doodle--accent { color: #e8a87c !important; }
html[data-theme="dark"] .doodle--ochre  { color: #d4a06a !important; }
html[data-theme="dark"] .doodle--sage   { color: #9bb39a !important; }

/* Background marquee words — slightly visible cream */
html[data-theme="dark"] .row { color: rgba(237,225,200,0.045) !important; }

/* Footer */
html[data-theme="dark"] .footer {
  background: #15110e !important;
  border-top-color: rgba(237,225,200,0.18) !important;
}
html[data-theme="dark"] .footer_links a:hover,
html[data-theme="dark"] .footer_social a:hover { color: #e8a87c !important; }
html[data-theme="dark"] .footer_footer { border-top-color: rgba(237,225,200,0.10) !important; }

/* Subtitle squiggle underline — repaint to warm in dark */
html[data-theme="dark"] .subtitle em::after {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 14' preserveAspectRatio='none'><path d='M2 8 Q 30 2, 60 6 T 120 7 T 198 5' fill='none' stroke='%23e8a87c' stroke-width='2.4' stroke-linecap='round'/></svg>") !important;
}

/* ══════════════════════════════════════════════════════
   Inline-style overrides for main.html / post.html.
   Both pages embed page-specific <style> blocks with
   `!important` cream backgrounds (`#fffbf2`, rgba(255,250,240,...))
   that beat the cascade. Match every one with an equally
   forceful warm-dark surface so the page stops looking like
   half-light / half-dark.
   ══════════════════════════════════════════════════════ */

/* — Filter panel container — */
html[data-theme="dark"] .filter-panel {
  background: var(--surface-card) !important;
  border-color: var(--border-glass) !important;
}

/* — Search bar — */
html[data-theme="dark"] .search-bar {
  background: var(--surface-input) !important;
  border-color: var(--border-subtle) !important;
}
html[data-theme="dark"] .search-input {
  background: transparent !important;
  color: var(--text-dark) !important;
}
html[data-theme="dark"] .search-input::placeholder {
  color: var(--text-light) !important;
}

/* — Language pills — */
html[data-theme="dark"] .lang-pill {
  background: var(--surface-input) !important;
  border-color: var(--border-subtle) !important;
  color: var(--text-dark) !important;
}
html[data-theme="dark"] .lang-pill:hover {
  background: var(--surface-input) !important;
  border-color: var(--accent-2) !important;
  color: var(--accent-2) !important;
}
html[data-theme="dark"] .lang-pill.pill-active,
html[data-theme="dark"] .lang-item input:checked + .lang-pill {
  background: var(--accent-2) !important;
  color: #fff !important;
  border-color: var(--accent-2) !important;
}
html[data-theme="dark"] .lang-select-other {
  background: var(--surface-input) !important;
  border-color: var(--border-subtle) !important;
  color: var(--text-mid) !important;
}

/* — Support-type / mode pills — */
html[data-theme="dark"] .support-pill,
html[data-theme="dark"] .mode-pill,
html[data-theme="dark"] .pill,
html[data-theme="dark"] .filter-pill {
  background: var(--surface-input) !important;
  border-color: var(--border-subtle) !important;
  color: var(--text-dark) !important;
}

/* — Sort dropdown / native select — */
html[data-theme="dark"] .sort-select,
html[data-theme="dark"] .filter-select,
html[data-theme="dark"] select {
  background: var(--surface-input) !important;
  border-color: var(--border-subtle) !important;
  color: var(--text-dark) !important;
}

/* — Filter / refresh top buttons — */
html[data-theme="dark"] .button-icon,
html[data-theme="dark"] .feed-action-btn {
  background: var(--surface-card) !important;
  border-color: var(--border-glass) !important;
  color: var(--text-dark) !important;
}

/* — Post three-dot menu (the small dropdown opened from ⋯) — */
html[data-theme="dark"] .main-menu-panel,
html[data-theme="dark"] .post-menu-down,
html[data-theme="dark"] .post-menu,
html[data-theme="dark"] .pmenu,
html[data-theme="dark"] [class*="post-menu"] {
  background: var(--surface-menu) !important;
  border-color: var(--border-glass) !important;
}
html[data-theme="dark"] .post-menu-trigger,
html[data-theme="dark"] .post-menu-button {
  background: var(--surface-card) !important;
  color: var(--text-dark) !important;
}

/* — Reply / comment-compose form on post page — */
html[data-theme="dark"] .reply-form,
html[data-theme="dark"] .comment-form,
html[data-theme="dark"] .ql-container,
html[data-theme="dark"] .ql-editor,
html[data-theme="dark"] .reply-box,
html[data-theme="dark"] .comment-compose,
html[data-theme="dark"] .post-reply {
  background: var(--surface-card) !important;
  color: var(--text-dark) !important;
  border-color: var(--border-glass) !important;
}
html[data-theme="dark"] .ql-toolbar {
  background: var(--surface-input) !important;
  border-color: var(--border-subtle) !important;
}
html[data-theme="dark"] .ql-editor.ql-blank::before {
  color: var(--text-light) !important;
}

/* — Stats numbers in "This Week" widget were already correct,
     but reinforce so they don't tint red against the dark bg — */
html[data-theme="dark"] .statistic-value,
html[data-theme="dark"] .stat-value {
  color: var(--charcoal) !important;
}

/* — "0 responses" / comment count near bottom of post page — */
html[data-theme="dark"] .comment-count,
html[data-theme="dark"] .responses-count,
html[data-theme="dark"] .replies-count {
  color: var(--text-mid) !important;
}

/* ══════════════════════════════════════════════════════
   "Show more stories" load-more button — main.html inline
   sets it to cream #fffbf2; override.
   ══════════════════════════════════════════════════════ */
html[data-theme="dark"] .feed-load-more-btn {
  background: var(--surface-card) !important;
  color: var(--text-dark) !important;
  border-color: var(--border-glass) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.30) !important;
}
html[data-theme="dark"] .feed-load-more-btn:hover {
  border-color: var(--accent-2) !important;
  color: var(--accent-2) !important;
}

/* ══════════════════════════════════════════════════════
   Post three-dot trigger button — main-screen.css uses
   `background: none !important` but the global .button-icon
   dark override painted it. Force transparent for triggers.
   ══════════════════════════════════════════════════════ */
html[data-theme="dark"] .button-icon.post-menu-trigger,
html[data-theme="dark"] .post-menu-trigger {
  background: transparent !important;
  border-color: transparent !important;
  color: var(--text-dark) !important;
}
html[data-theme="dark"] .button-icon.post-menu-trigger:hover,
html[data-theme="dark"] .post-menu-trigger:hover {
  background: rgba(255, 240, 220, 0.06) !important;
  color: var(--charcoal) !important;
}

/* ══════════════════════════════════════════════════════
   Toast (Link copied) — main-screen.css has light bg,
   needs dark surface so the warm cream text reads.
   ══════════════════════════════════════════════════════ */
html[data-theme="dark"] .toast {
  background: var(--surface-menu) !important;
  color: var(--text-dark) !important;
  border: 1px solid var(--border-glass) !important;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.55) !important;
}

/* ══════════════════════════════════════════════════════
   Reply / submit button on post page — was cream in dark.
   ══════════════════════════════════════════════════════ */
html[data-theme="dark"] .btn-reply,
html[data-theme="dark"] .reply-submit,
html[data-theme="dark"] .btn-publish,
html[data-theme="dark"] .post-reply-submit {
  background: var(--charcoal) !important;
  color: #1a1612 !important;
  border: none !important;
}
html[data-theme="dark"] .btn-reply:hover,
html[data-theme="dark"] .reply-submit:hover,
html[data-theme="dark"] .post-reply-submit:hover {
  background: var(--accent-2) !important;
  color: #fff !important;
}

/* ══════════════════════════════════════════════════════
   Contacts page — .ct-card uses var(--paper-soft).
   Light-theme path doesn't define --paper-soft anywhere
   loaded by contacts.html, but the variable inversion in
   :root above should now feed it. Belt-and-braces:
   force a dark surface so the cream-on-cream issue can't
   recur. Same for the rest of contact-specific tokens.
   ══════════════════════════════════════════════════════ */
html[data-theme="dark"] .ct-card,
html[data-theme="dark"] .ct-hero-card,
html[data-theme="dark"] .ct-faq {
  background: var(--surface-card) !important;
  border-color: var(--border-glass) !important;
}
html[data-theme="dark"] .ct-card-icon {
  background: rgba(255, 240, 220, 0.06) !important;
  color: var(--text-mid) !important;
}
html[data-theme="dark"] .ct-card-value {
  color: var(--charcoal) !important;
}
html[data-theme="dark"] .ct-card-desc {
  color: var(--text-mid) !important;
}
html[data-theme="dark"] .ct-card-label,
html[data-theme="dark"] .ct-card-arrow {
  color: var(--text-light) !important;
}

/* ══════════════════════════════════════════════════════
   Hamburger menu trigger.
   Light theme: `background: var(--ink)` with `color: var(--paper)` —
   dark pill, cream icon. After the --ink/--paper inversion above,
   the bg flipped to cream and icon to dark. Force a dark warm pill
   with cream icon to keep the intended look.
   ══════════════════════════════════════════════════════ */
html[data-theme="dark"] .main-menu-trigger {
  background: #2a221c !important;
  color: var(--charcoal) !important;
}
html[data-theme="dark"] .main-menu-trigger:hover {
  background: var(--accent-2) !important;
}
html[data-theme="dark"] .main-menu-trigger .icon {
  color: var(--charcoal) !important;
}

/* ══════════════════════════════════════════════════════
   About page — paper cards. The inline <style> uses
   `var(--paper-soft)` everywhere; the global inversion
   should already feed it, but inline rules at end of cascade
   can win in odd situations (caching, specificity). Pin
   them explicitly.
   ══════════════════════════════════════════════════════ */
html[data-theme="dark"] .ab-hero-card,
html[data-theme="dark"] .ab-pull-quote,
html[data-theme="dark"] .ab-quote,
html[data-theme="dark"] .ab-section-card,
html[data-theme="dark"] .ab-feature-card,
html[data-theme="dark"] .ab-paper-note {
  background: var(--surface-card) !important;
  border-color: var(--border-glass) !important;
  box-shadow: 0 14px 36px -18px rgba(0, 0, 0, 0.55) !important;
}

/* ══════════════════════════════════════════════════════
   Create-post sidebar widgets — same family as main feed
   widgets. Used inline styles also painted cream.
   ══════════════════════════════════════════════════════ */
html[data-theme="dark"] .cp-widget,
html[data-theme="dark"] .cp-side-widget,
html[data-theme="dark"] .cp-tips {
  background: var(--surface-card) !important;
  border-color: var(--border-glass) !important;
  color: var(--text-dark) !important;
}
html[data-theme="dark"] .cp-widget-title {
  color: var(--charcoal) !important;
}
html[data-theme="dark"] .cp-widget-list li {
  color: var(--text-mid) !important;
  border-bottom-color: var(--border-subtle) !important;
}
html[data-theme="dark"] .cp-widget-link,
html[data-theme="dark"] .cp-widget-foot {
  color: var(--text-mid) !important;
}
html[data-theme="dark"] .cp-widget-link:hover,
html[data-theme="dark"] .cp-widget-foot:hover {
  color: var(--accent-2) !important;
}

/* ══════════════════════════════════════════════════════
   Post-page reply form — extra coverage for any wrapper
   classes used around the Quill editor.
   ══════════════════════════════════════════════════════ */
html[data-theme="dark"] .post-reply-card,
html[data-theme="dark"] .reply-card,
html[data-theme="dark"] .comment-card,
html[data-theme="dark"] .post-comment {
  background: var(--surface-card) !important;
  border-color: var(--border-glass) !important;
}

/* ══════════════════════════════════════════════════════
   Post-page reply compose card.
   post-screen.css defines a local `:root { --paper-soft:#fffaf0 }`
   so the card looks cream in dark mode. Pin background directly.
   ══════════════════════════════════════════════════════ */
html[data-theme="dark"] .compose-card {
  background: var(--surface-card) !important;
  border-color: var(--border-glass) !important;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45) !important;
}
html[data-theme="dark"] .compose-label {
  color: var(--charcoal) !important;
}
html[data-theme="dark"] .compose-note {
  color: var(--text-light) !important;
}
html[data-theme="dark"] .compose-submit {
  background: var(--charcoal) !important;
  color: #1a1612 !important;
  border-color: transparent !important;
}

/* ══════════════════════════════════════════════════════
   Main feed filter panel wrappers — there's an inner
   container that also paints a cream/purple bg in some
   pages. Pin both layers explicitly.
   ══════════════════════════════════════════════════════ */
html[data-theme="dark"] .filter-panel,
html[data-theme="dark"] .filters-container,
html[data-theme="dark"] .filters-wrap {
  background: var(--surface-card) !important;
  border-color: var(--border-glass) !important;
}

/* ══════════════════════════════════════════════════════
   Create-post chips & pills.
   The inline <style> uses `background: #fffbf2; color: var(--ink)`,
   and after the --ink inversion --ink is now cream → cream text
   on cream pill = invisible. Pin both bg and text in dark mode.
   ══════════════════════════════════════════════════════ */
html[data-theme="dark"] .cp-lang-pill,
html[data-theme="dark"] .cp-topic-chip,
html[data-theme="dark"] .cp-lang-other {
  background: var(--surface-input) !important;
  border-color: var(--border-subtle) !important;
  color: var(--text-dark) !important;
}
html[data-theme="dark"] .cp-lang-pill:hover,
html[data-theme="dark"] .cp-topic-chip:hover,
html[data-theme="dark"] .cp-lang-other:hover {
  border-color: var(--accent-2) !important;
  color: var(--accent-2) !important;
}
/* Selected / active state — force the colored fill so the active
   pill is clearly distinguishable from the inactive ones. */
html[data-theme="dark"] .cp-lang-item input:checked + .cp-lang-pill {
  background: var(--accent-2) !important;
  border-color: var(--accent-2) !important;
  color: #fff !important;
  box-shadow: 0 3px 12px -3px rgba(214, 83, 60, 0.55) !important;
}
html[data-theme="dark"] .cp-topic-input:checked + .cp-topic-chip {
  background: var(--chip-color, var(--accent-2)) !important;
  border-color: var(--chip-color, var(--accent-2)) !important;
  color: #fff !important;
}
/* Same for the main feed filter language pills (.lang-pill) — the
   active state was disappearing into the dark surface. */
html[data-theme="dark"] .lang-pill.pill-active,
html[data-theme="dark"] .lang-item input:checked + .lang-pill {
  background: var(--accent-2) !important;
  border-color: var(--accent-2) !important;
  color: #fff !important;
  box-shadow: 0 3px 12px -3px rgba(214, 83, 60, 0.55) !important;
}

/* ══════════════════════════════════════════════════════
   Crisis Hotlines button — `.widget-link` has literal
   `color: #fff` in the light theme, but reports of gray
   text suggest something cascades. Pin pure white.
   ══════════════════════════════════════════════════════ */
html[data-theme="dark"] .widget-link {
  color: #fff !important;
}
html[data-theme="dark"] .widget-link svg {
  color: #fff !important;
}

/* ══════════════════════════════════════════════════════
   Profile page — Anonymity callout + read-more cards.
   .pf-anon uses var(--paper-soft); inversion should feed it,
   but caching/specificity can lose. Pin explicitly.
   ══════════════════════════════════════════════════════ */
html[data-theme="dark"] .pf-anon,
html[data-theme="dark"] .pf-card,
html[data-theme="dark"] .pf-stat-card,
html[data-theme="dark"] .pf-doc-card {
  background: var(--surface-card) !important;
  border-color: var(--border-glass) !important;
}
html[data-theme="dark"] .pf-anon-title,
html[data-theme="dark"] .pf-anon-link {
  color: var(--charcoal) !important;
}
html[data-theme="dark"] .pf-anon-title em {
  color: var(--accent-2) !important;
}
html[data-theme="dark"] .pf-anon-text,
html[data-theme="dark"] .pf-doc-card-desc {
  color: var(--text-mid) !important;
}

/* "read more" cards row at the bottom — same family across pages */
html[data-theme="dark"] .ab-read-more-card,
html[data-theme="dark"] .ab-doc-card,
html[data-theme="dark"] .pf-doc-card,
html[data-theme="dark"] .read-more-card,
html[data-theme="dark"] .doc-card,
html[data-theme="dark"] .doc-link-card {
  background: var(--surface-card) !important;
  border-color: var(--border-glass) !important;
}

/* ══════════════════════════════════════════════════════
   Main feed Crisis Hotlines widget — `.widget.support` only,
   NOT `.widget.support.ai` (AI is a different widget that
   shares the `support` class but should look neutral).
   Use :not(.ai) so the AI variant keeps the standard surface.
   ══════════════════════════════════════════════════════ */
html[data-theme="dark"] .widget.support:not(.ai),
html[data-theme="dark"] .right-sticky .widget.support:not(.ai),
html[data-theme="dark"] .right-sticky.is-floating .widget.support:not(.ai) {
  background: rgba(214, 83, 60, 0.12) !important;
  border-color: rgba(214, 83, 60, 0.32) !important;
}
/* Make absolutely sure the AI variant uses the neutral surface,
   no red border bleeding in from the .support rule above. */
html[data-theme="dark"] .widget.support.ai {
  background: var(--surface-card) !important;
  border-color: var(--border-glass) !important;
}

/* ══════════════════════════════════════════════════════
   Background doodles fix.
   In light mode .pg-doodle uses `mix-blend-mode: multiply`
   so the brown PNG darkens against the paper bg. On dark
   bg, multiply = invisible (dark on dark). Switch to
   `screen` so the doodle lightens against the dark bg,
   and bump opacity so it's actually noticeable.
   ══════════════════════════════════════════════════════ */
html[data-theme="dark"] .pg-doodle {
  mix-blend-mode: screen;
  opacity: 0.14;
  filter: brightness(1.4);
}
