/* EllasNews article dark-mode pairing 2026-11-17 (consolidated, round 3)
   Fixes BOTH reported classes on WP article pages with the WS6 portal chrome:
   (1) legacy prefers-color-scheme guard: on OS-dark machines the guard
       html:not(.light-mode) body:not(.light-mode):not(.dark-mode) re-paints
       BODY with LIGHT tokens (guard checks body classes; boot sets theme class
       on html) — ink title/body on midnight background (1.07:1). The body is
       NOT classless: it carries .en-portal + .wp-singular etc. Scope the same
       tokens to html.dark as a stronger, later override.
   (2) link contrast (#0d5eaf 2.8:1 on midnight) -> #6db3ee (8.1:1).
   New filename 20261117f = cache-bust (en-asset serves immutable 1y). */

/* --- (1) dark token block, must win over every body-level guard --- */
html.dark,
html.dark body,
body.dark-mode,
body.en-portal {
  --color-text: #ece8de;
  --color-text-light: #c5c0b4;
  --color-muted: #9a968c;
  --color-border: rgba(236, 232, 222, 0.18);
  --color-border-strong: rgba(236, 232, 222, 0.42);
  --color-bg: #0f151e;
  --color-card: #161e29;
  --color-header-bg: #070c13;
  --color-paper2: #161e29;
  --color-cream: #0f151e;
  --color-navy: #0b2038;
  color-scheme: dark;
}

html.light,
html.light body,
body.light-mode,
body:not(.dark-mode):not(.en-portal) {
  --color-text: #101c2c;
  --color-text-light: #4a5568;
  --color-muted: #8a8f98;
  --color-border: rgba(16, 28, 44, 0.16);
  --color-border-strong: rgba(16, 28, 44, 0.4);
  --color-bg: #f5f1e8;
  --color-card: #faf8f1;
  --color-header-bg: #0a1522;
  --color-paper2: #ede7d9;
  --color-cream: #f5f1e8;
  --color-navy: #082d4f;
  color-scheme: light;
}

body {
  background: var(--color-bg) !important;
  color: var(--color-text) !important;
}
.en-home {
  background: rgb(var(--paper-rgb));
  color: rgb(var(--ink-rgb));
}
html.dark .en-home {
  background: var(--color-bg);
  color: var(--color-text);
}

/* neutralize the legacy OS-dark guard remnants inside the article */
html.dark .single-article__content p,
html.dark .single-article__title,
html.dark .single-article__content h2,
html.dark .single-article__content h3 {
  color: var(--color-text);
}
html.dark .single-article__subheadline {
  color: var(--color-text-light);
}
html.dark .single-article__meta {
  color: var(--color-muted);
}

/* --- (2) link contrast on dark backgrounds --- */
html.dark .single-article__content a,
html.dark .single-article__sources a,
body.dark-mode .single-article__content a,
body.dark-mode .single-article__sources a {
  color: #6db3ee;
}
html.dark .single-article__content a:hover,
body.dark-mode .single-article__content a:hover {
  color: #c5c0b4;
}
html.dark .single-article__meta a,
body.dark-mode .single-article__meta a {
  color: var(--color-text-light, #c5c0b4);
}
html.dark .article-card__title a:hover,
body.dark-mode .article-card__title a:hover {
  color: #6db3ee;
}

/* --- (3) surgical override of the legacy OS-dark guard (round 5) ---
   The 29/10 guard below has specificity (0,3,2) and matches BODY on OS-dark
   machines (body never receives the classes it checks — boot toggles html).
   Same selector + dark tokens one sheet later = wins exactly when the user
   (or the boot JS) chose dark. JS-off (no class on html) keeps light. */
@media (prefers-color-scheme: dark) {
  html.dark body:not(.light-mode):not(.dark-mode) {
    --color-text: #ece8de;
    --color-text-light: #c5c0b4;
    --color-muted: #9a968c;
    --color-border: rgba(236, 232, 222, 0.18);
    --color-border-strong: rgba(236, 232, 222, 0.42);
    --color-bg: #0f151e;
    --color-card: #161e29;
    --color-header-bg: #070c13;
    --color-paper2: #161e29;
    --color-cream: #0f151e;
    --color-navy: #0b2038;
  }
}
