/* ==========================================================================
   1. VARIABLES Y FUENTES (Paleta Miradas.mx)
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&family=Merriweather:ital,wght@0,400;0,700;1,400&display=swap');

:root {
    /* Colores del Logo */
    --brand-blue: #17437D;
    --brand-red: #A22731;
    
    /* Colores de Interfaz */
    --text-main: #222222;
    --text-light: #555555;
    --bg-body: #F7F9FA;
    --bg-card: #FFFFFF;
    --border-color: #EAEAEA;
    
    /* Tipografías */
    --font-ui: 'Inter', sans-serif;
    --font-editorial: 'Merriweather', serif;
}

/* ==========================================================================
   2. RESET Y ESTILOS BASE
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-ui);
    color: var(--text-main);
    background-color: var(--bg-body);
    line-height: 1.6;
}

a {
    color: var(--brand-blue);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--brand-red);
}

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

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ==========================================================================
   3. CABECERA (Header)
   ========================================================================== */
.site-header {
    background-color: var(--bg-card);
    border-bottom: 2px solid var(--brand-blue);
    padding: 20px 0;
    margin-bottom: 40px;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-logo img {
    max-height: 50px; /* Ajusta el tamaño de tu logo aquí */
}

.site-nav ul {
    list-style: none;
    display: flex;
    gap: 20px;
}

.site-nav a {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.9rem;
    color: var(--text-main);
}

.site-nav a:hover {
    color: var(--brand-red);
}

/* ==========================================================================
   PORTADA ESTILO CNN (GRID ESTRICTO)
   ========================================================================== */
.news-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 24px;
    align-items: start;
    margin-top: 20px;
}

/* 🌟 NOTA PRINCIPAL (Columna Izquierda - Abarca 6 columnas y 5 filas de alto) */
.news-grid .post-card:nth-child(1) {
    grid-column: 1 / 7;
    grid-row: 1 / 6; /* Esto es la magia que evita el hueco blanco */
}
.news-grid .post-card:nth-child(1) .post-title {
    font-size: 2.2rem;
    color: #17437D;
    margin: 8px 0 15px 0;
    line-height: 1.1;
    font-weight: 800;
}
.news-grid .post-card:nth-child(1) .post-image {
    width: 100%;
    height: auto;
    margin-bottom: 15px;
}
.news-grid .post-card:nth-child(1) .post-excerpt {
    font-size: 1.1rem;
    color: #444;
}

/* 🗞️ NOTAS SECUNDARIAS (Columna Central - Abarcan 3 columnas) */
.news-grid .post-card:nth-child(2) {
    grid-column: 7 / 10;
    grid-row: 1 / 3; /* Se apila arriba */
}
.news-grid .post-card:nth-child(3) {
    grid-column: 7 / 10;
    grid-row: 3 / 6; /* Se apila abajo de la 2 */
}
.news-grid .post-card:nth-child(2) .post-title,
.news-grid .post-card:nth-child(3) .post-title {
    font-size: 1.2rem;
    margin: 8px 0;
    line-height: 1.2;
}
.news-grid .post-card:nth-child(2) .post-image,
.news-grid .post-card:nth-child(3) .post-image {
    width: 100%;
    height: auto;
}
/* Ocultamos los extractos en la columna central para un look más limpio */
.news-grid .post-card:nth-child(2) .post-excerpt,
.news-grid .post-card:nth-child(3) .post-excerpt {
    display: none; 
}

/* 📋 NOTAS TERCIARIAS / SIDEBAR (Columna Derecha - Solo texto) */
.news-grid .post-card:nth-child(n+4) {
    grid-column: 10 / 13;
    border-bottom: 1px solid #e5e5e5;
    padding-bottom: 15px;
    margin-bottom: 5px;
}
.news-grid .post-card:nth-child(n+4):last-child {
    border-bottom: none;
}
/* Ocultamos imágenes y extractos: puro titular como en CNN */
.news-grid .post-card:nth-child(n+4) .post-image-link,
.news-grid .post-card:nth-child(n+4) .post-excerpt {
    display: none; 
}
.news-grid .post-card:nth-child(n+4) .post-title {
    font-size: 1rem;
    margin: 5px 0 0 0;
    line-height: 1.3;
}

