/*
 * Muted.News — public Material 3 editorial palette.
 * Public pages only: navy, cobalt blue, cloud surfaces and restrained gold.
 * Paint properties only: layout, typography and density stay in their own sheets.
 */
:root {
  /* Material 3 semantic tokens for PUBLIC pages only. Admin has a separate layout and CSS. */
  --md-sys-color-primary: #CFE2FF;
  --md-sys-color-on-primary: #0F172A;
  --md-sys-color-primary-container: #F1F5F9;
  --md-sys-color-on-primary-container: #0F172A;
  --md-sys-color-secondary: #1E293B;
  --md-sys-color-on-secondary: #F8FAFC;
  --md-sys-color-surface: #FFFFFF;
  --md-sys-color-surface-container-low: #F1F5F9;
  --md-sys-color-surface-container: #F1F5F9;
  --md-sys-color-surface-container-high: #F1F5F9;
  --md-sys-color-on-surface: #0F172A;
  --md-sys-color-on-surface-variant: #475569;
  --md-sys-color-outline: #CBD5E1;
  --md-sys-color-outline-variant: #CBD5E1;
  --md-sys-color-error: #9F1239;
  --md-sys-color-on-error: #FFFFFF;

  /* Legacy aliases consumed by the existing public layout sheets. */
  --brand-primary: #CFE2FF;
  --brand-secondary: #1E293B;
  --page-background: #F8FAFC;
  --surface-primary: #FFFFFF;
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --border-color: #CBD5E1;
  --surface-soft: #F1F5F9;
  --surface-container: #F1F5F9;
  --breaking-news: #9F1239;
  --text-on-primary: #0F172A;
  --radius-card: 14px;
  --shadow-card: 0 4px 14px rgba(20, 38, 61, 0.07);
  --shadow-card-hover: 0 6px 18px rgba(20, 38, 61, 0.10);

  /* Compatibility aliases used by the approved, layout-only stylesheets. */
  --ink: var(--text-primary);
  --muted: var(--text-secondary);
  --paper: var(--page-background);
  --card: var(--surface-primary);
  --line: var(--border-color);
  --blue: var(--brand-primary);
  --blue-dark: var(--brand-secondary);
  --orange: #CFE2FF;
  --teal: var(--brand-primary);
  --shade: var(--surface-soft);
  --shadow: var(--shadow-card);

  --accent: #CFE2FF;
  --accent-ink: #0F172A;
  --accent-border: #CBD5E1;
  --on-brand: var(--text-on-primary);
  --on-brand-muted: #475569;
  --brand-text: var(--text-primary);
  --brand-line: var(--brand-secondary);
  --link: var(--brand-secondary);
  --hover-surface: #F1F5F9;
  --soft-surface: var(--surface-soft);
  --focus: #475569;
}

body.dark {
  --md-sys-color-primary: #CFE2FF;
  --md-sys-color-on-primary: #0F172A;
  --md-sys-color-primary-container: #334155;
  --md-sys-color-on-primary-container: #F8FAFC;
  --md-sys-color-secondary: #334155;
  --md-sys-color-on-secondary: #F8FAFC;
  --md-sys-color-surface: #1E293B;
  --md-sys-color-surface-container-low: #1E293B;
  --md-sys-color-surface-container: #334155;
  --md-sys-color-surface-container-high: #334155;
  --md-sys-color-on-surface: #F8FAFC;
  --md-sys-color-on-surface-variant: #CBD5E1;
  --md-sys-color-outline: #475569;
  --md-sys-color-outline-variant: #475569;
  --md-sys-color-error: #9F1239;
  --md-sys-color-on-error: #FFFFFF;

  --ink: #F8FAFC;
  --muted: #CBD5E1;
  --paper: #0F172A;
  --card: #1E293B;
  --line: #475569;
  --brand-primary: #CFE2FF;
  --brand-secondary: #334155;
  --blue: var(--brand-primary);
  --blue-dark: #0F172A;
  --orange: #CFE2FF;
  --teal: var(--brand-secondary);
  --shade: #334155;
  --surface-container: #334155;
  --shadow: 0 4px 14px rgba(0, 0, 0, .22);

  --accent: #CFE2FF;
  --accent-ink: #0F172A;
  --accent-border: #475569;
  --on-brand: #F8FAFC;
  --on-brand-muted: #CBD5E1;
  --brand-text: #F8FAFC;
  --brand-line: #475569;
  --link: #CFE2FF;
  --hover-surface: #334155;
  --soft-surface: #334155;
  --focus: #B8D4F4;
}

