/*
Theme Name: Radar Mundial
Theme URI: https://radarmundial.com.br
Author: Radar Mundial (Especialista em Sites)
Description: Tema do portal de notícias trilíngue Radar Mundial — paleta navy/papel/âmbar, cards com localidade, ofertas rotativas (ML + Amazon), disclosure de afiliado, 3 idiomas (Polylang), WCAG AA.
Version: 1.0.0
Requires at least: 6.0
Requires PHP: 7.4
License: GNU General Public License v2 or later
Text Domain: radar-mundial
*/

/* ============================================================
   TOKENS — Radar Mundial
   navy #0B2545 · paper #F7F6F2 · amber #F59E0B (comercial only)
   ============================================================ */
:root {
  --rm-ink: #0b2545;
  --rm-blue: #1e5aa8;
  --rm-paper: #f7f6f2;
  --rm-white: #ffffff;
  --rm-amber: #f59e0b;
  --rm-amber-ink: #1a202c;
  --rm-red: #b03a2e;
  --rm-green: #2f855a;
  --rm-text: #1f2937;
  --rm-text-2: #4b5563;
  --rm-text-3: #6b7280;
  --rm-border: #e5e7eb;
  --rm-ad-bg: #f3f4f6;
  --rm-ad-border: #d1d5db;
  --rm-font-serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --rm-font-sans: 'Source Sans 3', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --rm-container: 1200px;
  --rm-surface: #ffffff;   /* fundo de cards/superfícies claras */
  --rm-heading: #0b2545;   /* cor de títulos (claro = navy) */
}

/* ============================================================
   MODO ESCURO (selecionável pelo usuário — data-theme no <html>)
   Paleta: fundo navy profundo, texto papel claro; âmbar segue
   reservado ao contexto comercial; contraste WCAG AA mantido.
   ============================================================ */
[data-theme='dark'] {
  --rm-paper: #0f1520;
  --rm-surface: #16202f;
  --rm-text: #e8ebf0;
  --rm-text-2: #aab4c4;
  --rm-text-3: #7e8aa0;
  --rm-border: #243044;
  --rm-blue: #6f9fe0;
  --rm-heading: #eef1f6;
  --rm-ad-bg: #121a28;
  --rm-ad-border: #31405c;
  color-scheme: dark;
}

