:root {
  --brand-accent: #bf0404;
  --bg-light: #f4f4f4;
  --text-main: #222222;
  --text-muted: #666666;
}

body { color: var(--text-main); }
a { color: var(--text-main); transition: color 0.2s; }
a:hover { color: var(--brand-accent); text-decoration: none; }

/* =========================================================
 1. TOP BAR Y TICKER
========================================================= */
.editorial-top-bar { background: #111; color: #fff; font-size: 13px; padding: 10px 0; }
.top-bar-flex { display: flex; justify-content: flex-start; align-items: center; flex-wrap: wrap; gap: 10px;}
.breaking-ticker { display: flex; align-items: center; gap: 10px; color: var(--brand-accent); flex: 1; max-width: 1080px;}
.ticker-wrap { height: 20px; overflow: hidden; position: relative; flex: 1; }
.ticker-wrap ul { list-style: none; margin: 0; padding: 0; animation: ticker 15s linear infinite; }
.ticker-wrap ul:hover { animation-play-state: paused; }
.ticker-wrap a { color: #fff; text-decoration: none; }
@keyframes ticker { 0% { transform: translateY(0); } 100% { transform: translateY(-100%); } }

/* =========================================================
 2. PORTADA: NUEVA ARQUITECTURA PREMIUM
========================================================= */
.hero-content { margin-top: 10px; }
.cat-label { color: var(--brand-accent); font-weight: bold; font-size: 12px; text-transform: uppercase; display: block; margin-bottom: 5px; }
.section-title { font-size: 1.2rem; margin-bottom: 20px; text-transform: uppercase; }
.section-title span { display: inline-block; }
.section-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 40px; }
.editorial-home-divider { border: 0; height: 1px; background: #111; margin: 20px 0; width: 100%; }

/* Tipografía de Portada */
.home-hero-lead h1 { font-size: 2.2rem; line-height: 1.15; margin: 0px 0 15px 0; font-weight: 800; }
.grid-sub-item h3 { font-size: 1.05rem; line-height: 1.3; margin-top: 12px; }

/* Diseño Desktop (PC) */
@media(min-width: 992px) {
  .editorial-top-section { display: grid; grid-template-columns: 1.5fr 1fr; gap: 40px; align-items: start; }
  .home-top-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
  .editorial-bottom-section { display: grid; grid-template-columns: 3fr 1fr; gap: 50px; align-items: start; }
}

/* Diseño Móvil / Tablet */
@media(max-width: 991px) {
  .editorial-top-section, .editorial-bottom-section { display: flex; flex-direction: column; gap: 30px; }
  .home-top-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 15px; }
  .editorial-bottom-section { display: flex; flex-direction: column; }
  .editorial-home-sidebar { order: -1; margin-bottom: 20px; }
}

/* Blindaje de imágenes Portada */
.grid-sub-item img, .section-item img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: center; display: block; border-radius: 4px; }
.home-hero-lead img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; object-position: center; display: block; border-radius: 4px; }