/* 🔴 ETIQUETAS INSTITUCIONALES (Categorías) */
.post-tag {
    color: #A22731;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    display: block;
}
.post-tag a {
    color: inherit;
    text-decoration: none;
}
.post-title a {
    color: inherit;
    text-decoration: none;
}
.post-title a:hover {
    color: #A22731; /* Se pinta de rojo al pasar el mouse */
}
/* ==========================================================================
   5. ARTÍCULO INDIVIDUAL (Post view)
   ========================================================================== */
.article-container {
    max-width: 800px;
    margin: 0 auto 60px;
    background: var(--bg-card);
    padding: 40px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.article-header {
    text-align: center;
    margin-bottom: 30px;
}

.article-tag {
    display: inline-block;
    background-color: var(--brand-red);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: bold;
    text-transform: uppercase;
    margin-bottom: 15px;
}

.article-tag:hover {
    background-color: var(--brand-blue);
    color: white;
}

.article-title {
    font-size: 2.5rem;
    color: var(--brand-blue);
    line-height: 1.2;
    margin-bottom: 15px;
}

.article-excerpt {
    font-size: 1.2rem;
    color: var(--text-light);
    font-style: italic;
    margin-bottom: 20px;
}

.article-meta {
    font-size: 0.9rem;
    color: #777;
}

.article-image {
    margin: 0 -40px 30px; /* Para que la imagen sobresalga del padding */
}

.article-image figcaption {
    text-align: center;
    font-size: 0.8rem;
    color: #888;
    padding: 10px;
}

/* Tipografía Editorial para el cuerpo del texto */
.article-content {
    font-family: var(--font-editorial);
    font-size: 1.1rem;
    line-height: 1.8;
    color: #111;
}

.article-content p {
    margin-bottom: 1.5em;
}

.article-content h2, .article-content h3 {
    font-family: var(--font-ui);
    color: var(--brand-blue);
    margin: 1.5em 0 0.5em;
}

/* ==========================================================================
   6. FOOTER
   ========================================================================== */
.site-footer {
    background-color: var(--brand-blue);
    color: white;
    text-align: center;
    padding: 30px 0;
    margin-top: 40px;
}

/* ==========================================================================
   7. GHOST KOENIG EDITOR (Estilos requeridos para imágenes)
   ========================================================================== */
.kg-width-wide {
    position: relative;
    width: 100vw;
    max-width: 1040px; /* Un poco más ancho que el texto */
    left: 50%;
    transform: translateX(-50%);
}

.kg-width-full {
    position: relative;
    width: 100vw;
    max-width: 100vw; /* De orilla a orilla de la pantalla */
    left: 50%;
    transform: translateX(-50%);
}

.kg-width-wide img,
.kg-width-full img {
    width: 100%;
    height: auto;
}

/* ==========================================================================
   8. DISEÑO DEL ARTÍCULO (post.hbs)
   ========================================================================== */
.article {
    /* Mantenemos un ancho máximo para que la lectura no canse la vista */
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px 80px;
}

.article-header {
    text-align: center;
    margin-bottom: 40px;
}

.article-tag {
    color: var(--brand-red);
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    display: inline-block;
    margin-bottom: 15px;
    letter-spacing: 0.5px;
}

.article-title {
    font-size: 2.8rem;
    color: var(--brand-blue);
    line-height: 1.2;
    margin-bottom: 20px;
}

.article-excerpt {
    font-size: 1.3rem;
    color: var(--text-light);
    line-height: 1.5;
    margin-bottom: 20px;
}

.article-meta {
    font-size: 0.9rem;
    color: #888;
    border-top: 1px solid var(--border-color);
    padding-top: 15px;
    margin-top: 20px;
}

.article-image {
    margin: 0 0 40px 0;
}

.article-image img {
    width: 100%;
    border-radius: 4px;
    object-fit: cover;
}

.article-content {
    font-size: 1.15rem;
    line-height: 1.8;
    color: var(--text-main);
}

.article-content p {
    margin-bottom: 1.5em;
}

.article-content h2, 
.article-content h3 {
    color: var(--brand-blue);
    margin-top: 2em;
    margin-bottom: 1em;
}

.article-tag {
    background-color: var(--brand-red); /* Fondo rojo institucional */
    color: #ffffff !important; /* Texto blanco forzado para que siempre contraste */
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    display: inline-block;
    margin-bottom: 15px;
    letter-spacing: 0.5px;
    padding: 4px 12px; /* Da el volumen de la píldora */
    border-radius: 20px; /* Bordes redondeados */
    transition: background-color 0.3s ease; /* Transición suave al pasar el mouse */
}

/* Efecto hover: Cambia a azul institucional */
.article-tag:hover {
    background-color: var(--brand-blue);
    color: #ffffff !important;
}

/* Ajustes para móviles */
@media (max-width: 768px) {
    .article-title {
        font-size: 2rem;
    }
    .article {
        padding: 20px 15px 40px;
    }
}

/* ==========================================================================
   9. ADORNOS EDITORIALES (Fuente original)
   ========================================================================== */
.article-content .nota-fuente {
    font-size: 1.05rem;
    color: #666666; /* Un gris sutil para no robar atención al título */
    font-style: italic;
    border-bottom: 1px solid var(--border-color); /* Una línea sutil de separación */
    padding-bottom: 15px;
    margin-top: -10px;
    margin-bottom: 25px;
}

.article-content .nota-fuente strong {
    color: var(--brand-blue); /* Tu azul institucional */
    font-weight: 700;
    font-style: normal; /* Para que el nombre resalte recto, no en cursiva */
    letter-spacing: 0.3px;
}

/* ==========================================================================
   10. BOTONES DE COMPARTIR
   ========================================================================== */
.share-container {
    display: flex;
    margin: 20px 0 30px 0;
    justify-content: flex-end; /* Alinea el botón a la derecha */
}

.share-btn.whatsapp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center; /* Centra el ícono dentro del círculo */
    background-color: #25D366; 
    color: #ffffff !important;
    width: 44px;  /* Ancho fijo para formar el círculo */
    height: 44px; /* Alto fijo para formar el círculo */
    border-radius: 50%; /* Hace que sea completamente redondo */
    text-decoration: none;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 6px rgba(37, 211, 102, 0.2);
}