/* ============================================================
   BASE
   ============================================================ */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--rm-paper);
  color: var(--rm-text);
  font-family: var(--rm-font-sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
h1, h2, h3, h4 { font-family: var(--rm-font-serif); color: var(--rm-heading); line-height: 1.2; margin: 0 0 .5em; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; }
p { margin: 0 0 1em; }
:focus-visible { outline: 2px solid var(--rm-blue); outline-offset: 2px; border-radius: 4px; }
.container { max-width: var(--rm-container); margin: 0 auto; padding: 0 16px; }
@media (min-width: 640px) { .container { padding: 0 24px; } }

/* ============================================================
   SKIP LINK / ACESSIBILIDADE
   ============================================================ */
.skip-link {
  position: absolute; left: 16px; top: 16px; z-index: 200;
  background: var(--rm-ink); color: #fff; padding: 10px 16px; border-radius: 4px;
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; }

/* ============================================================
   HEADER
   ============================================================ */
.rm-topbar { background: var(--rm-surface); border-bottom: 1px solid var(--rm-border); font-size: 12px; color: var(--rm-text-3); }
.rm-topbar-right { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; }
.rm-topbar .container { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 6px; padding-bottom: 6px; }
.rm-topbar-links { display: none; gap: 16px; }
@media (min-width: 768px) { .rm-topbar-links { display: flex; } }
.rm-topbar a:hover { color: var(--rm-blue); text-decoration: underline; }
.rm-lang { display: inline-flex; gap: 2px; border: 1px solid var(--rm-border); border-radius: 4px; padding: 2px; background: var(--rm-surface); flex-shrink: 0; }
.rm-lang-item { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; font-size: 12px; font-weight: 600; color: var(--rm-ink); border-radius: 3px; text-transform: uppercase; }
.rm-lang-item:hover { background: var(--rm-paper); }
.rm-lang-item.active { background: var(--rm-ink); color: #fff; }
.rm-flag { width: 20px; height: 14px; object-fit: cover; border-radius: 2px; border: 1px solid rgba(0,0,0,.08); display: inline-block; }

/* Botão claro/escuro */
.rm-theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; min-height: 44px; border: 1px solid var(--rm-border);
  background: var(--rm-surface); border-radius: 4px; color: var(--rm-heading);
  cursor: pointer;
}
.rm-theme-toggle:hover { background: var(--rm-paper); }
.rm-theme-toggle .icon-moon { display: none; }
[data-theme='dark'] .rm-theme-toggle .icon-moon { display: inline; }
[data-theme='dark'] .rm-theme-toggle .icon-sun { display: none; }

.rm-masthead { background: var(--rm-surface); border-bottom: 1px solid var(--rm-border); }
.rm-masthead .container { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 14px; padding-bottom: 14px; }
.rm-brand { display: flex; align-items: center; gap: 10px; }
.rm-brand svg { flex-shrink: 0; }
.rm-brand-name { font-family: var(--rm-font-serif); font-weight: 700; font-size: 20px; color: var(--rm-heading); line-height: 1; }
.rm-brand-tag { margin: 2px 0 0; font-size: 12px; color: var(--rm-text-3); font-style: italic; font-family: var(--rm-font-serif); }
.rm-slogan { display: none; font-family: var(--rm-font-serif); font-style: italic; color: var(--rm-text-2); font-size: 14px; }
@media (min-width: 1024px) { .rm-slogan { display: block; } }
.rm-search { display: none; }
@media (min-width: 768px) {
  .rm-search { display: flex; align-items: center; border: 1px solid var(--rm-border); background: var(--rm-paper); border-radius: 4px; padding: 0 10px; }
  .rm-search input { border: 0; background: transparent; min-height: 40px; width: 200px; font-size: 14px; color: var(--rm-text); outline: none; }
}

.rm-nav { background: var(--rm-ink); }
.rm-nav .container { display: flex; align-items: center; gap: 2px; overflow-x: auto; padding-top: 8px; padding-bottom: 8px; scrollbar-width: none; }
.rm-nav .container::-webkit-scrollbar { display: none; }
.rm-nav a { color: rgba(255,255,255,.85); padding: 8px 12px; font-size: 14px; font-weight: 500; white-space: nowrap; border-radius: 4px; }
.rm-nav a:hover { background: rgba(255,255,255,.1); color: #fff; }
.rm-nav a.rm-ofertas { color: var(--rm-amber); border: 1px solid rgba(245,158,11,.6); border-radius: 999px; padding: 6px 14px; }
.rm-nav a.rm-ofertas:hover { background: rgba(245,158,11,.12); }
.rm-nav-toggle { display: none; }

@media (max-width: 767px) {
  .rm-nav .container { display: none; }
  .rm-nav { position: relative; }
  .rm-nav-toggle {
    display: flex; align-items: center; justify-content: space-between;
    width: 100%; background: var(--rm-ink); color: #fff; border: 0; padding: 12px 16px;
    font-size: 14px; font-weight: 600; cursor: pointer; min-height: 44px;
  }
  .rm-nav.open .container { display: flex; flex-direction: column; align-items: stretch; padding: 8px 16px 16px; }
  .rm-nav.open a { padding: 12px; border-top: 1px solid rgba(255,255,255,.1); }
  .rm-nav.open a.rm-ofertas { border: 0; border-top: 1px solid rgba(255,255,255,.1); border-radius: 0; }
}

/* ============================================================
   CARDS DE NOTÍCIA (com LOCALIDADE)
   ============================================================ */
.rm-card { background: var(--rm-surface); border: 1px solid var(--rm-border); border-radius: 8px; overflow: hidden; box-shadow: 0 1px 3px rgba(11,36,69,.08); }
.rm-card img { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; }
.rm-card-body { padding: 16px; }
.rm-card-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.rm-chip { display: inline-flex; align-items: center; gap: 4px; border: 1px solid rgba(11,36,69,.25); border-radius: 4px; padding: 2px 8px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--rm-ink); }
[data-theme='dark'] .rm-chip { color: var(--rm-heading); border-color: rgba(255,255,255,.28); }
.rm-locality { display: inline-flex; align-items: center; gap: 4px; background: rgba(30,90,168,.1); color: var(--rm-blue); border-color: rgba(30,90,168,.35); }
[data-theme='dark'] .rm-locality { background: rgba(111,159,224,.16); color: var(--rm-blue); border-color: rgba(111,159,224,.45); }
.rm-locality svg { width: 12px; height: 12px; }
.rm-card h2, .rm-card h3 { font-size: 18px; margin: 0 0 8px; }
.rm-card h2 a:hover, .rm-card h3 a:hover { color: var(--rm-blue); text-decoration: underline; text-decoration-color: var(--rm-ink); }
.rm-card-excerpt { color: var(--rm-text-2); font-size: 14px; margin: 0 0 12px; }
.rm-card-foot { font-size: 12px; color: var(--rm-text-3); }

/* Hero da home */
.rm-hero { display: grid; gap: 24px; margin-bottom: 40px; }
@media (min-width: 1024px) { .rm-hero { grid-template-columns: 2fr 1fr; } }
.rm-hero-main .rm-card h2 { font-size: clamp(24px, 3vw, 32px); }
.rm-hero-side { display: grid; gap: 24px; align-content: start; }

/* Grade de notícias */
.rm-grid { display: grid; gap: 24px; }
@media (min-width: 640px) { .rm-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .rm-grid.rm-cols-3 { grid-template-columns: repeat(3, 1fr); } }

/* ============================================================
   SEÇÕES / TÍTULOS
   ============================================================ */
.rm-section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; border-bottom: 2px solid var(--rm-ink); padding-bottom: 6px; margin: 40px 0 24px; }
.rm-section-title h2 { font-size: 24px; margin: 0; }
.rm-section-title a { font-size: 14px; font-weight: 600; color: var(--rm-blue); }
.rm-section-title a:hover { text-decoration: underline; }