/* Botón Ver Más */
.section-footer { margin-top:20px; margin-bottom: 30px; text-align: right; }
.btn-read-more { display: inline-flex; align-items: center; gap: 8px; font-size: 0.85rem; font-weight: 700; color: #ffffff !important; background-color: var(--brand-accent); padding: 10px 24px; text-transform: uppercase; text-decoration: none; letter-spacing: 1px; border-radius: 3px; border: 2px solid var(--brand-accent); transition: all 0.3s ease; }
.btn-read-more:hover { background-color: transparent; color: var(--brand-accent) !important; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.btn-read-more .dashicons { font-size: 18px; width: 18px; height: 18px; transition: transform transform 0.3s ease; }
.btn-read-more:hover .dashicons { transform: translateX(5px); }

/* =========================================================
 3. PUBLICIDAD (ADS)
========================================================= */
.masthead-top-wrapper { background-color: #111111 !important; text-align: center; padding: 20px 0 !important; width: 100%; border-bottom: 2px solid #000; min-height: 90px; }
.masthead-top-wrapper div, .masthead-top-wrapper section, .masthead-top-wrapper aside, .masthead-top-wrapper figure { background: transparent !important; background-color: transparent !important; border: none !important; padding: 0 !important; margin: 0 auto !important; box-shadow: none !important; }
.masthead-top-wrapper div::before, .masthead-top-wrapper section::before, .masthead-top-wrapper aside::before, .masthead-top-wrapper *::before { content: none !important; display: none !important; }
.masthead-top-wrapper img, .masthead-top-wrapper iframe { display: block !important; margin: 0 auto !important; background: transparent !important; max-width: 100%; height: auto; }

.home-inline-ad { width: 100%; text-align: center; margin: 0px 0 30px 0; padding: 20px 0; background: #fdfdfd; border: 1px solid #eaeaea; display: flex ; flex-direction: column; align-items: center; justify-content: center; overflow: hidden; }
.home-inline-ad::before { content: "- PUBLICIDAD -"; display: block; font-size: 0.65rem; color: #999; letter-spacing: 1.5px; margin-bottom: 5px; text-transform: uppercase; }
.home-inline-ad img, .home-inline-ad iframe { max-width: 100%; height: auto; }

/* NUEVO: Diseño para Banners de Publicidad Globales (Sidebar y Single) */
.ad-container {
  width: 100% !important;
  text-align: center !important;
  margin: 40px 0 !important;
  padding: 20px 0 !important;
  background: #fdfdfd !important;
  border: 1px solid #eaeaea !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: hidden !important;
}

.ad-container .ad-label {
  display: block !important;
  font-size: 0.65rem !important;
  color: #999 !important;
  letter-spacing: 1.5px !important;
  margin-bottom: 15px !important;
  text-transform: uppercase !important;
  font-weight: 600 !important;
}

.ad-container img,
.ad-container iframe,
.ad-container figure,
.ad-container .wp-block-image {
  max-width: 100% !important;
  height: auto !important;
  margin: 0 auto !important;
  display: block !important;
  border-radius: 4px !important;
}

/* =========================================================
 4. NOTICIA INDIVIDUAL (SINGLE POST) - REPARACIÓN FINAL
========================================================= */

/* 1. ROMPER EL CANDADO DE ASTRA (Narrow Container)
 Forzamos a que el contenedor de Astra SIEMPRE sea de 1240px en las noticias */
body.single-post .site-content > .ast-container,
body.single-post.ast-narrow-container .site-content > .ast-container {
  max-width: 1240px !important;
  width: 100% !important;
  margin: 0 auto !important;
  padding: 0 20px !important;
}

/* 2. LIBERAR EL ÁREA PRIMARIA
 Astra limita el #primary cuando no hay sidebar oficial. Lo liberamos al 100%
 para que nuestro wrapper interno maneje las columnas. */
body.single-post #primary {
  margin: 0 !important;
  padding: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
}

/* 3. DISEÑO DE COLUMNAS (CONTENIDO + SIDEBAR)
 Usamos Grid en el wrapper que creamos en el PHP */
.editorial-single-wrapper {
  display: grid !important;
  grid-template-columns: 1fr; /* Por defecto 1 columna (móvil) */
  gap: 40px;
  margin: 40px 0;
  width: 100% !important;
}

@media(min-width: 992px) {
  .editorial-single-wrapper {
    grid-template-columns: 2.8fr 1fr !important; /* Proporción 70/30 aprox */
    align-items: start;
  }
}

/* 4. AJUSTES DEL CONTENIDO */
.editorial-featured-image {
    margin-bottom: 20px;
}
.editorial-single-article {
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
}

.entry-content {
  font-size: 1.15rem;
  line-height: 1.8;
  color: #333;
}
/* =========================================================
   ESTILOS PARA ETIQUETAS (TAGS) EN SINGLE
   ========================================================= */
.editorial-post-tags {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin: 30px 0;
}

.editorial-post-tags .tags-label {
    font-weight: 700;
    font-size: 14px;
    color: #1a1a1a;
    text-transform: uppercase;
}

.editorial-post-tags .tags-links a {
    display: inline-block;
    background-color: #f4f4f4;
    color: #444;
    padding: 5px 12px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 3px;
    margin-right: 5px;
    margin-bottom: 5px;
    transition: all 0.3s ease;
}

.editorial-post-tags .tags-links a:hover {
    background-color: var(--brand-accent, #bf0404);
    color: #ffffff;
}
/* 5. AJUSTES DEL SIDEBAR */
.editorial-single-sidebar {
  border-left: 1px solid #eaeaea;
  padding-left: 30px;
  display: block !important;
}

/* 6. LIMPIEZA DE METADATOS Y TÍTULO */
.editorial-breadcrumbs { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 20px; }
.editorial-entry-meta { border-top: 1px solid #eee; border-bottom: 1px solid #eee; padding: 10px 0; margin-bottom: 30px; font-weight: 600; text-transform: uppercase; font-size: 12px; letter-spacing: 1px; color: var(--text-muted); }
.entry-header .entry-title { font-size: 2.8rem; line-height: 1.1; margin-bottom: 20px; font-weight: 800; letter-spacing: -1px; }

/* Ocultar basura de Astra */
.ast-single-post .entry-meta .author,
.ast-single-post .ast-author-details,
.author-box {
  display: none !important;
}

/* =========================================================
 5. NOTICIAS RELACIONADAS
========================================================= */
.related-grid-modern { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.related-card .related-thumb img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 6px; display: block; }
.related-title { margin-bottom: 12px; }
.related-info h4 { font-size: 1rem; line-height: 1.3; margin: 12px 0 5px; font-weight: 700; }
.related-date { font-size: 0.75rem; color: #999; text-transform: uppercase; font-weight: 600; }
@media (max-width: 768px) { .related-grid-modern { grid-template-columns: 1fr; } }

/* =========================================================
 6. ARCHIVOS Y CATEGORÍAS
========================================================= */
.archive #primary, .search #primary { max-width: 100% !important; padding: 0 20px; }
.archive .ast-container, .search .ast-container { max-width: 1240px !important; padding-top: 0px; }
.editorial-archive-header { display: flex; justify-content: space-between; align-items: center;padding-bottom:0px; margin: 20px auto; }

#editorial-archive-wrapper.layout-grid .editorial-archive-loop { margin-top:20px;display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
#editorial-archive-wrapper.layout-grid .archive-item { display: flex; flex-direction: column; width: 100%; padding: 0;}
#editorial-archive-wrapper.layout-grid .archive-img img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; display: block; margin-bottom: 15px; border-radius: 4px; }
#editorial-archive-wrapper.layout-grid .archive-content { width: 100%; }

#editorial-archive-wrapper.layout-list .editorial-archive-loop { display: flex; flex-direction: column; gap: 30px; }
#editorial-archive-wrapper.layout-list .archive-item { display: flex; gap: 20px; border-bottom: 1px solid #eee; padding-bottom: 20px; }
#editorial-archive-wrapper.layout-list .archive-img { flex: 0 0 300px; }
#editorial-archive-wrapper.layout-list .archive-img img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 4px; }

.editorial-archive-loop.layout-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-column-gap: 30px;
    grid-row-gap:0px;
}

.entry-title{
    font-size:1.3em;
}

/* Switcher Grid/Lista - ERROR REPARADO AQUÍ */
.editorial-layout-switch button { cursor: pointer; border: 1px solid #ccc; background: #fff; color: #333 !important; padding: 6px 12px; border-radius: 4px; transition: all 0.3s ease; display: inline-flex; align-items: center; justify-content: center; }
.editorial-layout-switch button.active { background: var(--brand-accent) !important; color: #fff !important; border-color: var(--brand-accent) !important; }
.editorial-layout-switch button:not(.active):hover { background: #f5f5f5; }

.ast-separate-container #primary,
.ast-separate-container.ast-left-sidebar #primary,
.ast-separate-container.ast-right-sidebar #primary {
  margin-top: 0px;
}

/* =========================================================
 7. WIDGETS DEL SIDEBAR (FOTOS Y LISTAS LIMPIAS)
========================================================= */
/*titulo h3*/
.widget-editorial h3 {
  margin-bottom: 15px;
}
/* Limpiar puntos y listas feas */
.widget-editorial ul,
.widget-editorial ol {
  list-style: none !important;
  list-style-type: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

.widget-editorial li {
  list-style: none !important;
  list-style-type: none !important;
  display: block !important;
  margin: 0 0 15px 0 !important;
  padding: 0 0 15px 0 !important;
}

.widget-editorial li::before,
.widget-editorial li::after {
  display: none !important;
  content: none !important;
}

.widget-editorial li:last-child {
  border-bottom: none !important;
  margin-bottom: 0 !important;
  padding-bottom: 0 !important;
}

/* Diseño Foto Izquierda / Texto Derecha */
.widget-editorial .widget-post-link {
  display: flex !important;
  align-items: center !important;
  gap: 15px !important;
  text-decoration: none !important;
  color: inherit !important;
}

.widget-editorial .widget-post-thumb {
  flex: 0 0 75px !important;
}

.widget-editorial .widget-post-thumb img {
  width: 100% !important;
  height: 75px !important;
  object-fit: cover !important;
  border-radius: 6px !important;
  display: block !important;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
}

.widget-editorial .widget-post-info {
  flex: 1 !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
}

.widget-editorial .widget-post-title {
  font-size: 0.95rem !important;
  font-weight: 700 !important;
  line-height: 1.3 !important;
  color: #222 !important;
  transition: color 0.2s ease !important;
}

.widget-editorial .widget-post-link:hover .widget-post-title {
  color: #bf0404 !important;
}

.widget-editorial .time {
  font-size: 0.75rem !important;
  color: #bf0404 !important;
  font-weight: 900 !important;
  margin-bottom: 4px !important;
  display: block !important;
  text-transform: uppercase !important;
}

/* =========================================================
 8. RESETEO NUCLEAR: LIBERAR LA PORTADA DE ASTRA
========================================================= */

body.home .site-content > .ast-container,
body.front-page .site-content > .ast-container {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  padding: 0 !important;
}

body.home #primary,
body.front-page #primary {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  flex: none !important;
  padding: 0 !important;
}

.editorial-custom-layout {
  display: block !important;
  width: 100% !important;
  max-width: 1240px !important;
  margin: 0 auto !important;
  padding: 0 20px !important;
  box-sizing: border-box !important;
}

@media (min-width: 992px) {
  .editorial-top-section {
    display: grid !important;
    grid-template-columns: 1.6fr 1fr !important;
    gap: 40px !important;
  }
 
  .home-top-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 20px !important;
    align-content: start !important;
  }

  .editorial-bottom-section {
    display: grid !important;
    grid-template-columns: 3fr 1fr !important;
    gap: 50px !important;
    align-items: start !important;
  }
}
/* Estilo para el estado del Infinite Scroll */
.load-more-status {
  text-align: center;
  padding: 40px 0;
  font-weight: 700;
  text-transform: uppercase;
  color: #999;
  width: 100%;
  clear: both;
}
/* =========================================================
 10. RESETEO NUCLEAR: LIBERAR CONTENEDORES DE ASTRA
========================================================= */

/* Anulamos el flex de Astra en Portada y Archivos/Categorías.
 Esto obliga a que la cabecera vaya ARRIBA y el contenido ABAJO.
*/
body.home .site-content > .ast-container,
body.front-page .site-content > .ast-container,
body.archive .site-content > .ast-container,#editorial-archive-wrapper.layout-grid .archive-item
body.category .site-content > .ast-container {
  display: block !important; /* <--- AQUÍ MATAMOS EL FLEX DAÑINO */
  width: 100% !important;
  max-width: 100% !important;
  padding: 0 !important;
}

/* Aseguramos que el contenedor de archivos mantenga el ancho de 1240px */
.editorial-archive-header{
  display: block !important;
  max-width: 1240px !important;
  margin-left: auto !important;
  margin-right: auto !important;
  width: 100% !important;
}

/* Corregimos el ancho del contenido principal en archivos para que no flote */
body.archive #primary,
body.category #primary {
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 auto !important;
  padding: 0 !important;
}
/* =========================================================
 FIX PARA LISTA: ANULAR REGLAS INTERNAS DE ASTRA
========================================================= */

/* Cuando activamos .layout-list, forzamos el ancho al 100%
 y anulamos el 33.33% de Astra */
#editorial-archive-wrapper.layout-list .editorial-archive-loop article.ast-article-post,
#editorial-archive-wrapper.layout-list .archive-item {
  width: 100% !important;
  max-width: 100% !important;
  margin-right: 0 !important;
  margin-left: 0 !important;
  flex: 0 0 100% !important;
  display: flex !important; /* Mantiene la foto a la izquierda */
  gap: 30px !important;
  border-bottom: 1px solid #eee !important;
  padding-bottom: 30px !important;
}

/* En modo lista, la imagen no debe ocupar todo el ancho */
#editorial-archive-wrapper.layout-list .archive-img {
  flex: 0 0 350px !important; /* Tamaño fijo para la foto en lista */
  max-width: 350px !important;
}

/* En modo lista, el contenido toma el resto */
#editorial-archive-wrapper.layout-list .archive-content {
  flex: 1 !important;
}

/* Asegurar que el loop no intente ser un grid en modo lista */
#editorial-archive-wrapper.layout-list .editorial-archive-loop {
  display: flex !important;
  flex-direction: column !important;
  gap: 30px !important;
}
/* Adaptación del Hero de Portada para los Archivos */
.archive-hero-block {
  margin-bottom: 0px !important;
}

.archive-hero-block .home-hero-lead h2 {
  font-size: 2rem !important;
  font-weight: 800;
  margin-top: 15px;
  line-height: 1.1;
}

/* Evitar que el loop de abajo se pegue al bloque de arriba */
.editorial-archive-loop {
  margin-top: 30px;
  clear: both;
}
/* Paginación Editorial */
.editorial-pagination {
  margin: 50px 0;
  text-align: center;
}
.editorial-pagination .nav-links {
  display: flex;
  justify-content: center;
  gap: 10px;
}
.editorial-pagination a, .editorial-pagination .current {
  padding: 10px 18px;
  border: 1px solid #ddd;
  text-decoration: none;
  color: #333;
  font-weight: bold;
  border-radius: 4px;
}
.editorial-pagination .current {
  background: var(--brand-accent);
  color: #fff;
  border-color: var(--brand-accent);
}
.editorial-pagination a:hover {
  background: #f4f4f4;
}
/* Ajustes para el Sidebar en Archivos */
.editorial-archive-page .editorial-archive-header {
  margin-bottom: 30px;
  width: 100%;
}

@media(min-width: 992px) {
  .editorial-archive-page .editorial-bottom-section {
    display: grid !important;
    grid-template-columns: 3fr 1fr !important; /* Proporción 75% contenido - 25% sidebar */
    gap: 40px !important;
  }
}