.share-btn.whatsapp-btn:hover {
    background-color: #128C7E; 
    transform: translateY(-2px); 
    box-shadow: 0 6px 12px rgba(37, 211, 102, 0.3);
}

.share-btn.whatsapp-btn svg {
    width: 24px; /* Ajustamos el tamaño del SVG */
    height: 24px;
    fill: currentColor; 
    /* Eliminamos el margin-right que tenía antes porque ya no hay texto */
}

/* ==========================================================================
   CINTILLA DE ÚLTIMA HORA (TICKER)
   ========================================================================== */
.trending-ticker {
    border-bottom: 1px solid #e5e5e5;
    padding: 10px 0;
    font-size: 0.9rem;
    background-color: #fff;
}

.ticker-container {
    display: flex;
    align-items: center;
    white-space: nowrap;
    overflow-x: auto; /* Permite scroll horizontal en móviles */
    scrollbar-width: none; /* Oculta la barra de scroll en Firefox */
}

.ticker-container::-webkit-scrollbar {
    display: none; /* Oculta la barra de scroll en Chrome/Safari */
}

.ticker-label {
    color: #A22731; /* Rojo institucional */
    font-weight: 800;
    margin-right: 15px;
}

.ticker-content {
    display: flex;
    align-items: center;
}

.ticker-item {
    color: #333;
    text-decoration: none;
}

.ticker-item:hover {
    color: #17437D; /* Azul institucional al pasar el mouse */
}

.ticker-separator {
    color: #ccc;
    margin: 0 12px;
}

/* ==========================================================================
   AJUSTES DE ESPACIADO (HEADER Y TICKER)
   ========================================================================== */