/* ============================================================
   OFERTAS (comercial — âmbar exclusivo)
   ============================================================ */
.rm-ofertas { margin: 48px 0; }
.rm-ofertas .rm-section-title h2 { color: var(--rm-amber-ink); }
[data-theme='dark'] .rm-ofertas .rm-section-title h2 { color: var(--rm-amber); }
.rm-ofertas-featured { border: 1px solid rgba(245,158,11,.5); background: var(--rm-surface); border-radius: 8px; padding: 20px; display: grid; gap: 16px; box-shadow: 0 1px 3px rgba(11,36,69,.08); }
@media (min-width: 768px) { .rm-ofertas-featured { grid-template-columns: auto 1fr; align-items: center; } }
.rm-badge-oferta { display: inline-flex; align-items: center; gap: 6px; background: var(--rm-amber); color: var(--rm-amber-ink); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; padding: 4px 10px; border-radius: 4px; }
.rm-offer-name { font-family: var(--rm-font-serif); font-size: 20px; font-weight: 700; color: var(--rm-heading); margin: 8px 0 4px; }
.rm-offer-call { color: var(--rm-text-2); font-size: 14px; margin: 0 0 8px; }
.rm-offer-price { font-weight: 700; font-size: 22px; color: var(--rm-heading); }
.rm-offer-price-de { color: var(--rm-text-3); text-decoration: line-through; font-size: 14px; font-weight: 400; margin-right: 8px; }
.rm-offer-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.rm-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 20px; border-radius: 4px; font-size: 14px; font-weight: 600; border: 0; cursor: pointer; }
.rm-btn-amber { background: var(--rm-amber); color: var(--rm-amber-ink); }
.rm-btn-amber:hover { background: #e08e0a; }
.rm-btn-navy { background: var(--rm-ink); color: #fff; }
.rm-btn-navy:hover { background: #14335f; }
.rm-offer-note { font-size: 12px; color: var(--rm-text-3); }

/* Card de oferta discreto: foto + rótulo miúdo PUBLICIDADE + nota de comissão */
.rm-offer-img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 6px; border: 1px solid var(--rm-border); }
.rm-ofertas-featured .rm-offer-img { max-width: 220px; }
.rm-offer-mini { padding: 0; }
.rm-offer-mini-body { padding: 12px 14px 14px; }
.rm-ad-label-mini { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--rm-text-3); margin: 10px 0 0; }
.rm-commission-note { font-size: 11px; color: var(--rm-text-3); margin: 2px 0 0; }
.rm-context-offers { margin-top: 32px; border-top: 1px solid var(--rm-border); padding-top: 20px; }
.rm-context-offers-title { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--rm-text-3); margin-bottom: 14px; }
.rm-disclosure { border-left: 3px solid var(--rm-amber); background: #fef9e7; padding: 10px 14px; font-size: 13px; color: var(--rm-text-2); border-radius: 0 6px 6px 0; margin: 12px 0 0; }
.rm-supplement-note { font-size: 12px; color: var(--rm-text-3); background: var(--rm-ad-bg); border-radius: 4px; padding: 6px 10px; margin-top: 8px; }
.rm-ofertas-list { display: grid; gap: 16px; margin-top: 24px; }
@media (min-width: 640px) { .rm-ofertas-list { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .rm-ofertas-list { grid-template-columns: repeat(3, 1fr); } }
.rm-offer-mini { border: 1px solid var(--rm-border); border-radius: 8px; background: var(--rm-surface); padding: 14px; }
.rm-offer-mini .rm-offer-name { font-size: 16px; margin-top: 6px; }
.rm-offer-mini .rm-badge-oferta { font-size: 10px; }
.rm-verificar { color: var(--rm-red); font-size: 12px; font-weight: 600; }
.rm-nota { color: var(--rm-text-3); font-size: 12px; }

/* ============================================================
   ARTIGO (single)
   ============================================================ */
.rm-breadcrumb { font-size: 13px; color: var(--rm-text-2); margin: 24px 0 0; }
.rm-breadcrumb a:hover { color: var(--rm-blue); text-decoration: underline; }
.rm-article { display: grid; gap: 32px; margin: 24px 0 48px; }
@media (min-width: 1024px) { .rm-article { grid-template-columns: 720px 320px; justify-content: center; } }
.rm-article-main { background: var(--rm-surface); border: 1px solid var(--rm-border); border-radius: 8px; padding: 24px; box-shadow: 0 1px 3px rgba(11,36,69,.08); }
@media (min-width: 768px) { .rm-article-main { padding: 40px; } }
.rm-article h1 { font-size: clamp(28px, 4vw, 40px); line-height: 1.15; margin: 16px 0 8px; }
.rm-article-dek { font-size: 18px; color: var(--rm-text-2); line-height: 1.5; }
.rm-byline { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; border-top: 1px solid var(--rm-border); border-bottom: 1px solid var(--rm-border); padding: 12px 0; font-size: 13px; color: var(--rm-text-3); margin: 16px 0 24px; }
.rm-byline strong { color: var(--rm-text-2); }
.rm-article-content { font-family: var(--rm-font-serif); font-size: 17px; line-height: 1.7; color: var(--rm-text); }
.rm-article-content p { margin-bottom: 1.2em; }
.rm-article-content h2, .rm-article-content h3 { font-family: var(--rm-font-serif); margin: 1.4em 0 .6em; }
.rm-article-content blockquote { border-left: 3px solid var(--rm-ink); margin: 1.4em 0; padding: 4px 0 4px 16px; font-style: italic; color: var(--rm-text-2); }
.rm-fonte { font-size: 13px; color: var(--rm-text-3); margin-top: 24px; }
.rm-verified { display: inline-flex; align-items: center; gap: 6px; color: var(--rm-green); font-weight: 600; font-size: 13px; }
.rm-sidebar { display: grid; gap: 24px; align-content: start; }
@media (min-width: 1024px) { .rm-sidebar { position: sticky; top: 24px; } }
.rm-box { background: var(--rm-surface); border: 1px solid var(--rm-border); border-radius: 8px; padding: 20px; box-shadow: 0 1px 3px rgba(11,36,69,.08); }
.rm-box h3 { font-size: 18px; margin: 0 0 12px; border-bottom: 2px solid var(--rm-ink); padding-bottom: 8px; }
.rm-mostread ol { margin: 0; padding: 0; list-style: none; counter-reset: rm; }
.rm-mostread li { counter-increment: rm; border-bottom: 1px solid var(--rm-border); padding: 10px 0; }
.rm-mostread li:last-child { border: 0; }
.rm-mostread a { display: flex; gap: 12px; font-family: var(--rm-font-serif); font-weight: 600; font-size: 14px; line-height: 1.4; color: var(--rm-text); }
.rm-mostread a:hover { color: var(--rm-blue); }
.rm-mostread a::before { content: counter(rm, decimal-leading-zero); font-size: 24px; color: rgba(107,114,128,.5); font-weight: 700; font-family: var(--rm-font-serif); }

/* Ad zone (PUBLICIDADE) */
.rm-ad { border: 1px dashed var(--rm-ad-border); background: var(--rm-ad-bg); border-radius: 8px; padding: 8px; text-align: center; }
.rm-ad-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--rm-text-3); }
.rm-ad-inner { min-height: 200px; display: flex; align-items: center; justify-content: center; color: var(--rm-text-3); font-size: 12px; }

