/*
Theme Name: FofoNews Versão Final
Theme URI: https://wpastra.com
Author: Departamento de Tecnologia
Author URI: https://impulsionai.com
Description: Versão final do tema FofoNews para portal de notícias independente.
Version: 1.2.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: fofonews
Tags: news, blog, custom-menu, featured-images, post-formats, translation-ready
Requires at least: 6.0
Tested up to: 6.5
Requires PHP: 7.4
*/

/* =====================================================
   FOFONEWS — DESIGN SYSTEM & BASE STYLES
   Portal de Notícias Profissional
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Merriweather:ital,wght@0,400;0,700;1,400&display=swap');

/* ── ROOT TOKENS ── */
:root {
  /* Cores principais */
  --brand-blue: #0A3D91;
  --brand-blue-dark: #072B66;
  --brand-blue-light: #1565C0;
  --brand-red: #E50914;

  /* Aliases para compatibilidade */
  --red: var(--brand-blue);
  --red-dark: var(--brand-blue-dark);
  --red-light: var(--brand-blue-light);

  --black: #111111;
  --white: #FFFFFF;
  --gray-50: #FAFAFA;
  --gray-100: #F5F5F5;
  --gray-200: #E8E8E8;
  --gray-300: #CCCCCC;
  --gray-500: #888888;
  --gray-600: #666666;
  --gray-700: #444444;

  /* Modos e superfícies */
  --bg-main: #FFFFFF;
  --bg-card: #FFFFFF;
  --text-main: #111111;
  --text-muted: #666666;
  --border-color: #E8E8E8;

  /* Cores por editoria */
  --cat-politica: #0A3D91;
  --cat-entretenimento: #8B00CC;
  --cat-esportes: #006B3C;
  --cat-economia: #0055AA;
  --cat-tecnologia: #0099CC;
  --cat-saude: #008866;
  --cat-cultura: #CC6600;
  --cat-brasil: #009B3A;

  /* Tipografia */
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-serif: 'Merriweather', Georgia, serif;

  /* Tamanhos */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --text-5xl: 3rem;

  /* Espaçamentos */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  /* Layout Padronizado para Alinhamento Perfeito no Desktop */
  --container: 1240px;
  --container-wide: 1240px;
  --sidebar-width: 320px;
  --header-height: 64px;

  /* Bordas */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 20px;

  /* Sombras */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, .12);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, .15);
  --shadow-xl: 0 16px 40px rgba(0, 0, 0, .18);

  /* Transições */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 400ms ease;
}

/* ── DARK MODE TOKENS (APENAS SE O USUÁRIO ATIVAR NO BOTÃO) ── */
body.dark-mode {
  --bg-main: #0F172A;
  --bg-card: #1E293B;
  --text-main: #F8FAFC;
  --text-muted: #94A3B8;
  --border-color: #334155;
  --gray-100: #1E293B;
  --gray-200: #334155;
  --gray-300: #475569;
  --gray-500: #94A3B8;
  --gray-600: #CBD5E1;
  --gray-700: #E2E8F0;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.5);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.6);
}

/* ── RESET ── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  color: var(--text-main);
  background: var(--bg-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
  position: relative;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
}

ul, ol {
  list-style: none;
}

input, textarea {
  font-family: inherit;
}

/* ── LAYOUT CONTAINERS COM MARGEM UNIFORME EM TODA A PÁGINA ── */
.container,
.container-wide {
  width: 100%;
  max-width: 1240px;
  margin-inline: auto;
  padding-inline: 24px;
  box-sizing: border-box;
}

.grid-main,
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--sidebar-width);
  gap: 24px;
  align-items: start;
  width: 100%;
  box-sizing: border-box;
}

.main-content,
.hero-main {
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.sidebar,
.hero-side {
  width: var(--sidebar-width);
  box-sizing: border-box;
}

/* ── CATEGORY BADGES ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #FFFFFF;
  background: var(--brand-blue);
  line-height: 1;
}

.badge--politica { background: var(--cat-politica); }
.badge--entretenimento { background: var(--cat-entretenimento); }
.badge--esportes { background: var(--cat-esportes); }
.badge--economia { background: var(--cat-economia); }
.badge--tecnologia { background: var(--cat-tecnologia); }
.badge--saude { background: var(--cat-saude); }
.badge--cultura { background: var(--cat-cultura); }
.badge--brasil { background: var(--cat-brasil); }
.badge--urgente {
  background: var(--brand-red);
  animation: pulse 1.5s infinite;
}
.badge--exclusivo { background: #6600CC; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* ── SECTION HEADINGS (ESPAÇAMENTO NATURAL DE PALAVRAS E BARRA AZUL) ── */
.section-title {
  display: block !important;
  position: relative !important;
  font-size: var(--text-2xl) !important;
  font-weight: 900 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.03em !important;
  color: var(--text-main) !important;
  padding-bottom: var(--space-3) !important;
  border-bottom: 3px solid var(--border-color) !important;
  margin-bottom: var(--space-5) !important;
  padding-left: 14px !important;
  line-height: 1.3 !important;
}

.section-title::before {
  content: '' !important;
  position: absolute !important;
  left: 0 !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  width: 4px !important;
  height: 24px !important;
  background: var(--brand-blue) !important;
  border-radius: 2px !important;
}

.section-title .accent {
  color: var(--brand-blue) !important;
  margin-left: 0.35em !important;
}

.section-title a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-fast);
}