/* Quitamos el margen inferior del encabezado principal */
.site-header, 
.gh-head /* Dependiendo de tu tema base, esta es la clase habitual */ {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

/* Nos aseguramos de que el ticker no tenga margen superior */
.trending-ticker {
    margin-top: 0 !important;
    /* Reducimos ligeramente el padding superior/inferior para que se vea más compacto */
    padding: 8px 0; 
}
.site-logo {
    max-height: 45px; 
    width: auto;
    display: block;
    
    /* 1. Esto agrega el "respiro" entre el logo y la línea azul */
    margin-bottom: 12px !important; 
    
    /* 2. Esto empuja el logo hacia la izquierda para alinearlo con el ticker */
    margin-left: -45px !important; 
}

/* ==========================================================================
   OPTIMIZACIÓN PARA MÓVILES (APILAR COLUMNAS)
   ========================================================================== */
@media (max-width: 768px) {
    
    /* 1. Cambiamos el grid principal a 1 sola columna */
    .news-grid {
        grid-template-columns: 1fr !important;
        gap: 30px !important;
    }

    /* 2. LA CLAVE: Liberamos TODAS las notas de sus coordenadas estrictas */
    .news-grid .post-card:nth-child(n) {
        grid-column: 1 / -1 !important; /* Obliga a que ocupen todo el ancho */
        grid-row: auto !important;      /* Hace que se apilen hacia abajo naturalmente */
        border-bottom: 1px solid #e5e5e5; /* Agrega una línea divisoria entre notas */
        padding-bottom: 25px;
        margin-bottom: 0;
    }
    
    /* Quitamos la línea de la última nota para que no se vea feo junto a la paginación */
    .news-grid .post-card:last-child {
        border-bottom: none;
    }

    /* 3. Ajustamos los tamaños de las fuentes para que sean cómodos de leer */
    .news-grid .post-card:nth-child(1) .post-title {
        font-size: 1.8rem !important; /* Título principal un poco más chico en móvil */
    }
    .news-grid .post-card:nth-child(n+2) .post-title {
        font-size: 1.3rem !important; /* Títulos secundarios estandarizados */
    }

    /* 4. En móvil es mejor que todas las notas muestren su foto, así que las restauramos */
    .news-grid .post-card:nth-child(n) .post-image-link {
        display: block !important;
        margin-bottom: 12px;
    }
    
    /* 5. Asegurarnos que la cintilla superior se pueda desplazar con el dedo */
    .ticker-container {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }
}

/* ==========================================================================
   MENÚ HAMBURGUESA
   ========================================================================== */

/* 1. Ocultar el botón por defecto (en escritorio) */
.menu-toggle {
    display: none;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 10px;
    z-index: 100; /* Para que quede por encima del menú desplegado */
}

.menu-toggle .icon-bar {
    display: block;
    width: 25px;
    height: 3px;
    margin: 4px 0;
    background-color: #1a4a7e; /* Azul de tu logo */
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* 2. Reglas solo para móviles (Menú Hamburguesa) */
@media (max-width: 768px) {
    .menu-toggle {
        display: block; /* Mostrar el botón en móvil */
        margin-left: auto; /* Empuja el botón a la derecha si el header usa flexbox */
    }

    /* Ocultamos a la fuerza el contenedor principal */
    .site-nav {
        display: none !important; 
        position: absolute;
        top: 60px; /* Ajusta según la altura de tu header, puede que necesites 70px o 80px */
        left: 0;
        width: 100%;
        background-color: #ffffff;
        box-shadow: 0 4px 10px rgba(0,0,0,0.1);
        padding: 15px 0;
        z-index: 99;
    }

    /* Esta clase es la que activa el JS para mostrarlo */
    .site-nav.is-active {
        display: block !important;
    }

    /* Le damos formato a la lista de enlaces de Ghost */
    .site-nav .nav {
        display: flex !important;
        flex-direction: column;
        text-align: center;
        list-style: none;
        padding: 0;
        margin: 0;
    }

    /* Ajuste de los enlaces dentro del menú móvil */
    .site-nav .nav li {
        margin: 12px 0;
    }
    
    .site-nav .nav li a {
        font-size: 1.2rem;
        color: #1a4a7e; /* Azul de tu logo */
        text-decoration: none;
        font-weight: bold;
        text-transform: uppercase;
        display: block;
    }
}

/* ==========================================================================
   ESTILOS DEL FOOTER
   ========================================================================== */
.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 15px 0;
}

.footer-nav a {
    color: #ffffff; /* Letra blanca para contrastar con tu fondo azul */
    text-decoration: none;
    font-size: 0.9rem;
    opacity: 0.8; /* Un poco transparente para no robar atención */
    transition: opacity 0.2s ease;
}

.footer-nav a:hover {
    opacity: 1; /* Brilla al pasar el mouse */
    text-decoration: underline;
}

/* Diseño para computadoras (Tablet en adelante) */
@media (min-width: 768px) {
    .footer-content {
        flex-direction: row;
        justify-content: space-between; /* Copyright a la izquierda, enlace a la derecha */
    }
}