/* ============================================================
   PÁGINAS INSTITUCIONAIS
   ============================================================ */
.rm-page { max-width: 760px; margin: 32px auto 56px; background: var(--rm-surface); border: 1px solid var(--rm-border); border-radius: 8px; padding: 28px; box-shadow: 0 1px 3px rgba(11,36,69,.08); }
@media (min-width: 768px) { .rm-page { padding: 48px; } }
.rm-page h1 { font-size: 34px; }
.rm-page h2 { font-size: 22px; margin-top: 1.6em; }

/* ============================================================
   FOOTER
   ============================================================ */
.rm-footer { background: var(--rm-ink); color: #f7f6f2; margin-top: 48px; }
.rm-footer .container { display: grid; gap: 32px; padding-top: 40px; padding-bottom: 24px; }
@media (min-width: 768px) { .rm-footer .container { grid-template-columns: 1.2fr 1fr 1fr; } }
.rm-footer h3 { color: rgba(247,246,242,.6); font-size: 13px; text-transform: uppercase; letter-spacing: .06em; font-family: var(--rm-font-sans); margin: 0 0 12px; }
.rm-footer ul { list-style: none; margin: 0; padding: 0; }
.rm-footer li { margin-bottom: 8px; }
.rm-footer a { color: rgba(247,246,242,.8); font-size: 14px; }
.rm-footer a:hover { color: #fff; text-decoration: underline; }
.rm-footer-selo { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: rgba(247,246,242,.8); }
.rm-footer-selo::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--rm-green); }
.rm-footer-bottom { border-top: 1px solid rgba(255,255,255,.15); padding-top: 20px; margin-top: 32px; display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; font-size: 12px; color: rgba(247,246,242,.6); }