/* Normalize paint-only exceptions from the legacy public palette. */
.comment-banner { background: var(--surface-soft); color: var(--text-primary); border-color: var(--border-color); }
.text-news-row:hover, .dark .text-news-row:hover { background: var(--surface-soft); }
.newsletter-panel, .more-button, .channel-link, .primary-button { background: var(--brand-primary); color: var(--text-on-primary); border-radius: var(--radius-card); }
.newsletter-panel button { background: var(--accent); color: var(--accent-ink); }
.newsletter-panel button:hover, .primary-button:hover, .channel-link:hover { background: var(--brand-secondary); color: var(--md-sys-color-on-secondary); }
.standards-strip, .comment-banner, .article-view .article-source-box, .article-view .article-share-box { background: var(--surface-soft); }
.source-rfi, .source-dw, .source-voa, .source-iw { background: var(--brand-secondary); color: var(--md-sys-color-on-secondary); }
.author-avatar, .avatar-b, .avatar-c, .avatar-d { background: var(--brand-secondary); color: var(--md-sys-color-on-secondary); }
.primary-button { border-color: var(--brand-primary); }
.visual-thumb:after, .video-thumb:after { background: linear-gradient(135deg, rgba(15,23,42,.08), rgba(207,226,255,.16)); }
.thumb-city, .thumb-portrait, .thumb-studio, .thumb-street,
.video-a, .video-b, .video-c, .muted-a, .muted-b, .muted-c {
  background: linear-gradient(125deg, var(--brand-primary) 0 35%, var(--brand-secondary) 36% 65%, var(--surface-soft) 66%);
}
.breaking-news, [data-breaking-news="true"] { background: var(--breaking-news); color: #FFFFFF; }
.main-nav a.active:after, .dot { background-color: var(--accent); }
.column-title { border-color: var(--brand-primary); }
.more-button:hover { background: var(--brand-secondary); }
.text-news-row, .compact-list, .source-feed, .author-list, .rank-list, .feed-grid, .special-card, .video-grid { border-color: var(--border-color); }
.newsletter-panel { box-shadow: var(--shadow-card); }
.site-footer { background: var(--brand-primary); color: var(--text-on-primary); border-color: var(--brand-secondary); }
.site-footer p, .footer-links { color: var(--text-on-primary); }
.footer-links a:hover { color: var(--accent); }

.utility-bar,
.main-nav,
.newsletter-panel {
  color: var(--on-brand);
}

.utility-links a:hover,
.main-nav a.active,
.main-nav a:hover {
  color: var(--accent);
}

.brand-lockup strong,
.editorial-signature strong,
.dark .editorial-signature strong,
.footer-brand {
  color: var(--brand-text);
}

.brand-lockup strong span,
.footer-brand span {
  color: var(--orange);
}

.brand-symbol,
.special-badge,
.newsletter-panel button,
.primary-button,
.channel-link {
  background: var(--accent);
  color: var(--accent-ink);
}

.main-nav a.active:after,
.dot {
  background-color: var(--accent);
}

.dot {
  background-color: transparent;
  color: var(--accent);
}

.main-nav a,
.column-title em,
.search-box input::placeholder,
.newsletter-panel p,
.newsletter-panel small {
  color: var(--on-brand-muted);
}

.search-box,
.search-box input {
  color: var(--on-brand);
  border-color: var(--brand-line);
}

.column-title {
  background: var(--blue);
  color: var(--on-brand);
  border-color: var(--brand-line);
}

.lead-text {
  border-color: var(--line);
  border-top-color: var(--blue);
}

.row-arrow,
.trust-points span {
  color: var(--link);
}

.trust-points span {
  border-color: var(--accent-border);
}

.more-button {
  background: var(--teal);
  color: var(--on-brand);
  border-color: var(--brand-line);
}

.more-button:hover {
  background: var(--blue-dark);
}

.channel-link:hover,
.newsletter-panel button:hover,
.primary-button:hover {
  background: var(--on-brand);
  color: var(--blue-dark);
}

.newsletter-panel input {
  background: var(--card);
  color: var(--ink);
}

.newsletter-panel input::placeholder {
  color: var(--muted);
}

.comment-banner,
.standards-strip,
.dark .standards-strip {
  background: var(--soft-surface);
  color: var(--ink);
  border-color: var(--accent-border);
}

.standards-strip .section-label {
  color: var(--orange);
}

.text-news-row:hover,
.dark .text-news-row:hover {
  background: var(--hover-surface);
}

.author-avatar {
  background: #334155;
  color: #FFFFFF;
}

.avatar-b {
  background: #1E293B;
}

.avatar-c {
  background: #475569;
}

.avatar-d {
  background: #475569;
}

.source-feed-row b,
.world-source {
  background: var(--blue);
  color: var(--on-brand);
}

/* Source badges retain distinct source colours. */
.source-rfi { background: #a93443; }
.source-dw { background: #325c71; }
.source-voa { background: #334155; }
.source-iw { background: #77514e; }

.visual-thumb:after {
  background: linear-gradient(135deg, rgba(15, 23, 42, .08), rgba(207, 226, 255, .14));
}

.thumb-city {
  background: linear-gradient(125deg, #1E293B 0 28%, #475569 29% 48%, #B8D4F4 49% 68%, #334155 69%);
}

.thumb-portrait {
  background: radial-gradient(circle at 32% 45%, #CBD5E1 0 14%, transparent 15%), linear-gradient(120deg, #1E293B 0 38%, #475569 39% 65%, #F1F5F9 66%);
}

.thumb-studio {
  background: linear-gradient(120deg, #1E293B 0 35%, #475569 36% 62%, #334155 63%);
}

.thumb-street {
  background: linear-gradient(135deg, #475569 0 27%, #B8D4F4 28% 58%, #334155 59%);
}

.video-a, .muted-a {
  background: linear-gradient(135deg, #1E293B 0 35%, #B8D4F4 36% 61%, #334155 62%);
}

.video-b, .muted-b {
  background: linear-gradient(135deg, #334155 0 34%, #B8D4F4 35% 64%, #F1F5F9 65%);
}

.video-c, .muted-c {
  background: linear-gradient(135deg, #475569 0 38%, #B8D4F4 39% 57%, #1E293B 58%);
}

.muted-videos .video-thumb {
  border-color: var(--brand-line);
}

.muted-videos .video-thumb > .channel-mark {
  background: rgba(15, 23, 42, .88);
  color: #FFFFFF;
}

.toast {
  background: var(--blue-dark);
  color: var(--on-brand);
}

.annotatable:hover {
  box-shadow: 0 0 0 2px rgba(207, 226, 255, .25), var(--shadow);
}

.comment-mode .annotatable:hover {
  box-shadow: 0 0 0 3px var(--focus), var(--shadow);
}

.annotated {
  box-shadow: 0 0 0 3px var(--link), var(--shadow) !important;
}

.comment-dialog::backdrop,
.drawer-backdrop {
  background: rgba(15, 23, 42, .55);
}

:focus-visible {
  outline-color: var(--focus);
}

input, textarea {
  caret-color: var(--link);
}

::selection {
  background: var(--accent);
  color: var(--accent-ink);
}

.site-language-switcher {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  white-space: nowrap;
  font-size: 10px;
}

.site-language-switcher a {
  color: inherit;
  opacity: .78;
}

.site-language-switcher a[aria-current="page"],
.site-language-switcher a:hover {
  opacity: 1;
  text-decoration: underline;
  text-underline-offset: 3px;
}

@media (max-width: 650px) {
  .site-language-switcher { margin-inline-start: auto; }
}

/* Keep the approved column and header positions when the content language is LTR. */
html[dir="ltr"] .front-grid,
html[dir="ltr"] .article-view .article-layout,
html[dir="ltr"] .masthead-inner,
html[dir="ltr"] .main-nav .nav-inner,
html[dir="ltr"] .footer-inner {
  direction: rtl;
}

html[dir="ltr"] .front-grid > *,
html[dir="ltr"] .article-view .article-layout > *,
html[dir="ltr"] .masthead-inner > *,
html[dir="ltr"] .main-nav .nav-inner > *,
html[dir="ltr"] .footer-inner > * {
  direction: ltr;
  text-align: left;
}