.section-title a:hover {
  color: var(--brand-blue-light);
}

/* Titles links */
.hero-main__title a,
.hero-side-card__title a,
.feed-item__title a,
.editorial-main__title a,
.editorial-list-item__title a,
.most-read-item__title a {
  color: inherit;
  text-decoration: none;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.hero-main__title a:hover,
.hero-side-card__title a:hover,
.feed-item__title a:hover,
.editorial-main__title a:hover,
.editorial-list-item__title a:hover,
.most-read-item__title a:hover {
  color: var(--brand-blue-light);
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: var(--text-sm);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.btn-primary {
  background: var(--brand-blue);
  color: #FFFFFF;
  border: 2px solid var(--brand-blue);
}

.btn-primary:hover {
  background: var(--brand-blue-dark);
  border-color: var(--brand-blue-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-outline {
  background: transparent;
  color: var(--brand-blue);
  border: 2px solid var(--brand-blue);
}

.btn-outline:hover {
  background: var(--brand-blue);
  color: #FFFFFF;
}

/* Dark mode toggle button */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #FFFFFF;
  transition: all var(--transition-fast);
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.05);
}

/* TTS Player Button */
.tts-play-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: var(--brand-blue);
  color: #FFFFFF;
  font-size: var(--text-xs);
  font-weight: 700;
  transition: all var(--transition-fast);
}

.tts-play-btn:hover {
  background: var(--brand-blue-dark);
  transform: translateY(-1px);
}

.tts-play-btn.is-playing {
  background: var(--brand-red);
}

/* ── DIVIDER ── */
.divider {
  height: 1px;
  background: var(--border-color);
  margin: var(--space-6) 0;
}

/* ── READ TIME & RELATIVE TIME ── */
.read-time, .time-ago {
  font-size: var(--text-xs);
  color: var(--gray-500);
  white-space: nowrap;
}

/* ── SHARE BUTTONS ── */
.share-buttons {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 700;
  color: #FFFFFF;
  transition: all var(--transition-fast);
  cursor: pointer;
}

.share-btn:hover {
  opacity: 0.88;
  transform: translateY(-1px);
}

.share-btn--whatsapp { background: #25D366; }
.share-btn--facebook { background: #1877F2; }
.share-btn--twitter { background: #000000; }
.share-btn--copy { background: var(--gray-500); color: #FFFFFF; }

/* ── RESPONSIVE HELPERS & MEDIA QUERIES ── */
@media (max-width: 1024px) {
  .grid-main,
  .hero-grid {
    grid-template-columns: 1fr;
  }
  .sidebar,
  .hero-side {
    width: 100%;
  }
}

@media (max-width: 768px) {
  :root {
    --text-3xl: 1.5rem;
    --text-4xl: 1.875rem;
    --text-5xl: 2.25rem;
  }

  .container, .container-wide {
    padding-inline: 16px;
  }

  .grid-main,
  .hero-grid {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: var(--space-6);
  }
}

/* ── WORDPRESS ALIGNMENT CLASSES ── */
.alignleft {
  float: left;
  margin-right: var(--space-4);
  margin-bottom: var(--space-4);
}

.alignright {
  float: right;
  margin-left: var(--space-4);
  margin-bottom: var(--space-4);
}

.aligncenter {
  display: block;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: var(--space-4);
}

.wp-caption {
  max-width: 100%;
}

.wp-caption-text {
  font-size: var(--text-xs);
  color: var(--gray-600);
  margin-top: var(--space-2);
  font-style: italic;
}

/* ── WP PAGINATION ── */
.page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 var(--space-2);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-main);
  background: var(--gray-100);
  transition: all var(--transition-fast);
  text-decoration: none;
}

.page-numbers:hover {
  background: var(--gray-200);
}

.page-numbers.current {
  background: var(--brand-blue);
  color: #FFFFFF;
}

/* ── ACESSIBILIDADE WCAG (SKIP LINK, FOCUS-VISIBLE, REDUCED-MOTION) ── */
.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 99999;
  background: #0A3D91;
  color: #FFFFFF !important;
  padding: 12px 20px;
  border-radius: 4px;
  font-weight: 800;
  font-size: 0.9rem;
  text-decoration: none;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 16px;
  outline: 3px solid #E50914;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--brand-blue) !important;
  outline-offset: 2px !important;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}