/* ============================================================
   BANNER ANIMADO 300x250 (espaço PUBLICIDADE)
   ============================================================ */
.rm-banner {
  position: relative; width: 300px; max-width: 100%; height: 250px;
  background: var(--rm-ink); border-radius: 8px; overflow: hidden;
  padding: 10px; margin: 0 auto;
  box-shadow: 0 1px 3px rgba(11,36,69,.15);
}
.rm-banner-label {
  position: absolute; top: 8px; left: 12px; z-index: 3;
  font-size: 9px; font-weight: 600; text-transform: uppercase; letter-spacing: .1em;
  color: rgba(247,246,242,.55); margin: 0;
}
.rm-banner-viewport { position: relative; width: 100%; height: 100%; }
.rm-banner-slide {
  position: absolute; inset: 0; display: flex; flex-direction: column; gap: 6px;
  padding: 20px 10px 18px; opacity: 0; visibility: hidden;
  transition: opacity .5s ease, visibility .5s ease;
}
.rm-banner-slide.active { opacity: 1; visibility: visible; }
.rm-banner-img {
  width: 100%; height: 128px; object-fit: cover; border-radius: 6px;
  border: 1px solid rgba(255,255,255,.15);
}
.rm-banner-info { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.rm-banner-name { font-family: var(--rm-font-serif); font-size: 14px; line-height: 1.25; color: #fff; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rm-banner-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rm-banner-price { font-size: 15px; font-weight: 700; color: var(--rm-amber); }
.rm-banner-cta { display: inline-flex; align-items: center; justify-content: center; min-height: 32px; padding: 0 14px; border-radius: 4px; background: var(--rm-amber); color: var(--rm-amber-ink); font-size: 12px; font-weight: 600; }
.rm-banner-dots { position: absolute; bottom: 8px; left: 0; right: 0; display: flex; justify-content: center; gap: 5px; z-index: 3; }
.rm-banner-dots i { width: 6px; height: 6px; border-radius: 50%; background: rgba(247,246,242,.3); cursor: pointer; }
.rm-banner-dots i.active { background: var(--rm-amber); }
.rm-sidebar .rm-banner, .rm-ofertas-list + .rm-banner { margin: 0 auto; }

/* ============================================================
   WHATSAPP CTA (mensagem pré-preenchida por idioma)
   ============================================================ */
.rm-whatsapp {
  position: fixed; right: 20px; bottom: 20px; z-index: 150;
  display: inline-flex; align-items: center; justify-content: center;
  width: 54px; height: 54px; border-radius: 50%;
  background: #25d366; color: #fff;
  box-shadow: 0 4px 12px rgba(0,0,0,.25);
  transition: transform .15s ease;
}
.rm-whatsapp:hover { transform: scale(1.06); color: #fff; }
@media (prefers-reduced-motion: reduce) { .rm-whatsapp { transition: none; } }

/* ============================================================
   RESPONSIVO / MISC
   ============================================================ */
.rm-empty { text-align: center; color: var(--rm-text-2); padding: 48px 16px; }
.rm-related { display: grid; gap: 24px; }
@media (min-width: 768px) { .rm-related { grid-template-columns: repeat(3, 1fr); } }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
